backendless 6.6.3 → 6.6.5

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
@@ -680,9 +680,9 @@ declare module Backendless {
680
680
 
681
681
  function createEmailConfirmationURL(identity: string | number): Promise<object>;
682
682
 
683
- function enableUser(userId: string): Promise<void>;
683
+ function enableUser(userId: string | number): Promise<void>;
684
684
 
685
- function disableUser(userId: string): Promise<void>;
685
+ function disableUser(userId: string | number): Promise<void>;
686
686
 
687
687
  function getAuthorizationUrlLink(providerCode: string, fieldsMapping?: object, scope?: string, redirect?: boolean, redirectAfterLoginUrl?: string, callbackUrlDomain?: string): Promise<string>;
688
688
  }
@@ -944,6 +944,8 @@ declare module Backendless {
944
944
 
945
945
  function setLogReportingPolicy(numOfMessages: number, timeFrequencySec: number): void;
946
946
 
947
+ function setMessagesLimit(limit: number): void;
948
+
947
949
  function getLogger(name: string): Backendless.Logger;
948
950
  }
949
951
 
@@ -1433,7 +1435,7 @@ declare module Backendless {
1433
1435
 
1434
1436
  deepSave<T = object>(obj: T | object): Promise<T>;
1435
1437
 
1436
- remove(id: object | string): Promise<object>;
1438
+ remove(id: object | string | number): Promise<object>;
1437
1439
 
1438
1440
  find<T = object>(obj?: Backendless.DataQueryBuilder | DataQueryI): Promise<Array<T>>;
1439
1441
 
@@ -1441,25 +1443,25 @@ declare module Backendless {
1441
1443
 
1442
1444
  countInGroup(obj?: Backendless.GroupQueryBuilder | GroupQueryI): Promise<number>;
1443
1445
 
1444
- findById<T = object>(objectId: string, query?: Backendless.DataQueryBuilder | DataQueryI): Promise<T>;
1446
+ findById<T = object>(objectId: string | number, query?: Backendless.DataQueryBuilder | DataQueryI): Promise<T>;
1445
1447
  findById<T = object>(primaryKeys: object, query?: Backendless.DataQueryBuilder | DataQueryI): Promise<T>;
1446
1448
 
1447
1449
  findFirst<T = object>(query?: Backendless.DataQueryBuilder | DataQueryI): Promise<T>;
1448
1450
 
1449
1451
  findLast<T = object>(query?: Backendless.DataQueryBuilder | DataQueryI): Promise<T>;
1450
1452
 
1451
- loadRelations<T = object>(parent: string | object, query: Backendless.LoadRelationsQueryBuilder | RelationsQueryI): Promise<Array<T>>;
1453
+ loadRelations<T = object>(parent: string | number | object, query: Backendless.LoadRelationsQueryBuilder | RelationsQueryI): Promise<Array<T>>;
1452
1454
 
1453
1455
  getObjectCount(query?: Backendless.DataQueryBuilder | string): Promise<number>
1454
1456
 
1455
- setRelation(parent: object, columnName: string, children: Array<object | string>): Promise<string>;
1456
- setRelation(parent: object, columnName: string, whereClause: string): Promise<string>;
1457
+ setRelation(parent: object | string | number, columnName: string, children: Array<object | string | number>): Promise<string>;
1458
+ setRelation(parent: object | string | number, columnName: string, whereClause: string): Promise<string>;
1457
1459
 
1458
- addRelation(parent: object, columnName: string, children: Array<object | string>): Promise<string>;
1459
- addRelation(parent: object, columnName: string, whereClause: string): Promise<string>;
1460
+ addRelation(parent: object | string | number, columnName: string, children: Array<object | string | number>): Promise<string>;
1461
+ addRelation(parent: object | string | number, columnName: string, whereClause: string): Promise<string>;
1460
1462
 
1461
- deleteRelation(parent: object, columnName: string, children: Array<object | string>): Promise<string>;
1462
- deleteRelation(parent: object, columnName: string, whereClause: string): Promise<string>;
1463
+ deleteRelation(parent: object | string | number, columnName: string, children: Array<object | string | number>): Promise<string>;
1464
+ deleteRelation(parent: object | string | number, columnName: string, whereClause: string): Promise<string>;
1463
1465
 
1464
1466
  bulkCreate(objects: Array<object>): Promise<Array<string>>;
1465
1467
 
@@ -1467,7 +1469,7 @@ declare module Backendless {
1467
1469
 
1468
1470
  bulkUpdate(whereClause: string, changes: object): Promise<string>;
1469
1471
 
1470
- bulkDelete(where: string | Array<string> | Array<{ objectId: string, [key: string]: any }>): Promise<string>;
1472
+ bulkDelete(where: string | Array<string | number | { objectId: string | number, [key: string]: any }>): Promise<string>;
1471
1473
 
1472
1474
  rt(): EventHandler;
1473
1475
  }
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * ********************************************************************************************************************
3
- * Backendless SDK for JavaScript. Version: 6.6.3
3
+ * Backendless SDK for JavaScript. Version: 6.6.5
4
4
  *
5
5
  * Copyright 2012-2023 BACKENDLESS.COM. All Rights Reserved.
6
6
  *
@@ -16669,12 +16669,12 @@ var DataStore = /*#__PURE__*/function () {
16669
16669
  case 0:
16670
16670
  objectId = object && object.objectId || object;
16671
16671
 
16672
- if (!(!objectId || typeof objectId !== 'string')) {
16672
+ if (!(!objectId || typeof objectId !== 'string' && typeof objectId !== 'number')) {
16673
16673
  _context3.next = 3;
16674
16674
  break;
16675
16675
  }
16676
16676
 
16677
- throw new Error('Object Id must be provided and must be a string.');
16677
+ throw new Error('Object Id must be provided and must be a string or number.');
16678
16678
 
16679
16679
  case 3:
16680
16680
  return _context3.abrupt("return", this.app.request["delete"]({
@@ -16822,12 +16822,12 @@ var DataStore = /*#__PURE__*/function () {
16822
16822
  break;
16823
16823
 
16824
16824
  case 8:
16825
- if (!(!objectId || typeof objectId !== 'string')) {
16825
+ if (!(!objectId || typeof objectId !== 'string' && typeof objectId !== 'number')) {
16826
16826
  _context7.next = 10;
16827
16827
  break;
16828
16828
  }
16829
16829
 
16830
- throw new Error('Object Id must be provided and must be a string or an object of primary keys.');
16830
+ throw new Error('Object Id must be provided and must be a string or number or an object of primary keys.');
16831
16831
 
16832
16832
  case 10:
16833
16833
  if (query) {
@@ -16997,12 +16997,12 @@ var DataStore = /*#__PURE__*/function () {
16997
16997
  case 0:
16998
16998
  parentObjectId = parent && parent.objectId || parent;
16999
16999
 
17000
- if (!(!parentObjectId || typeof parentObjectId !== 'string')) {
17000
+ if (!(!parentObjectId || typeof parentObjectId !== 'string' && typeof parentObjectId !== 'number')) {
17001
17001
  _context11.next = 3;
17002
17002
  break;
17003
17003
  }
17004
17004
 
17005
- throw new Error('Parent Object Id must be provided and must be a string.');
17005
+ throw new Error('Parent Object Id must be provided and must be a string or number.');
17006
17006
 
17007
17007
  case 3:
17008
17008
  _ref = queryBuilder instanceof _loadRelationsQueryBuilder["default"] ? queryBuilder.toJSON() : queryBuilder, relationName = _ref.relationName, relationModel = _ref.relationModel, query = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
@@ -17269,8 +17269,8 @@ var DataStore = /*#__PURE__*/function () {
17269
17269
  objectIds = condition.map(function (object) {
17270
17270
  var objectId = object && object.objectId || object;
17271
17271
 
17272
- if (!objectId || typeof objectId !== 'string') {
17273
- throw new Error('Can not transform "objects" to "whereClause". ' + 'Item must be a string or an object with property "objectId" as string.');
17272
+ if (!objectId || typeof objectId !== 'string' && typeof objectId !== 'number') {
17273
+ throw new Error('Can not transform "objects" to "whereClause". ' + 'Item must be a string or number or an object with property "objectId" as string.');
17274
17274
  }
17275
17275
 
17276
17276
  return "'".concat(objectId, "'");
@@ -17324,8 +17324,8 @@ var DataStore = /*#__PURE__*/function () {
17324
17324
  value: function changeRelation(method, parent, columnName, children) {
17325
17325
  var parentId = parent && parent.objectId || parent;
17326
17326
 
17327
- if (!parentId || typeof parentId !== 'string') {
17328
- throw new Error('Relation Parent must be provided and must be a string or an object with objectId property.');
17327
+ if (!parentId || typeof parentId !== 'string' && typeof parentId !== 'number') {
17328
+ throw new Error('Relation Parent must be provided and must be a string or number or an object with objectId property.');
17329
17329
  }
17330
17330
 
17331
17331
  if (!columnName || typeof columnName !== 'string') {
@@ -17344,8 +17344,8 @@ var DataStore = /*#__PURE__*/function () {
17344
17344
  condition.childrenIds = children.map(function (child) {
17345
17345
  var childId = child && child.objectId || child;
17346
17346
 
17347
- if (!childId || typeof childId !== 'string') {
17348
- throw new Error('Child Id must be provided and must be a string.');
17347
+ if (!childId || typeof childId !== 'string' && typeof childId !== 'number') {
17348
+ throw new Error('Child Id must be provided and must be a string or number.');
17349
17349
  }
17350
17350
 
17351
17351
  return childId;
@@ -21023,6 +21023,8 @@ exports["default"] = void 0;
21023
21023
 
21024
21024
  var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"));
21025
21025
 
21026
+ var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ "./node_modules/@babel/runtime/helpers/toConsumableArray.js"));
21027
+
21026
21028
  var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
21027
21029
 
21028
21030
  var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"));
@@ -21042,9 +21044,10 @@ var Logging = /*#__PURE__*/function () {
21042
21044
  key: "reset",
21043
21045
  value: function reset() {
21044
21046
  this.loggers = {};
21045
- this.pool = [];
21047
+ this.messages = [];
21046
21048
  this.numOfMessages = 10;
21047
21049
  this.timeFrequency = 1;
21050
+ this.messagesLimit = 100;
21048
21051
  }
21049
21052
  }, {
21050
21053
  key: "getLogger",
@@ -21065,19 +21068,27 @@ var Logging = /*#__PURE__*/function () {
21065
21068
  var _flush = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
21066
21069
  var _this = this;
21067
21070
 
21071
+ var messages;
21068
21072
  return _regenerator["default"].wrap(function _callee$(_context) {
21069
21073
  while (1) {
21070
21074
  switch (_context.prev = _context.next) {
21071
21075
  case 0:
21072
- if (!this.flushRequest && this.pool.length) {
21076
+ if (!this.flushRequest && this.messages.length) {
21073
21077
  this.stopFlushInterval();
21078
+ messages = (0, _toConsumableArray2["default"])(this.messages);
21079
+ this.messages = [];
21074
21080
  this.flushRequest = this.app.request.put({
21075
21081
  url: this.app.urls.logging(),
21076
- data: this.pool
21077
- }).then(function () {
21078
- delete _this.flushRequest;
21082
+ data: messages
21083
+ })["catch"](function (error) {
21084
+ _this.messages = [].concat((0, _toConsumableArray2["default"])(messages), (0, _toConsumableArray2["default"])(_this.messages));
21085
+
21086
+ _this.checkMessagesLimit();
21087
+
21088
+ throw error;
21089
+ })["finally"](function () {
21090
+ return delete _this.flushRequest;
21079
21091
  });
21080
- this.pool = [];
21081
21092
  }
21082
21093
 
21083
21094
  return _context.abrupt("return", this.flushRequest);
@@ -21103,22 +21114,30 @@ var Logging = /*#__PURE__*/function () {
21103
21114
  throw new Error('"message" must be a string');
21104
21115
  }
21105
21116
 
21106
- this.pool.push({
21117
+ this.messages.push({
21107
21118
  logger: logger,
21108
21119
  message: message,
21109
21120
  exception: exception,
21110
21121
  'log-level': logLevel,
21111
21122
  timestamp: Date.now()
21112
21123
  });
21124
+ this.checkMessagesLimit();
21113
21125
  this.checkMessagesLen();
21114
21126
  }
21115
21127
  }, {
21116
21128
  key: "checkMessagesLen",
21117
21129
  value: function checkMessagesLen() {
21118
- if (this.pool.length >= this.numOfMessages) {
21130
+ if (this.messages.length >= this.numOfMessages) {
21119
21131
  this.startFlushInterval();
21120
21132
  }
21121
21133
  }
21134
+ }, {
21135
+ key: "checkMessagesLimit",
21136
+ value: function checkMessagesLimit() {
21137
+ if (this.messages.length > this.messagesLimit) {
21138
+ this.messages = this.messages.slice(this.messages.length - this.messagesLimit);
21139
+ }
21140
+ }
21122
21141
  }, {
21123
21142
  key: "startFlushInterval",
21124
21143
  value: function startFlushInterval() {
@@ -21145,10 +21164,20 @@ var Logging = /*#__PURE__*/function () {
21145
21164
  this.stopFlushInterval();
21146
21165
  }
21147
21166
 
21167
+ if (numOfMessages > this.messagesLimit) {
21168
+ this.messagesLimit = numOfMessages;
21169
+ }
21170
+
21148
21171
  this.numOfMessages = numOfMessages;
21149
21172
  this.timeFrequency = timeFrequency;
21150
21173
  this.checkMessagesLen();
21151
21174
  }
21175
+ }, {
21176
+ key: "setMessagesLimit",
21177
+ value: function setMessagesLimit(messagesLimit) {
21178
+ this.messagesLimit = messagesLimit;
21179
+ this.checkMessagesLimit();
21180
+ }
21152
21181
  }]);
21153
21182
  return Logging;
21154
21183
  }();
@@ -25763,12 +25792,12 @@ var Users = /*#__PURE__*/function () {
25763
25792
  while (1) {
25764
25793
  switch (_context26.prev = _context26.next) {
25765
25794
  case 0:
25766
- if (!(!userId || typeof userId !== 'string')) {
25795
+ if (!(!userId || typeof userId !== 'string' && typeof userId !== 'number')) {
25767
25796
  _context26.next = 2;
25768
25797
  break;
25769
25798
  }
25770
25799
 
25771
- throw new Error('User objectId must be non empty string');
25800
+ throw new Error('User objectId must be non empty string/number');
25772
25801
 
25773
25802
  case 2:
25774
25803
  if (!(!userStatus || typeof userStatus !== 'string')) {