@aws-amplify/core 4.4.1-unstable.5 → 4.4.2-api-logging.2

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 (109) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/aws-amplify-core.js +1104 -202
  3. package/dist/aws-amplify-core.js.map +1 -1
  4. package/dist/aws-amplify-core.min.js +7 -7
  5. package/dist/aws-amplify-core.min.js.map +1 -1
  6. package/lib/Logger/ConsoleLogger.d.ts +12 -1
  7. package/lib/Logger/ConsoleLogger.js +61 -6
  8. package/lib/Logger/ConsoleLogger.js.map +1 -1
  9. package/lib/Platform/version.d.ts +1 -1
  10. package/lib/Platform/version.js +1 -1
  11. package/lib/Providers/APIProvider/APILoggingProvider.d.ts +28 -0
  12. package/lib/Providers/APIProvider/APILoggingProvider.js +311 -0
  13. package/lib/Providers/APIProvider/APILoggingProvider.js.map +1 -0
  14. package/lib/Providers/APIProvider/CloudWatchEventFormatter.d.ts +5 -0
  15. package/lib/Providers/APIProvider/CloudWatchEventFormatter.js +78 -0
  16. package/lib/Providers/APIProvider/CloudWatchEventFormatter.js.map +1 -0
  17. package/lib/Providers/APIProvider/Fetch.d.ts +10 -0
  18. package/lib/Providers/APIProvider/Fetch.js +13 -0
  19. package/lib/Providers/APIProvider/Fetch.js.map +1 -0
  20. package/lib/Providers/APIProvider/LoggerReachability/index.d.ts +3 -0
  21. package/lib/Providers/APIProvider/LoggerReachability/index.js +5 -0
  22. package/lib/Providers/APIProvider/LoggerReachability/index.js.map +1 -0
  23. package/lib/Providers/APIProvider/LoggerReachability/index.native.d.ts +3 -0
  24. package/lib/Providers/APIProvider/LoggerReachability/index.native.js +9 -0
  25. package/lib/Providers/APIProvider/LoggerReachability/index.native.js.map +1 -0
  26. package/lib/Providers/APIProvider/index.d.ts +1 -0
  27. package/lib/Providers/APIProvider/index.js +5 -0
  28. package/lib/Providers/APIProvider/index.js.map +1 -0
  29. package/lib/Providers/APIProvider/loggerConnectivity.d.ts +14 -0
  30. package/lib/Providers/APIProvider/loggerConnectivity.js +55 -0
  31. package/lib/Providers/APIProvider/loggerConnectivity.js.map +1 -0
  32. package/lib/Providers/index.d.ts +1 -0
  33. package/lib/Providers/index.js +2 -0
  34. package/lib/Providers/index.js.map +1 -1
  35. package/lib/Util/Constants.d.ts +3 -1
  36. package/lib/Util/Constants.js +4 -0
  37. package/lib/Util/Constants.js.map +1 -1
  38. package/lib/Util/Reachability.js +7 -5
  39. package/lib/Util/Reachability.js.map +1 -1
  40. package/lib/Util/Retry.js +2 -2
  41. package/lib/Util/Retry.js.map +1 -1
  42. package/lib/Util/StringUtils.d.ts +1 -0
  43. package/lib/Util/StringUtils.js +11 -6
  44. package/lib/Util/StringUtils.js.map +1 -1
  45. package/lib/types/index.js +4 -0
  46. package/lib/types/index.js.map +1 -1
  47. package/lib/types/types.d.ts +26 -1
  48. package/lib/types/types.js +5 -0
  49. package/lib/types/types.js.map +1 -1
  50. package/lib-esm/Logger/ConsoleLogger.d.ts +12 -1
  51. package/lib-esm/Logger/ConsoleLogger.js +59 -4
  52. package/lib-esm/Logger/ConsoleLogger.js.map +1 -1
  53. package/lib-esm/Platform/version.d.ts +1 -1
  54. package/lib-esm/Platform/version.js +1 -1
  55. package/lib-esm/Providers/APIProvider/APILoggingProvider.d.ts +28 -0
  56. package/lib-esm/Providers/APIProvider/APILoggingProvider.js +306 -0
  57. package/lib-esm/Providers/APIProvider/APILoggingProvider.js.map +1 -0
  58. package/lib-esm/Providers/APIProvider/CloudWatchEventFormatter.d.ts +5 -0
  59. package/lib-esm/Providers/APIProvider/CloudWatchEventFormatter.js +76 -0
  60. package/lib-esm/Providers/APIProvider/CloudWatchEventFormatter.js.map +1 -0
  61. package/lib-esm/Providers/APIProvider/Fetch.d.ts +10 -0
  62. package/lib-esm/Providers/APIProvider/Fetch.js +11 -0
  63. package/lib-esm/Providers/APIProvider/Fetch.js.map +1 -0
  64. package/lib-esm/Providers/APIProvider/LoggerReachability/index.d.ts +3 -0
  65. package/lib-esm/Providers/APIProvider/LoggerReachability/index.js +3 -0
  66. package/lib-esm/Providers/APIProvider/LoggerReachability/index.js.map +1 -0
  67. package/lib-esm/Providers/APIProvider/LoggerReachability/index.native.d.ts +3 -0
  68. package/lib-esm/Providers/APIProvider/LoggerReachability/index.native.js +4 -0
  69. package/lib-esm/Providers/APIProvider/LoggerReachability/index.native.js.map +1 -0
  70. package/lib-esm/Providers/APIProvider/index.d.ts +1 -0
  71. package/lib-esm/Providers/APIProvider/index.js +2 -0
  72. package/lib-esm/Providers/APIProvider/index.js.map +1 -0
  73. package/lib-esm/Providers/APIProvider/loggerConnectivity.d.ts +14 -0
  74. package/lib-esm/Providers/APIProvider/loggerConnectivity.js +50 -0
  75. package/lib-esm/Providers/APIProvider/loggerConnectivity.js.map +1 -0
  76. package/lib-esm/Providers/index.d.ts +1 -0
  77. package/lib-esm/Providers/index.js +1 -0
  78. package/lib-esm/Providers/index.js.map +1 -1
  79. package/lib-esm/Util/Constants.d.ts +3 -1
  80. package/lib-esm/Util/Constants.js +3 -1
  81. package/lib-esm/Util/Constants.js.map +1 -1
  82. package/lib-esm/Util/Reachability.js +5 -3
  83. package/lib-esm/Util/Reachability.js.map +1 -1
  84. package/lib-esm/Util/Retry.js +2 -2
  85. package/lib-esm/Util/Retry.js.map +1 -1
  86. package/lib-esm/Util/StringUtils.d.ts +1 -0
  87. package/lib-esm/Util/StringUtils.js +11 -6
  88. package/lib-esm/Util/StringUtils.js.map +1 -1
  89. package/lib-esm/types/index.js +1 -0
  90. package/lib-esm/types/index.js.map +1 -1
  91. package/lib-esm/types/types.d.ts +26 -1
  92. package/lib-esm/types/types.js +5 -0
  93. package/lib-esm/types/types.js.map +1 -1
  94. package/package.json +2 -2
  95. package/src/Logger/ConsoleLogger.ts +45 -2
  96. package/src/Platform/version.ts +1 -1
  97. package/src/Providers/APIProvider/APILoggingProvider.ts +286 -0
  98. package/src/Providers/APIProvider/CloudWatchEventFormatter.ts +97 -0
  99. package/src/Providers/APIProvider/Fetch.ts +10 -0
  100. package/src/Providers/APIProvider/LoggerReachability/index.native.ts +4 -0
  101. package/src/Providers/APIProvider/LoggerReachability/index.ts +2 -0
  102. package/src/Providers/APIProvider/index.ts +1 -0
  103. package/src/Providers/APIProvider/loggerConnectivity.ts +49 -0
  104. package/src/Providers/index.ts +1 -0
  105. package/src/Util/Constants.ts +4 -0
  106. package/src/Util/Reachability.ts +9 -7
  107. package/src/Util/Retry.ts +2 -2
  108. package/src/Util/StringUtils.ts +15 -6
  109. package/src/types/types.ts +88 -62
@@ -31566,11 +31566,12 @@ function () {
31566
31566
  /*!*****************************************!*\
31567
31567
  !*** ./lib-esm/Logger/ConsoleLogger.js ***!
31568
31568
  \*****************************************/
31569
- /*! exports provided: LOG_TYPE, ConsoleLogger */
31569
+ /*! exports provided: LOG_LEVELS, LOG_TYPE, ConsoleLogger */
31570
31570
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
31571
31571
 
31572
31572
  "use strict";
31573
31573
  __webpack_require__.r(__webpack_exports__);
31574
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LOG_LEVELS", function() { return LOG_LEVELS; });
31574
31575
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LOG_TYPE", function() { return LOG_TYPE; });
31575
31576
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ConsoleLogger", function() { return ConsoleLogger; });
31576
31577
  /* harmony import */ var _Util_Constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Util/Constants */ "./lib-esm/Util/Constants.js");
@@ -31678,6 +31679,10 @@ function () {
31678
31679
  this._pluggables = [];
31679
31680
  }
31680
31681
 
31682
+ ConsoleLogger.addPluggable = function (pluggable) {
31683
+ ConsoleLogger.pluggables.push(pluggable);
31684
+ };
31685
+
31681
31686
  ConsoleLogger.prototype._padding = function (n) {
31682
31687
  return n < 10 ? '0' + n : '' + n;
31683
31688
  };
@@ -31692,6 +31697,67 @@ function () {
31692
31697
  this._config = config;
31693
31698
  return this._config;
31694
31699
  };
31700
+
31701
+ ConsoleLogger.prototype._logGlobal = function (type) {
31702
+ var e_1, _a;
31703
+
31704
+ var msg = [];
31705
+
31706
+ for (var _i = 1; _i < arguments.length; _i++) {
31707
+ msg[_i - 1] = arguments[_i];
31708
+ }
31709
+
31710
+ try {
31711
+ for (var _b = __values(ConsoleLogger.pluggables), _c = _b.next(); !_c.done; _c = _b.next()) {
31712
+ var pluggable = _c.value;
31713
+
31714
+ var event_1 = this._generateGenericEvent(type, msg);
31715
+
31716
+ pluggable.pushLog(event_1);
31717
+ }
31718
+ } catch (e_1_1) {
31719
+ e_1 = {
31720
+ error: e_1_1
31721
+ };
31722
+ } finally {
31723
+ try {
31724
+ if (_c && !_c.done && (_a = _b["return"])) _a.call(_b);
31725
+ } finally {
31726
+ if (e_1) throw e_1.error;
31727
+ }
31728
+ }
31729
+ };
31730
+
31731
+ ConsoleLogger.prototype._generateGenericEvent = function (type, msg) {
31732
+ var strMessage = '';
31733
+ var data;
31734
+
31735
+ if (msg.length === 1 && typeof msg[0] === 'string') {
31736
+ strMessage = msg[0];
31737
+ } else if (msg.length === 1) {
31738
+ data = msg[0];
31739
+ } else if (typeof msg[0] === 'string') {
31740
+ var obj = msg.slice(1);
31741
+
31742
+ if (obj.length === 1) {
31743
+ obj = obj[0];
31744
+ }
31745
+
31746
+ strMessage = msg[0];
31747
+ data = obj;
31748
+ } else {
31749
+ data = msg;
31750
+ }
31751
+
31752
+ var event = {
31753
+ data: data,
31754
+ level: type,
31755
+ message: strMessage,
31756
+ source: this.name,
31757
+ timestamp: Date.now()
31758
+ };
31759
+ return event;
31760
+ };
31695
31761
  /**
31696
31762
  * Write log
31697
31763
  * @method
@@ -31702,7 +31768,7 @@ function () {
31702
31768
 
31703
31769
 
31704
31770
  ConsoleLogger.prototype._log = function (type) {
31705
- var e_1, _a;
31771
+ var e_2, _a;
31706
31772
 
31707
31773
  var msg = [];
31708
31774
 
@@ -31710,6 +31776,8 @@ function () {
31710
31776
  msg[_i - 1] = arguments[_i];
31711
31777
  }
31712
31778
 
31779
+ this._logGlobal.apply(this, __spread([type], msg));
31780
+
31713
31781
  var logger_level_name = this.level;
31714
31782
 
31715
31783
  if (ConsoleLogger.LOG_LEVEL) {
@@ -31770,15 +31838,15 @@ function () {
31770
31838
  };
31771
31839
  plugin.pushLogs([logEvent]);
31772
31840
  }
31773
- } catch (e_1_1) {
31774
- e_1 = {
31775
- error: e_1_1
31841
+ } catch (e_2_1) {
31842
+ e_2 = {
31843
+ error: e_2_1
31776
31844
  };
31777
31845
  } finally {
31778
31846
  try {
31779
31847
  if (_c && !_c.done && (_a = _b["return"])) _a.call(_b);
31780
31848
  } finally {
31781
- if (e_1) throw e_1.error;
31849
+ if (e_2) throw e_2.error;
31782
31850
  }
31783
31851
  }
31784
31852
  };
@@ -31897,6 +31965,7 @@ function () {
31897
31965
  return this._pluggables;
31898
31966
  };
31899
31967
 
31968
+ ConsoleLogger.pluggables = [];
31900
31969
  ConsoleLogger.LOG_LEVEL = null;
31901
31970
  return ConsoleLogger;
31902
31971
  }();
@@ -31909,12 +31978,14 @@ function () {
31909
31978
  /*!*********************************!*\
31910
31979
  !*** ./lib-esm/Logger/index.js ***!
31911
31980
  \*********************************/
31912
- /*! exports provided: LOG_TYPE, ConsoleLogger */
31981
+ /*! exports provided: LOG_LEVELS, LOG_TYPE, ConsoleLogger */
31913
31982
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
31914
31983
 
31915
31984
  "use strict";
31916
31985
  __webpack_require__.r(__webpack_exports__);
31917
31986
  /* harmony import */ var _ConsoleLogger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ConsoleLogger */ "./lib-esm/Logger/ConsoleLogger.js");
31987
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "LOG_LEVELS", function() { return _ConsoleLogger__WEBPACK_IMPORTED_MODULE_0__["LOG_LEVELS"]; });
31988
+
31918
31989
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "LOG_TYPE", function() { return _ConsoleLogger__WEBPACK_IMPORTED_MODULE_0__["LOG_TYPE"]; });
31919
31990
 
31920
31991
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ConsoleLogger", function() { return _ConsoleLogger__WEBPACK_IMPORTED_MODULE_0__["ConsoleLogger"]; });
@@ -32492,62 +32563,950 @@ function () {
32492
32563
  });
32493
32564
  };
32494
32565
 
32495
- return GoogleOAuth;
32496
- }();
32566
+ return GoogleOAuth;
32567
+ }();
32568
+
32569
+
32570
+ /**
32571
+ * @deprecated use named import
32572
+ */
32573
+
32574
+ /* harmony default export */ __webpack_exports__["default"] = (GoogleOAuth);
32575
+
32576
+ /***/ }),
32577
+
32578
+ /***/ "./lib-esm/OAuthHelper/index.js":
32579
+ /*!**************************************!*\
32580
+ !*** ./lib-esm/OAuthHelper/index.js ***!
32581
+ \**************************************/
32582
+ /*! exports provided: GoogleOAuth, FacebookOAuth */
32583
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
32584
+
32585
+ "use strict";
32586
+ __webpack_require__.r(__webpack_exports__);
32587
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GoogleOAuth", function() { return GoogleOAuth; });
32588
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FacebookOAuth", function() { return FacebookOAuth; });
32589
+ /* harmony import */ var _GoogleOAuth__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./GoogleOAuth */ "./lib-esm/OAuthHelper/GoogleOAuth.js");
32590
+ /* harmony import */ var _FacebookOAuth__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./FacebookOAuth */ "./lib-esm/OAuthHelper/FacebookOAuth.js");
32591
+ /*
32592
+ * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
32593
+ *
32594
+ * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
32595
+ * the License. A copy of the License is located at
32596
+ *
32597
+ * http://aws.amazon.com/apache2.0/
32598
+ *
32599
+ * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
32600
+ * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
32601
+ * and limitations under the License.
32602
+ */
32603
+
32604
+
32605
+ var GoogleOAuth = new _GoogleOAuth__WEBPACK_IMPORTED_MODULE_0__["GoogleOAuth"]();
32606
+ var FacebookOAuth = new _FacebookOAuth__WEBPACK_IMPORTED_MODULE_1__["FacebookOAuth"]();
32607
+
32608
+ /***/ }),
32609
+
32610
+ /***/ "./lib-esm/Parser.js":
32611
+ /*!***************************!*\
32612
+ !*** ./lib-esm/Parser.js ***!
32613
+ \***************************/
32614
+ /*! exports provided: parseMobileHubConfig, Parser, default */
32615
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
32616
+
32617
+ "use strict";
32618
+ __webpack_require__.r(__webpack_exports__);
32619
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parseMobileHubConfig", function() { return parseMobileHubConfig; });
32620
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Parser", function() { return Parser; });
32621
+ /* harmony import */ var _Logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Logger */ "./lib-esm/Logger/index.js");
32622
+ var __assign = undefined && undefined.__assign || function () {
32623
+ __assign = Object.assign || function (t) {
32624
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
32625
+ s = arguments[i];
32626
+
32627
+ for (var p in s) {
32628
+ if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
32629
+ }
32630
+ }
32631
+
32632
+ return t;
32633
+ };
32634
+
32635
+ return __assign.apply(this, arguments);
32636
+ };
32637
+
32638
+
32639
+ var logger = new _Logger__WEBPACK_IMPORTED_MODULE_0__["ConsoleLogger"]('Parser');
32640
+ var parseMobileHubConfig = function parseMobileHubConfig(config) {
32641
+ var amplifyConfig = {}; // Analytics
32642
+
32643
+ if (config['aws_mobile_analytics_app_id']) {
32644
+ var Analytics = {
32645
+ AWSPinpoint: {
32646
+ appId: config['aws_mobile_analytics_app_id'],
32647
+ region: config['aws_mobile_analytics_app_region']
32648
+ }
32649
+ };
32650
+ amplifyConfig.Analytics = Analytics;
32651
+ } // Auth
32652
+
32653
+
32654
+ if (config['aws_cognito_identity_pool_id'] || config['aws_user_pools_id']) {
32655
+ amplifyConfig.Auth = {
32656
+ userPoolId: config['aws_user_pools_id'],
32657
+ userPoolWebClientId: config['aws_user_pools_web_client_id'],
32658
+ region: config['aws_cognito_region'],
32659
+ identityPoolId: config['aws_cognito_identity_pool_id'],
32660
+ identityPoolRegion: config['aws_cognito_region'],
32661
+ mandatorySignIn: config['aws_mandatory_sign_in'] === 'enable'
32662
+ };
32663
+ } // Storage
32664
+
32665
+
32666
+ var storageConfig;
32667
+
32668
+ if (config['aws_user_files_s3_bucket']) {
32669
+ storageConfig = {
32670
+ AWSS3: {
32671
+ bucket: config['aws_user_files_s3_bucket'],
32672
+ region: config['aws_user_files_s3_bucket_region'],
32673
+ dangerouslyConnectToHttpEndpointForTesting: config['aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing']
32674
+ }
32675
+ };
32676
+ } else {
32677
+ storageConfig = config ? config.Storage || config : {};
32678
+ } // Logging
32679
+
32680
+
32681
+ if (config['Logging']) {
32682
+ amplifyConfig.Logging = __assign(__assign({}, config['Logging']), {
32683
+ region: config['aws_project_region']
32684
+ });
32685
+ } // Geo
32686
+
32687
+
32688
+ if (config['geo']) {
32689
+ amplifyConfig.Geo = Object.assign({}, config.geo);
32690
+
32691
+ if (config.geo['amazon_location_service']) {
32692
+ amplifyConfig.Geo = {
32693
+ AmazonLocationService: config.geo['amazon_location_service']
32694
+ };
32695
+ }
32696
+ }
32697
+
32698
+ amplifyConfig.Analytics = Object.assign({}, amplifyConfig.Analytics, config.Analytics);
32699
+ amplifyConfig.Auth = Object.assign({}, amplifyConfig.Auth, config.Auth);
32700
+ amplifyConfig.Storage = Object.assign({}, storageConfig);
32701
+ amplifyConfig.Logging = Object.assign({}, amplifyConfig.Logging, config.Logging);
32702
+ logger.debug('parse config', config, 'to amplifyconfig', amplifyConfig);
32703
+ return amplifyConfig;
32704
+ };
32705
+ /**
32706
+ * @deprecated use per-function export
32707
+ */
32708
+
32709
+ var Parser =
32710
+ /** @class */
32711
+ function () {
32712
+ function Parser() {}
32713
+
32714
+ Parser.parseMobilehubConfig = parseMobileHubConfig;
32715
+ return Parser;
32716
+ }();
32717
+
32718
+
32719
+ /**
32720
+ * @deprecated use per-function export
32721
+ */
32722
+
32723
+ /* harmony default export */ __webpack_exports__["default"] = (Parser);
32724
+
32725
+ /***/ }),
32726
+
32727
+ /***/ "./lib-esm/Platform/index.js":
32728
+ /*!***********************************!*\
32729
+ !*** ./lib-esm/Platform/index.js ***!
32730
+ \***********************************/
32731
+ /*! exports provided: Platform, getAmplifyUserAgent, default */
32732
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
32733
+
32734
+ "use strict";
32735
+ __webpack_require__.r(__webpack_exports__);
32736
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Platform", function() { return Platform; });
32737
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getAmplifyUserAgent", function() { return getAmplifyUserAgent; });
32738
+ /* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./version */ "./lib-esm/Platform/version.js");
32739
+ /*
32740
+ * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
32741
+ *
32742
+ * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
32743
+ * the License. A copy of the License is located at
32744
+ *
32745
+ * http://aws.amazon.com/apache2.0/
32746
+ *
32747
+ * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
32748
+ * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
32749
+ * and limitations under the License.
32750
+ */
32751
+
32752
+ var BASE_USER_AGENT = "aws-amplify/" + _version__WEBPACK_IMPORTED_MODULE_0__["version"];
32753
+ var Platform = {
32754
+ userAgent: BASE_USER_AGENT + " js",
32755
+ product: '',
32756
+ navigator: null,
32757
+ isReactNative: false
32758
+ };
32759
+
32760
+ if (typeof navigator !== 'undefined' && navigator.product) {
32761
+ Platform.product = navigator.product || '';
32762
+ Platform.navigator = navigator || null;
32763
+
32764
+ switch (navigator.product) {
32765
+ case 'ReactNative':
32766
+ Platform.userAgent = BASE_USER_AGENT + " react-native";
32767
+ Platform.isReactNative = true;
32768
+ break;
32769
+
32770
+ default:
32771
+ Platform.userAgent = BASE_USER_AGENT + " js";
32772
+ Platform.isReactNative = false;
32773
+ break;
32774
+ }
32775
+ }
32776
+
32777
+ var getAmplifyUserAgent = function getAmplifyUserAgent() {
32778
+ return Platform.userAgent;
32779
+ };
32780
+ /**
32781
+ * @deprecated use named import
32782
+ */
32783
+
32784
+ /* harmony default export */ __webpack_exports__["default"] = (Platform);
32785
+
32786
+ /***/ }),
32787
+
32788
+ /***/ "./lib-esm/Platform/version.js":
32789
+ /*!*************************************!*\
32790
+ !*** ./lib-esm/Platform/version.js ***!
32791
+ \*************************************/
32792
+ /*! exports provided: version */
32793
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
32794
+
32795
+ "use strict";
32796
+ __webpack_require__.r(__webpack_exports__);
32797
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "version", function() { return version; });
32798
+ // generated by genversion
32799
+ var version = '4.4.1';
32800
+
32801
+ /***/ }),
32802
+
32803
+ /***/ "./lib-esm/Providers/APIProvider/APILoggingProvider.js":
32804
+ /*!*************************************************************!*\
32805
+ !*** ./lib-esm/Providers/APIProvider/APILoggingProvider.js ***!
32806
+ \*************************************************************/
32807
+ /*! exports provided: APILoggingProvider */
32808
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
32809
+
32810
+ "use strict";
32811
+ __webpack_require__.r(__webpack_exports__);
32812
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "APILoggingProvider", function() { return APILoggingProvider; });
32813
+ /* harmony import */ var _Logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Logger */ "./lib-esm/Logger/index.js");
32814
+ /* harmony import */ var _loggerConnectivity__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./loggerConnectivity */ "./lib-esm/Providers/APIProvider/loggerConnectivity.js");
32815
+ /* harmony import */ var _types_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../types/types */ "./lib-esm/types/types.js");
32816
+ /* harmony import */ var ___WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../ */ "./lib-esm/index.js");
32817
+ /* harmony import */ var _CloudWatchEventFormatter__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./CloudWatchEventFormatter */ "./lib-esm/Providers/APIProvider/CloudWatchEventFormatter.js");
32818
+ /* harmony import */ var _Fetch__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Fetch */ "./lib-esm/Providers/APIProvider/Fetch.js");
32819
+ /* harmony import */ var _Util_Constants__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../Util/Constants */ "./lib-esm/Util/Constants.js");
32820
+ /* harmony import */ var _Util_StringUtils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../Util/StringUtils */ "./lib-esm/Util/StringUtils.js");
32821
+ function _typeof(obj) {
32822
+ "@babel/helpers - typeof";
32823
+
32824
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
32825
+ return typeof obj;
32826
+ } : function (obj) {
32827
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
32828
+ }, _typeof(obj);
32829
+ }
32830
+
32831
+ var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
32832
+ function adopt(value) {
32833
+ return value instanceof P ? value : new P(function (resolve) {
32834
+ resolve(value);
32835
+ });
32836
+ }
32837
+
32838
+ return new (P || (P = Promise))(function (resolve, reject) {
32839
+ function fulfilled(value) {
32840
+ try {
32841
+ step(generator.next(value));
32842
+ } catch (e) {
32843
+ reject(e);
32844
+ }
32845
+ }
32846
+
32847
+ function rejected(value) {
32848
+ try {
32849
+ step(generator["throw"](value));
32850
+ } catch (e) {
32851
+ reject(e);
32852
+ }
32853
+ }
32854
+
32855
+ function step(result) {
32856
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
32857
+ }
32858
+
32859
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
32860
+ });
32861
+ };
32862
+
32863
+ var __generator = undefined && undefined.__generator || function (thisArg, body) {
32864
+ var _ = {
32865
+ label: 0,
32866
+ sent: function sent() {
32867
+ if (t[0] & 1) throw t[1];
32868
+ return t[1];
32869
+ },
32870
+ trys: [],
32871
+ ops: []
32872
+ },
32873
+ f,
32874
+ y,
32875
+ t,
32876
+ g;
32877
+ return g = {
32878
+ next: verb(0),
32879
+ "throw": verb(1),
32880
+ "return": verb(2)
32881
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
32882
+ return this;
32883
+ }), g;
32884
+
32885
+ function verb(n) {
32886
+ return function (v) {
32887
+ return step([n, v]);
32888
+ };
32889
+ }
32890
+
32891
+ function step(op) {
32892
+ if (f) throw new TypeError("Generator is already executing.");
32893
+
32894
+ while (_) {
32895
+ try {
32896
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
32897
+ if (y = 0, t) op = [op[0] & 2, t.value];
32898
+
32899
+ switch (op[0]) {
32900
+ case 0:
32901
+ case 1:
32902
+ t = op;
32903
+ break;
32904
+
32905
+ case 4:
32906
+ _.label++;
32907
+ return {
32908
+ value: op[1],
32909
+ done: false
32910
+ };
32911
+
32912
+ case 5:
32913
+ _.label++;
32914
+ y = op[1];
32915
+ op = [0];
32916
+ continue;
32917
+
32918
+ case 7:
32919
+ op = _.ops.pop();
32920
+
32921
+ _.trys.pop();
32922
+
32923
+ continue;
32924
+
32925
+ default:
32926
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
32927
+ _ = 0;
32928
+ continue;
32929
+ }
32930
+
32931
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
32932
+ _.label = op[1];
32933
+ break;
32934
+ }
32935
+
32936
+ if (op[0] === 6 && _.label < t[1]) {
32937
+ _.label = t[1];
32938
+ t = op;
32939
+ break;
32940
+ }
32941
+
32942
+ if (t && _.label < t[2]) {
32943
+ _.label = t[2];
32944
+
32945
+ _.ops.push(op);
32946
+
32947
+ break;
32948
+ }
32949
+
32950
+ if (t[2]) _.ops.pop();
32951
+
32952
+ _.trys.pop();
32953
+
32954
+ continue;
32955
+ }
32956
+
32957
+ op = body.call(thisArg, _);
32958
+ } catch (e) {
32959
+ op = [6, e];
32960
+ y = 0;
32961
+ } finally {
32962
+ f = t = 0;
32963
+ }
32964
+ }
32965
+
32966
+ if (op[0] & 5) throw op[1];
32967
+ return {
32968
+ value: op[0] ? op[1] : void 0,
32969
+ done: true
32970
+ };
32971
+ }
32972
+ };
32973
+
32974
+ var __read = undefined && undefined.__read || function (o, n) {
32975
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
32976
+ if (!m) return o;
32977
+ var i = m.call(o),
32978
+ r,
32979
+ ar = [],
32980
+ e;
32981
+
32982
+ try {
32983
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
32984
+ ar.push(r.value);
32985
+ }
32986
+ } catch (error) {
32987
+ e = {
32988
+ error: error
32989
+ };
32990
+ } finally {
32991
+ try {
32992
+ if (r && !r.done && (m = i["return"])) m.call(i);
32993
+ } finally {
32994
+ if (e) throw e.error;
32995
+ }
32996
+ }
32997
+
32998
+ return ar;
32999
+ };
33000
+
33001
+ var __spread = undefined && undefined.__spread || function () {
33002
+ for (var ar = [], i = 0; i < arguments.length; i++) {
33003
+ ar = ar.concat(__read(arguments[i]));
33004
+ }
33005
+
33006
+ return ar;
33007
+ };
33008
+
33009
+
33010
+
33011
+
33012
+
33013
+
33014
+
33015
+
33016
+
33017
+ var logger = new _Logger__WEBPACK_IMPORTED_MODULE_0__["ConsoleLogger"]('APILoggingProvider');
33018
+ var HTTPS = 'https';
33019
+ var LOCALHOST = 'http://localhost';
33020
+ var DEFAULT_INTERVAL = 3000; // Exclude these to avoid infinite loop
33021
+
33022
+ var DEFAULT_CLASS_EXCLUDE_LIST = ['APILoggingProvider', 'AWSCloudWatch', 'Retry'];
33023
+ var LAMBDA_PAYLOAD_LIMIT = 6 * 1024 * 1024; // 6MB
33024
+
33025
+ /*
33026
+ Todo:
33027
+ * Refactor this into a FSM - managing state will become complex when remote config functionality gets added in P1
33028
+ */
33029
+
33030
+ var APILoggingProvider =
33031
+ /** @class */
33032
+ function () {
33033
+ function APILoggingProvider(config) {
33034
+ this.online = false;
33035
+ this.eventBuffer = [];
33036
+ this.configure(config);
33037
+ }
33038
+
33039
+ APILoggingProvider.prototype.getProviderName = function () {
33040
+ return APILoggingProvider.PROVIDER_NAME;
33041
+ };
33042
+
33043
+ APILoggingProvider.prototype.getCategoryName = function () {
33044
+ return APILoggingProvider.CATEGORY;
33045
+ };
33046
+
33047
+ APILoggingProvider.prototype.configure = function (config) {
33048
+ try {
33049
+ this.validateConfig(config);
33050
+ this.config = this.normalizeConfig(config);
33051
+
33052
+ if (this.config.enabled === true) {
33053
+ this.initialize();
33054
+ } else {
33055
+ this.disable();
33056
+ }
33057
+
33058
+ return this.config;
33059
+ } catch (error) {
33060
+ logger.error('Unable to start: ', error);
33061
+ }
33062
+ };
33063
+
33064
+ APILoggingProvider.prototype.pushLog = function (event) {
33065
+ var _a;
33066
+
33067
+ if (((_a = this.config) === null || _a === void 0 ? void 0 : _a.enabled) === false) {
33068
+ return;
33069
+ }
33070
+
33071
+ if (!this.verifyEvent(event)) {
33072
+ return;
33073
+ }
33074
+
33075
+ switch (this.config.eventFormat) {
33076
+ case _types_types__WEBPACK_IMPORTED_MODULE_2__["EVENT_FORMAT"].CLOUDWATCH:
33077
+ var cloudWatchEvent = Object(_CloudWatchEventFormatter__WEBPACK_IMPORTED_MODULE_4__["cloudWatchEventFromGeneric"])(event);
33078
+ this.eventBuffer.push(cloudWatchEvent);
33079
+ break;
33080
+
33081
+ case _types_types__WEBPACK_IMPORTED_MODULE_2__["EVENT_FORMAT"].GENERIC:
33082
+ default:
33083
+ this.eventBuffer.push(event);
33084
+ break;
33085
+ }
33086
+ };
33087
+
33088
+ APILoggingProvider.prototype.validateConfig = function (config) {
33089
+ if (typeof (config === null || config === void 0 ? void 0 : config.endpoint) !== 'string') {
33090
+ throw new Error("Invalid configuration. `config.endpoint` must be a string. Received: " + _typeof(config === null || config === void 0 ? void 0 : config.endpoint));
33091
+ }
33092
+
33093
+ var protocolStr = config.endpoint.substring(0, 5).toLowerCase();
33094
+ var isUsingLocalhost = config.endpoint.substring(0, LOCALHOST.length).toLowerCase() === LOCALHOST;
33095
+
33096
+ if (protocolStr !== HTTPS && !isUsingLocalhost) {
33097
+ throw new Error("Invalid configuration. Only HTTPS endpoints are supported. Received: " + protocolStr);
33098
+ }
33099
+ };
33100
+
33101
+ APILoggingProvider.prototype.normalizeConfig = function (config) {
33102
+ var _a, _b, _c, _d;
33103
+
33104
+ var normalizedConfig = {
33105
+ endpoint: config.endpoint,
33106
+ apiKey: config.apiKey,
33107
+ metadata: config.metadata,
33108
+ enabled: (_a = config.enabled) !== null && _a !== void 0 ? _a : true,
33109
+ level: (_b = config.level) !== null && _b !== void 0 ? _b : _Logger__WEBPACK_IMPORTED_MODULE_0__["LOG_TYPE"].WARN,
33110
+ eventFormat: (_c = config.eventFormat) !== null && _c !== void 0 ? _c : _types_types__WEBPACK_IMPORTED_MODULE_2__["EVENT_FORMAT"].CLOUDWATCH,
33111
+ bufferInterval: (_d = config.bufferInterval) !== null && _d !== void 0 ? _d : DEFAULT_INTERVAL,
33112
+ excludeClassList: config.excludeClassList instanceof Array ? __spread(DEFAULT_CLASS_EXCLUDE_LIST, config.excludeClassList) : DEFAULT_CLASS_EXCLUDE_LIST
33113
+ };
33114
+ return normalizedConfig;
33115
+ };
33116
+
33117
+ APILoggingProvider.prototype.initialize = function () {
33118
+ this.subscribeConnectivity();
33119
+ };
33120
+
33121
+ APILoggingProvider.prototype.disable = function () {
33122
+ this.clearInterval();
33123
+ this.unsubscribeConnectivity();
33124
+ this.eventBuffer = [];
33125
+ };
33126
+
33127
+ APILoggingProvider.prototype.subscribeConnectivity = function () {
33128
+ var _this = this;
33129
+
33130
+ if (this.connectivity) {
33131
+ return;
33132
+ }
33133
+
33134
+ this.connectivity = new _loggerConnectivity__WEBPACK_IMPORTED_MODULE_1__["default"]();
33135
+ this.connectivity.status().subscribe(function (_a) {
33136
+ var online = _a.online;
33137
+
33138
+ if (online && !_this.online) {
33139
+ _this.startInterval();
33140
+ } else {
33141
+ _this.clearInterval();
33142
+ }
33143
+
33144
+ _this.online = online;
33145
+ logger.debug('Connectivity status: ', online);
33146
+ });
33147
+ };
33148
+
33149
+ APILoggingProvider.prototype.unsubscribeConnectivity = function () {
33150
+ if (this.connectivity) {
33151
+ this.connectivity.unsubscribe();
33152
+ this.connectivity = undefined;
33153
+ }
33154
+ };
33155
+
33156
+ APILoggingProvider.prototype.startInterval = function () {
33157
+ var _this = this;
33158
+
33159
+ if (this.bufferInterval) {
33160
+ this.clearInterval();
33161
+ }
33162
+
33163
+ this.bufferInterval = setInterval(function () {
33164
+ return __awaiter(_this, void 0, void 0, function () {
33165
+ var error_1;
33166
+ return __generator(this, function (_a) {
33167
+ switch (_a.label) {
33168
+ case 0:
33169
+ _a.trys.push([0, 2,, 3]);
33170
+
33171
+ return [4
33172
+ /*yield*/
33173
+ , this.uploadEvents()];
33174
+
33175
+ case 1:
33176
+ _a.sent();
33177
+
33178
+ return [3
33179
+ /*break*/
33180
+ , 3];
33181
+
33182
+ case 2:
33183
+ error_1 = _a.sent();
33184
+ logger.error("Could not upload log events", error_1);
33185
+ return [3
33186
+ /*break*/
33187
+ , 3];
33188
+
33189
+ case 3:
33190
+ return [2
33191
+ /*return*/
33192
+ ];
33193
+ }
33194
+ });
33195
+ });
33196
+ }, this.config.bufferInterval);
33197
+ };
33198
+
33199
+ APILoggingProvider.prototype.clearInterval = function () {
33200
+ clearInterval(this.bufferInterval);
33201
+ this.bufferInterval = undefined;
33202
+ };
33203
+ /*
33204
+ Filter out events that don't adhere to config settings
33205
+ */
33206
+
33207
+
33208
+ APILoggingProvider.prototype.verifyEvent = function (event) {
33209
+ var level = event.level,
33210
+ source = event.source;
33211
+ var configLevelValue = _Logger__WEBPACK_IMPORTED_MODULE_0__["LOG_LEVELS"][this.config.level];
33212
+ var eventLevelValue = _Logger__WEBPACK_IMPORTED_MODULE_0__["LOG_LEVELS"][level];
33213
+
33214
+ if (eventLevelValue < configLevelValue) {
33215
+ return false;
33216
+ }
33217
+
33218
+ if (this.config.excludeClassList.includes(source)) {
33219
+ return false;
33220
+ }
33221
+
33222
+ return true;
33223
+ };
33224
+
33225
+ APILoggingProvider.prototype.uploadEvents = function () {
33226
+ return __awaiter(this, void 0, void 0, function () {
33227
+ var eventBatch, body, options;
33228
+
33229
+ var _this = this;
33230
+
33231
+ return __generator(this, function (_a) {
33232
+ switch (_a.label) {
33233
+ case 0:
33234
+ eventBatch = this.generateEventBatch(this.eventBuffer);
33235
+
33236
+ if (eventBatch.length < 1) {
33237
+ return [2
33238
+ /*return*/
33239
+ ];
33240
+ }
33241
+
33242
+ body = {
33243
+ logEvents: eventBatch,
33244
+ metadata: this.config.metadata
33245
+ };
33246
+ options = Object(_Fetch__WEBPACK_IMPORTED_MODULE_5__["postOptions"])(body);
33247
+ return [4
33248
+ /*yield*/
33249
+ , Object(___WEBPACK_IMPORTED_MODULE_3__["jitteredExponentialRetry"])(function (endpoint, options) {
33250
+ return __awaiter(_this, void 0, void 0, function () {
33251
+ var res, error_2;
33252
+ return __generator(this, function (_a) {
33253
+ switch (_a.label) {
33254
+ case 0:
33255
+ _a.trys.push([0, 2,, 3]);
33256
+
33257
+ return [4
33258
+ /*yield*/
33259
+ , fetch(endpoint, options)];
33260
+
33261
+ case 1:
33262
+ res = _a.sent();
33263
+ if (!res.ok) throw new Error("Request Failed. Status: " + res.status + " - " + res.statusText);
33264
+ return [3
33265
+ /*break*/
33266
+ , 3];
33267
+
33268
+ case 2:
33269
+ error_2 = _a.sent(); // fetch will only fail in the event of a network error. Don't retry
33270
+
33271
+ if (error_2.message === 'Failed to fetch') {
33272
+ throw new ___WEBPACK_IMPORTED_MODULE_3__["NonRetryableError"](error_2.message);
33273
+ } // all other errors are logged and retried
33274
+
33275
+
33276
+ logger.warn(error_2);
33277
+ throw error_2;
33278
+
33279
+ case 3:
33280
+ return [2
33281
+ /*return*/
33282
+ ];
33283
+ }
33284
+ });
33285
+ });
33286
+ }, [this.config.endpoint, options])];
33287
+
33288
+ case 1:
33289
+ _a.sent(); // remove events from buffer after the request succeeds
33290
+
33291
+
33292
+ this.eventBuffer.splice(0, eventBatch.length);
33293
+ return [2
33294
+ /*return*/
33295
+ ];
33296
+ }
33297
+ });
33298
+ });
33299
+ };
33300
+
33301
+ APILoggingProvider.prototype.generateEventBatch = function (buffer) {
33302
+ switch (this.config.eventFormat) {
33303
+ case _types_types__WEBPACK_IMPORTED_MODULE_2__["EVENT_FORMAT"].CLOUDWATCH:
33304
+ return Object(_CloudWatchEventFormatter__WEBPACK_IMPORTED_MODULE_4__["cloudWatchLogEventBatch"])(buffer);
33305
+
33306
+ case _types_types__WEBPACK_IMPORTED_MODULE_2__["EVENT_FORMAT"].GENERIC:
33307
+ default:
33308
+ return this.genericLogEventBatch(buffer);
33309
+ }
33310
+ };
33311
+
33312
+ APILoggingProvider.prototype.genericLogEventBatch = function (buffer) {
33313
+ var totalByteSize = 0;
33314
+ var currentEventIdx = 0;
33315
+
33316
+ while (currentEventIdx < buffer.length) {
33317
+ var currentEvent = buffer[currentEventIdx];
33318
+ var eventSize = Object(_Util_StringUtils__WEBPACK_IMPORTED_MODULE_7__["getStringByteSize"])(JSON.stringify(currentEvent));
33319
+
33320
+ if (totalByteSize + eventSize > LAMBDA_PAYLOAD_LIMIT) {
33321
+ break;
33322
+ }
33323
+
33324
+ totalByteSize += eventSize;
33325
+ currentEventIdx += 1;
33326
+ }
33327
+
33328
+ return buffer.slice(0, currentEventIdx);
33329
+ };
33330
+
33331
+ APILoggingProvider.PROVIDER_NAME = _Util_Constants__WEBPACK_IMPORTED_MODULE_6__["API_LOGGING_PROVIDER_NAME"];
33332
+ APILoggingProvider.CATEGORY = _Util_Constants__WEBPACK_IMPORTED_MODULE_6__["API_LOGGING_PROVIDER_CATEGORY"];
33333
+ return APILoggingProvider;
33334
+ }();
33335
+
33336
+
33337
+
33338
+ /***/ }),
33339
+
33340
+ /***/ "./lib-esm/Providers/APIProvider/CloudWatchEventFormatter.js":
33341
+ /*!*******************************************************************!*\
33342
+ !*** ./lib-esm/Providers/APIProvider/CloudWatchEventFormatter.js ***!
33343
+ \*******************************************************************/
33344
+ /*! exports provided: cloudWatchEventFromGeneric, truncateOversizedEvent, cloudWatchLogEventBatch */
33345
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
33346
+
33347
+ "use strict";
33348
+ __webpack_require__.r(__webpack_exports__);
33349
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "cloudWatchEventFromGeneric", function() { return cloudWatchEventFromGeneric; });
33350
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "truncateOversizedEvent", function() { return truncateOversizedEvent; });
33351
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "cloudWatchLogEventBatch", function() { return cloudWatchLogEventBatch; });
33352
+ /* harmony import */ var _Util_Constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Util/Constants */ "./lib-esm/Util/Constants.js");
33353
+ /* harmony import */ var ___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../ */ "./lib-esm/index.js");
33354
+ var __rest = undefined && undefined.__rest || function (s, e) {
33355
+ var t = {};
33356
+
33357
+ for (var p in s) {
33358
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
33359
+ }
33360
+
33361
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
33362
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
33363
+ }
33364
+ return t;
33365
+ };
33366
+
33367
+
33368
+
33369
+ var logger = new ___WEBPACK_IMPORTED_MODULE_1__["ConsoleLogger"]('APILoggingProvider');
33370
+ var TRUNCATE_MAX_LENGTH = 5000;
33371
+ var cloudWatchEventFromGeneric = function cloudWatchEventFromGeneric(event) {
33372
+ var timestamp = event.timestamp,
33373
+ message = __rest(event, ["timestamp"]);
33374
+
33375
+ return {
33376
+ timestamp: timestamp,
33377
+ message: JSON.stringify(message)
33378
+ };
33379
+ };
33380
+ var truncateOversizedEvent = function truncateOversizedEvent(event) {
33381
+ var timestamp = event.timestamp,
33382
+ message = event.message;
33383
+
33384
+ try {
33385
+ var messageJson = JSON.parse(message);
33386
+ var truncatedObj = {
33387
+ level: messageJson.level,
33388
+ "class": messageJson["class"],
33389
+ message: messageJson.message.substring(0, TRUNCATE_MAX_LENGTH)
33390
+ };
33391
+
33392
+ if (messageJson.data != null) {
33393
+ truncatedObj['data'] = "OBJECT SIZE EXCEEDS CLOUDWATCH EVENT LIMIT. Truncated: " + JSON.stringify(messageJson.data).substring(0, TRUNCATE_MAX_LENGTH);
33394
+ }
33395
+
33396
+ return {
33397
+ timestamp: timestamp,
33398
+ message: JSON.stringify(truncatedObj)
33399
+ };
33400
+ } catch (error) {
33401
+ logger.warn('Could not truncate oversized event', error);
33402
+ var truncated = JSON.stringify({
33403
+ level: 'UNKNOWN',
33404
+ "class": 'Unknown',
33405
+ message: 'OBJECT SIZE EXCEEDS CLOUDWATCH EVENT LIMIT. Could not parse event to truncate'
33406
+ });
33407
+ return {
33408
+ timestamp: timestamp,
33409
+ message: truncated
33410
+ };
33411
+ }
33412
+ };
33413
+ var cloudWatchLogEventBatch = function cloudWatchLogEventBatch(buffer) {
33414
+ var totalByteSize = 0;
33415
+ var currentEventIdx = 0;
33416
+
33417
+ while (currentEventIdx < buffer.length) {
33418
+ var currentEvent = buffer[currentEventIdx];
33419
+ var eventSize = Object(___WEBPACK_IMPORTED_MODULE_1__["getStringByteSize"])(currentEvent.message) + _Util_Constants__WEBPACK_IMPORTED_MODULE_0__["AWS_CLOUDWATCH_BASE_BUFFER_SIZE"];
33420
+
33421
+ if (eventSize > _Util_Constants__WEBPACK_IMPORTED_MODULE_0__["AWS_CLOUDWATCH_MAX_EVENT_SIZE"]) {
33422
+ var errString = "Log event exceeds maximum size for CloudWatch logs. Log size: " + eventSize + ". Truncating log message.";
33423
+ logger.debug(errString);
33424
+ currentEvent = truncateOversizedEvent(currentEvent);
33425
+ buffer[currentEventIdx] = currentEvent;
33426
+ eventSize = new TextEncoder().encode(currentEvent.message).length + _Util_Constants__WEBPACK_IMPORTED_MODULE_0__["AWS_CLOUDWATCH_BASE_BUFFER_SIZE"];
33427
+ }
33428
+
33429
+ if (totalByteSize + eventSize > _Util_Constants__WEBPACK_IMPORTED_MODULE_0__["AWS_CLOUDWATCH_MAX_BATCH_EVENT_SIZE"]) {
33430
+ break;
33431
+ }
33432
+
33433
+ totalByteSize += eventSize;
33434
+ currentEventIdx += 1;
33435
+ }
33436
+
33437
+ return buffer.slice(0, currentEventIdx);
33438
+ };
33439
+
33440
+ /***/ }),
33441
+
33442
+ /***/ "./lib-esm/Providers/APIProvider/Fetch.js":
33443
+ /*!************************************************!*\
33444
+ !*** ./lib-esm/Providers/APIProvider/Fetch.js ***!
33445
+ \************************************************/
33446
+ /*! exports provided: postOptions */
33447
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
33448
+
33449
+ "use strict";
33450
+ __webpack_require__.r(__webpack_exports__);
33451
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "postOptions", function() { return postOptions; });
33452
+ var postOptions = function postOptions(body) {
33453
+ return {
33454
+ method: 'POST',
33455
+ mode: 'cors',
33456
+ cache: 'no-cache',
33457
+ credentials: 'same-origin',
33458
+ headers: {
33459
+ 'Content-Type': 'application/json'
33460
+ },
33461
+ body: JSON.stringify(body)
33462
+ };
33463
+ };
33464
+
33465
+ /***/ }),
32497
33466
 
33467
+ /***/ "./lib-esm/Providers/APIProvider/LoggerReachability/index.js":
33468
+ /*!*******************************************************************!*\
33469
+ !*** ./lib-esm/Providers/APIProvider/LoggerReachability/index.js ***!
33470
+ \*******************************************************************/
33471
+ /*! exports provided: ReachabilityMonitor */
33472
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
32498
33473
 
32499
- /**
32500
- * @deprecated use named import
32501
- */
33474
+ "use strict";
33475
+ __webpack_require__.r(__webpack_exports__);
33476
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ReachabilityMonitor", function() { return ReachabilityMonitor; });
33477
+ /* harmony import */ var _Util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../Util */ "./lib-esm/Util/index.js");
32502
33478
 
32503
- /* harmony default export */ __webpack_exports__["default"] = (GoogleOAuth);
33479
+ var ReachabilityMonitor = new _Util__WEBPACK_IMPORTED_MODULE_0__["Reachability"]().networkMonitor();
32504
33480
 
32505
33481
  /***/ }),
32506
33482
 
32507
- /***/ "./lib-esm/OAuthHelper/index.js":
32508
- /*!**************************************!*\
32509
- !*** ./lib-esm/OAuthHelper/index.js ***!
32510
- \**************************************/
32511
- /*! exports provided: GoogleOAuth, FacebookOAuth */
33483
+ /***/ "./lib-esm/Providers/APIProvider/index.js":
33484
+ /*!************************************************!*\
33485
+ !*** ./lib-esm/Providers/APIProvider/index.js ***!
33486
+ \************************************************/
33487
+ /*! exports provided: APILoggingProvider */
32512
33488
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
32513
33489
 
32514
33490
  "use strict";
32515
33491
  __webpack_require__.r(__webpack_exports__);
32516
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GoogleOAuth", function() { return GoogleOAuth; });
32517
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FacebookOAuth", function() { return FacebookOAuth; });
32518
- /* harmony import */ var _GoogleOAuth__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./GoogleOAuth */ "./lib-esm/OAuthHelper/GoogleOAuth.js");
32519
- /* harmony import */ var _FacebookOAuth__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./FacebookOAuth */ "./lib-esm/OAuthHelper/FacebookOAuth.js");
32520
- /*
32521
- * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
32522
- *
32523
- * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
32524
- * the License. A copy of the License is located at
32525
- *
32526
- * http://aws.amazon.com/apache2.0/
32527
- *
32528
- * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
32529
- * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
32530
- * and limitations under the License.
32531
- */
33492
+ /* harmony import */ var _APILoggingProvider__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./APILoggingProvider */ "./lib-esm/Providers/APIProvider/APILoggingProvider.js");
33493
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "APILoggingProvider", function() { return _APILoggingProvider__WEBPACK_IMPORTED_MODULE_0__["APILoggingProvider"]; });
32532
33494
 
32533
33495
 
32534
- var GoogleOAuth = new _GoogleOAuth__WEBPACK_IMPORTED_MODULE_0__["GoogleOAuth"]();
32535
- var FacebookOAuth = new _FacebookOAuth__WEBPACK_IMPORTED_MODULE_1__["FacebookOAuth"]();
32536
33496
 
32537
33497
  /***/ }),
32538
33498
 
32539
- /***/ "./lib-esm/Parser.js":
32540
- /*!***************************!*\
32541
- !*** ./lib-esm/Parser.js ***!
32542
- \***************************/
32543
- /*! exports provided: parseMobileHubConfig, Parser, default */
33499
+ /***/ "./lib-esm/Providers/APIProvider/loggerConnectivity.js":
33500
+ /*!*************************************************************!*\
33501
+ !*** ./lib-esm/Providers/APIProvider/loggerConnectivity.js ***!
33502
+ \*************************************************************/
33503
+ /*! exports provided: default */
32544
33504
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
32545
33505
 
32546
33506
  "use strict";
32547
33507
  __webpack_require__.r(__webpack_exports__);
32548
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parseMobileHubConfig", function() { return parseMobileHubConfig; });
32549
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Parser", function() { return Parser; });
32550
- /* harmony import */ var _Logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Logger */ "./lib-esm/Logger/index.js");
33508
+ /* harmony import */ var zen_observable_ts__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! zen-observable-ts */ "../../node_modules/zen-observable-ts/lib/bundle.esm.js");
33509
+ /* harmony import */ var _LoggerReachability__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./LoggerReachability */ "./lib-esm/Providers/APIProvider/LoggerReachability/index.js");
32551
33510
  var __assign = undefined && undefined.__assign || function () {
32552
33511
  __assign = Object.assign || function (t) {
32553
33512
  for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -32565,167 +33524,54 @@ var __assign = undefined && undefined.__assign || function () {
32565
33524
  };
32566
33525
 
32567
33526
 
32568
- var logger = new _Logger__WEBPACK_IMPORTED_MODULE_0__["ConsoleLogger"]('Parser');
32569
- var parseMobileHubConfig = function parseMobileHubConfig(config) {
32570
- var amplifyConfig = {}; // Analytics
33527
+ // TODO: refactor this to a singleton that supports numerous observers
32571
33528
 
32572
- if (config['aws_mobile_analytics_app_id']) {
32573
- var Analytics = {
32574
- AWSPinpoint: {
32575
- appId: config['aws_mobile_analytics_app_id'],
32576
- region: config['aws_mobile_analytics_app_region']
32577
- }
33529
+ var LoggerConnectivity =
33530
+ /** @class */
33531
+ function () {
33532
+ function LoggerConnectivity() {
33533
+ this.connectionStatus = {
33534
+ online: false
32578
33535
  };
32579
- amplifyConfig.Analytics = Analytics;
32580
- } // Auth
32581
-
33536
+ }
32582
33537
 
32583
- if (config['aws_cognito_identity_pool_id'] || config['aws_user_pools_id']) {
32584
- amplifyConfig.Auth = {
32585
- userPoolId: config['aws_user_pools_id'],
32586
- userPoolWebClientId: config['aws_user_pools_web_client_id'],
32587
- region: config['aws_cognito_region'],
32588
- identityPoolId: config['aws_cognito_identity_pool_id'],
32589
- identityPoolRegion: config['aws_cognito_region'],
32590
- mandatorySignIn: config['aws_mandatory_sign_in'] === 'enable'
32591
- };
32592
- } // Storage
33538
+ LoggerConnectivity.prototype.status = function () {
33539
+ var _this = this;
32593
33540
 
33541
+ if (this.observer) {
33542
+ throw new Error('Subscriber already exists');
33543
+ }
32594
33544
 
32595
- var storageConfig;
33545
+ return new zen_observable_ts__WEBPACK_IMPORTED_MODULE_0__["default"](function (observer) {
33546
+ _this.observer = observer;
33547
+ _this.subscription = _LoggerReachability__WEBPACK_IMPORTED_MODULE_1__["ReachabilityMonitor"].subscribe(function (_a) {
33548
+ var online = _a.online;
33549
+ _this.connectionStatus.online = online;
32596
33550
 
32597
- if (config['aws_user_files_s3_bucket']) {
32598
- storageConfig = {
32599
- AWSS3: {
32600
- bucket: config['aws_user_files_s3_bucket'],
32601
- region: config['aws_user_files_s3_bucket_region'],
32602
- dangerouslyConnectToHttpEndpointForTesting: config['aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing']
32603
- }
32604
- };
32605
- } else {
32606
- storageConfig = config ? config.Storage || config : {};
32607
- } // Logging
33551
+ var observerResult = __assign({}, _this.connectionStatus);
32608
33552
 
33553
+ observer.next(observerResult);
33554
+ });
33555
+ return function () {
33556
+ clearTimeout(_this.timeout);
32609
33557
 
32610
- if (config['Logging']) {
32611
- amplifyConfig.Logging = __assign(__assign({}, config['Logging']), {
32612
- region: config['aws_project_region']
33558
+ _this.unsubscribe();
33559
+ };
32613
33560
  });
32614
- } // Geo
32615
-
32616
-
32617
- if (config['geo']) {
32618
- amplifyConfig.Geo = Object.assign({}, config.geo);
33561
+ };
32619
33562
 
32620
- if (config.geo['amazon_location_service']) {
32621
- amplifyConfig.Geo = {
32622
- AmazonLocationService: config.geo['amazon_location_service']
32623
- };
33563
+ LoggerConnectivity.prototype.unsubscribe = function () {
33564
+ if (this.subscription) {
33565
+ clearTimeout(this.timeout);
33566
+ this.subscription.unsubscribe();
33567
+ this.observer = undefined;
32624
33568
  }
32625
- }
32626
-
32627
- amplifyConfig.Analytics = Object.assign({}, amplifyConfig.Analytics, config.Analytics);
32628
- amplifyConfig.Auth = Object.assign({}, amplifyConfig.Auth, config.Auth);
32629
- amplifyConfig.Storage = Object.assign({}, storageConfig);
32630
- amplifyConfig.Logging = Object.assign({}, amplifyConfig.Logging, config.Logging);
32631
- logger.debug('parse config', config, 'to amplifyconfig', amplifyConfig);
32632
- return amplifyConfig;
32633
- };
32634
- /**
32635
- * @deprecated use per-function export
32636
- */
32637
-
32638
- var Parser =
32639
- /** @class */
32640
- function () {
32641
- function Parser() {}
33569
+ };
32642
33570
 
32643
- Parser.parseMobilehubConfig = parseMobileHubConfig;
32644
- return Parser;
33571
+ return LoggerConnectivity;
32645
33572
  }();
32646
33573
 
32647
-
32648
- /**
32649
- * @deprecated use per-function export
32650
- */
32651
-
32652
- /* harmony default export */ __webpack_exports__["default"] = (Parser);
32653
-
32654
- /***/ }),
32655
-
32656
- /***/ "./lib-esm/Platform/index.js":
32657
- /*!***********************************!*\
32658
- !*** ./lib-esm/Platform/index.js ***!
32659
- \***********************************/
32660
- /*! exports provided: Platform, getAmplifyUserAgent, default */
32661
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
32662
-
32663
- "use strict";
32664
- __webpack_require__.r(__webpack_exports__);
32665
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Platform", function() { return Platform; });
32666
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getAmplifyUserAgent", function() { return getAmplifyUserAgent; });
32667
- /* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./version */ "./lib-esm/Platform/version.js");
32668
- /*
32669
- * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
32670
- *
32671
- * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
32672
- * the License. A copy of the License is located at
32673
- *
32674
- * http://aws.amazon.com/apache2.0/
32675
- *
32676
- * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
32677
- * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
32678
- * and limitations under the License.
32679
- */
32680
-
32681
- var BASE_USER_AGENT = "aws-amplify/" + _version__WEBPACK_IMPORTED_MODULE_0__["version"];
32682
- var Platform = {
32683
- userAgent: BASE_USER_AGENT + " js",
32684
- product: '',
32685
- navigator: null,
32686
- isReactNative: false
32687
- };
32688
-
32689
- if (typeof navigator !== 'undefined' && navigator.product) {
32690
- Platform.product = navigator.product || '';
32691
- Platform.navigator = navigator || null;
32692
-
32693
- switch (navigator.product) {
32694
- case 'ReactNative':
32695
- Platform.userAgent = BASE_USER_AGENT + " react-native";
32696
- Platform.isReactNative = true;
32697
- break;
32698
-
32699
- default:
32700
- Platform.userAgent = BASE_USER_AGENT + " js";
32701
- Platform.isReactNative = false;
32702
- break;
32703
- }
32704
- }
32705
-
32706
- var getAmplifyUserAgent = function getAmplifyUserAgent() {
32707
- return Platform.userAgent;
32708
- };
32709
- /**
32710
- * @deprecated use named import
32711
- */
32712
-
32713
- /* harmony default export */ __webpack_exports__["default"] = (Platform);
32714
-
32715
- /***/ }),
32716
-
32717
- /***/ "./lib-esm/Platform/version.js":
32718
- /*!*************************************!*\
32719
- !*** ./lib-esm/Platform/version.js ***!
32720
- \*************************************/
32721
- /*! exports provided: version */
32722
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
32723
-
32724
- "use strict";
32725
- __webpack_require__.r(__webpack_exports__);
32726
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "version", function() { return version; });
32727
- // generated by genversion
32728
- var version = '4.4.0';
33574
+ /* harmony default export */ __webpack_exports__["default"] = (LoggerConnectivity);
32729
33575
 
32730
33576
  /***/ }),
32731
33577
 
@@ -33738,7 +34584,7 @@ function () {
33738
34584
  /*!************************************!*\
33739
34585
  !*** ./lib-esm/Providers/index.js ***!
33740
34586
  \************************************/
33741
- /*! exports provided: AWSCloudWatchProvider */
34587
+ /*! exports provided: AWSCloudWatchProvider, APILoggingProvider */
33742
34588
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
33743
34589
 
33744
34590
  "use strict";
@@ -33746,6 +34592,10 @@ __webpack_require__.r(__webpack_exports__);
33746
34592
  /* harmony import */ var _AWSCloudWatchProvider__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AWSCloudWatchProvider */ "./lib-esm/Providers/AWSCloudWatchProvider.js");
33747
34593
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AWSCloudWatchProvider", function() { return _AWSCloudWatchProvider__WEBPACK_IMPORTED_MODULE_0__["AWSCloudWatchProvider"]; });
33748
34594
 
34595
+ /* harmony import */ var _APIProvider__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./APIProvider */ "./lib-esm/Providers/APIProvider/index.js");
34596
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "APILoggingProvider", function() { return _APIProvider__WEBPACK_IMPORTED_MODULE_1__["APILoggingProvider"]; });
34597
+
34598
+
33749
34599
 
33750
34600
 
33751
34601
  /***/ }),
@@ -34750,7 +35600,7 @@ function () {
34750
35600
  /*!***********************************!*\
34751
35601
  !*** ./lib-esm/Util/Constants.js ***!
34752
35602
  \***********************************/
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 */
35603
+ /*! 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, API_LOGGING_PROVIDER_NAME, API_LOGGING_PROVIDER_CATEGORY */
34754
35604
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
34755
35605
 
34756
35606
  "use strict";
@@ -34762,6 +35612,8 @@ __webpack_require__.r(__webpack_exports__);
34762
35612
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AWS_CLOUDWATCH_PROVIDER_NAME", function() { return AWS_CLOUDWATCH_PROVIDER_NAME; });
34763
35613
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NO_CREDS_ERROR_STRING", function() { return NO_CREDS_ERROR_STRING; });
34764
35614
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RETRY_ERROR_CODES", function() { return RETRY_ERROR_CODES; });
35615
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "API_LOGGING_PROVIDER_NAME", function() { return API_LOGGING_PROVIDER_NAME; });
35616
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "API_LOGGING_PROVIDER_CATEGORY", function() { return API_LOGGING_PROVIDER_CATEGORY; });
34765
35617
  /*
34766
35618
  * Copyright 2017-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
34767
35619
  *
@@ -34782,6 +35634,8 @@ var AWS_CLOUDWATCH_CATEGORY = 'Logging';
34782
35634
  var AWS_CLOUDWATCH_PROVIDER_NAME = 'AWSCloudWatch';
34783
35635
  var NO_CREDS_ERROR_STRING = 'No credentials';
34784
35636
  var RETRY_ERROR_CODES = ['ResourceNotFoundException', 'InvalidSequenceTokenException'];
35637
+ var API_LOGGING_PROVIDER_NAME = 'API';
35638
+ var API_LOGGING_PROVIDER_CATEGORY = 'Logging';
34785
35639
 
34786
35640
 
34787
35641
  /***/ }),
@@ -34995,7 +35849,7 @@ function () {
34995
35849
 
34996
35850
  "use strict";
34997
35851
  __webpack_require__.r(__webpack_exports__);
34998
- /* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @aws-amplify/core */ "./lib-esm/index.js");
35852
+ /* harmony import */ var _JS__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../JS */ "./lib-esm/JS.js");
34999
35853
  /* harmony import */ var zen_observable_ts__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! zen-observable-ts */ "../../node_modules/zen-observable-ts/lib/bundle.esm.js");
35000
35854
  var __values = undefined && undefined.__values || function (o) {
35001
35855
  var s = typeof Symbol === "function" && Symbol.iterator,
@@ -35023,13 +35877,13 @@ function () {
35023
35877
  function ReachabilityNavigator() {}
35024
35878
 
35025
35879
  ReachabilityNavigator.prototype.networkMonitor = function (netInfo) {
35026
- if (Object(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["browserOrNode"])().isNode) {
35880
+ if (Object(_JS__WEBPACK_IMPORTED_MODULE_0__["browserOrNode"])().isNode) {
35027
35881
  return zen_observable_ts__WEBPACK_IMPORTED_MODULE_1__["default"].from([{
35028
35882
  online: true
35029
35883
  }]);
35030
35884
  }
35031
35885
 
35032
- var globalObj = Object(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["isWebWorker"])() ? self : window;
35886
+ var globalObj = Object(_JS__WEBPACK_IMPORTED_MODULE_0__["isWebWorker"])() ? self : window;
35033
35887
  return new zen_observable_ts__WEBPACK_IMPORTED_MODULE_1__["default"](function (observer) {
35034
35888
  observer.next({
35035
35889
  online: globalObj.navigator.onLine
@@ -35322,7 +36176,7 @@ var __spread = undefined && undefined.__spread || function () {
35322
36176
  };
35323
36177
 
35324
36178
 
35325
- var logger = new _Logger_ConsoleLogger__WEBPACK_IMPORTED_MODULE_0__["ConsoleLogger"]('Util');
36179
+ var logger = new _Logger_ConsoleLogger__WEBPACK_IMPORTED_MODULE_0__["ConsoleLogger"]('Retry');
35326
36180
 
35327
36181
  var NonRetryableError =
35328
36182
  /** @class */
@@ -35365,7 +36219,7 @@ function retry(functionToRetry, args, delayFn, attempt) {
35365
36219
  throw Error('functionToRetry must be a function');
35366
36220
  }
35367
36221
 
35368
- logger.debug(functionToRetry.name + " attempt #" + attempt + " with this vars: " + JSON.stringify(args));
36222
+ logger.debug(functionToRetry.name + " attempt #" + attempt + " with these vars: " + JSON.stringify(args));
35369
36223
  _a.label = 1;
35370
36224
 
35371
36225
  case 1:
@@ -35458,13 +36312,16 @@ var jitteredExponentialRetry = function jitteredExponentialRetry(functionToRetry
35458
36312
  /*!*************************************!*\
35459
36313
  !*** ./lib-esm/Util/StringUtils.js ***!
35460
36314
  \*************************************/
35461
- /*! exports provided: urlSafeEncode, urlSafeDecode */
36315
+ /*! exports provided: urlSafeEncode, urlSafeDecode, getStringByteSize */
35462
36316
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
35463
36317
 
35464
36318
  "use strict";
35465
36319
  __webpack_require__.r(__webpack_exports__);
35466
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "urlSafeEncode", function() { return urlSafeEncode; });
36320
+ /* WEBPACK VAR INJECTION */(function(Buffer) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "urlSafeEncode", function() { return urlSafeEncode; });
35467
36321
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "urlSafeDecode", function() { return urlSafeDecode; });
36322
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getStringByteSize", function() { return getStringByteSize; });
36323
+ /* harmony import */ var ___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../ */ "./lib-esm/index.js");
36324
+
35468
36325
  function urlSafeEncode(str) {
35469
36326
  return str.split('').map(function (_char) {
35470
36327
  return _char.charCodeAt(0).toString(16).padStart(2, '0');
@@ -35475,6 +36332,18 @@ function urlSafeDecode(hex) {
35475
36332
  return String.fromCharCode(parseInt(_char2, 16));
35476
36333
  }).join('');
35477
36334
  }
36335
+ var getStringByteSize = function getStringByteSize(str) {
36336
+ if (Object(___WEBPACK_IMPORTED_MODULE_0__["browserOrNode"])().isBrowser || Blob !== undefined) {
36337
+ return new Blob([str]).size;
36338
+ }
36339
+
36340
+ if (Buffer !== undefined) {
36341
+ return Buffer.byteLength(str, 'utf8');
36342
+ }
36343
+
36344
+ throw new Error('Cannot compute string length. Blob and Buffer are undefined');
36345
+ };
36346
+ /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../node_modules/buffer/index.js */ "../../node_modules/buffer/index.js").Buffer))
35478
36347
 
35479
36348
  /***/ }),
35480
36349
 
@@ -35482,7 +36351,7 @@ function urlSafeDecode(hex) {
35482
36351
  /*!*******************************!*\
35483
36352
  !*** ./lib-esm/Util/index.js ***!
35484
36353
  \*******************************/
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 */
36354
+ /*! exports provided: NonRetryableError, retry, jitteredExponentialRetry, Mutex, Reachability, DateUtils, urlSafeEncode, urlSafeDecode, getStringByteSize, 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, API_LOGGING_PROVIDER_NAME, API_LOGGING_PROVIDER_CATEGORY */
35486
36355
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
35487
36356
 
35488
36357
  "use strict";
@@ -35508,6 +36377,8 @@ __webpack_require__.r(__webpack_exports__);
35508
36377
 
35509
36378
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "urlSafeDecode", function() { return _StringUtils__WEBPACK_IMPORTED_MODULE_4__["urlSafeDecode"]; });
35510
36379
 
36380
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getStringByteSize", function() { return _StringUtils__WEBPACK_IMPORTED_MODULE_4__["getStringByteSize"]; });
36381
+
35511
36382
  /* harmony import */ var _Constants__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Constants */ "./lib-esm/Util/Constants.js");
35512
36383
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AWS_CLOUDWATCH_BASE_BUFFER_SIZE", function() { return _Constants__WEBPACK_IMPORTED_MODULE_5__["AWS_CLOUDWATCH_BASE_BUFFER_SIZE"]; });
35513
36384
 
@@ -35523,6 +36394,10 @@ __webpack_require__.r(__webpack_exports__);
35523
36394
 
35524
36395
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "RETRY_ERROR_CODES", function() { return _Constants__WEBPACK_IMPORTED_MODULE_5__["RETRY_ERROR_CODES"]; });
35525
36396
 
36397
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "API_LOGGING_PROVIDER_NAME", function() { return _Constants__WEBPACK_IMPORTED_MODULE_5__["API_LOGGING_PROVIDER_NAME"]; });
36398
+
36399
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "API_LOGGING_PROVIDER_CATEGORY", function() { return _Constants__WEBPACK_IMPORTED_MODULE_5__["API_LOGGING_PROVIDER_CATEGORY"]; });
36400
+
35526
36401
 
35527
36402
 
35528
36403
 
@@ -35572,7 +36447,7 @@ var USER_AGENT_HEADER = 'x-amz-user-agent';
35572
36447
  /*!**************************!*\
35573
36448
  !*** ./lib-esm/index.js ***!
35574
36449
  \**************************/
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 */
36450
+ /*! 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, APILoggingProvider, 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, getStringByteSize, 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, API_LOGGING_PROVIDER_NAME, API_LOGGING_PROVIDER_CATEGORY, Amplify, default */
35576
36451
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
35577
36452
 
35578
36453
  "use strict";
@@ -35641,6 +36516,8 @@ __webpack_require__.r(__webpack_exports__);
35641
36516
  /* harmony import */ var _Providers__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./Providers */ "./lib-esm/Providers/index.js");
35642
36517
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AWSCloudWatchProvider", function() { return _Providers__WEBPACK_IMPORTED_MODULE_10__["AWSCloudWatchProvider"]; });
35643
36518
 
36519
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "APILoggingProvider", function() { return _Providers__WEBPACK_IMPORTED_MODULE_10__["APILoggingProvider"]; });
36520
+
35644
36521
  /* harmony import */ var _OAuthHelper__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./OAuthHelper */ "./lib-esm/OAuthHelper/index.js");
35645
36522
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FacebookOAuth", function() { return _OAuthHelper__WEBPACK_IMPORTED_MODULE_11__["FacebookOAuth"]; });
35646
36523
 
@@ -35697,6 +36574,8 @@ __webpack_require__.r(__webpack_exports__);
35697
36574
 
35698
36575
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "urlSafeDecode", function() { return _Util__WEBPACK_IMPORTED_MODULE_18__["urlSafeDecode"]; });
35699
36576
 
36577
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getStringByteSize", function() { return _Util__WEBPACK_IMPORTED_MODULE_18__["getStringByteSize"]; });
36578
+
35700
36579
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AWS_CLOUDWATCH_BASE_BUFFER_SIZE", function() { return _Util__WEBPACK_IMPORTED_MODULE_18__["AWS_CLOUDWATCH_BASE_BUFFER_SIZE"]; });
35701
36580
 
35702
36581
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AWS_CLOUDWATCH_CATEGORY", function() { return _Util__WEBPACK_IMPORTED_MODULE_18__["AWS_CLOUDWATCH_CATEGORY"]; });
@@ -35711,6 +36590,10 @@ __webpack_require__.r(__webpack_exports__);
35711
36590
 
35712
36591
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "RETRY_ERROR_CODES", function() { return _Util__WEBPACK_IMPORTED_MODULE_18__["RETRY_ERROR_CODES"]; });
35713
36592
 
36593
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "API_LOGGING_PROVIDER_NAME", function() { return _Util__WEBPACK_IMPORTED_MODULE_18__["API_LOGGING_PROVIDER_NAME"]; });
36594
+
36595
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "API_LOGGING_PROVIDER_CATEGORY", function() { return _Util__WEBPACK_IMPORTED_MODULE_18__["API_LOGGING_PROVIDER_CATEGORY"]; });
36596
+
35714
36597
  /*
35715
36598
  * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
35716
36599
  *
@@ -35757,6 +36640,25 @@ var Constants = {
35757
36640
 
35758
36641
  /***/ }),
35759
36642
 
36643
+ /***/ "./lib-esm/types/types.js":
36644
+ /*!********************************!*\
36645
+ !*** ./lib-esm/types/types.js ***!
36646
+ \********************************/
36647
+ /*! exports provided: EVENT_FORMAT */
36648
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
36649
+
36650
+ "use strict";
36651
+ __webpack_require__.r(__webpack_exports__);
36652
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EVENT_FORMAT", function() { return EVENT_FORMAT; });
36653
+ var EVENT_FORMAT;
36654
+
36655
+ (function (EVENT_FORMAT) {
36656
+ EVENT_FORMAT["GENERIC"] = "GENERIC";
36657
+ EVENT_FORMAT["CLOUDWATCH"] = "CLOUDWATCH";
36658
+ })(EVENT_FORMAT || (EVENT_FORMAT = {}));
36659
+
36660
+ /***/ }),
36661
+
35760
36662
  /***/ "./node_modules/@aws-crypto/sha256-js/build/RawSha256.js":
35761
36663
  /*!***************************************************************!*\
35762
36664
  !*** ./node_modules/@aws-crypto/sha256-js/build/RawSha256.js ***!