backendless 7.0.1 → 7.0.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.
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * ********************************************************************************************************************
3
- * Backendless SDK for JavaScript. Version: 7.0.1
3
+ * Backendless SDK for JavaScript. Version: 7.0.3
4
4
  *
5
5
  * Copyright 2012-2023 BACKENDLESS.COM. All Rights Reserved.
6
6
  *
@@ -7046,12 +7046,19 @@ var Logging = /*#__PURE__*/function () {
7046
7046
  (0, _classCallCheck2["default"])(this, Logging);
7047
7047
  this.app = app;
7048
7048
  this.reset();
7049
- this.setConfig(app.loggingConfig);
7049
+ if (app.loggingConfig) {
7050
+ this.setConfig(app.loggingConfig);
7051
+ }
7050
7052
  }
7051
7053
  (0, _createClass2["default"])(Logging, [{
7052
7054
  key: "setConfig",
7053
7055
  value: function setConfig(config) {
7054
- this.config = config;
7056
+ if (config.levels) {
7057
+ this.levels = config.levels;
7058
+ }
7059
+ if (config.defaultLevel) {
7060
+ this.defaultLevel = config.defaultLevel;
7061
+ }
7055
7062
  if (config.loadLevels) {
7056
7063
  this.loadLoggingLevels();
7057
7064
  }
@@ -7059,11 +7066,13 @@ var Logging = /*#__PURE__*/function () {
7059
7066
  }, {
7060
7067
  key: "reset",
7061
7068
  value: function reset() {
7069
+ this.levels = {};
7070
+ this.defaultLevel = 'all';
7062
7071
  this.loggers = {};
7063
7072
  this.messages = [];
7064
7073
  this.numOfMessages = 10;
7065
7074
  this.timeFrequency = 1;
7066
- this.messagesLimit = 100;
7075
+ this.messagesLimit = 1000;
7067
7076
  }
7068
7077
  }, {
7069
7078
  key: "loadLoggingLevels",
@@ -7073,9 +7082,9 @@ var Logging = /*#__PURE__*/function () {
7073
7082
  url: this.app.urls.loggingLevels()
7074
7083
  }).then(function (loggers) {
7075
7084
  loggers.forEach(function (logger) {
7076
- _this.config.levels[logger.name] = logger.level;
7085
+ _this.levels[logger.name] = logger.level;
7077
7086
  });
7078
- _this.config.defaultLevel = _this.config.levels[GLOBAL_LOGGER_NAME] || _this.config.defaultLevel;
7087
+ _this.defaultLevel = _this.levels[GLOBAL_LOGGER_NAME] || _this.defaultLevel;
7079
7088
  })["catch"](function (error) {
7080
7089
  // eslint-disable-next-line no-console
7081
7090
  console.error('Could not load logging levels: ', error);
@@ -7141,7 +7150,6 @@ var Logging = /*#__PURE__*/function () {
7141
7150
  'log-level': logLevel,
7142
7151
  timestamp: Date.now()
7143
7152
  });
7144
- this.checkMessagesLimit();
7145
7153
  this.checkMessagesLen();
7146
7154
  }
7147
7155
  }, {
@@ -7274,11 +7282,7 @@ var Logger = /*#__PURE__*/function () {
7274
7282
  }, {
7275
7283
  key: "min",
7276
7284
  value: function min(level) {
7277
- var configuredLevel = this.logging.config.levels[this.name];
7278
- if (!configuredLevel) {
7279
- var defaultLevel = this.logging.config.defaultLevel;
7280
- return LogLevelPriorities[defaultLevel.toLowerCase()] >= LogLevelPriorities[level.toLowerCase()];
7281
- }
7285
+ var configuredLevel = this.logging.levels[this.name] || this.logging.defaultLevel;
7282
7286
  return LogLevelPriorities[configuredLevel.toLowerCase()] >= LogLevelPriorities[level.toLowerCase()];
7283
7287
  }
7284
7288
  }]);
@@ -12334,6 +12338,7 @@ var Request = /*#__PURE__*/function (_EventEmitter) {
12334
12338
  _this.queryParams = {};
12335
12339
  _this.encoding = 'utf8';
12336
12340
  _this.timeout = 0;
12341
+ _this.withCredentials = null;
12337
12342
  return _this;
12338
12343
  }
12339
12344
 
@@ -12485,6 +12490,19 @@ var Request = /*#__PURE__*/function (_EventEmitter) {
12485
12490
  return this;
12486
12491
  }
12487
12492
 
12493
+ /**
12494
+ * set withCredentials option
12495
+ *
12496
+ * @param {Boolean} value
12497
+ * @returns {Request}
12498
+ */
12499
+ }, {
12500
+ key: "setWithCredentials",
12501
+ value: function setWithCredentials(value) {
12502
+ this.withCredentials = value;
12503
+ return this;
12504
+ }
12505
+
12488
12506
  /**
12489
12507
  * A number specifying request timeout in milliseconds.
12490
12508
  * @param {Number} ms
@@ -12553,7 +12571,8 @@ var Request = /*#__PURE__*/function (_EventEmitter) {
12553
12571
  if (Request.verbose) {
12554
12572
  console.log(this.method.toUpperCase(), decodeURIComponent(path), body, this.headers);
12555
12573
  }
12556
- var request = Request.send(path, this.method.toUpperCase(), this.headers, body, this.encoding, this.timeout).then(parseBody).then(checkStatus).then(unwrapBody).then(cacheResponse).then(flushCache);
12574
+ var withCredentials = typeof this.withCredentials === 'boolean' ? this.withCredentials : Request.withCredentials;
12575
+ var request = Request.send(path, this.method.toUpperCase(), this.headers, body, this.encoding, this.timeout, withCredentials).then(parseBody).then(checkStatus).then(unwrapBody).then(cacheResponse).then(flushCache);
12557
12576
  request.then(function (result) {
12558
12577
  _this3.emit(RESPONSE_EVENT, result);
12559
12578
  _this3.emit(DONE_EVENT, null, result);
@@ -12636,11 +12655,12 @@ Object.defineProperty(_request.Request, 'FormData', {
12636
12655
  }
12637
12656
  });
12638
12657
  _request.Request.XMLHttpRequest = typeof XMLHttpRequest !== 'undefined' ? XMLHttpRequest : undefined;
12639
- _request.Request.send = function (path, method, headers, body, encoding, timeout) {
12658
+ _request.Request.send = function (path, method, headers, body, encoding, timeout, withCredentials) {
12640
12659
  var sender = typeof _request.Request.XMLHttpRequest !== 'undefined' ? _clientBrowser.sendXmlHttpRequest : _clientNode.sendNodeAPIRequest;
12641
- return sender(path, method, headers, body, encoding, timeout);
12660
+ return sender(path, method, headers, body, encoding, timeout, withCredentials);
12642
12661
  };
12643
12662
  _request.Request.verbose = false;
12663
+ _request.Request.withCredentials = false;
12644
12664
  _request.Request.methods = ['get', 'post', 'put', 'patch', 'delete'];
12645
12665
  _request.Request.methods.forEach(function (method) {
12646
12666
  _request.Request[method] = function (path, body) {
@@ -12663,7 +12683,7 @@ Object.defineProperty(exports, "__esModule", {
12663
12683
  });
12664
12684
  exports.sendNodeAPIRequest = sendNodeAPIRequest;
12665
12685
  var _utils = __webpack_require__(0);
12666
- function sendNodeAPIRequest(path, method, headers, body, encoding, timeout) {
12686
+ function sendNodeAPIRequest(path, method, headers, body, encoding, timeout, withCredentials) {
12667
12687
  return new Promise(function (resolve, reject) {
12668
12688
  var u = __webpack_require__(6).parse(path);
12669
12689
  var form = (0, _utils.isFormData)(body) && body;
@@ -12676,6 +12696,9 @@ function sendNodeAPIRequest(path, method, headers, body, encoding, timeout) {
12676
12696
  headers: headers,
12677
12697
  timeout: timeout
12678
12698
  };
12699
+ if (typeof withCredentials === 'boolean') {
12700
+ options.withCredentials = withCredentials;
12701
+ }
12679
12702
  var _send = function _send() {
12680
12703
  var Buffer = __webpack_require__(1).Buffer;
12681
12704
  var httpClient = __webpack_require__(https ? 7 : 8);
@@ -12780,7 +12803,7 @@ Object.defineProperty(exports, "__esModule", {
12780
12803
  });
12781
12804
  exports.sendXmlHttpRequest = sendXmlHttpRequest;
12782
12805
  var _request2 = __webpack_require__(2);
12783
- function sendXmlHttpRequest(path, method, headers, body, encoding, timeout) {
12806
+ function sendXmlHttpRequest(path, method, headers, body, encoding, timeout, withCredentials) {
12784
12807
  return new Promise(function sendRequest(resolve, reject) {
12785
12808
  var request = new _request2.Request.XMLHttpRequest();
12786
12809
  request.timeout = timeout;
@@ -12788,6 +12811,9 @@ function sendXmlHttpRequest(path, method, headers, body, encoding, timeout) {
12788
12811
  request.responseType = 'arraybuffer';
12789
12812
  }
12790
12813
  request.open(method.toUpperCase(), path, true);
12814
+ if (typeof withCredentials === 'boolean') {
12815
+ request.withCredentials = withCredentials;
12816
+ }
12791
12817
  request.onload = function handleLoadEvent() {
12792
12818
  var headers = parseHeaders(request.getAllResponseHeaders());
12793
12819
  var _request = request,