backendless 6.7.0 → 6.7.1-dev.2

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.
Files changed (159) hide show
  1. package/backendless.d.ts +5 -0
  2. package/dist/backendless.js +20966 -23929
  3. package/dist/backendless.js.map +1 -1
  4. package/dist/backendless.min.js +2 -2
  5. package/es/bl/constants.js +0 -2
  6. package/es/bl/custom-services.js +40 -65
  7. package/es/bl/events.js +30 -52
  8. package/es/bl/index.js +3 -9
  9. package/es/cache/index.js +125 -189
  10. package/es/commerce/index.js +78 -119
  11. package/es/counters/counter.js +0 -8
  12. package/es/counters/index.js +171 -258
  13. package/es/data/data-query-builder.js +2 -39
  14. package/es/data/geo/geo-constructor.js +5 -26
  15. package/es/data/geo/geo-json-parser.js +0 -7
  16. package/es/data/geo/geometry.js +4 -13
  17. package/es/data/geo/linestring.js +4 -21
  18. package/es/data/geo/point.js +4 -22
  19. package/es/data/geo/polygon.js +4 -30
  20. package/es/data/geo/spatial-reference-system.js +1 -7
  21. package/es/data/geo/wkt-parser.js +0 -10
  22. package/es/data/geo/wkt-to-geojson.js +4 -44
  23. package/es/data/group-query-builder.js +0 -23
  24. package/es/data/index.js +17 -54
  25. package/es/data/json-update-builder.js +0 -18
  26. package/es/data/load-relations-query-builder.js +0 -16
  27. package/es/data/persmission.js +0 -16
  28. package/es/data/rt-handlers.js +1 -46
  29. package/es/data/store.js +316 -518
  30. package/es/decorators/deprecated.js +2 -5
  31. package/es/decorators/index.js +0 -2
  32. package/es/device/index.js +3 -8
  33. package/es/expression.js +29 -0
  34. package/es/files/index.js +354 -493
  35. package/es/files/persmission.js +0 -15
  36. package/es/files/utils.js +32 -55
  37. package/es/hive/index.js +1 -13
  38. package/es/hive/stores/base-store.js +14 -50
  39. package/es/hive/stores/index.js +0 -10
  40. package/es/hive/stores/key-value.js +4 -37
  41. package/es/hive/stores/list.js +0 -32
  42. package/es/hive/stores/map.js +0 -34
  43. package/es/hive/stores/set.js +0 -29
  44. package/es/hive/stores/sorted-set.js +19 -94
  45. package/es/hive/utils.js +0 -2
  46. package/es/index.js +51 -71
  47. package/es/local-cache/index.js +0 -10
  48. package/es/local-cache/local-storage.js +1 -9
  49. package/es/local-cache/virtual-storage.js +0 -6
  50. package/es/logging/index.js +21 -46
  51. package/es/logging/logger.js +0 -6
  52. package/es/management/data.js +0 -8
  53. package/es/management/index.js +3 -7
  54. package/es/messaging/channel/index.js +0 -27
  55. package/es/messaging/helpers/body-parts.js +3 -6
  56. package/es/messaging/helpers/delivery-options.js +3 -6
  57. package/es/messaging/helpers/email-envelope.js +13 -25
  58. package/es/messaging/helpers/index.js +10 -16
  59. package/es/messaging/helpers/publish-options.js +3 -6
  60. package/es/messaging/index.js +213 -317
  61. package/es/persmission.js +7 -16
  62. package/es/request/index.js +2 -16
  63. package/es/rso/connection.js +3 -34
  64. package/es/rso/index.js +0 -7
  65. package/es/rt.js +21 -52
  66. package/es/unit-of-work/constants.js +1 -1
  67. package/es/unit-of-work/index.js +27 -145
  68. package/es/unit-of-work/json-adapter.js +14 -35
  69. package/es/unit-of-work/op-result-value-reference.js +1 -11
  70. package/es/unit-of-work/op-result.js +2 -13
  71. package/es/urls.js +18 -15
  72. package/es/user-agent.js +0 -7
  73. package/es/users/index.js +345 -552
  74. package/es/users/roles.js +79 -128
  75. package/es/users/social/container.js +0 -16
  76. package/es/users/social/index.js +166 -250
  77. package/es/users/user.js +2 -9
  78. package/es/users/utils.js +0 -3
  79. package/es/utils.js +0 -17
  80. package/lib/bl/constants.js +0 -2
  81. package/lib/bl/custom-services.js +40 -65
  82. package/lib/bl/events.js +30 -52
  83. package/lib/bl/index.js +3 -9
  84. package/lib/cache/index.js +125 -189
  85. package/lib/commerce/index.js +78 -119
  86. package/lib/counters/counter.js +0 -8
  87. package/lib/counters/index.js +171 -258
  88. package/lib/data/data-query-builder.js +2 -39
  89. package/lib/data/geo/geo-constructor.js +5 -26
  90. package/lib/data/geo/geo-json-parser.js +0 -7
  91. package/lib/data/geo/geometry.js +4 -13
  92. package/lib/data/geo/linestring.js +4 -21
  93. package/lib/data/geo/point.js +4 -22
  94. package/lib/data/geo/polygon.js +4 -30
  95. package/lib/data/geo/spatial-reference-system.js +1 -7
  96. package/lib/data/geo/wkt-parser.js +0 -10
  97. package/lib/data/geo/wkt-to-geojson.js +4 -44
  98. package/lib/data/group-query-builder.js +0 -23
  99. package/lib/data/index.js +17 -54
  100. package/lib/data/json-update-builder.js +0 -18
  101. package/lib/data/load-relations-query-builder.js +0 -16
  102. package/lib/data/persmission.js +0 -16
  103. package/lib/data/rt-handlers.js +1 -46
  104. package/lib/data/store.js +316 -518
  105. package/lib/decorators/deprecated.js +2 -5
  106. package/lib/decorators/index.js +0 -2
  107. package/lib/device/index.js +3 -8
  108. package/lib/expression.js +29 -0
  109. package/lib/files/index.js +354 -493
  110. package/lib/files/persmission.js +0 -15
  111. package/lib/files/utils.js +32 -55
  112. package/lib/hive/index.js +1 -13
  113. package/lib/hive/stores/base-store.js +14 -50
  114. package/lib/hive/stores/index.js +0 -10
  115. package/lib/hive/stores/key-value.js +4 -37
  116. package/lib/hive/stores/list.js +0 -32
  117. package/lib/hive/stores/map.js +0 -34
  118. package/lib/hive/stores/set.js +0 -29
  119. package/lib/hive/stores/sorted-set.js +19 -94
  120. package/lib/hive/utils.js +0 -2
  121. package/lib/index.js +51 -71
  122. package/lib/local-cache/index.js +0 -10
  123. package/lib/local-cache/local-storage.js +1 -9
  124. package/lib/local-cache/virtual-storage.js +0 -6
  125. package/lib/logging/index.js +21 -46
  126. package/lib/logging/logger.js +0 -6
  127. package/lib/management/data.js +0 -8
  128. package/lib/management/index.js +3 -7
  129. package/lib/messaging/channel/index.js +0 -27
  130. package/lib/messaging/helpers/body-parts.js +3 -6
  131. package/lib/messaging/helpers/delivery-options.js +3 -6
  132. package/lib/messaging/helpers/email-envelope.js +13 -25
  133. package/lib/messaging/helpers/index.js +10 -16
  134. package/lib/messaging/helpers/publish-options.js +3 -6
  135. package/lib/messaging/index.js +213 -317
  136. package/lib/persmission.js +7 -16
  137. package/lib/request/index.js +2 -16
  138. package/lib/rso/connection.js +3 -34
  139. package/lib/rso/index.js +0 -7
  140. package/lib/rt.js +21 -52
  141. package/lib/unit-of-work/constants.js +1 -1
  142. package/lib/unit-of-work/index.js +27 -145
  143. package/lib/unit-of-work/json-adapter.js +14 -35
  144. package/lib/unit-of-work/op-result-value-reference.js +1 -11
  145. package/lib/unit-of-work/op-result.js +2 -13
  146. package/lib/urls.js +18 -15
  147. package/lib/user-agent.js +0 -7
  148. package/lib/users/index.js +345 -552
  149. package/lib/users/roles.js +79 -128
  150. package/lib/users/social/container.js +0 -16
  151. package/lib/users/social/index.js +166 -250
  152. package/lib/users/user.js +2 -9
  153. package/lib/users/utils.js +0 -3
  154. package/lib/utils.js +0 -17
  155. package/package.json +16 -16
  156. package/src/data/store.js +3 -1
  157. package/src/expression.js +16 -0
  158. package/src/files/utils.js +1 -1
  159. package/src/index.js +5 -0
package/es/cache/index.js CHANGED
@@ -1,29 +1,21 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports["default"] = void 0;
9
-
10
8
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
-
12
9
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
13
-
14
10
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
15
-
16
11
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
17
-
18
12
  var _utils = _interopRequireDefault(require("../utils"));
19
-
20
13
  var Cache = /*#__PURE__*/function () {
21
14
  function Cache(app) {
22
15
  (0, _classCallCheck2["default"])(this, Cache);
23
16
  this.app = app;
24
17
  this.parsers = {};
25
18
  }
26
-
27
19
  (0, _createClass2["default"])(Cache, [{
28
20
  key: "setObjectFactory",
29
21
  value: function setObjectFactory(objectName, factoryMethod) {
@@ -33,15 +25,12 @@ var Cache = /*#__PURE__*/function () {
33
25
  key: "parseItem",
34
26
  value: function parseItem(item) {
35
27
  var className = item && item.___class;
36
-
37
28
  if (className) {
38
29
  var Class = this.parsers[className];
39
-
40
30
  if (Class) {
41
31
  item = new Class(item);
42
32
  }
43
33
  }
44
-
45
34
  return item;
46
35
  }
47
36
  }, {
@@ -50,7 +39,6 @@ var Cache = /*#__PURE__*/function () {
50
39
  if (_utils["default"].isCustomClassInstance(item)) {
51
40
  item.___class = item.___class || _utils["default"].getClassName(item);
52
41
  }
53
-
54
42
  return JSON.stringify(item);
55
43
  }
56
44
  }, {
@@ -58,48 +46,39 @@ var Cache = /*#__PURE__*/function () {
58
46
  value: function () {
59
47
  var _put = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(key, value, timeToLive) {
60
48
  return _regenerator["default"].wrap(function _callee$(_context) {
61
- while (1) {
62
- switch (_context.prev = _context.next) {
63
- case 0:
64
- if (!(!key || typeof key !== 'string')) {
65
- _context.next = 2;
66
- break;
67
- }
68
-
69
- throw new Error('Cache Key must be provided and must be a string.');
70
-
71
- case 2:
72
- if (!(timeToLive && (typeof timeToLive !== 'number' || timeToLive < 0))) {
73
- _context.next = 4;
74
- break;
75
- }
76
-
77
- throw new Error('Cache TimeToLive must be a positive number.');
78
-
79
- case 4:
80
- return _context.abrupt("return", this.app.request.put({
81
- url: this.app.urls.cacheItem(key),
82
- query: {
83
- timeout: timeToLive
84
- },
85
- headers: {
86
- 'Content-Type': 'application/json'
87
- },
88
- data: this.stringifyItem(value)
89
- }));
90
-
91
- case 5:
92
- case "end":
93
- return _context.stop();
94
- }
49
+ while (1) switch (_context.prev = _context.next) {
50
+ case 0:
51
+ if (!(!key || typeof key !== 'string')) {
52
+ _context.next = 2;
53
+ break;
54
+ }
55
+ throw new Error('Cache Key must be provided and must be a string.');
56
+ case 2:
57
+ if (!(timeToLive && (typeof timeToLive !== 'number' || timeToLive < 0))) {
58
+ _context.next = 4;
59
+ break;
60
+ }
61
+ throw new Error('Cache TimeToLive must be a positive number.');
62
+ case 4:
63
+ return _context.abrupt("return", this.app.request.put({
64
+ url: this.app.urls.cacheItem(key),
65
+ query: {
66
+ timeout: timeToLive
67
+ },
68
+ headers: {
69
+ 'Content-Type': 'application/json'
70
+ },
71
+ data: this.stringifyItem(value)
72
+ }));
73
+ case 5:
74
+ case "end":
75
+ return _context.stop();
95
76
  }
96
77
  }, _callee, this);
97
78
  }));
98
-
99
79
  function put(_x, _x2, _x3) {
100
80
  return _put.apply(this, arguments);
101
81
  }
102
-
103
82
  return put;
104
83
  }()
105
84
  }, {
@@ -107,37 +86,29 @@ var Cache = /*#__PURE__*/function () {
107
86
  value: function () {
108
87
  var _get = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(key) {
109
88
  var _this = this;
110
-
111
89
  return _regenerator["default"].wrap(function _callee2$(_context2) {
112
- while (1) {
113
- switch (_context2.prev = _context2.next) {
114
- case 0:
115
- if (!(!key || typeof key !== 'string')) {
116
- _context2.next = 2;
117
- break;
118
- }
119
-
120
- throw new Error('Cache Key must be provided and must be a string.');
121
-
122
- case 2:
123
- return _context2.abrupt("return", this.app.request.get({
124
- url: this.app.urls.cacheItem(key)
125
- }).then(function (item) {
126
- return _this.parseItem(item);
127
- }));
128
-
129
- case 3:
130
- case "end":
131
- return _context2.stop();
132
- }
90
+ while (1) switch (_context2.prev = _context2.next) {
91
+ case 0:
92
+ if (!(!key || typeof key !== 'string')) {
93
+ _context2.next = 2;
94
+ break;
95
+ }
96
+ throw new Error('Cache Key must be provided and must be a string.');
97
+ case 2:
98
+ return _context2.abrupt("return", this.app.request.get({
99
+ url: this.app.urls.cacheItem(key)
100
+ }).then(function (item) {
101
+ return _this.parseItem(item);
102
+ }));
103
+ case 3:
104
+ case "end":
105
+ return _context2.stop();
133
106
  }
134
107
  }, _callee2, this);
135
108
  }));
136
-
137
109
  function get(_x4) {
138
110
  return _get.apply(this, arguments);
139
111
  }
140
-
141
112
  return get;
142
113
  }()
143
114
  }, {
@@ -145,33 +116,26 @@ var Cache = /*#__PURE__*/function () {
145
116
  value: function () {
146
117
  var _remove = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(key) {
147
118
  return _regenerator["default"].wrap(function _callee3$(_context3) {
148
- while (1) {
149
- switch (_context3.prev = _context3.next) {
150
- case 0:
151
- if (!(!key || typeof key !== 'string')) {
152
- _context3.next = 2;
153
- break;
154
- }
155
-
156
- throw new Error('Cache Key must be provided and must be a string.');
157
-
158
- case 2:
159
- return _context3.abrupt("return", this.app.request["delete"]({
160
- url: this.app.urls.cacheItem(key)
161
- }));
162
-
163
- case 3:
164
- case "end":
165
- return _context3.stop();
166
- }
119
+ while (1) switch (_context3.prev = _context3.next) {
120
+ case 0:
121
+ if (!(!key || typeof key !== 'string')) {
122
+ _context3.next = 2;
123
+ break;
124
+ }
125
+ throw new Error('Cache Key must be provided and must be a string.');
126
+ case 2:
127
+ return _context3.abrupt("return", this.app.request["delete"]({
128
+ url: this.app.urls.cacheItem(key)
129
+ }));
130
+ case 3:
131
+ case "end":
132
+ return _context3.stop();
167
133
  }
168
134
  }, _callee3, this);
169
135
  }));
170
-
171
136
  function remove(_x5) {
172
137
  return _remove.apply(this, arguments);
173
138
  }
174
-
175
139
  return remove;
176
140
  }()
177
141
  }, {
@@ -179,33 +143,26 @@ var Cache = /*#__PURE__*/function () {
179
143
  value: function () {
180
144
  var _contains = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(key) {
181
145
  return _regenerator["default"].wrap(function _callee4$(_context4) {
182
- while (1) {
183
- switch (_context4.prev = _context4.next) {
184
- case 0:
185
- if (!(!key || typeof key !== 'string')) {
186
- _context4.next = 2;
187
- break;
188
- }
189
-
190
- throw new Error('Cache Key must be provided and must be a string.');
191
-
192
- case 2:
193
- return _context4.abrupt("return", this.app.request.get({
194
- url: this.app.urls.cacheItemCheck(key)
195
- }));
196
-
197
- case 3:
198
- case "end":
199
- return _context4.stop();
200
- }
146
+ while (1) switch (_context4.prev = _context4.next) {
147
+ case 0:
148
+ if (!(!key || typeof key !== 'string')) {
149
+ _context4.next = 2;
150
+ break;
151
+ }
152
+ throw new Error('Cache Key must be provided and must be a string.');
153
+ case 2:
154
+ return _context4.abrupt("return", this.app.request.get({
155
+ url: this.app.urls.cacheItemCheck(key)
156
+ }));
157
+ case 3:
158
+ case "end":
159
+ return _context4.stop();
201
160
  }
202
161
  }, _callee4, this);
203
162
  }));
204
-
205
163
  function contains(_x6) {
206
164
  return _contains.apply(this, arguments);
207
165
  }
208
-
209
166
  return contains;
210
167
  }()
211
168
  }, {
@@ -213,45 +170,36 @@ var Cache = /*#__PURE__*/function () {
213
170
  value: function () {
214
171
  var _expireIn = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(key, seconds) {
215
172
  return _regenerator["default"].wrap(function _callee5$(_context5) {
216
- while (1) {
217
- switch (_context5.prev = _context5.next) {
218
- case 0:
219
- if (!(!key || typeof key !== 'string')) {
220
- _context5.next = 2;
221
- break;
222
- }
223
-
224
- throw new Error('Cache Key must be provided and must be a string.');
225
-
226
- case 2:
227
- if (!(typeof seconds !== 'number' || seconds <= 0)) {
228
- _context5.next = 4;
229
- break;
230
- }
231
-
232
- throw new Error('Cache Expiration must be provided and must be a number of seconds.');
233
-
234
- case 4:
235
- return _context5.abrupt("return", this.app.request.put({
236
- url: this.app.urls.cacheItemExpireIn(key),
237
- query: {
238
- timeout: seconds
239
- },
240
- data: {}
241
- }));
242
-
243
- case 5:
244
- case "end":
245
- return _context5.stop();
246
- }
173
+ while (1) switch (_context5.prev = _context5.next) {
174
+ case 0:
175
+ if (!(!key || typeof key !== 'string')) {
176
+ _context5.next = 2;
177
+ break;
178
+ }
179
+ throw new Error('Cache Key must be provided and must be a string.');
180
+ case 2:
181
+ if (!(typeof seconds !== 'number' || seconds <= 0)) {
182
+ _context5.next = 4;
183
+ break;
184
+ }
185
+ throw new Error('Cache Expiration must be provided and must be a number of seconds.');
186
+ case 4:
187
+ return _context5.abrupt("return", this.app.request.put({
188
+ url: this.app.urls.cacheItemExpireIn(key),
189
+ query: {
190
+ timeout: seconds
191
+ },
192
+ data: {}
193
+ }));
194
+ case 5:
195
+ case "end":
196
+ return _context5.stop();
247
197
  }
248
198
  }, _callee5, this);
249
199
  }));
250
-
251
200
  function expireIn(_x7, _x8) {
252
201
  return _expireIn.apply(this, arguments);
253
202
  }
254
-
255
203
  return expireIn;
256
204
  }()
257
205
  }, {
@@ -259,59 +207,47 @@ var Cache = /*#__PURE__*/function () {
259
207
  value: function () {
260
208
  var _expireAt = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(key, timestamp) {
261
209
  return _regenerator["default"].wrap(function _callee6$(_context6) {
262
- while (1) {
263
- switch (_context6.prev = _context6.next) {
264
- case 0:
265
- if (!(!key || typeof key !== 'string')) {
266
- _context6.next = 2;
267
- break;
268
- }
269
-
270
- throw new Error('Cache Key must be provided and must be a string.');
271
-
272
- case 2:
273
- if (!(timestamp instanceof Date)) {
274
- _context6.next = 6;
275
- break;
276
- }
277
-
278
- timestamp = timestamp.getTime();
210
+ while (1) switch (_context6.prev = _context6.next) {
211
+ case 0:
212
+ if (!(!key || typeof key !== 'string')) {
213
+ _context6.next = 2;
214
+ break;
215
+ }
216
+ throw new Error('Cache Key must be provided and must be a string.');
217
+ case 2:
218
+ if (!(timestamp instanceof Date)) {
219
+ _context6.next = 6;
220
+ break;
221
+ }
222
+ timestamp = timestamp.getTime();
223
+ _context6.next = 8;
224
+ break;
225
+ case 6:
226
+ if (!(typeof timestamp !== 'number' || timestamp <= 0)) {
279
227
  _context6.next = 8;
280
228
  break;
281
-
282
- case 6:
283
- if (!(typeof timestamp !== 'number' || timestamp <= 0)) {
284
- _context6.next = 8;
285
- break;
286
- }
287
-
288
- throw new Error('Cache Expiration must be provided and must be a timestamp or an instance of Date.');
289
-
290
- case 8:
291
- return _context6.abrupt("return", this.app.request.put({
292
- url: this.app.urls.cacheItemExpireAt(key),
293
- query: {
294
- timestamp: timestamp
295
- },
296
- data: {}
297
- }));
298
-
299
- case 9:
300
- case "end":
301
- return _context6.stop();
302
- }
229
+ }
230
+ throw new Error('Cache Expiration must be provided and must be a timestamp or an instance of Date.');
231
+ case 8:
232
+ return _context6.abrupt("return", this.app.request.put({
233
+ url: this.app.urls.cacheItemExpireAt(key),
234
+ query: {
235
+ timestamp: timestamp
236
+ },
237
+ data: {}
238
+ }));
239
+ case 9:
240
+ case "end":
241
+ return _context6.stop();
303
242
  }
304
243
  }, _callee6, this);
305
244
  }));
306
-
307
245
  function expireAt(_x9, _x10) {
308
246
  return _expireAt.apply(this, arguments);
309
247
  }
310
-
311
248
  return expireAt;
312
249
  }()
313
250
  }]);
314
251
  return Cache;
315
252
  }();
316
-
317
253
  exports["default"] = Cache;