@aws-amplify/core 4.3.14 → 4.3.15-cloud-logging.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.
- package/dist/aws-amplify-core.js +248 -104
- package/dist/aws-amplify-core.js.map +1 -1
- package/dist/aws-amplify-core.min.js +6 -6
- package/dist/aws-amplify-core.min.js.map +1 -1
- package/lib/Hub.js +1 -0
- package/lib/Hub.js.map +1 -1
- package/lib/Logger/ConsoleLogger.d.ts +6 -0
- package/lib/Logger/ConsoleLogger.js +118 -43
- package/lib/Logger/ConsoleLogger.js.map +1 -1
- package/lib/Platform/version.d.ts +1 -1
- package/lib/Platform/version.js +1 -1
- package/lib/Providers/AWSCloudWatchProvider.d.ts +10 -3
- package/lib/Providers/AWSCloudWatchProvider.js +62 -36
- package/lib/Providers/AWSCloudWatchProvider.js.map +1 -1
- package/lib/Providers/AmazonKinesisLoggingProvider.d.ts +13 -0
- package/lib/Providers/AmazonKinesisLoggingProvider.js +30 -0
- package/lib/Providers/AmazonKinesisLoggingProvider.js.map +1 -0
- package/lib/Util/Constants.d.ts +3 -1
- package/lib/Util/Constants.js +5 -0
- package/lib/Util/Constants.js.map +1 -1
- package/lib/types/types.d.ts +13 -0
- package/lib-esm/Hub.js +1 -0
- package/lib-esm/Hub.js.map +1 -1
- package/lib-esm/Logger/ConsoleLogger.d.ts +6 -0
- package/lib-esm/Logger/ConsoleLogger.js +118 -43
- package/lib-esm/Logger/ConsoleLogger.js.map +1 -1
- package/lib-esm/Platform/version.d.ts +1 -1
- package/lib-esm/Platform/version.js +1 -1
- package/lib-esm/Providers/AWSCloudWatchProvider.d.ts +10 -3
- package/lib-esm/Providers/AWSCloudWatchProvider.js +62 -36
- package/lib-esm/Providers/AWSCloudWatchProvider.js.map +1 -1
- package/lib-esm/Providers/AmazonKinesisLoggingProvider.d.ts +13 -0
- package/lib-esm/Providers/AmazonKinesisLoggingProvider.js +28 -0
- package/lib-esm/Providers/AmazonKinesisLoggingProvider.js.map +1 -0
- package/lib-esm/Util/Constants.d.ts +3 -1
- package/lib-esm/Util/Constants.js +4 -1
- package/lib-esm/Util/Constants.js.map +1 -1
- package/lib-esm/types/types.d.ts +13 -0
- package/package.json +3 -2
- package/src/Hub.ts +1 -0
- package/src/Logger/ConsoleLogger.ts +119 -34
- package/src/Platform/version.ts +1 -1
- package/src/Providers/AWSCloudWatchProvider.ts +62 -15
- package/src/Providers/AmazonKinesisLoggingProvider.ts +43 -0
- package/src/Util/Constants.ts +7 -0
- package/src/types/types.ts +79 -62
package/dist/aws-amplify-core.js
CHANGED
|
@@ -25767,6 +25767,24 @@ function isnan (val) {
|
|
|
25767
25767
|
|
|
25768
25768
|
/***/ }),
|
|
25769
25769
|
|
|
25770
|
+
/***/ "../../node_modules/fast-text-encoding/text.min.js":
|
|
25771
|
+
/*!********************************************************************!*\
|
|
25772
|
+
!*** /root/amplify-js/node_modules/fast-text-encoding/text.min.js ***!
|
|
25773
|
+
\********************************************************************/
|
|
25774
|
+
/*! no static exports found */
|
|
25775
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
25776
|
+
|
|
25777
|
+
/* 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"}));
|
|
25778
|
+
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++]=
|
|
25779
|
+
(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,
|
|
25780
|
+
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&
|
|
25781
|
+
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.");
|
|
25782
|
+
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);
|
|
25783
|
+
|
|
25784
|
+
/* 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))
|
|
25785
|
+
|
|
25786
|
+
/***/ }),
|
|
25787
|
+
|
|
25770
25788
|
/***/ "../../node_modules/ieee754/index.js":
|
|
25771
25789
|
/*!******************************************************!*\
|
|
25772
25790
|
!*** /root/amplify-js/node_modules/ieee754/index.js ***!
|
|
@@ -30698,7 +30716,7 @@ function () {
|
|
|
30698
30716
|
function HubClass(name) {
|
|
30699
30717
|
this.listeners = [];
|
|
30700
30718
|
this.patterns = [];
|
|
30701
|
-
this.protectedChannels = ['core', 'auth', 'api', 'analytics', 'interactions', 'pubsub', 'storage', 'xr'];
|
|
30719
|
+
this.protectedChannels = ['core', 'auth', 'api', 'analytics', 'interactions', 'pubsub', 'storage', 'ui', 'xr'];
|
|
30702
30720
|
this.name = name;
|
|
30703
30721
|
} // Note - Need to pass channel as a reference for removal to work and not anonymous function
|
|
30704
30722
|
|
|
@@ -31646,6 +31664,7 @@ var LOG_LEVELS = {
|
|
|
31646
31664
|
WARN: 4,
|
|
31647
31665
|
ERROR: 5
|
|
31648
31666
|
};
|
|
31667
|
+
var COMPATIBLE_PLUGINS = [_Util_Constants__WEBPACK_IMPORTED_MODULE_0__["AWS_CLOUDWATCH_CATEGORY"]];
|
|
31649
31668
|
var LOG_TYPE;
|
|
31650
31669
|
|
|
31651
31670
|
(function (LOG_TYPE) {
|
|
@@ -31655,12 +31674,13 @@ var LOG_TYPE;
|
|
|
31655
31674
|
LOG_TYPE["WARN"] = "WARN";
|
|
31656
31675
|
LOG_TYPE["VERBOSE"] = "VERBOSE";
|
|
31657
31676
|
})(LOG_TYPE || (LOG_TYPE = {}));
|
|
31677
|
+
|
|
31678
|
+
var cloudWatchExcludeList = ['AWSCloudWatch', 'Amplify', 'Credentials', 'AuthClass', 'CloudLogger'];
|
|
31658
31679
|
/**
|
|
31659
31680
|
* Write logs
|
|
31660
31681
|
* @class Logger
|
|
31661
31682
|
*/
|
|
31662
31683
|
|
|
31663
|
-
|
|
31664
31684
|
var ConsoleLogger =
|
|
31665
31685
|
/** @class */
|
|
31666
31686
|
function () {
|
|
@@ -31676,8 +31696,19 @@ function () {
|
|
|
31676
31696
|
this.name = name;
|
|
31677
31697
|
this.level = level;
|
|
31678
31698
|
this._pluggables = [];
|
|
31699
|
+
this.addPluggable = this.addPluggable.bind(this);
|
|
31679
31700
|
}
|
|
31680
31701
|
|
|
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
|
+
|
|
31681
31712
|
ConsoleLogger.prototype._padding = function (n) {
|
|
31682
31713
|
return n < 10 ? '0' + n : '' + n;
|
|
31683
31714
|
};
|
|
@@ -31692,6 +31723,20 @@ function () {
|
|
|
31692
31723
|
this._config = config;
|
|
31693
31724
|
return this._config;
|
|
31694
31725
|
};
|
|
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
|
+
};
|
|
31695
31740
|
/**
|
|
31696
31741
|
* Write log
|
|
31697
31742
|
* @method
|
|
@@ -31704,12 +31749,49 @@ function () {
|
|
|
31704
31749
|
ConsoleLogger.prototype._log = function (type) {
|
|
31705
31750
|
var e_1, _a;
|
|
31706
31751
|
|
|
31752
|
+
var _this = this;
|
|
31753
|
+
|
|
31707
31754
|
var msg = [];
|
|
31708
31755
|
|
|
31709
31756
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
31710
31757
|
msg[_i - 1] = arguments[_i];
|
|
31711
31758
|
}
|
|
31712
31759
|
|
|
31760
|
+
if (!cloudWatchExcludeList.includes(this.name)) {
|
|
31761
|
+
this._checkPluggables();
|
|
31762
|
+
}
|
|
31763
|
+
|
|
31764
|
+
var generateMessage = function generateMessage(msg) {};
|
|
31765
|
+
|
|
31766
|
+
var generateCloudMessage = function generateCloudMessage(msg) {
|
|
31767
|
+
var message = '';
|
|
31768
|
+
var data;
|
|
31769
|
+
|
|
31770
|
+
if (msg.length === 1 && typeof msg[0] === 'string') {
|
|
31771
|
+
message = msg[0];
|
|
31772
|
+
} else if (msg.length === 1) {
|
|
31773
|
+
data = msg[0];
|
|
31774
|
+
} else if (typeof msg[0] === 'string') {
|
|
31775
|
+
var obj = msg.slice(1);
|
|
31776
|
+
|
|
31777
|
+
if (obj.length === 1) {
|
|
31778
|
+
obj = obj[0];
|
|
31779
|
+
}
|
|
31780
|
+
|
|
31781
|
+
message = msg[0];
|
|
31782
|
+
data = obj;
|
|
31783
|
+
} else {
|
|
31784
|
+
data = msg;
|
|
31785
|
+
}
|
|
31786
|
+
|
|
31787
|
+
return JSON.stringify({
|
|
31788
|
+
level: type,
|
|
31789
|
+
"class": _this.name,
|
|
31790
|
+
message: message,
|
|
31791
|
+
data: data
|
|
31792
|
+
});
|
|
31793
|
+
};
|
|
31794
|
+
|
|
31713
31795
|
var logger_level_name = this.level;
|
|
31714
31796
|
|
|
31715
31797
|
if (ConsoleLogger.LOG_LEVEL) {
|
|
@@ -31723,62 +31805,72 @@ function () {
|
|
|
31723
31805
|
var logger_level = LOG_LEVELS[logger_level_name];
|
|
31724
31806
|
var type_level = LOG_LEVELS[type];
|
|
31725
31807
|
|
|
31726
|
-
if (
|
|
31727
|
-
|
|
31728
|
-
return;
|
|
31729
|
-
}
|
|
31808
|
+
if (type_level >= logger_level) {
|
|
31809
|
+
var log = console.log.bind(console);
|
|
31730
31810
|
|
|
31731
|
-
|
|
31811
|
+
if (type === LOG_TYPE.ERROR && console.error) {
|
|
31812
|
+
log = console.error.bind(console);
|
|
31813
|
+
}
|
|
31732
31814
|
|
|
31733
|
-
|
|
31734
|
-
|
|
31735
|
-
|
|
31815
|
+
if (type === LOG_TYPE.WARN && console.warn) {
|
|
31816
|
+
log = console.warn.bind(console);
|
|
31817
|
+
}
|
|
31736
31818
|
|
|
31737
|
-
|
|
31738
|
-
|
|
31739
|
-
|
|
31819
|
+
var prefix = "[" + type + "] " + this._ts() + " " + this.name;
|
|
31820
|
+
var message = '';
|
|
31821
|
+
var data = void 0;
|
|
31740
31822
|
|
|
31741
|
-
|
|
31742
|
-
|
|
31823
|
+
if (msg.length === 1 && typeof msg[0] === 'string') {
|
|
31824
|
+
message = msg[0];
|
|
31825
|
+
log(prefix + " - " + message);
|
|
31826
|
+
} else if (msg.length === 1) {
|
|
31827
|
+
data = msg[0];
|
|
31828
|
+
log(prefix, data);
|
|
31829
|
+
} else if (typeof msg[0] === 'string') {
|
|
31830
|
+
var obj = msg.slice(1);
|
|
31743
31831
|
|
|
31744
|
-
|
|
31745
|
-
|
|
31746
|
-
|
|
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);
|
|
31832
|
+
if (obj.length === 1) {
|
|
31833
|
+
obj = obj[0];
|
|
31834
|
+
}
|
|
31752
31835
|
|
|
31753
|
-
|
|
31754
|
-
|
|
31836
|
+
message = msg[0];
|
|
31837
|
+
data = obj;
|
|
31838
|
+
log(prefix + " - " + message, data);
|
|
31839
|
+
} else {
|
|
31840
|
+
data = msg;
|
|
31841
|
+
log(prefix, data);
|
|
31755
31842
|
}
|
|
31756
|
-
|
|
31757
|
-
message = prefix + " - " + msg[0] + " " + obj;
|
|
31758
|
-
log(prefix + " - " + msg[0], obj);
|
|
31759
|
-
} else {
|
|
31760
|
-
message = prefix + " " + msg;
|
|
31761
|
-
log(prefix, msg);
|
|
31762
31843
|
}
|
|
31763
31844
|
|
|
31764
|
-
|
|
31765
|
-
|
|
31766
|
-
|
|
31767
|
-
var logEvent = {
|
|
31768
|
-
message: message,
|
|
31769
|
-
timestamp: Date.now()
|
|
31770
|
-
};
|
|
31771
|
-
plugin.pushLogs([logEvent]);
|
|
31772
|
-
}
|
|
31773
|
-
} catch (e_1_1) {
|
|
31774
|
-
e_1 = {
|
|
31775
|
-
error: e_1_1
|
|
31776
|
-
};
|
|
31777
|
-
} finally {
|
|
31845
|
+
if (ConsoleLogger.CLOUD_LOG_LEVEL != null && !cloudWatchExcludeList.includes(this.name)) {
|
|
31846
|
+
var cloudMessage = generateCloudMessage(msg);
|
|
31847
|
+
|
|
31778
31848
|
try {
|
|
31779
|
-
|
|
31849
|
+
for (var _b = __values(this._pluggables), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
31850
|
+
var plugin = _c.value;
|
|
31851
|
+
var logger_level_1 = LOG_LEVELS[ConsoleLogger.CLOUD_LOG_LEVEL];
|
|
31852
|
+
var type_level_1 = LOG_LEVELS[type];
|
|
31853
|
+
var logEvent = {
|
|
31854
|
+
message: cloudMessage,
|
|
31855
|
+
timestamp: Date.now()
|
|
31856
|
+
};
|
|
31857
|
+
|
|
31858
|
+
if (type_level_1 >= logger_level_1) {
|
|
31859
|
+
plugin.pushLogs([logEvent]);
|
|
31860
|
+
} else {
|
|
31861
|
+
plugin.pushLogs([]);
|
|
31862
|
+
}
|
|
31863
|
+
}
|
|
31864
|
+
} catch (e_1_1) {
|
|
31865
|
+
e_1 = {
|
|
31866
|
+
error: e_1_1
|
|
31867
|
+
};
|
|
31780
31868
|
} finally {
|
|
31781
|
-
|
|
31869
|
+
try {
|
|
31870
|
+
if (_c && !_c.done && (_a = _b["return"])) _a.call(_b);
|
|
31871
|
+
} finally {
|
|
31872
|
+
if (e_1) throw e_1.error;
|
|
31873
|
+
}
|
|
31782
31874
|
}
|
|
31783
31875
|
}
|
|
31784
31876
|
};
|
|
@@ -31886,10 +31978,8 @@ function () {
|
|
|
31886
31978
|
};
|
|
31887
31979
|
|
|
31888
31980
|
ConsoleLogger.prototype.addPluggable = function (pluggable) {
|
|
31889
|
-
if (pluggable && pluggable.getCategoryName()
|
|
31981
|
+
if (pluggable && COMPATIBLE_PLUGINS.includes(pluggable.getCategoryName())) {
|
|
31890
31982
|
this._pluggables.push(pluggable);
|
|
31891
|
-
|
|
31892
|
-
pluggable.configure(this._config);
|
|
31893
31983
|
}
|
|
31894
31984
|
};
|
|
31895
31985
|
|
|
@@ -31897,7 +31987,9 @@ function () {
|
|
|
31897
31987
|
return this._pluggables;
|
|
31898
31988
|
};
|
|
31899
31989
|
|
|
31990
|
+
ConsoleLogger._globalpluggables = [];
|
|
31900
31991
|
ConsoleLogger.LOG_LEVEL = null;
|
|
31992
|
+
ConsoleLogger.CLOUD_LOG_LEVEL = null;
|
|
31901
31993
|
return ConsoleLogger;
|
|
31902
31994
|
}();
|
|
31903
31995
|
|
|
@@ -32725,7 +32817,7 @@ var getAmplifyUserAgent = function getAmplifyUserAgent() {
|
|
|
32725
32817
|
__webpack_require__.r(__webpack_exports__);
|
|
32726
32818
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "version", function() { return version; });
|
|
32727
32819
|
// generated by genversion
|
|
32728
|
-
var version = '4.3.
|
|
32820
|
+
var version = '4.3.14';
|
|
32729
32821
|
|
|
32730
32822
|
/***/ }),
|
|
32731
32823
|
|
|
@@ -32745,6 +32837,15 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
32745
32837
|
/* harmony import */ var _Platform__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Platform */ "./lib-esm/Platform/index.js");
|
|
32746
32838
|
/* harmony import */ var _Parser__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Parser */ "./lib-esm/Parser.js");
|
|
32747
32839
|
/* harmony import */ var _Util_Constants__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Util/Constants */ "./lib-esm/Util/Constants.js");
|
|
32840
|
+
function _typeof(obj) {
|
|
32841
|
+
"@babel/helpers - typeof";
|
|
32842
|
+
|
|
32843
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
32844
|
+
return typeof obj;
|
|
32845
|
+
} : function (obj) {
|
|
32846
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
32847
|
+
}, _typeof(obj);
|
|
32848
|
+
}
|
|
32748
32849
|
/*
|
|
32749
32850
|
* Copyright 2017-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
32750
32851
|
*
|
|
@@ -32757,6 +32858,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
32757
32858
|
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
|
|
32758
32859
|
* and limitations under the License.
|
|
32759
32860
|
*/
|
|
32861
|
+
|
|
32862
|
+
|
|
32760
32863
|
var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
32761
32864
|
function adopt(value) {
|
|
32762
32865
|
return value instanceof P ? value : new P(function (resolve) {
|
|
@@ -32900,62 +33003,44 @@ var __generator = undefined && undefined.__generator || function (thisArg, body)
|
|
|
32900
33003
|
}
|
|
32901
33004
|
};
|
|
32902
33005
|
|
|
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;
|
|
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
33006
|
|
|
32935
|
-
return ar;
|
|
32936
|
-
};
|
|
32937
33007
|
|
|
32938
33008
|
|
|
32939
33009
|
|
|
32940
33010
|
|
|
32941
33011
|
|
|
32942
33012
|
|
|
33013
|
+
if (typeof window === 'undefined' || (typeof window === "undefined" ? "undefined" : _typeof(window)) === 'object' && !window.TextEncoder) {
|
|
33014
|
+
__webpack_require__(/*! fast-text-encoding */ "../../node_modules/fast-text-encoding/text.min.js");
|
|
33015
|
+
}
|
|
32943
33016
|
|
|
32944
33017
|
var logger = new _Logger__WEBPACK_IMPORTED_MODULE_2__["ConsoleLogger"]('AWSCloudWatch');
|
|
33018
|
+
var INTERVAL = 30000;
|
|
32945
33019
|
|
|
32946
33020
|
var AWSCloudWatchProvider =
|
|
32947
33021
|
/** @class */
|
|
32948
33022
|
function () {
|
|
32949
33023
|
function AWSCloudWatchProvider(config) {
|
|
32950
|
-
this.
|
|
32951
|
-
|
|
32952
|
-
|
|
32953
|
-
|
|
32954
|
-
|
|
32955
|
-
|
|
33024
|
+
this._initialized = false;
|
|
33025
|
+
console.log('cstr', config);
|
|
33026
|
+
|
|
33027
|
+
if (!this._initialized) {
|
|
33028
|
+
this.configure(config);
|
|
33029
|
+
this._dataTracker = {
|
|
33030
|
+
eventUploadInProgress: false,
|
|
33031
|
+
logEvents: [],
|
|
33032
|
+
verifiedLogGroup: {
|
|
33033
|
+
logGroupName: this._config.logGroupName
|
|
33034
|
+
}
|
|
33035
|
+
};
|
|
33036
|
+
this._currentLogBatch = [];
|
|
33037
|
+
|
|
33038
|
+
this._initiateLogPushInterval();
|
|
33039
|
+
|
|
33040
|
+
this._initialized = true;
|
|
33041
|
+
}
|
|
33042
|
+
} // public static instance: AWSCloudWatchProvider;
|
|
32956
33043
|
|
|
32957
|
-
this._initiateLogPushInterval();
|
|
32958
|
-
}
|
|
32959
33044
|
|
|
32960
33045
|
AWSCloudWatchProvider.prototype.getProviderName = function () {
|
|
32961
33046
|
return AWSCloudWatchProvider.PROVIDER_NAME;
|
|
@@ -32969,6 +33054,12 @@ function () {
|
|
|
32969
33054
|
return this._dataTracker.logEvents;
|
|
32970
33055
|
};
|
|
32971
33056
|
|
|
33057
|
+
AWSCloudWatchProvider.prototype.setPreFlightCheck = function (cb) {
|
|
33058
|
+
if (typeof cb === 'function') {
|
|
33059
|
+
this._preFlightCheck = cb;
|
|
33060
|
+
}
|
|
33061
|
+
};
|
|
33062
|
+
|
|
32972
33063
|
AWSCloudWatchProvider.prototype.configure = function (config) {
|
|
32973
33064
|
if (!config) return this._config || {};
|
|
32974
33065
|
var conf = Object.assign({}, this._config, Object(_Parser__WEBPACK_IMPORTED_MODULE_4__["parseMobileHubConfig"])(config).Logging, config);
|
|
@@ -33222,8 +33313,27 @@ function () {
|
|
|
33222
33313
|
};
|
|
33223
33314
|
|
|
33224
33315
|
AWSCloudWatchProvider.prototype.pushLogs = function (logs) {
|
|
33225
|
-
logger.debug('pushing log events to Cloudwatch
|
|
33226
|
-
this._dataTracker.logEvents =
|
|
33316
|
+
logger.debug('pushing log events to Cloudwatch buffer');
|
|
33317
|
+
this._dataTracker.logEvents = this._dataTracker.logEvents.concat(logs);
|
|
33318
|
+
};
|
|
33319
|
+
|
|
33320
|
+
AWSCloudWatchProvider.prototype.pause = function () {
|
|
33321
|
+
this._processing = false;
|
|
33322
|
+
|
|
33323
|
+
if (this._timer) {
|
|
33324
|
+
clearInterval(this._timer);
|
|
33325
|
+
}
|
|
33326
|
+
};
|
|
33327
|
+
|
|
33328
|
+
AWSCloudWatchProvider.prototype.resume = function () {
|
|
33329
|
+
this._processing = true;
|
|
33330
|
+
|
|
33331
|
+
this._initiateLogPushInterval();
|
|
33332
|
+
};
|
|
33333
|
+
|
|
33334
|
+
AWSCloudWatchProvider.prototype.clear = function () {
|
|
33335
|
+
this._dataTracker.logEvents = [];
|
|
33336
|
+
this._currentLogBatch = [];
|
|
33227
33337
|
};
|
|
33228
33338
|
|
|
33229
33339
|
AWSCloudWatchProvider.prototype._validateLogGroupExistsAndCreate = function (logGroupName) {
|
|
@@ -33540,13 +33650,33 @@ function () {
|
|
|
33540
33650
|
return __generator(this, function (_a) {
|
|
33541
33651
|
switch (_a.label) {
|
|
33542
33652
|
case 0:
|
|
33543
|
-
_a.trys.push([0,
|
|
33653
|
+
_a.trys.push([0, 4,, 5]);
|
|
33544
33654
|
|
|
33545
33655
|
return [4
|
|
33546
33656
|
/*yield*/
|
|
33547
|
-
, this.
|
|
33657
|
+
, this._preFlightCheck()];
|
|
33548
33658
|
|
|
33549
33659
|
case 1:
|
|
33660
|
+
/**
|
|
33661
|
+
* CloudWatch has restrictions on the size of the log events that get sent up.
|
|
33662
|
+
* We need to track both the size of each event and the total size of the batch
|
|
33663
|
+
* of logs.
|
|
33664
|
+
*
|
|
33665
|
+
* We also need to ensure that the logs in the batch are sorted in chronological order.
|
|
33666
|
+
* https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutLogEvents.html
|
|
33667
|
+
*/
|
|
33668
|
+
if (!_a.sent()) {
|
|
33669
|
+
this.clear();
|
|
33670
|
+
return [2
|
|
33671
|
+
/*return*/
|
|
33672
|
+
];
|
|
33673
|
+
}
|
|
33674
|
+
|
|
33675
|
+
return [4
|
|
33676
|
+
/*yield*/
|
|
33677
|
+
, this._getNextSequenceToken()];
|
|
33678
|
+
|
|
33679
|
+
case 2:
|
|
33550
33680
|
seqToken = _a.sent();
|
|
33551
33681
|
logBatch = this._currentLogBatch.length === 0 ? this._getBufferedBatchOfLogs() : this._currentLogBatch;
|
|
33552
33682
|
putLogsPayload = {
|
|
@@ -33560,7 +33690,7 @@ function () {
|
|
|
33560
33690
|
/*yield*/
|
|
33561
33691
|
, this._sendLogEvents(putLogsPayload)];
|
|
33562
33692
|
|
|
33563
|
-
case
|
|
33693
|
+
case 3:
|
|
33564
33694
|
sendLogEventsResponse = _a.sent();
|
|
33565
33695
|
this._nextSequenceToken = sendLogEventsResponse.nextSequenceToken;
|
|
33566
33696
|
this._dataTracker.eventUploadInProgress = false;
|
|
@@ -33569,7 +33699,7 @@ function () {
|
|
|
33569
33699
|
/*return*/
|
|
33570
33700
|
, sendLogEventsResponse];
|
|
33571
33701
|
|
|
33572
|
-
case
|
|
33702
|
+
case 4:
|
|
33573
33703
|
err_5 = _a.sent();
|
|
33574
33704
|
logger.error("error during _safeUploadLogEvents: " + err_5);
|
|
33575
33705
|
|
|
@@ -33586,9 +33716,9 @@ function () {
|
|
|
33586
33716
|
|
|
33587
33717
|
return [3
|
|
33588
33718
|
/*break*/
|
|
33589
|
-
,
|
|
33719
|
+
, 5];
|
|
33590
33720
|
|
|
33591
|
-
case
|
|
33721
|
+
case 5:
|
|
33592
33722
|
return [2
|
|
33593
33723
|
/*return*/
|
|
33594
33724
|
];
|
|
@@ -33707,6 +33837,7 @@ function () {
|
|
|
33707
33837
|
case 3:
|
|
33708
33838
|
err_7 = _a.sent();
|
|
33709
33839
|
logger.error("error when calling _safeUploadLogEvents in the timer interval - " + err_7);
|
|
33840
|
+
this.pause();
|
|
33710
33841
|
return [3
|
|
33711
33842
|
/*break*/
|
|
33712
33843
|
, 4];
|
|
@@ -33718,7 +33849,7 @@ function () {
|
|
|
33718
33849
|
}
|
|
33719
33850
|
});
|
|
33720
33851
|
});
|
|
33721
|
-
},
|
|
33852
|
+
}, INTERVAL);
|
|
33722
33853
|
};
|
|
33723
33854
|
|
|
33724
33855
|
AWSCloudWatchProvider.prototype._getDocUploadPermissibility = function () {
|
|
@@ -34750,7 +34881,7 @@ function () {
|
|
|
34750
34881
|
/*!***********************************!*\
|
|
34751
34882
|
!*** ./lib-esm/Util/Constants.js ***!
|
|
34752
34883
|
\***********************************/
|
|
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 */
|
|
34884
|
+
/*! 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 */
|
|
34754
34885
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
34755
34886
|
|
|
34756
34887
|
"use strict";
|
|
@@ -34762,6 +34893,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
34762
34893
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AWS_CLOUDWATCH_PROVIDER_NAME", function() { return AWS_CLOUDWATCH_PROVIDER_NAME; });
|
|
34763
34894
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NO_CREDS_ERROR_STRING", function() { return NO_CREDS_ERROR_STRING; });
|
|
34764
34895
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RETRY_ERROR_CODES", function() { return RETRY_ERROR_CODES; });
|
|
34896
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AMAZON_KINESIS_LOGGING_PROVIDER_NAME", function() { return AMAZON_KINESIS_LOGGING_PROVIDER_NAME; });
|
|
34897
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AMAZON_KINESIS_LOGGING_CATEGORY", function() { return AMAZON_KINESIS_LOGGING_CATEGORY; });
|
|
34765
34898
|
/*
|
|
34766
34899
|
* Copyright 2017-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
34767
34900
|
*
|
|
@@ -34775,11 +34908,14 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
34775
34908
|
* and limitations under the License.
|
|
34776
34909
|
*/
|
|
34777
34910
|
// Logging constants
|
|
34911
|
+
// Cloudwatch
|
|
34778
34912
|
var AWS_CLOUDWATCH_BASE_BUFFER_SIZE = 26;
|
|
34779
34913
|
var AWS_CLOUDWATCH_MAX_BATCH_EVENT_SIZE = 1048576;
|
|
34780
34914
|
var AWS_CLOUDWATCH_MAX_EVENT_SIZE = 256000;
|
|
34781
34915
|
var AWS_CLOUDWATCH_CATEGORY = 'Logging';
|
|
34782
34916
|
var AWS_CLOUDWATCH_PROVIDER_NAME = 'AWSCloudWatch';
|
|
34917
|
+
var AMAZON_KINESIS_LOGGING_CATEGORY = 'KinesisLogging';
|
|
34918
|
+
var AMAZON_KINESIS_LOGGING_PROVIDER_NAME = 'AmazonKinesisLogging';
|
|
34783
34919
|
var NO_CREDS_ERROR_STRING = 'No credentials';
|
|
34784
34920
|
var RETRY_ERROR_CODES = ['ResourceNotFoundException', 'InvalidSequenceTokenException'];
|
|
34785
34921
|
|
|
@@ -35482,7 +35618,7 @@ function urlSafeDecode(hex) {
|
|
|
35482
35618
|
/*!*******************************!*\
|
|
35483
35619
|
!*** ./lib-esm/Util/index.js ***!
|
|
35484
35620
|
\*******************************/
|
|
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 */
|
|
35621
|
+
/*! 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 */
|
|
35486
35622
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
35487
35623
|
|
|
35488
35624
|
"use strict";
|
|
@@ -35523,6 +35659,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
35523
35659
|
|
|
35524
35660
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "RETRY_ERROR_CODES", function() { return _Constants__WEBPACK_IMPORTED_MODULE_5__["RETRY_ERROR_CODES"]; });
|
|
35525
35661
|
|
|
35662
|
+
/* 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"]; });
|
|
35663
|
+
|
|
35664
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AMAZON_KINESIS_LOGGING_CATEGORY", function() { return _Constants__WEBPACK_IMPORTED_MODULE_5__["AMAZON_KINESIS_LOGGING_CATEGORY"]; });
|
|
35665
|
+
|
|
35526
35666
|
|
|
35527
35667
|
|
|
35528
35668
|
|
|
@@ -35572,7 +35712,7 @@ var USER_AGENT_HEADER = 'x-amz-user-agent';
|
|
|
35572
35712
|
/*!**************************!*\
|
|
35573
35713
|
!*** ./lib-esm/index.js ***!
|
|
35574
35714
|
\**************************/
|
|
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 */
|
|
35715
|
+
/*! 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 */
|
|
35576
35716
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
35577
35717
|
|
|
35578
35718
|
"use strict";
|
|
@@ -35711,6 +35851,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
35711
35851
|
|
|
35712
35852
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "RETRY_ERROR_CODES", function() { return _Util__WEBPACK_IMPORTED_MODULE_18__["RETRY_ERROR_CODES"]; });
|
|
35713
35853
|
|
|
35854
|
+
/* 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"]; });
|
|
35855
|
+
|
|
35856
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AMAZON_KINESIS_LOGGING_CATEGORY", function() { return _Util__WEBPACK_IMPORTED_MODULE_18__["AMAZON_KINESIS_LOGGING_CATEGORY"]; });
|
|
35857
|
+
|
|
35714
35858
|
/*
|
|
35715
35859
|
* Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
35716
35860
|
*
|