backendless 6.3.10 → 6.3.11

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/backendless.d.ts CHANGED
@@ -4,6 +4,7 @@
4
4
  */
5
5
  declare module Backendless {
6
6
  let debugMode: boolean;
7
+ let useTableClassesFromGlobalScope: boolean;
7
8
  let serverURL: string;
8
9
  let appId: string;
9
10
  let apiKey: string;
@@ -35,7 +36,8 @@ declare module Backendless {
35
36
  serverURL?: string;
36
37
  domain?: string;
37
38
  debugMode?: boolean;
38
- XMLHttpRequest?: XMLHttpRequest,
39
+ XMLHttpRequest?: XMLHttpRequest;
40
+ useTableClassesFromGlobalScope?: boolean;
39
41
  }
40
42
 
41
43
  /**
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * ********************************************************************************************************************
3
- * Backendless SDK for JavaScript. Version: 6.3.10
3
+ * Backendless SDK for JavaScript. Version: 6.3.11
4
4
  *
5
5
  * Copyright 2012-2022 BACKENDLESS.COM. All Rights Reserved.
6
6
  *
@@ -16704,7 +16704,7 @@ var DataStore = /*#__PURE__*/function () {
16704
16704
  }, {
16705
16705
  key: "parseRelationsResponse",
16706
16706
  value: function parseRelationsResponse(result, RelationModel) {
16707
- return convertToClientRecords(result, RelationModel, this.classToTableMap);
16707
+ return convertToClientRecords(result, RelationModel, this);
16708
16708
  }
16709
16709
  /**
16710
16710
  * @private
@@ -16713,7 +16713,7 @@ var DataStore = /*#__PURE__*/function () {
16713
16713
  }, {
16714
16714
  key: "parseResponse",
16715
16715
  value: function parseResponse(result) {
16716
- return convertToClientRecords(result, this.model, this.classToTableMap);
16716
+ return convertToClientRecords(result, this.model, this);
16717
16717
  }
16718
16718
  /**
16719
16719
  * @private
@@ -16812,14 +16812,15 @@ var convertToServerRecord = function () {
16812
16812
  }();
16813
16813
 
16814
16814
  var convertToClientRecords = function () {
16815
- return function (records, RootModel, classToTableMap) {
16815
+ return function (records, RootModel, dataStore) {
16816
16816
  if (!records) {
16817
16817
  return records;
16818
16818
  }
16819
16819
 
16820
16820
  var context = {
16821
16821
  RootModel: RootModel,
16822
- classToTableMap: classToTableMap,
16822
+ app: dataStore.app,
16823
+ classToTableMap: dataStore.classToTableMap,
16823
16824
  subIds: {},
16824
16825
  postAssign: []
16825
16826
  };
@@ -16837,7 +16838,14 @@ var convertToClientRecords = function () {
16837
16838
  target[prop] = context.subIds[__subID];
16838
16839
  delete source[prop].__subID;
16839
16840
  } else {
16840
- var Model = context.classToTableMap[source[prop].___class] || _utils["default"].globalScope[source[prop].___class];
16841
+ var Model = context.classToTableMap[source[prop].___class];
16842
+
16843
+ if (!Model && context.app.useTableClassesFromGlobalScope && _utils["default"].globalScope[source[prop].___class]) {
16844
+ // eslint-disable-next-line no-console
16845
+ console.warn('Resolving DataTable classes from the global scope is deprecated ' + 'and it won\'t be supported in the nearest future. ' + 'Instead, you should register your DataTable classes ' + 'using the following method Backendless.Data.mapTableToClass');
16846
+ Model = _utils["default"].globalScope[source[prop].___class];
16847
+ }
16848
+
16841
16849
  target[prop] = Model ? new Model() : {};
16842
16850
 
16843
16851
  if (__subID && !context.subIds[__subID]) {
@@ -17848,7 +17856,10 @@ var DEFAULT_PROPS = {
17848
17856
  apiURI: '/api',
17849
17857
  debugMode: false,
17850
17858
  standalone: false,
17851
- XMLHttpRequest: typeof XMLHttpRequest !== 'undefined' ? XMLHttpRequest : undefined
17859
+ XMLHttpRequest: typeof XMLHttpRequest !== 'undefined' ? XMLHttpRequest : undefined,
17860
+ //TODO: this is a temporary to disable getting DataTable classes from the global scope
17861
+ //TODO: it will be removed in the nearest future
17862
+ useTableClassesFromGlobalScope: true
17852
17863
  };
17853
17864
  var STATELESS_PROPS = ['appId', 'apiKey', 'domain'];
17854
17865
  var root = (typeof self === "undefined" ? "undefined" : (0, _typeof2["default"])(self)) === 'object' && self.self === self && self || (typeof global === "undefined" ? "undefined" : (0, _typeof2["default"])(global)) === 'object' && global.global === global && global;
@@ -18091,6 +18102,15 @@ var Backendless = /*#__PURE__*/function () {
18091
18102
  },
18092
18103
  set: function set(appPath) {
18093
18104
  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');
18105
+ } ///--------useTableClassesFromGlobalScope-------///
18106
+
18107
+ }, {
18108
+ key: "useTableClassesFromGlobalScope",
18109
+ get: function get() {
18110
+ return this.__useTableClassesFromGlobalScope;
18111
+ },
18112
+ set: function set(useTableClassesFromGlobalScope) {
18113
+ this.__useTableClassesFromGlobalScope = !!useTableClassesFromGlobalScope;
18094
18114
  } ///--------debugMode-------///
18095
18115
 
18096
18116
  }, {