@aws-amplify/datastore 3.7.7-cloud-logging.9 → 3.7.7-unstable.10

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.
@@ -28071,24 +28071,6 @@ function tryDecode(str, decode) {
28071
28071
  }
28072
28072
 
28073
28073
 
28074
- /***/ }),
28075
-
28076
- /***/ "../../node_modules/fast-text-encoding/text.min.js":
28077
- /*!********************************************************************!*\
28078
- !*** /root/amplify-js/node_modules/fast-text-encoding/text.min.js ***!
28079
- \********************************************************************/
28080
- /*! no static exports found */
28081
- /***/ (function(module, exports, __webpack_require__) {
28082
-
28083
- /* 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"}));
28084
- 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++]=
28085
- (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,
28086
- 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&
28087
- 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.");
28088
- 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);
28089
-
28090
- /* 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))
28091
-
28092
28074
  /***/ }),
28093
28075
 
28094
28076
  /***/ "../../node_modules/graphql/error/GraphQLError.mjs":
@@ -58498,9 +58480,9 @@ function () {
58498
58480
  /**
58499
58481
  * Executes a GraphQL operation
58500
58482
  *
58501
- * @param {GraphQLOptions} GraphQL Options
58502
- * @param {object} additionalHeaders headers to merge in after any `graphql_headers` set in the config
58503
- * @returns {Promise<GraphQLResult> | Observable<object>}
58483
+ * @param options - GraphQL Options
58484
+ * @param [additionalHeaders] - headers to merge in after any `graphql_headers` set in the config
58485
+ * @returns An Observable if the query is a subscription query, else a promise of the graphql result.
58504
58486
  */
58505
58487
 
58506
58488
 
@@ -58550,9 +58532,10 @@ function () {
58550
58532
  variables: variables,
58551
58533
  authMode: authMode
58552
58534
  }, headers);
58553
- }
58554
58535
 
58555
- throw new Error("invalid operation type: " + operationType);
58536
+ default:
58537
+ throw new Error("invalid operation type: " + operationType);
58538
+ }
58556
58539
  };
58557
58540
 
58558
58541
  GraphQLAPIClass.prototype._graphql = function (_a, additionalHeaders, initParams) {
@@ -60327,10 +60310,10 @@ function () {
60327
60310
  };
60328
60311
  /**
60329
60312
  * Make a GET request
60330
- * @param {string} apiName - The api name of the request
60331
- * @param {string} path - The path of the request
60332
- * @param {json} [init] - Request extra params
60333
- * @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.
60313
+ * @param apiName - The api name of the request
60314
+ * @param path - The path of the request
60315
+ * @param [init] - Request extra params
60316
+ * @return A promise that resolves to an object with response status and JSON data, if successful.
60334
60317
  */
60335
60318
 
60336
60319
 
@@ -60339,10 +60322,10 @@ function () {
60339
60322
  };
60340
60323
  /**
60341
60324
  * Make a POST request
60342
- * @param {string} apiName - The api name of the request
60343
- * @param {string} path - The path of the request
60344
- * @param {json} [init] - Request extra params
60345
- * @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.
60325
+ * @param apiName - The api name of the request
60326
+ * @param path - The path of the request
60327
+ * @param [init] - Request extra params
60328
+ * @return A promise that resolves to an object with response status and JSON data, if successful.
60346
60329
  */
60347
60330
 
60348
60331
 
@@ -60351,10 +60334,10 @@ function () {
60351
60334
  };
60352
60335
  /**
60353
60336
  * Make a PUT request
60354
- * @param {string} apiName - The api name of the request
60355
- * @param {string} path - The path of the request
60356
- * @param {json} [init] - Request extra params
60357
- * @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.
60337
+ * @param apiName - The api name of the request
60338
+ * @param path - The path of the request
60339
+ * @param [init] - Request extra params
60340
+ * @return A promise that resolves to an object with response status and JSON data, if successful.
60358
60341
  */
60359
60342
 
60360
60343
 
@@ -60363,10 +60346,10 @@ function () {
60363
60346
  };
60364
60347
  /**
60365
60348
  * Make a PATCH request
60366
- * @param {string} apiName - The api name of the request
60367
- * @param {string} path - The path of the request
60368
- * @param {json} [init] - Request extra params
60369
- * @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.
60349
+ * @param apiName - The api name of the request
60350
+ * @param path - The path of the request
60351
+ * @param [init] - Request extra params
60352
+ * @return A promise that resolves to an object with response status and JSON data, if successful.
60370
60353
  */
60371
60354
 
60372
60355
 
@@ -60375,10 +60358,10 @@ function () {
60375
60358
  };
60376
60359
  /**
60377
60360
  * Make a DEL request
60378
- * @param {string} apiName - The api name of the request
60379
- * @param {string} path - The path of the request
60380
- * @param {json} [init] - Request extra params
60381
- * @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.
60361
+ * @param apiName - The api name of the request
60362
+ * @param path - The path of the request
60363
+ * @param [init] - Request extra params
60364
+ * @return A promise that resolves to an object with response status and JSON data, if successful.
60382
60365
  */
60383
60366
 
60384
60367
 
@@ -60387,10 +60370,10 @@ function () {
60387
60370
  };
60388
60371
  /**
60389
60372
  * Make a HEAD request
60390
- * @param {string} apiName - The api name of the request
60391
- * @param {string} path - The path of the request
60392
- * @param {json} [init] - Request extra params
60393
- * @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.
60373
+ * @param apiName - The api name of the request
60374
+ * @param path - The path of the request
60375
+ * @param [init] - Request extra params
60376
+ * @return A promise that resolves to an object with response status and JSON data, if successful.
60394
60377
  */
60395
60378
 
60396
60379
 
@@ -60399,8 +60382,8 @@ function () {
60399
60382
  };
60400
60383
  /**
60401
60384
  * Checks to see if an error thrown is from an api request cancellation
60402
- * @param {any} error - Any error
60403
- * @return {boolean} - A boolean indicating if the error was from an api request cancellation
60385
+ * @param error - Any error
60386
+ * @return If the error was from an api request cancellation
60404
60387
  */
60405
60388
 
60406
60389
 
@@ -60409,8 +60392,9 @@ function () {
60409
60392
  };
60410
60393
  /**
60411
60394
  * Cancels an inflight request
60412
- * @param {any} request - request to cancel
60413
- * @return {boolean} - A boolean indicating if the request was cancelled
60395
+ * @param request - request to cancel
60396
+ * @param [message] - custom error message
60397
+ * @return If the request was cancelled
60414
60398
  */
60415
60399
 
60416
60400
 
@@ -60419,8 +60403,8 @@ function () {
60419
60403
  };
60420
60404
  /**
60421
60405
  * Getting endpoint for API
60422
- * @param {string} apiName - The name of the api
60423
- * @return {string} - The endpoint of the api
60406
+ * @param apiName - The name of the api
60407
+ * @return The endpoint of the api
60424
60408
  */
60425
60409
 
60426
60410
 
@@ -60442,14 +60426,6 @@ function () {
60442
60426
  APIClass.prototype.getGraphqlOperationType = function (operation) {
60443
60427
  return this._graphqlApi.getGraphqlOperationType(operation);
60444
60428
  };
60445
- /**
60446
- * Executes a GraphQL operation
60447
- *
60448
- * @param {GraphQLOptions} GraphQL Options
60449
- * @param {object} additionalHeaders headers to merge in after any `graphql_headers` set in the config
60450
- * @returns {Promise<GraphQLResult> | Observable<object>}
60451
- */
60452
-
60453
60429
 
60454
60430
  APIClass.prototype.graphql = function (options, additionalHeaders) {
60455
60431
  return this._graphqlApi.graphql(options, additionalHeaders);
@@ -61935,7 +61911,7 @@ function () {
61935
61911
  * Delete the current authenticated user
61936
61912
  * @return {Promise}
61937
61913
  **/
61938
- // TODO: Check return type void
61914
+ //TODO: Check return type void
61939
61915
 
61940
61916
 
61941
61917
  AuthClass.prototype.deleteUser = function () {
@@ -69791,7 +69767,6 @@ var LOG_LEVELS = {
69791
69767
  WARN: 4,
69792
69768
  ERROR: 5
69793
69769
  };
69794
- var COMPATIBLE_PLUGINS = [_Util_Constants__WEBPACK_IMPORTED_MODULE_0__["AWS_CLOUDWATCH_CATEGORY"]];
69795
69770
  var LOG_TYPE;
69796
69771
 
69797
69772
  (function (LOG_TYPE) {
@@ -69801,13 +69776,12 @@ var LOG_TYPE;
69801
69776
  LOG_TYPE["WARN"] = "WARN";
69802
69777
  LOG_TYPE["VERBOSE"] = "VERBOSE";
69803
69778
  })(LOG_TYPE || (LOG_TYPE = {}));
69804
-
69805
- var cloudWatchExcludeList = ['AWSCloudWatch', 'Amplify', 'Credentials', 'AuthClass', 'CloudLogger'];
69806
69779
  /**
69807
69780
  * Write logs
69808
69781
  * @class Logger
69809
69782
  */
69810
69783
 
69784
+
69811
69785
  var ConsoleLogger =
69812
69786
  /** @class */
69813
69787
  function () {
@@ -69823,19 +69797,8 @@ function () {
69823
69797
  this.name = name;
69824
69798
  this.level = level;
69825
69799
  this._pluggables = [];
69826
- this.addPluggable = this.addPluggable.bind(this);
69827
69800
  }
69828
69801
 
69829
- ConsoleLogger.globalPluggables = function (pluggable) {
69830
- if (pluggable && COMPATIBLE_PLUGINS.includes(pluggable.getCategoryName())) {
69831
- ConsoleLogger._globalpluggables.push(pluggable);
69832
- }
69833
- };
69834
-
69835
- ConsoleLogger.clearGlobalPluggables = function () {
69836
- ConsoleLogger._globalpluggables = [];
69837
- };
69838
-
69839
69802
  ConsoleLogger.prototype._padding = function (n) {
69840
69803
  return n < 10 ? '0' + n : '' + n;
69841
69804
  };
@@ -69850,20 +69813,6 @@ function () {
69850
69813
  this._config = config;
69851
69814
  return this._config;
69852
69815
  };
69853
-
69854
- ConsoleLogger.prototype._checkPluggables = function () {
69855
- if (this._pluggables.length !== ConsoleLogger._globalpluggables.length) {
69856
- if (ConsoleLogger._globalpluggables.length > 0) {
69857
- ConsoleLogger._globalpluggables.forEach(this.addPluggable);
69858
-
69859
- return;
69860
- }
69861
-
69862
- if (ConsoleLogger._globalpluggables.length === 0) {
69863
- this._pluggables = [];
69864
- }
69865
- }
69866
- };
69867
69816
  /**
69868
69817
  * Write log
69869
69818
  * @method
@@ -69876,49 +69825,12 @@ function () {
69876
69825
  ConsoleLogger.prototype._log = function (type) {
69877
69826
  var e_1, _a;
69878
69827
 
69879
- var _this = this;
69880
-
69881
69828
  var msg = [];
69882
69829
 
69883
69830
  for (var _i = 1; _i < arguments.length; _i++) {
69884
69831
  msg[_i - 1] = arguments[_i];
69885
69832
  }
69886
69833
 
69887
- if (!cloudWatchExcludeList.includes(this.name)) {
69888
- this._checkPluggables();
69889
- }
69890
-
69891
- var generateMessage = function generateMessage(msg) {};
69892
-
69893
- var generateCloudMessage = function generateCloudMessage(msg) {
69894
- var message = '';
69895
- var data;
69896
-
69897
- if (msg.length === 1 && typeof msg[0] === 'string') {
69898
- message = msg[0];
69899
- } else if (msg.length === 1) {
69900
- data = msg[0];
69901
- } else if (typeof msg[0] === 'string') {
69902
- var obj = msg.slice(1);
69903
-
69904
- if (obj.length === 1) {
69905
- obj = obj[0];
69906
- }
69907
-
69908
- message = msg[0];
69909
- data = obj;
69910
- } else {
69911
- data = msg;
69912
- }
69913
-
69914
- return JSON.stringify({
69915
- level: type,
69916
- "class": _this.name,
69917
- message: message,
69918
- data: data
69919
- });
69920
- };
69921
-
69922
69834
  var logger_level_name = this.level;
69923
69835
 
69924
69836
  if (ConsoleLogger.LOG_LEVEL) {
@@ -69932,72 +69844,62 @@ function () {
69932
69844
  var logger_level = LOG_LEVELS[logger_level_name];
69933
69845
  var type_level = LOG_LEVELS[type];
69934
69846
 
69935
- if (type_level >= logger_level) {
69936
- var log = console.log.bind(console);
69847
+ if (!(type_level >= logger_level)) {
69848
+ // Do nothing if type is not greater than or equal to logger level (handle undefined)
69849
+ return;
69850
+ }
69937
69851
 
69938
- if (type === LOG_TYPE.ERROR && console.error) {
69939
- log = console.error.bind(console);
69940
- }
69852
+ var log = console.log.bind(console);
69941
69853
 
69942
- if (type === LOG_TYPE.WARN && console.warn) {
69943
- log = console.warn.bind(console);
69944
- }
69854
+ if (type === LOG_TYPE.ERROR && console.error) {
69855
+ log = console.error.bind(console);
69856
+ }
69945
69857
 
69946
- var prefix = "[" + type + "] " + this._ts() + " " + this.name;
69947
- var message = '';
69948
- var data = void 0;
69858
+ if (type === LOG_TYPE.WARN && console.warn) {
69859
+ log = console.warn.bind(console);
69860
+ }
69949
69861
 
69950
- if (msg.length === 1 && typeof msg[0] === 'string') {
69951
- message = msg[0];
69952
- log(prefix + " - " + message);
69953
- } else if (msg.length === 1) {
69954
- data = msg[0];
69955
- log(prefix, data);
69956
- } else if (typeof msg[0] === 'string') {
69957
- var obj = msg.slice(1);
69862
+ var prefix = "[" + type + "] " + this._ts() + " " + this.name;
69863
+ var message = '';
69958
69864
 
69959
- if (obj.length === 1) {
69960
- obj = obj[0];
69961
- }
69865
+ if (msg.length === 1 && typeof msg[0] === 'string') {
69866
+ message = prefix + " - " + msg[0];
69867
+ log(message);
69868
+ } else if (msg.length === 1) {
69869
+ message = prefix + " " + msg[0];
69870
+ log(prefix, msg[0]);
69871
+ } else if (typeof msg[0] === 'string') {
69872
+ var obj = msg.slice(1);
69962
69873
 
69963
- message = msg[0];
69964
- data = obj;
69965
- log(prefix + " - " + message, data);
69966
- } else {
69967
- data = msg;
69968
- log(prefix, data);
69874
+ if (obj.length === 1) {
69875
+ obj = obj[0];
69969
69876
  }
69970
- }
69971
-
69972
- if (ConsoleLogger.CLOUD_LOG_LEVEL != null && !cloudWatchExcludeList.includes(this.name)) {
69973
- var cloudMessage = generateCloudMessage(msg);
69974
69877
 
69975
- try {
69976
- for (var _b = __values(this._pluggables), _c = _b.next(); !_c.done; _c = _b.next()) {
69977
- var plugin = _c.value;
69978
- var logger_level_1 = LOG_LEVELS[ConsoleLogger.CLOUD_LOG_LEVEL];
69979
- var type_level_1 = LOG_LEVELS[type];
69980
- var logEvent = {
69981
- message: cloudMessage,
69982
- timestamp: Date.now()
69983
- };
69878
+ message = prefix + " - " + msg[0] + " " + obj;
69879
+ log(prefix + " - " + msg[0], obj);
69880
+ } else {
69881
+ message = prefix + " " + msg;
69882
+ log(prefix, msg);
69883
+ }
69984
69884
 
69985
- if (type_level_1 >= logger_level_1) {
69986
- plugin.pushLogs([logEvent]);
69987
- } else {
69988
- plugin.pushLogs([]);
69989
- }
69990
- }
69991
- } catch (e_1_1) {
69992
- e_1 = {
69993
- error: e_1_1
69885
+ try {
69886
+ for (var _b = __values(this._pluggables), _c = _b.next(); !_c.done; _c = _b.next()) {
69887
+ var plugin = _c.value;
69888
+ var logEvent = {
69889
+ message: message,
69890
+ timestamp: Date.now()
69994
69891
  };
69892
+ plugin.pushLogs([logEvent]);
69893
+ }
69894
+ } catch (e_1_1) {
69895
+ e_1 = {
69896
+ error: e_1_1
69897
+ };
69898
+ } finally {
69899
+ try {
69900
+ if (_c && !_c.done && (_a = _b["return"])) _a.call(_b);
69995
69901
  } finally {
69996
- try {
69997
- if (_c && !_c.done && (_a = _b["return"])) _a.call(_b);
69998
- } finally {
69999
- if (e_1) throw e_1.error;
70000
- }
69902
+ if (e_1) throw e_1.error;
70001
69903
  }
70002
69904
  }
70003
69905
  };
@@ -70105,8 +70007,10 @@ function () {
70105
70007
  };
70106
70008
 
70107
70009
  ConsoleLogger.prototype.addPluggable = function (pluggable) {
70108
- if (pluggable && COMPATIBLE_PLUGINS.includes(pluggable.getCategoryName())) {
70010
+ if (pluggable && pluggable.getCategoryName() === _Util_Constants__WEBPACK_IMPORTED_MODULE_0__["AWS_CLOUDWATCH_CATEGORY"]) {
70109
70011
  this._pluggables.push(pluggable);
70012
+
70013
+ pluggable.configure(this._config);
70110
70014
  }
70111
70015
  };
70112
70016
 
@@ -70114,9 +70018,7 @@ function () {
70114
70018
  return this._pluggables;
70115
70019
  };
70116
70020
 
70117
- ConsoleLogger._globalpluggables = [];
70118
70021
  ConsoleLogger.LOG_LEVEL = null;
70119
- ConsoleLogger.CLOUD_LOG_LEVEL = null;
70120
70022
  return ConsoleLogger;
70121
70023
  }();
70122
70024
 
@@ -70964,15 +70866,6 @@ __webpack_require__.r(__webpack_exports__);
70964
70866
  /* harmony import */ var _Platform__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Platform */ "../core/lib-esm/Platform/index.js");
70965
70867
  /* harmony import */ var _Parser__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Parser */ "../core/lib-esm/Parser.js");
70966
70868
  /* harmony import */ var _Util_Constants__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Util/Constants */ "../core/lib-esm/Util/Constants.js");
70967
- function _typeof(obj) {
70968
- "@babel/helpers - typeof";
70969
-
70970
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
70971
- return typeof obj;
70972
- } : function (obj) {
70973
- return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
70974
- }, _typeof(obj);
70975
- }
70976
70869
  /*
70977
70870
  * Copyright 2017-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
70978
70871
  *
@@ -70985,8 +70878,6 @@ function _typeof(obj) {
70985
70878
  * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
70986
70879
  * and limitations under the License.
70987
70880
  */
70988
-
70989
-
70990
70881
  var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
70991
70882
  function adopt(value) {
70992
70883
  return value instanceof P ? value : new P(function (resolve) {
@@ -71130,44 +71021,62 @@ var __generator = undefined && undefined.__generator || function (thisArg, body)
71130
71021
  }
71131
71022
  };
71132
71023
 
71024
+ var __read = undefined && undefined.__read || function (o, n) {
71025
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
71026
+ if (!m) return o;
71027
+ var i = m.call(o),
71028
+ r,
71029
+ ar = [],
71030
+ e;
71031
+
71032
+ try {
71033
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
71034
+ ar.push(r.value);
71035
+ }
71036
+ } catch (error) {
71037
+ e = {
71038
+ error: error
71039
+ };
71040
+ } finally {
71041
+ try {
71042
+ if (r && !r.done && (m = i["return"])) m.call(i);
71043
+ } finally {
71044
+ if (e) throw e.error;
71045
+ }
71046
+ }
71047
+
71048
+ return ar;
71049
+ };
71050
+
71051
+ var __spread = undefined && undefined.__spread || function () {
71052
+ for (var ar = [], i = 0; i < arguments.length; i++) {
71053
+ ar = ar.concat(__read(arguments[i]));
71054
+ }
71133
71055
 
71056
+ return ar;
71057
+ };
71134
71058
 
71135
71059
 
71136
71060
 
71137
71061
 
71138
71062
 
71139
71063
 
71140
- if (typeof window === 'undefined' || (typeof window === "undefined" ? "undefined" : _typeof(window)) === 'object' && !window.TextEncoder) {
71141
- __webpack_require__(/*! fast-text-encoding */ "../../node_modules/fast-text-encoding/text.min.js");
71142
- }
71143
71064
 
71144
71065
  var logger = new _Logger__WEBPACK_IMPORTED_MODULE_2__["ConsoleLogger"]('AWSCloudWatch');
71145
- var INTERVAL = 30000;
71146
71066
 
71147
71067
  var AWSCloudWatchProvider =
71148
71068
  /** @class */
71149
71069
  function () {
71150
71070
  function AWSCloudWatchProvider(config) {
71151
- this._initialized = false;
71152
- console.log('cstr', config);
71153
-
71154
- if (!this._initialized) {
71155
- this.configure(config);
71156
- this._dataTracker = {
71157
- eventUploadInProgress: false,
71158
- logEvents: [],
71159
- verifiedLogGroup: {
71160
- logGroupName: this._config.logGroupName
71161
- }
71162
- };
71163
- this._currentLogBatch = [];
71164
-
71165
- this._initiateLogPushInterval();
71166
-
71167
- this._initialized = true;
71168
- }
71169
- } // public static instance: AWSCloudWatchProvider;
71071
+ this.configure(config);
71072
+ this._dataTracker = {
71073
+ eventUploadInProgress: false,
71074
+ logEvents: []
71075
+ };
71076
+ this._currentLogBatch = [];
71170
71077
 
71078
+ this._initiateLogPushInterval();
71079
+ }
71171
71080
 
71172
71081
  AWSCloudWatchProvider.prototype.getProviderName = function () {
71173
71082
  return AWSCloudWatchProvider.PROVIDER_NAME;
@@ -71181,12 +71090,6 @@ function () {
71181
71090
  return this._dataTracker.logEvents;
71182
71091
  };
71183
71092
 
71184
- AWSCloudWatchProvider.prototype.setPreFlightCheck = function (cb) {
71185
- if (typeof cb === 'function') {
71186
- this._preFlightCheck = cb;
71187
- }
71188
- };
71189
-
71190
71093
  AWSCloudWatchProvider.prototype.configure = function (config) {
71191
71094
  if (!config) return this._config || {};
71192
71095
  var conf = Object.assign({}, this._config, Object(_Parser__WEBPACK_IMPORTED_MODULE_4__["parseMobileHubConfig"])(config).Logging, config);
@@ -71440,27 +71343,8 @@ function () {
71440
71343
  };
71441
71344
 
71442
71345
  AWSCloudWatchProvider.prototype.pushLogs = function (logs) {
71443
- logger.debug('pushing log events to Cloudwatch buffer');
71444
- this._dataTracker.logEvents = this._dataTracker.logEvents.concat(logs);
71445
- };
71446
-
71447
- AWSCloudWatchProvider.prototype.pause = function () {
71448
- this._processing = false;
71449
-
71450
- if (this._timer) {
71451
- clearInterval(this._timer);
71452
- }
71453
- };
71454
-
71455
- AWSCloudWatchProvider.prototype.resume = function () {
71456
- this._processing = true;
71457
-
71458
- this._initiateLogPushInterval();
71459
- };
71460
-
71461
- AWSCloudWatchProvider.prototype.clear = function () {
71462
- this._dataTracker.logEvents = [];
71463
- this._currentLogBatch = [];
71346
+ logger.debug('pushing log events to Cloudwatch...');
71347
+ this._dataTracker.logEvents = __spread(this._dataTracker.logEvents, logs);
71464
71348
  };
71465
71349
 
71466
71350
  AWSCloudWatchProvider.prototype._validateLogGroupExistsAndCreate = function (logGroupName) {
@@ -71777,33 +71661,13 @@ function () {
71777
71661
  return __generator(this, function (_a) {
71778
71662
  switch (_a.label) {
71779
71663
  case 0:
71780
- _a.trys.push([0, 4,, 5]);
71781
-
71782
- return [4
71783
- /*yield*/
71784
- , this._preFlightCheck()];
71785
-
71786
- case 1:
71787
- /**
71788
- * CloudWatch has restrictions on the size of the log events that get sent up.
71789
- * We need to track both the size of each event and the total size of the batch
71790
- * of logs.
71791
- *
71792
- * We also need to ensure that the logs in the batch are sorted in chronological order.
71793
- * https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutLogEvents.html
71794
- */
71795
- if (!_a.sent()) {
71796
- this.clear();
71797
- return [2
71798
- /*return*/
71799
- ];
71800
- }
71664
+ _a.trys.push([0, 3,, 4]);
71801
71665
 
71802
71666
  return [4
71803
71667
  /*yield*/
71804
71668
  , this._getNextSequenceToken()];
71805
71669
 
71806
- case 2:
71670
+ case 1:
71807
71671
  seqToken = _a.sent();
71808
71672
  logBatch = this._currentLogBatch.length === 0 ? this._getBufferedBatchOfLogs() : this._currentLogBatch;
71809
71673
  putLogsPayload = {
@@ -71817,7 +71681,7 @@ function () {
71817
71681
  /*yield*/
71818
71682
  , this._sendLogEvents(putLogsPayload)];
71819
71683
 
71820
- case 3:
71684
+ case 2:
71821
71685
  sendLogEventsResponse = _a.sent();
71822
71686
  this._nextSequenceToken = sendLogEventsResponse.nextSequenceToken;
71823
71687
  this._dataTracker.eventUploadInProgress = false;
@@ -71826,7 +71690,7 @@ function () {
71826
71690
  /*return*/
71827
71691
  , sendLogEventsResponse];
71828
71692
 
71829
- case 4:
71693
+ case 3:
71830
71694
  err_5 = _a.sent();
71831
71695
  logger.error("error during _safeUploadLogEvents: " + err_5);
71832
71696
 
@@ -71843,9 +71707,9 @@ function () {
71843
71707
 
71844
71708
  return [3
71845
71709
  /*break*/
71846
- , 5];
71710
+ , 4];
71847
71711
 
71848
- case 5:
71712
+ case 4:
71849
71713
  return [2
71850
71714
  /*return*/
71851
71715
  ];
@@ -71964,7 +71828,6 @@ function () {
71964
71828
  case 3:
71965
71829
  err_7 = _a.sent();
71966
71830
  logger.error("error when calling _safeUploadLogEvents in the timer interval - " + err_7);
71967
- this.pause();
71968
71831
  return [3
71969
71832
  /*break*/
71970
71833
  , 4];
@@ -71976,7 +71839,7 @@ function () {
71976
71839
  }
71977
71840
  });
71978
71841
  });
71979
- }, INTERVAL);
71842
+ }, 2000);
71980
71843
  };
71981
71844
 
71982
71845
  AWSCloudWatchProvider.prototype._getDocUploadPermissibility = function () {
@@ -73008,7 +72871,7 @@ function () {
73008
72871
  /*!*****************************************!*\
73009
72872
  !*** ../core/lib-esm/Util/Constants.js ***!
73010
72873
  \*****************************************/
73011
- /*! 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 */
72874
+ /*! 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 */
73012
72875
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
73013
72876
 
73014
72877
  "use strict";
@@ -73020,8 +72883,6 @@ __webpack_require__.r(__webpack_exports__);
73020
72883
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AWS_CLOUDWATCH_PROVIDER_NAME", function() { return AWS_CLOUDWATCH_PROVIDER_NAME; });
73021
72884
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NO_CREDS_ERROR_STRING", function() { return NO_CREDS_ERROR_STRING; });
73022
72885
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RETRY_ERROR_CODES", function() { return RETRY_ERROR_CODES; });
73023
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AMAZON_KINESIS_LOGGING_PROVIDER_NAME", function() { return AMAZON_KINESIS_LOGGING_PROVIDER_NAME; });
73024
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AMAZON_KINESIS_LOGGING_CATEGORY", function() { return AMAZON_KINESIS_LOGGING_CATEGORY; });
73025
72886
  /*
73026
72887
  * Copyright 2017-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
73027
72888
  *
@@ -73035,14 +72896,11 @@ __webpack_require__.r(__webpack_exports__);
73035
72896
  * and limitations under the License.
73036
72897
  */
73037
72898
  // Logging constants
73038
- // Cloudwatch
73039
72899
  var AWS_CLOUDWATCH_BASE_BUFFER_SIZE = 26;
73040
72900
  var AWS_CLOUDWATCH_MAX_BATCH_EVENT_SIZE = 1048576;
73041
72901
  var AWS_CLOUDWATCH_MAX_EVENT_SIZE = 256000;
73042
72902
  var AWS_CLOUDWATCH_CATEGORY = 'Logging';
73043
72903
  var AWS_CLOUDWATCH_PROVIDER_NAME = 'AWSCloudWatch';
73044
- var AMAZON_KINESIS_LOGGING_CATEGORY = 'KinesisLogging';
73045
- var AMAZON_KINESIS_LOGGING_PROVIDER_NAME = 'AmazonKinesisLogging';
73046
72904
  var NO_CREDS_ERROR_STRING = 'No credentials';
73047
72905
  var RETRY_ERROR_CODES = ['ResourceNotFoundException', 'InvalidSequenceTokenException'];
73048
72906
 
@@ -73745,7 +73603,7 @@ function urlSafeDecode(hex) {
73745
73603
  /*!*************************************!*\
73746
73604
  !*** ../core/lib-esm/Util/index.js ***!
73747
73605
  \*************************************/
73748
- /*! 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 */
73606
+ /*! 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 */
73749
73607
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
73750
73608
 
73751
73609
  "use strict";
@@ -73786,10 +73644,6 @@ __webpack_require__.r(__webpack_exports__);
73786
73644
 
73787
73645
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "RETRY_ERROR_CODES", function() { return _Constants__WEBPACK_IMPORTED_MODULE_5__["RETRY_ERROR_CODES"]; });
73788
73646
 
73789
- /* 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"]; });
73790
-
73791
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AMAZON_KINESIS_LOGGING_CATEGORY", function() { return _Constants__WEBPACK_IMPORTED_MODULE_5__["AMAZON_KINESIS_LOGGING_CATEGORY"]; });
73792
-
73793
73647
 
73794
73648
 
73795
73649
 
@@ -73839,7 +73693,7 @@ var USER_AGENT_HEADER = 'x-amz-user-agent';
73839
73693
  /*!********************************!*\
73840
73694
  !*** ../core/lib-esm/index.js ***!
73841
73695
  \********************************/
73842
- /*! 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 */
73696
+ /*! 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 */
73843
73697
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
73844
73698
 
73845
73699
  "use strict";
@@ -73978,10 +73832,6 @@ __webpack_require__.r(__webpack_exports__);
73978
73832
 
73979
73833
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "RETRY_ERROR_CODES", function() { return _Util__WEBPACK_IMPORTED_MODULE_18__["RETRY_ERROR_CODES"]; });
73980
73834
 
73981
- /* 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"]; });
73982
-
73983
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AMAZON_KINESIS_LOGGING_CATEGORY", function() { return _Util__WEBPACK_IMPORTED_MODULE_18__["AMAZON_KINESIS_LOGGING_CATEGORY"]; });
73984
-
73985
73835
  /*
73986
73836
  * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
73987
73837
  *
@@ -82429,32 +82279,24 @@ function () {
82429
82279
  case 4:
82430
82280
  _b.sent();
82431
82281
 
82432
- logger.debug('Debug info before sync');
82433
- return [4
82434
- /*yield*/
82435
- , this.storage.logDebugInfo()];
82436
-
82437
- case 5:
82438
- _b.sent();
82439
-
82440
82282
  return [4
82441
82283
  /*yield*/
82442
82284
  , checkSchemaVersion(this.storage, schema.version)];
82443
82285
 
82444
- case 6:
82286
+ case 5:
82445
82287
  _b.sent();
82446
82288
 
82447
82289
  aws_appsync_graphqlEndpoint = this.amplifyConfig.aws_appsync_graphqlEndpoint;
82448
82290
  if (!aws_appsync_graphqlEndpoint) return [3
82449
82291
  /*break*/
82450
- , 8];
82292
+ , 7];
82451
82293
  logger.debug('GraphQL endpoint available', aws_appsync_graphqlEndpoint);
82452
82294
  _a = this;
82453
82295
  return [4
82454
82296
  /*yield*/
82455
82297
  , this.processSyncExpressions()];
82456
82298
 
82457
- case 7:
82299
+ case 6:
82458
82300
  _a.syncPredicates = _b.sent();
82459
82301
  this.sync = new _sync__WEBPACK_IMPORTED_MODULE_7__["SyncEngine"](schema, namespaceResolver, syncClasses, userClasses, this.storage, modelInstanceCreator, this.conflictHandler, this.errorHandler, this.syncPredicates, this.amplifyConfig, this.authModeStrategy);
82460
82302
  fullSyncIntervalInMilliseconds = this.fullSyncInterval * 1000 * 60;
@@ -82472,16 +82314,6 @@ function () {
82472
82314
  _this.initResolve();
82473
82315
  }
82474
82316
 
82475
- if (type === _sync__WEBPACK_IMPORTED_MODULE_7__["ControlMessage"].SYNC_ENGINE_SYNC_QUERIES_READY) {
82476
- logger.debug('Debug info after sync');
82477
-
82478
- _this.storage.logDebugInfo();
82479
- }
82480
-
82481
- logger.debug({
82482
- event: type,
82483
- data: data
82484
- });
82485
82317
  _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["Hub"].dispatch('datastore', {
82486
82318
  event: type,
82487
82319
  data: data
@@ -82495,21 +82327,21 @@ function () {
82495
82327
  });
82496
82328
  return [3
82497
82329
  /*break*/
82498
- , 9];
82330
+ , 8];
82499
82331
 
82500
- case 8:
82332
+ case 7:
82501
82333
  logger.warn("Data won't be synchronized. No GraphQL endpoint configured. Did you forget `Amplify.configure(awsconfig)`?", {
82502
82334
  config: this.amplifyConfig
82503
82335
  });
82504
82336
  this.initResolve();
82505
- _b.label = 9;
82337
+ _b.label = 8;
82506
82338
 
82507
- case 9:
82339
+ case 8:
82508
82340
  return [4
82509
82341
  /*yield*/
82510
82342
  , this.initialized];
82511
82343
 
82512
- case 10:
82344
+ case 9:
82513
82345
  _b.sent();
82514
82346
 
82515
82347
  return [2
@@ -89505,33 +89337,6 @@ function () {
89505
89337
  });
89506
89338
  };
89507
89339
 
89508
- StorageClass.prototype.logDebugInfo = function () {
89509
- return __awaiter(this, void 0, void 0, function () {
89510
- var results;
89511
- return __generator(this, function (_a) {
89512
- switch (_a.label) {
89513
- case 0:
89514
- if (!(typeof this.adapter.getDebugInfo === 'function')) return [3
89515
- /*break*/
89516
- , 2];
89517
- return [4
89518
- /*yield*/
89519
- , this.adapter.getDebugInfo()];
89520
-
89521
- case 1:
89522
- results = _a.sent();
89523
- logger.debug('DB Debug Info', results);
89524
- _a.label = 2;
89525
-
89526
- case 2:
89527
- return [2
89528
- /*return*/
89529
- ];
89530
- }
89531
- });
89532
- });
89533
- };
89534
-
89535
89340
  return StorageClass;
89536
89341
  }();
89537
89342
 
@@ -89637,18 +89442,6 @@ function () {
89637
89442
  return this.storage.batchSave(modelConstructor, items);
89638
89443
  };
89639
89444
 
89640
- ExclusiveStorage.prototype.logDebugInfo = function () {
89641
- return __awaiter(this, void 0, void 0, function () {
89642
- return __generator(this, function (_a) {
89643
- return [2
89644
- /*return*/
89645
- , this.runExclusive(function (storage) {
89646
- return storage.logDebugInfo();
89647
- })];
89648
- });
89649
- });
89650
- };
89651
-
89652
89445
  ExclusiveStorage.prototype.init = function () {
89653
89446
  return __awaiter(this, void 0, void 0, function () {
89654
89447
  return __generator(this, function (_a) {