backendless 7.4.5 → 7.4.7

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.4.5
3
+ * Backendless SDK for JavaScript. Version: 7.4.7
4
4
  *
5
5
  * Copyright 2012-2023 BACKENDLESS.COM. All Rights Reserved.
6
6
  *
@@ -6691,6 +6691,10 @@ var Backendless = /*#__PURE__*/function () {
6691
6691
  }).then(resolve)["catch"](reject);
6692
6692
  });
6693
6693
  }
6694
+ this.__appInfoPromise["catch"](function (error) {
6695
+ // eslint-disable-next-line no-console
6696
+ console.error('could not load backendless app info', error);
6697
+ });
6694
6698
  return this.__appInfoPromise;
6695
6699
  }
6696
6700
  }, {
@@ -6789,7 +6793,10 @@ var Backendless = /*#__PURE__*/function () {
6789
6793
  if (this.domain) {
6790
6794
  return this.domain + this.apiURI;
6791
6795
  }
6792
- return [this.serverURL, this.appId, this.apiKey].join('/');
6796
+ if (this.appId && this.apiKey) {
6797
+ return [this.serverURL, this.appId, this.apiKey].join('/');
6798
+ }
6799
+ return null;
6793
6800
  },
6794
6801
  set: function set(appPath) {
6795
6802
  throw new Error("Setting '".concat(appPath, "' value to Backendless.appPath directly is not possible, ") + 'instead you must use Backendless.initApp(APP_ID, API_KEY) for setup the value');
@@ -7386,13 +7393,15 @@ var Logging = /*#__PURE__*/function () {
7386
7393
  this.stopFlushInterval();
7387
7394
  messages = (0, _toConsumableArray2["default"])(this.messages);
7388
7395
  this.messages = [];
7389
- this.flushRequest = this.app.request.put({
7390
- url: this.app.urls.logging(),
7391
- data: messages
7392
- })["catch"](function (error) {
7393
- _this2.messages = [].concat((0, _toConsumableArray2["default"])(messages), (0, _toConsumableArray2["default"])(_this2.messages));
7394
- _this2.checkMessagesLimit();
7395
- throw error;
7396
+ this.flushRequest = Promise.resolve().then(function () {
7397
+ return _this2.app.request.put({
7398
+ url: _this2.app.urls.logging(),
7399
+ data: messages
7400
+ })["catch"](function (error) {
7401
+ _this2.messages = [].concat((0, _toConsumableArray2["default"])(messages), (0, _toConsumableArray2["default"])(_this2.messages));
7402
+ _this2.checkMessagesLimit();
7403
+ throw error;
7404
+ });
7396
7405
  })["finally"](function () {
7397
7406
  return delete _this2.flushRequest;
7398
7407
  });
@@ -7430,7 +7439,10 @@ var Logging = /*#__PURE__*/function () {
7430
7439
  }
7431
7440
  this.checkMessagesLenTimer = setTimeout(function () {
7432
7441
  if (_this3.messages.length >= _this3.numOfMessages) {
7433
- _this3.flush();
7442
+ _this3.flush()["catch"](function (error) {
7443
+ // eslint-disable-next-line no-console
7444
+ console.error('Could not flush log messages immediately: ', error);
7445
+ });
7434
7446
  } else {
7435
7447
  _this3.startFlushInterval();
7436
7448
  }
@@ -7449,7 +7461,10 @@ var Logging = /*#__PURE__*/function () {
7449
7461
  var _this4 = this;
7450
7462
  if (!this.flushInterval) {
7451
7463
  this.flushInterval = setTimeout(function () {
7452
- return _this4.flush();
7464
+ _this4.flush()["catch"](function (error) {
7465
+ // eslint-disable-next-line no-console
7466
+ console.error('Could not flush log messages with timer: ', error);
7467
+ });
7453
7468
  }, this.timeFrequency * 1000);
7454
7469
  }
7455
7470
  }
@@ -10369,6 +10384,9 @@ var Urls = /*#__PURE__*/function () {
10369
10384
  (0, _createClass2["default"])(Urls, [{
10370
10385
  key: "root",
10371
10386
  value: function root() {
10387
+ if (!this.app.appPath) {
10388
+ throw new Error('Backendless API is not configured, make sure you run Backendless.initApp(...) ' + 'before the operation');
10389
+ }
10372
10390
  return this.app.appPath;
10373
10391
  }
10374
10392
 
@@ -10908,6 +10926,7 @@ var _utils = _interopRequireDefault(__webpack_require__(/*! ./utils */ "./src/ut
10908
10926
  function getUserAgent() {
10909
10927
  var ua = 'NodeJS';
10910
10928
  if (_utils["default"].isBrowser) {
10929
+ var navigator = _utils["default"].getWindowNavigator();
10911
10930
  ua = navigator.userAgent ? navigator.userAgent.toLowerCase() : 'hybrid-app';
10912
10931
  }
10913
10932
  var match = /(chrome)[ \/]([\w.]+)/.exec(ua) || /(webkit)[ \/]([\w.]+)/.exec(ua) || /(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) || /(msie) ([\w.]+)/.exec(ua) || ua.indexOf('compatible') < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) || [];
@@ -12406,18 +12425,21 @@ User.prototype.___class = User.className;
12406
12425
  /*!****************************!*\
12407
12426
  !*** ./src/users/utils.js ***!
12408
12427
  \****************************/
12409
- /***/ ((__unused_webpack_module, exports) => {
12428
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
12410
12429
 
12411
12430
  "use strict";
12412
12431
 
12413
12432
 
12433
+ var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js");
12414
12434
  Object.defineProperty(exports, "__esModule", ({
12415
12435
  value: true
12416
12436
  }));
12417
12437
  exports.UsersUtils = void 0;
12438
+ var _utils = _interopRequireDefault(__webpack_require__(/*! ../utils */ "./src/utils.js"));
12418
12439
  var UsersUtils = {
12419
12440
  getClientUserLocale: function getClientUserLocale() {
12420
- if (typeof navigator === 'undefined') {
12441
+ var navigator = _utils["default"].getWindowNavigator();
12442
+ if (typeof navigator === 'undefined' || !navigator) {
12421
12443
  return;
12422
12444
  }
12423
12445
  var language = '';
@@ -12500,6 +12522,9 @@ var Utils = {
12500
12522
  },
12501
12523
  isObject: function isObject(obj) {
12502
12524
  return obj != null && obj.constructor.name === 'Object';
12525
+ },
12526
+ getWindowNavigator: function getWindowNavigator() {
12527
+ return typeof __test_navigator !== 'undefined' ? __test_navigator : __webpack_require__.g.navigator;
12503
12528
  }
12504
12529
  };
12505
12530
  function isBrowser() {