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
@@ -1,34 +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 _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
-
14
10
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
15
-
16
11
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
17
-
18
12
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
19
-
20
13
  var _utils = require("./utils");
21
-
22
14
  var _user = _interopRequireDefault(require("./user"));
23
-
24
15
  var _roles = _interopRequireDefault(require("./roles"));
25
-
26
16
  var _social = _interopRequireDefault(require("./social"));
27
-
28
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
29
-
30
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
31
-
17
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
18
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
32
19
  var Users = /*#__PURE__*/function () {
33
20
  function Users(app) {
34
21
  (0, _classCallCheck2["default"])(this, Users);
@@ -37,7 +24,6 @@ var Users = /*#__PURE__*/function () {
37
24
  this.social = new _social["default"](this);
38
25
  this.dataStore = this.app.Data.of(_user["default"]);
39
26
  }
40
-
41
27
  (0, _createClass2["default"])(Users, [{
42
28
  key: "Utils",
43
29
  get: function get() {
@@ -48,41 +34,32 @@ var Users = /*#__PURE__*/function () {
48
34
  value: function () {
49
35
  var _register = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(user) {
50
36
  var _this = this;
51
-
52
37
  var clientUserLocale;
53
38
  return _regenerator["default"].wrap(function _callee$(_context) {
54
- while (1) {
55
- switch (_context.prev = _context.next) {
56
- case 0:
57
- user = _objectSpread({}, user);
58
-
59
- if (!user.blUserLocale) {
60
- clientUserLocale = this.Utils.getClientUserLocale();
61
-
62
- if (clientUserLocale) {
63
- user.blUserLocale = clientUserLocale;
64
- }
39
+ while (1) switch (_context.prev = _context.next) {
40
+ case 0:
41
+ user = _objectSpread({}, user);
42
+ if (!user.blUserLocale) {
43
+ clientUserLocale = this.Utils.getClientUserLocale();
44
+ if (clientUserLocale) {
45
+ user.blUserLocale = clientUserLocale;
65
46
  }
66
-
67
- return _context.abrupt("return", this.app.request.post({
68
- url: this.app.urls.userRegister(),
69
- data: user
70
- }).then(function (data) {
71
- return _this.dataStore.parseResponse(data);
72
- }));
73
-
74
- case 3:
75
- case "end":
76
- return _context.stop();
77
- }
47
+ }
48
+ return _context.abrupt("return", this.app.request.post({
49
+ url: this.app.urls.userRegister(),
50
+ data: user
51
+ }).then(function (data) {
52
+ return _this.dataStore.parseResponse(data);
53
+ }));
54
+ case 3:
55
+ case "end":
56
+ return _context.stop();
78
57
  }
79
58
  }, _callee, this);
80
59
  }));
81
-
82
60
  function register(_x) {
83
61
  return _register.apply(this, arguments);
84
62
  }
85
-
86
63
  return register;
87
64
  }()
88
65
  }, {
@@ -90,77 +67,60 @@ var Users = /*#__PURE__*/function () {
90
67
  value: function () {
91
68
  var _login2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(_login, password, stayLoggedIn) {
92
69
  var _this2 = this;
93
-
94
70
  var data;
95
71
  return _regenerator["default"].wrap(function _callee2$(_context2) {
96
- while (1) {
97
- switch (_context2.prev = _context2.next) {
98
- case 0:
99
- data = {};
100
-
101
- if (!(typeof _login !== 'string' && typeof _login !== 'number')) {
102
- _context2.next = 3;
103
- break;
104
- }
105
-
106
- throw new Error('the first argument must be either a string or a number');
107
-
108
- case 3:
109
- if (_login) {
110
- _context2.next = 5;
111
- break;
112
- }
113
-
114
- throw new Error('the first argument cannot be an empty value');
115
-
116
- case 5:
117
- if (typeof password === 'boolean') {
118
- stayLoggedIn = password;
119
- password = undefined;
120
- }
121
-
122
- if (!(typeof _login === 'string' && password === undefined)) {
123
- _context2.next = 10;
124
- break;
125
- }
126
-
127
- data.objectId = _login;
128
- _context2.next = 14;
72
+ while (1) switch (_context2.prev = _context2.next) {
73
+ case 0:
74
+ data = {};
75
+ if (!(typeof _login !== 'string' && typeof _login !== 'number')) {
76
+ _context2.next = 3;
129
77
  break;
130
-
131
- case 10:
132
- if (password) {
133
- _context2.next = 12;
134
- break;
135
- }
136
-
137
- throw new Error('the "password" value cannot be an empty value');
138
-
139
- case 12:
140
- data.login = _login;
141
- data.password = password;
142
-
143
- case 14:
144
- stayLoggedIn = stayLoggedIn === true;
145
- return _context2.abrupt("return", this.app.request.post({
146
- url: this.app.urls.userLogin(),
147
- data: data
148
- }).then(function (data) {
149
- return _this2.setCurrentUser(data, stayLoggedIn);
150
- }));
151
-
152
- case 16:
153
- case "end":
154
- return _context2.stop();
155
- }
78
+ }
79
+ throw new Error('the first argument must be either a string or a number');
80
+ case 3:
81
+ if (_login) {
82
+ _context2.next = 5;
83
+ break;
84
+ }
85
+ throw new Error('the first argument cannot be an empty value');
86
+ case 5:
87
+ if (typeof password === 'boolean') {
88
+ stayLoggedIn = password;
89
+ password = undefined;
90
+ }
91
+ if (!(typeof _login === 'string' && password === undefined)) {
92
+ _context2.next = 10;
93
+ break;
94
+ }
95
+ data.objectId = _login;
96
+ _context2.next = 14;
97
+ break;
98
+ case 10:
99
+ if (password) {
100
+ _context2.next = 12;
101
+ break;
102
+ }
103
+ throw new Error('the "password" value cannot be an empty value');
104
+ case 12:
105
+ data.login = _login;
106
+ data.password = password;
107
+ case 14:
108
+ stayLoggedIn = stayLoggedIn === true;
109
+ return _context2.abrupt("return", this.app.request.post({
110
+ url: this.app.urls.userLogin(),
111
+ data: data
112
+ }).then(function (data) {
113
+ return _this2.setCurrentUser(data, stayLoggedIn);
114
+ }));
115
+ case 16:
116
+ case "end":
117
+ return _context2.stop();
156
118
  }
157
119
  }, _callee2, this);
158
120
  }));
159
-
160
121
  function login(_x2, _x3, _x4) {
161
122
  return _login2.apply(this, arguments);
162
123
  }
163
-
164
124
  return login;
165
125
  }()
166
126
  }, {
@@ -168,30 +128,24 @@ var Users = /*#__PURE__*/function () {
168
128
  value: function () {
169
129
  var _loginAsGuest = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(stayLoggedIn) {
170
130
  var _this3 = this;
171
-
172
131
  return _regenerator["default"].wrap(function _callee3$(_context3) {
173
- while (1) {
174
- switch (_context3.prev = _context3.next) {
175
- case 0:
176
- stayLoggedIn = stayLoggedIn === true;
177
- return _context3.abrupt("return", this.app.request.post({
178
- url: this.app.urls.guestLogin()
179
- }).then(function (data) {
180
- return _this3.setCurrentUser(data, stayLoggedIn);
181
- }));
182
-
183
- case 2:
184
- case "end":
185
- return _context3.stop();
186
- }
132
+ while (1) switch (_context3.prev = _context3.next) {
133
+ case 0:
134
+ stayLoggedIn = stayLoggedIn === true;
135
+ return _context3.abrupt("return", this.app.request.post({
136
+ url: this.app.urls.guestLogin()
137
+ }).then(function (data) {
138
+ return _this3.setCurrentUser(data, stayLoggedIn);
139
+ }));
140
+ case 2:
141
+ case "end":
142
+ return _context3.stop();
187
143
  }
188
144
  }, _callee3, this);
189
145
  }));
190
-
191
146
  function loginAsGuest(_x5) {
192
147
  return _loginAsGuest.apply(this, arguments);
193
148
  }
194
-
195
149
  return loginAsGuest;
196
150
  }()
197
151
  }, {
@@ -199,23 +153,18 @@ var Users = /*#__PURE__*/function () {
199
153
  value: function () {
200
154
  var _loginWithFacebook = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(fieldsMapping, permissions, stayLoggedIn) {
201
155
  return _regenerator["default"].wrap(function _callee4$(_context4) {
202
- while (1) {
203
- switch (_context4.prev = _context4.next) {
204
- case 0:
205
- return _context4.abrupt("return", this.social.loginWithFacebook(fieldsMapping, permissions, stayLoggedIn));
206
-
207
- case 1:
208
- case "end":
209
- return _context4.stop();
210
- }
156
+ while (1) switch (_context4.prev = _context4.next) {
157
+ case 0:
158
+ return _context4.abrupt("return", this.social.loginWithFacebook(fieldsMapping, permissions, stayLoggedIn));
159
+ case 1:
160
+ case "end":
161
+ return _context4.stop();
211
162
  }
212
163
  }, _callee4, this);
213
164
  }));
214
-
215
165
  function loginWithFacebook(_x6, _x7, _x8) {
216
166
  return _loginWithFacebook.apply(this, arguments);
217
167
  }
218
-
219
168
  return loginWithFacebook;
220
169
  }()
221
170
  }, {
@@ -223,23 +172,18 @@ var Users = /*#__PURE__*/function () {
223
172
  value: function () {
224
173
  var _loginWithFacebookSdk = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(accessToken, fieldsMapping, stayLoggedIn, options) {
225
174
  return _regenerator["default"].wrap(function _callee5$(_context5) {
226
- while (1) {
227
- switch (_context5.prev = _context5.next) {
228
- case 0:
229
- return _context5.abrupt("return", this.social.loginWithFacebookSdk(accessToken, fieldsMapping, stayLoggedIn, options));
230
-
231
- case 1:
232
- case "end":
233
- return _context5.stop();
234
- }
175
+ while (1) switch (_context5.prev = _context5.next) {
176
+ case 0:
177
+ return _context5.abrupt("return", this.social.loginWithFacebookSdk(accessToken, fieldsMapping, stayLoggedIn, options));
178
+ case 1:
179
+ case "end":
180
+ return _context5.stop();
235
181
  }
236
182
  }, _callee5, this);
237
183
  }));
238
-
239
184
  function loginWithFacebookSdk(_x9, _x10, _x11, _x12) {
240
185
  return _loginWithFacebookSdk.apply(this, arguments);
241
186
  }
242
-
243
187
  return loginWithFacebookSdk;
244
188
  }()
245
189
  }, {
@@ -247,23 +191,18 @@ var Users = /*#__PURE__*/function () {
247
191
  value: function () {
248
192
  var _loginWithGooglePlus = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(fieldsMapping, permissions, container, stayLoggedIn) {
249
193
  return _regenerator["default"].wrap(function _callee6$(_context6) {
250
- while (1) {
251
- switch (_context6.prev = _context6.next) {
252
- case 0:
253
- return _context6.abrupt("return", this.social.loginWithGooglePlus(fieldsMapping, permissions, container, stayLoggedIn));
254
-
255
- case 1:
256
- case "end":
257
- return _context6.stop();
258
- }
194
+ while (1) switch (_context6.prev = _context6.next) {
195
+ case 0:
196
+ return _context6.abrupt("return", this.social.loginWithGooglePlus(fieldsMapping, permissions, container, stayLoggedIn));
197
+ case 1:
198
+ case "end":
199
+ return _context6.stop();
259
200
  }
260
201
  }, _callee6, this);
261
202
  }));
262
-
263
203
  function loginWithGooglePlus(_x13, _x14, _x15, _x16) {
264
204
  return _loginWithGooglePlus.apply(this, arguments);
265
205
  }
266
-
267
206
  return loginWithGooglePlus;
268
207
  }()
269
208
  }, {
@@ -271,23 +210,18 @@ var Users = /*#__PURE__*/function () {
271
210
  value: function () {
272
211
  var _loginWithGooglePlusSdk = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(accessToken, fieldsMapping, stayLoggedIn) {
273
212
  return _regenerator["default"].wrap(function _callee7$(_context7) {
274
- while (1) {
275
- switch (_context7.prev = _context7.next) {
276
- case 0:
277
- return _context7.abrupt("return", this.social.loginWithGooglePlusSdk(accessToken, fieldsMapping, stayLoggedIn));
278
-
279
- case 1:
280
- case "end":
281
- return _context7.stop();
282
- }
213
+ while (1) switch (_context7.prev = _context7.next) {
214
+ case 0:
215
+ return _context7.abrupt("return", this.social.loginWithGooglePlusSdk(accessToken, fieldsMapping, stayLoggedIn));
216
+ case 1:
217
+ case "end":
218
+ return _context7.stop();
283
219
  }
284
220
  }, _callee7, this);
285
221
  }));
286
-
287
222
  function loginWithGooglePlusSdk(_x17, _x18, _x19) {
288
223
  return _loginWithGooglePlusSdk.apply(this, arguments);
289
224
  }
290
-
291
225
  return loginWithGooglePlusSdk;
292
226
  }()
293
227
  }, {
@@ -295,23 +229,18 @@ var Users = /*#__PURE__*/function () {
295
229
  value: function () {
296
230
  var _loginWithTwitter = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8(fieldsMapping, stayLoggedIn) {
297
231
  return _regenerator["default"].wrap(function _callee8$(_context8) {
298
- while (1) {
299
- switch (_context8.prev = _context8.next) {
300
- case 0:
301
- return _context8.abrupt("return", this.social.loginWithTwitter(fieldsMapping, stayLoggedIn));
302
-
303
- case 1:
304
- case "end":
305
- return _context8.stop();
306
- }
232
+ while (1) switch (_context8.prev = _context8.next) {
233
+ case 0:
234
+ return _context8.abrupt("return", this.social.loginWithTwitter(fieldsMapping, stayLoggedIn));
235
+ case 1:
236
+ case "end":
237
+ return _context8.stop();
307
238
  }
308
239
  }, _callee8, this);
309
240
  }));
310
-
311
241
  function loginWithTwitter(_x20, _x21) {
312
242
  return _loginWithTwitter.apply(this, arguments);
313
243
  }
314
-
315
244
  return loginWithTwitter;
316
245
  }()
317
246
  }, {
@@ -319,23 +248,18 @@ var Users = /*#__PURE__*/function () {
319
248
  value: function () {
320
249
  var _loginWithOauth = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(providerCode, accessToken, guestUser, fieldsMapping, stayLoggedIn) {
321
250
  return _regenerator["default"].wrap(function _callee9$(_context9) {
322
- while (1) {
323
- switch (_context9.prev = _context9.next) {
324
- case 0:
325
- return _context9.abrupt("return", this.social.loginWithOauth2(providerCode, accessToken, guestUser, fieldsMapping, stayLoggedIn));
326
-
327
- case 1:
328
- case "end":
329
- return _context9.stop();
330
- }
251
+ while (1) switch (_context9.prev = _context9.next) {
252
+ case 0:
253
+ return _context9.abrupt("return", this.social.loginWithOauth2(providerCode, accessToken, guestUser, fieldsMapping, stayLoggedIn));
254
+ case 1:
255
+ case "end":
256
+ return _context9.stop();
331
257
  }
332
258
  }, _callee9, this);
333
259
  }));
334
-
335
260
  function loginWithOauth2(_x22, _x23, _x24, _x25, _x26) {
336
261
  return _loginWithOauth.apply(this, arguments);
337
262
  }
338
-
339
263
  return loginWithOauth2;
340
264
  }()
341
265
  }, {
@@ -343,23 +267,18 @@ var Users = /*#__PURE__*/function () {
343
267
  value: function () {
344
268
  var _loginWithOauth2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(providerCode, accessToken, accessTokenSecret, guestUser, fieldsMapping, stayLoggedIn) {
345
269
  return _regenerator["default"].wrap(function _callee10$(_context10) {
346
- while (1) {
347
- switch (_context10.prev = _context10.next) {
348
- case 0:
349
- return _context10.abrupt("return", this.social.loginWithOauth1(providerCode, accessToken, accessTokenSecret, guestUser, fieldsMapping, stayLoggedIn));
350
-
351
- case 1:
352
- case "end":
353
- return _context10.stop();
354
- }
270
+ while (1) switch (_context10.prev = _context10.next) {
271
+ case 0:
272
+ return _context10.abrupt("return", this.social.loginWithOauth1(providerCode, accessToken, accessTokenSecret, guestUser, fieldsMapping, stayLoggedIn));
273
+ case 1:
274
+ case "end":
275
+ return _context10.stop();
355
276
  }
356
277
  }, _callee10, this);
357
278
  }));
358
-
359
279
  function loginWithOauth1(_x27, _x28, _x29, _x30, _x31, _x32) {
360
280
  return _loginWithOauth2.apply(this, arguments);
361
281
  }
362
-
363
282
  return loginWithOauth1;
364
283
  }()
365
284
  }, {
@@ -367,35 +286,28 @@ var Users = /*#__PURE__*/function () {
367
286
  value: function () {
368
287
  var _logout = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11() {
369
288
  var _this4 = this;
370
-
371
289
  return _regenerator["default"].wrap(function _callee11$(_context11) {
372
- while (1) {
373
- switch (_context11.prev = _context11.next) {
374
- case 0:
375
- return _context11.abrupt("return", this.app.request.get({
376
- url: this.app.urls.userLogout()
377
- }).then(function () {
290
+ while (1) switch (_context11.prev = _context11.next) {
291
+ case 0:
292
+ return _context11.abrupt("return", this.app.request.get({
293
+ url: this.app.urls.userLogout()
294
+ }).then(function () {
295
+ _this4.setCurrentUser(null);
296
+ })["catch"](function (error) {
297
+ if ([3023, 3064, 3090, 3091].includes(error.code)) {
378
298
  _this4.setCurrentUser(null);
379
- })["catch"](function (error) {
380
- if ([3023, 3064, 3090, 3091].includes(error.code)) {
381
- _this4.setCurrentUser(null);
382
- }
383
-
384
- throw error;
385
- }));
386
-
387
- case 1:
388
- case "end":
389
- return _context11.stop();
390
- }
299
+ }
300
+ throw error;
301
+ }));
302
+ case 1:
303
+ case "end":
304
+ return _context11.stop();
391
305
  }
392
306
  }, _callee11, this);
393
307
  }));
394
-
395
308
  function logout() {
396
309
  return _logout.apply(this, arguments);
397
310
  }
398
-
399
311
  return logout;
400
312
  }()
401
313
  }, {
@@ -403,59 +315,46 @@ var Users = /*#__PURE__*/function () {
403
315
  value: function () {
404
316
  var _getCurrentUser = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee12(reload) {
405
317
  var _this5 = this;
406
-
407
318
  var currentUserId;
408
319
  return _regenerator["default"].wrap(function _callee12$(_context12) {
409
- while (1) {
410
- switch (_context12.prev = _context12.next) {
411
- case 0:
412
- if (!(this.currentUser && !reload)) {
413
- _context12.next = 2;
414
- break;
415
- }
416
-
417
- return _context12.abrupt("return", this.currentUser);
418
-
419
- case 2:
420
- if (!this.currentUserRequest) {
421
- _context12.next = 4;
422
- break;
423
- }
424
-
425
- return _context12.abrupt("return", this.currentUserRequest);
426
-
427
- case 4:
428
- currentUserId = this.getCurrentUserId();
429
-
430
- if (!currentUserId) {
431
- _context12.next = 7;
432
- break;
433
- }
434
-
435
- return _context12.abrupt("return", this.currentUserRequest = this.dataStore.findById(currentUserId).then(function (user) {
436
- _this5.currentUserRequest = null;
437
- user['user-token'] = _this5.currentUser && _this5.currentUser['user-token'] || undefined;
438
- return _this5.currentUser = user;
439
- })["catch"](function (error) {
440
- _this5.currentUserRequest = null;
441
- throw error;
442
- }));
443
-
444
- case 7:
445
- return _context12.abrupt("return", null);
446
-
447
- case 8:
448
- case "end":
449
- return _context12.stop();
450
- }
320
+ while (1) switch (_context12.prev = _context12.next) {
321
+ case 0:
322
+ if (!(this.currentUser && !reload)) {
323
+ _context12.next = 2;
324
+ break;
325
+ }
326
+ return _context12.abrupt("return", this.currentUser);
327
+ case 2:
328
+ if (!this.currentUserRequest) {
329
+ _context12.next = 4;
330
+ break;
331
+ }
332
+ return _context12.abrupt("return", this.currentUserRequest);
333
+ case 4:
334
+ currentUserId = this.getCurrentUserId();
335
+ if (!currentUserId) {
336
+ _context12.next = 7;
337
+ break;
338
+ }
339
+ return _context12.abrupt("return", this.currentUserRequest = this.dataStore.findById(currentUserId).then(function (user) {
340
+ _this5.currentUserRequest = null;
341
+ user['user-token'] = _this5.currentUser && _this5.currentUser['user-token'] || undefined;
342
+ return _this5.currentUser = user;
343
+ })["catch"](function (error) {
344
+ _this5.currentUserRequest = null;
345
+ throw error;
346
+ }));
347
+ case 7:
348
+ return _context12.abrupt("return", null);
349
+ case 8:
350
+ case "end":
351
+ return _context12.stop();
451
352
  }
452
353
  }, _callee12, this);
453
354
  }));
454
-
455
355
  function getCurrentUser(_x33) {
456
356
  return _getCurrentUser.apply(this, arguments);
457
357
  }
458
-
459
358
  return getCurrentUser;
460
359
  }()
461
360
  }, {
@@ -465,23 +364,19 @@ var Users = /*#__PURE__*/function () {
465
364
  this.app.LocalCache.remove(this.app.LocalCache.Keys.CURRENT_USER_ID);
466
365
  this.app.LocalCache.remove(this.app.LocalCache.Keys.STAY_LOGGED_IN);
467
366
  this.currentUser = user || null;
468
-
469
367
  if (this.currentUser) {
470
368
  if (!(this.currentUser instanceof _user["default"])) {
471
369
  this.currentUser = this.dataStore.parseResponse(this.currentUser);
472
370
  }
473
-
474
371
  if (stayLoggedIn) {
475
372
  this.app.LocalCache.set(this.app.LocalCache.Keys.STAY_LOGGED_IN, true);
476
373
  this.app.LocalCache.set(this.app.LocalCache.Keys.USER_TOKEN, this.currentUser['user-token']);
477
374
  this.app.LocalCache.set(this.app.LocalCache.Keys.CURRENT_USER_ID, this.currentUser.objectId);
478
375
  }
479
376
  }
480
-
481
377
  if (this.app.__RT) {
482
378
  this.app.RT.updateUserTokenIfNeeded();
483
379
  }
484
-
485
380
  return this.currentUser;
486
381
  }
487
382
  }, {
@@ -490,35 +385,27 @@ var Users = /*#__PURE__*/function () {
490
385
  var _isValidLogin = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee13() {
491
386
  var userToken;
492
387
  return _regenerator["default"].wrap(function _callee13$(_context13) {
493
- while (1) {
494
- switch (_context13.prev = _context13.next) {
495
- case 0:
496
- userToken = this.getCurrentUserToken();
497
-
498
- if (!userToken) {
499
- _context13.next = 3;
500
- break;
501
- }
502
-
503
- return _context13.abrupt("return", this.app.request.get({
504
- url: this.app.urls.userTokenCheck(userToken)
505
- }));
506
-
507
- case 3:
508
- return _context13.abrupt("return", false);
509
-
510
- case 4:
511
- case "end":
512
- return _context13.stop();
513
- }
388
+ while (1) switch (_context13.prev = _context13.next) {
389
+ case 0:
390
+ userToken = this.getCurrentUserToken();
391
+ if (!userToken) {
392
+ _context13.next = 3;
393
+ break;
394
+ }
395
+ return _context13.abrupt("return", this.app.request.get({
396
+ url: this.app.urls.userTokenCheck(userToken)
397
+ }));
398
+ case 3:
399
+ return _context13.abrupt("return", false);
400
+ case 4:
401
+ case "end":
402
+ return _context13.stop();
514
403
  }
515
404
  }, _callee13, this);
516
405
  }));
517
-
518
406
  function isValidLogin() {
519
407
  return _isValidLogin.apply(this, arguments);
520
408
  }
521
-
522
409
  return isValidLogin;
523
410
  }()
524
411
  }, {
@@ -526,46 +413,37 @@ var Users = /*#__PURE__*/function () {
526
413
  value: function () {
527
414
  var _verifyPassword = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee14(currentPassword) {
528
415
  return _regenerator["default"].wrap(function _callee14$(_context14) {
529
- while (1) {
530
- switch (_context14.prev = _context14.next) {
531
- case 0:
532
- if (!(!currentPassword || typeof currentPassword !== 'string')) {
533
- _context14.next = 2;
534
- break;
535
- }
536
-
537
- throw new Error('Password has to be a non empty string');
538
-
539
- case 2:
540
- if (this.getCurrentUserToken()) {
541
- _context14.next = 4;
542
- break;
416
+ while (1) switch (_context14.prev = _context14.next) {
417
+ case 0:
418
+ if (!(!currentPassword || typeof currentPassword !== 'string')) {
419
+ _context14.next = 2;
420
+ break;
421
+ }
422
+ throw new Error('Password has to be a non empty string');
423
+ case 2:
424
+ if (this.getCurrentUserToken()) {
425
+ _context14.next = 4;
426
+ break;
427
+ }
428
+ throw new Error('In order to check password you have to be logged in');
429
+ case 4:
430
+ return _context14.abrupt("return", this.app.request.post({
431
+ url: this.app.urls.userVerifyPassowrd(),
432
+ data: {
433
+ password: currentPassword
543
434
  }
544
-
545
- throw new Error('In order to check password you have to be logged in');
546
-
547
- case 4:
548
- return _context14.abrupt("return", this.app.request.post({
549
- url: this.app.urls.userVerifyPassowrd(),
550
- data: {
551
- password: currentPassword
552
- }
553
- }).then(function (result) {
554
- return !!(result && result.valid);
555
- }));
556
-
557
- case 5:
558
- case "end":
559
- return _context14.stop();
560
- }
435
+ }).then(function (result) {
436
+ return !!(result && result.valid);
437
+ }));
438
+ case 5:
439
+ case "end":
440
+ return _context14.stop();
561
441
  }
562
442
  }, _callee14, this);
563
443
  }));
564
-
565
444
  function verifyPassword(_x34) {
566
445
  return _verifyPassword.apply(this, arguments);
567
446
  }
568
-
569
447
  return verifyPassword;
570
448
  }()
571
449
  }, {
@@ -573,33 +451,26 @@ var Users = /*#__PURE__*/function () {
573
451
  value: function () {
574
452
  var _restorePassword = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee15(emailAddress) {
575
453
  return _regenerator["default"].wrap(function _callee15$(_context15) {
576
- while (1) {
577
- switch (_context15.prev = _context15.next) {
578
- case 0:
579
- if (!(!emailAddress || typeof emailAddress !== 'string')) {
580
- _context15.next = 2;
581
- break;
582
- }
583
-
584
- throw new Error('Email Address must be provided and must be a string.');
585
-
586
- case 2:
587
- return _context15.abrupt("return", this.app.request.get({
588
- url: this.app.urls.userRestorePassword(emailAddress)
589
- }));
590
-
591
- case 3:
592
- case "end":
593
- return _context15.stop();
594
- }
454
+ while (1) switch (_context15.prev = _context15.next) {
455
+ case 0:
456
+ if (!(!emailAddress || typeof emailAddress !== 'string')) {
457
+ _context15.next = 2;
458
+ break;
459
+ }
460
+ throw new Error('Email Address must be provided and must be a string.');
461
+ case 2:
462
+ return _context15.abrupt("return", this.app.request.get({
463
+ url: this.app.urls.userRestorePassword(emailAddress)
464
+ }));
465
+ case 3:
466
+ case "end":
467
+ return _context15.stop();
595
468
  }
596
469
  }, _callee15, this);
597
470
  }));
598
-
599
471
  function restorePassword(_x35) {
600
472
  return _restorePassword.apply(this, arguments);
601
473
  }
602
-
603
474
  return restorePassword;
604
475
  }()
605
476
  }, {
@@ -607,50 +478,39 @@ var Users = /*#__PURE__*/function () {
607
478
  value: function () {
608
479
  var _resendEmailConfirmation = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee16(identity) {
609
480
  return _regenerator["default"].wrap(function _callee16$(_context16) {
610
- while (1) {
611
- switch (_context16.prev = _context16.next) {
612
- case 0:
613
- if (!(typeof identity === 'string')) {
614
- _context16.next = 5;
615
- break;
616
- }
617
-
618
- if (identity) {
619
- _context16.next = 3;
620
- break;
621
- }
622
-
623
- throw new Error('Identity can not be an empty string.');
624
-
625
- case 3:
481
+ while (1) switch (_context16.prev = _context16.next) {
482
+ case 0:
483
+ if (!(typeof identity === 'string')) {
484
+ _context16.next = 5;
485
+ break;
486
+ }
487
+ if (identity) {
488
+ _context16.next = 3;
489
+ break;
490
+ }
491
+ throw new Error('Identity can not be an empty string.');
492
+ case 3:
493
+ _context16.next = 7;
494
+ break;
495
+ case 5:
496
+ if (!(typeof identity !== 'number')) {
626
497
  _context16.next = 7;
627
498
  break;
628
-
629
- case 5:
630
- if (!(typeof identity !== 'number')) {
631
- _context16.next = 7;
632
- break;
633
- }
634
-
635
- throw new Error('Identity must be a string or number.');
636
-
637
- case 7:
638
- return _context16.abrupt("return", this.app.request.post({
639
- url: this.app.urls.userResendConfirmation(identity)
640
- }));
641
-
642
- case 8:
643
- case "end":
644
- return _context16.stop();
645
- }
499
+ }
500
+ throw new Error('Identity must be a string or number.');
501
+ case 7:
502
+ return _context16.abrupt("return", this.app.request.post({
503
+ url: this.app.urls.userResendConfirmation(identity)
504
+ }));
505
+ case 8:
506
+ case "end":
507
+ return _context16.stop();
646
508
  }
647
509
  }, _callee16, this);
648
510
  }));
649
-
650
511
  function resendEmailConfirmation(_x36) {
651
512
  return _resendEmailConfirmation.apply(this, arguments);
652
513
  }
653
-
654
514
  return resendEmailConfirmation;
655
515
  }()
656
516
  }, {
@@ -658,50 +518,39 @@ var Users = /*#__PURE__*/function () {
658
518
  value: function () {
659
519
  var _createEmailConfirmationURL = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee17(identity) {
660
520
  return _regenerator["default"].wrap(function _callee17$(_context17) {
661
- while (1) {
662
- switch (_context17.prev = _context17.next) {
663
- case 0:
664
- if (!(typeof identity === 'string')) {
665
- _context17.next = 5;
666
- break;
667
- }
668
-
669
- if (identity) {
670
- _context17.next = 3;
671
- break;
672
- }
673
-
674
- throw new Error('Identity can not be an empty string.');
675
-
676
- case 3:
521
+ while (1) switch (_context17.prev = _context17.next) {
522
+ case 0:
523
+ if (!(typeof identity === 'string')) {
524
+ _context17.next = 5;
525
+ break;
526
+ }
527
+ if (identity) {
528
+ _context17.next = 3;
529
+ break;
530
+ }
531
+ throw new Error('Identity can not be an empty string.');
532
+ case 3:
533
+ _context17.next = 7;
534
+ break;
535
+ case 5:
536
+ if (!(typeof identity !== 'number')) {
677
537
  _context17.next = 7;
678
538
  break;
679
-
680
- case 5:
681
- if (!(typeof identity !== 'number')) {
682
- _context17.next = 7;
683
- break;
684
- }
685
-
686
- throw new Error('Identity must be a string or number.');
687
-
688
- case 7:
689
- return _context17.abrupt("return", this.app.request.post({
690
- url: this.app.urls.userCreateConfirmationURL(identity)
691
- }));
692
-
693
- case 8:
694
- case "end":
695
- return _context17.stop();
696
- }
539
+ }
540
+ throw new Error('Identity must be a string or number.');
541
+ case 7:
542
+ return _context17.abrupt("return", this.app.request.post({
543
+ url: this.app.urls.userCreateConfirmationURL(identity)
544
+ }));
545
+ case 8:
546
+ case "end":
547
+ return _context17.stop();
697
548
  }
698
549
  }, _callee17, this);
699
550
  }));
700
-
701
551
  function createEmailConfirmationURL(_x37) {
702
552
  return _createEmailConfirmationURL.apply(this, arguments);
703
553
  }
704
-
705
554
  return createEmailConfirmationURL;
706
555
  }()
707
556
  }, {
@@ -709,30 +558,24 @@ var Users = /*#__PURE__*/function () {
709
558
  value: function () {
710
559
  var _update = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee18(user) {
711
560
  var _this6 = this;
712
-
713
561
  return _regenerator["default"].wrap(function _callee18$(_context18) {
714
- while (1) {
715
- switch (_context18.prev = _context18.next) {
716
- case 0:
717
- return _context18.abrupt("return", this.app.request.put({
718
- url: this.app.urls.userObject(user.objectId),
719
- data: user
720
- }).then(function (data) {
721
- return _this6.dataStore.parseResponse(data);
722
- }));
723
-
724
- case 1:
725
- case "end":
726
- return _context18.stop();
727
- }
562
+ while (1) switch (_context18.prev = _context18.next) {
563
+ case 0:
564
+ return _context18.abrupt("return", this.app.request.put({
565
+ url: this.app.urls.userObject(user.objectId),
566
+ data: user
567
+ }).then(function (data) {
568
+ return _this6.dataStore.parseResponse(data);
569
+ }));
570
+ case 1:
571
+ case "end":
572
+ return _context18.stop();
728
573
  }
729
574
  }, _callee18, this);
730
575
  }));
731
-
732
576
  function update(_x38) {
733
577
  return _update.apply(this, arguments);
734
578
  }
735
-
736
579
  return update;
737
580
  }()
738
581
  }, {
@@ -740,23 +583,18 @@ var Users = /*#__PURE__*/function () {
740
583
  value: function () {
741
584
  var _findByRole = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee19(roleName, loadRoles, query) {
742
585
  return _regenerator["default"].wrap(function _callee19$(_context19) {
743
- while (1) {
744
- switch (_context19.prev = _context19.next) {
745
- case 0:
746
- return _context19.abrupt("return", this.roles.findByRole(roleName, loadRoles, query));
747
-
748
- case 1:
749
- case "end":
750
- return _context19.stop();
751
- }
586
+ while (1) switch (_context19.prev = _context19.next) {
587
+ case 0:
588
+ return _context19.abrupt("return", this.roles.findByRole(roleName, loadRoles, query));
589
+ case 1:
590
+ case "end":
591
+ return _context19.stop();
752
592
  }
753
593
  }, _callee19, this);
754
594
  }));
755
-
756
595
  function findByRole(_x39, _x40, _x41) {
757
596
  return _findByRole.apply(this, arguments);
758
597
  }
759
-
760
598
  return findByRole;
761
599
  }()
762
600
  }, {
@@ -764,23 +602,18 @@ var Users = /*#__PURE__*/function () {
764
602
  value: function () {
765
603
  var _getUserRoles = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee20(userId) {
766
604
  return _regenerator["default"].wrap(function _callee20$(_context20) {
767
- while (1) {
768
- switch (_context20.prev = _context20.next) {
769
- case 0:
770
- return _context20.abrupt("return", this.roles.getUserRoles(userId));
771
-
772
- case 1:
773
- case "end":
774
- return _context20.stop();
775
- }
605
+ while (1) switch (_context20.prev = _context20.next) {
606
+ case 0:
607
+ return _context20.abrupt("return", this.roles.getUserRoles(userId));
608
+ case 1:
609
+ case "end":
610
+ return _context20.stop();
776
611
  }
777
612
  }, _callee20, this);
778
613
  }));
779
-
780
614
  function getUserRoles(_x42) {
781
615
  return _getUserRoles.apply(this, arguments);
782
616
  }
783
-
784
617
  return getUserRoles;
785
618
  }()
786
619
  }, {
@@ -788,23 +621,18 @@ var Users = /*#__PURE__*/function () {
788
621
  value: function () {
789
622
  var _assignRole = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee21(identity, rolename) {
790
623
  return _regenerator["default"].wrap(function _callee21$(_context21) {
791
- while (1) {
792
- switch (_context21.prev = _context21.next) {
793
- case 0:
794
- return _context21.abrupt("return", this.roles.assignRole(identity, rolename));
795
-
796
- case 1:
797
- case "end":
798
- return _context21.stop();
799
- }
624
+ while (1) switch (_context21.prev = _context21.next) {
625
+ case 0:
626
+ return _context21.abrupt("return", this.roles.assignRole(identity, rolename));
627
+ case 1:
628
+ case "end":
629
+ return _context21.stop();
800
630
  }
801
631
  }, _callee21, this);
802
632
  }));
803
-
804
633
  function assignRole(_x43, _x44) {
805
634
  return _assignRole.apply(this, arguments);
806
635
  }
807
-
808
636
  return assignRole;
809
637
  }()
810
638
  }, {
@@ -812,23 +640,18 @@ var Users = /*#__PURE__*/function () {
812
640
  value: function () {
813
641
  var _unassignRole = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee22(identity, rolename) {
814
642
  return _regenerator["default"].wrap(function _callee22$(_context22) {
815
- while (1) {
816
- switch (_context22.prev = _context22.next) {
817
- case 0:
818
- return _context22.abrupt("return", this.roles.unassignRole(identity, rolename));
819
-
820
- case 1:
821
- case "end":
822
- return _context22.stop();
823
- }
643
+ while (1) switch (_context22.prev = _context22.next) {
644
+ case 0:
645
+ return _context22.abrupt("return", this.roles.unassignRole(identity, rolename));
646
+ case 1:
647
+ case "end":
648
+ return _context22.stop();
824
649
  }
825
650
  }, _callee22, this);
826
651
  }));
827
-
828
652
  function unassignRole(_x45, _x46) {
829
653
  return _unassignRole.apply(this, arguments);
830
654
  }
831
-
832
655
  return unassignRole;
833
656
  }()
834
657
  }, {
@@ -836,25 +659,20 @@ var Users = /*#__PURE__*/function () {
836
659
  value: function () {
837
660
  var _describeUserClass = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee23() {
838
661
  return _regenerator["default"].wrap(function _callee23$(_context23) {
839
- while (1) {
840
- switch (_context23.prev = _context23.next) {
841
- case 0:
842
- return _context23.abrupt("return", this.app.request.get({
843
- url: this.app.urls.userClassProps()
844
- }));
845
-
846
- case 1:
847
- case "end":
848
- return _context23.stop();
849
- }
662
+ while (1) switch (_context23.prev = _context23.next) {
663
+ case 0:
664
+ return _context23.abrupt("return", this.app.request.get({
665
+ url: this.app.urls.userClassProps()
666
+ }));
667
+ case 1:
668
+ case "end":
669
+ return _context23.stop();
850
670
  }
851
671
  }, _callee23, this);
852
672
  }));
853
-
854
673
  function describeUserClass() {
855
674
  return _describeUserClass.apply(this, arguments);
856
675
  }
857
-
858
676
  return describeUserClass;
859
677
  }()
860
678
  }, {
@@ -862,23 +680,18 @@ var Users = /*#__PURE__*/function () {
862
680
  value: function () {
863
681
  var _enableUser = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee24(userId) {
864
682
  return _regenerator["default"].wrap(function _callee24$(_context24) {
865
- while (1) {
866
- switch (_context24.prev = _context24.next) {
867
- case 0:
868
- return _context24.abrupt("return", this.updateUserStatus(userId, 'ENABLED'));
869
-
870
- case 1:
871
- case "end":
872
- return _context24.stop();
873
- }
683
+ while (1) switch (_context24.prev = _context24.next) {
684
+ case 0:
685
+ return _context24.abrupt("return", this.updateUserStatus(userId, 'ENABLED'));
686
+ case 1:
687
+ case "end":
688
+ return _context24.stop();
874
689
  }
875
690
  }, _callee24, this);
876
691
  }));
877
-
878
692
  function enableUser(_x47) {
879
693
  return _enableUser.apply(this, arguments);
880
694
  }
881
-
882
695
  return enableUser;
883
696
  }()
884
697
  }, {
@@ -886,23 +699,18 @@ var Users = /*#__PURE__*/function () {
886
699
  value: function () {
887
700
  var _disableUser = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee25(userId) {
888
701
  return _regenerator["default"].wrap(function _callee25$(_context25) {
889
- while (1) {
890
- switch (_context25.prev = _context25.next) {
891
- case 0:
892
- return _context25.abrupt("return", this.updateUserStatus(userId, 'DISABLED'));
893
-
894
- case 1:
895
- case "end":
896
- return _context25.stop();
897
- }
702
+ while (1) switch (_context25.prev = _context25.next) {
703
+ case 0:
704
+ return _context25.abrupt("return", this.updateUserStatus(userId, 'DISABLED'));
705
+ case 1:
706
+ case "end":
707
+ return _context25.stop();
898
708
  }
899
709
  }, _callee25, this);
900
710
  }));
901
-
902
711
  function disableUser(_x48) {
903
712
  return _disableUser.apply(this, arguments);
904
713
  }
905
-
906
714
  return disableUser;
907
715
  }()
908
716
  }, {
@@ -910,44 +718,35 @@ var Users = /*#__PURE__*/function () {
910
718
  value: function () {
911
719
  var _updateUserStatus = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee26(userId, userStatus) {
912
720
  return _regenerator["default"].wrap(function _callee26$(_context26) {
913
- while (1) {
914
- switch (_context26.prev = _context26.next) {
915
- case 0:
916
- if (!(!userId || typeof userId !== 'string' && typeof userId !== 'number')) {
917
- _context26.next = 2;
918
- break;
919
- }
920
-
921
- throw new Error('User objectId must be non empty string/number');
922
-
923
- case 2:
924
- if (!(!userStatus || typeof userStatus !== 'string')) {
925
- _context26.next = 4;
926
- break;
721
+ while (1) switch (_context26.prev = _context26.next) {
722
+ case 0:
723
+ if (!(!userId || typeof userId !== 'string' && typeof userId !== 'number')) {
724
+ _context26.next = 2;
725
+ break;
726
+ }
727
+ throw new Error('User objectId must be non empty string/number');
728
+ case 2:
729
+ if (!(!userStatus || typeof userStatus !== 'string')) {
730
+ _context26.next = 4;
731
+ break;
732
+ }
733
+ throw new Error('User Status must be a valid string');
734
+ case 4:
735
+ return _context26.abrupt("return", this.app.request.put({
736
+ url: this.app.urls.userStatus(userId),
737
+ data: {
738
+ userStatus: userStatus
927
739
  }
928
-
929
- throw new Error('User Status must be a valid string');
930
-
931
- case 4:
932
- return _context26.abrupt("return", this.app.request.put({
933
- url: this.app.urls.userStatus(userId),
934
- data: {
935
- userStatus: userStatus
936
- }
937
- }));
938
-
939
- case 5:
940
- case "end":
941
- return _context26.stop();
942
- }
740
+ }));
741
+ case 5:
742
+ case "end":
743
+ return _context26.stop();
943
744
  }
944
745
  }, _callee26, this);
945
746
  }));
946
-
947
747
  function updateUserStatus(_x49, _x50) {
948
748
  return _updateUserStatus.apply(this, arguments);
949
749
  }
950
-
951
750
  return updateUserStatus;
952
751
  }()
953
752
  }, {
@@ -975,22 +774,18 @@ var Users = /*#__PURE__*/function () {
975
774
  if (this.currentUser && this.currentUser['user-token']) {
976
775
  return this.currentUser['user-token'];
977
776
  }
978
-
979
777
  return this.app.LocalCache.get(this.app.LocalCache.Keys.USER_TOKEN) || null;
980
778
  }
981
779
  }, {
982
780
  key: "setCurrentUserToken",
983
781
  value: function setCurrentUserToken(userToken) {
984
782
  userToken = userToken || null;
985
-
986
783
  if (this.currentUser) {
987
784
  this.currentUser['user-token'] = userToken;
988
785
  }
989
-
990
786
  if (this.app.LocalCache.get('user-token')) {
991
787
  this.app.LocalCache.set('user-token', userToken);
992
788
  }
993
-
994
789
  if (this.app.__RT) {
995
790
  this.app.RT.updateUserTokenIfNeeded();
996
791
  }
@@ -1001,22 +796,21 @@ var Users = /*#__PURE__*/function () {
1001
796
  if (this.currentUser) {
1002
797
  return this.currentUser.objectId;
1003
798
  }
1004
-
1005
799
  return this.app.LocalCache.get(this.app.LocalCache.Keys.CURRENT_USER_ID) || null;
1006
800
  }
801
+
1007
802
  /**
1008
803
  * @deprecated
1009
804
  * */
1010
-
1011
805
  }, {
1012
806
  key: "getLocalCurrentUser",
1013
807
  value: function getLocalCurrentUser() {
1014
808
  return this.currentUser;
1015
809
  }
810
+
1016
811
  /**
1017
812
  * @deprecated
1018
813
  * */
1019
-
1020
814
  }, {
1021
815
  key: "setLocalCurrentUser",
1022
816
  value: function setLocalCurrentUser(user, stayLoggedIn) {
@@ -1025,5 +819,4 @@ var Users = /*#__PURE__*/function () {
1025
819
  }]);
1026
820
  return Users;
1027
821
  }();
1028
-
1029
822
  exports["default"] = Users;