roboto-js 1.5.6 → 1.6.1

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.
@@ -26,20 +26,19 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
26
26
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
27
27
  var RbtApi = exports["default"] = /*#__PURE__*/function () {
28
28
  function RbtApi(_ref) {
29
- var apiKey = _ref.apiKey,
30
- baseUrl = _ref.baseUrl,
29
+ var baseUrl = _ref.baseUrl,
30
+ accesskey = _ref.accesskey,
31
31
  _ref$authtoken = _ref.authtoken,
32
32
  authtoken = _ref$authtoken === void 0 ? null : _ref$authtoken,
33
- _ref$accesskey = _ref.accesskey,
34
- accesskey = _ref$accesskey === void 0 ? null : _ref$accesskey,
33
+ _ref$apikey = _ref.apikey,
34
+ apikey = _ref$apikey === void 0 ? null : _ref$apikey,
35
35
  _ref$localStorageAdap = _ref.localStorageAdaptor,
36
36
  localStorageAdaptor = _ref$localStorageAdap === void 0 ? null : _ref$localStorageAdap;
37
37
  _classCallCheck(this, RbtApi);
38
38
  this.axios = _axios["default"].create({
39
39
  baseURL: baseUrl,
40
40
  headers: {
41
- 'accesskey': accesskey || apiKey
42
- //'authtoken': authTokenToUse
41
+ 'accesskey': accesskey
43
42
  }
44
43
  });
45
44
  if (localStorageAdaptor) {
@@ -66,6 +65,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
66
65
 
67
66
  // Use the storageAdaptor to get the authToken, if available
68
67
  this.initAuthToken(authtoken);
68
+ this.initApiKey(apikey);
69
69
  }
70
70
  _createClass(RbtApi, [{
71
71
  key: "initAuthToken",
@@ -83,9 +83,11 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
83
83
  case 3:
84
84
  authtoken = _context.sent;
85
85
  case 4:
86
- this.authtoken = authtoken;
87
- this.axios.defaults.headers.common['authtoken'] = this.authtoken;
88
- case 6:
86
+ if (authtoken) {
87
+ this.authtoken = authtoken;
88
+ this.axios.defaults.headers.common['authtoken'] = this.authtoken;
89
+ }
90
+ case 5:
89
91
  case "end":
90
92
  return _context.stop();
91
93
  }
@@ -97,13 +99,44 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
97
99
  return initAuthToken;
98
100
  }()
99
101
  }, {
100
- key: "initLocalDb",
102
+ key: "initApiKey",
101
103
  value: function () {
102
- var _initLocalDb = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
104
+ var _initApiKey = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(apikey) {
103
105
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
104
106
  while (1) switch (_context2.prev = _context2.next) {
105
107
  case 0:
106
- _context2.next = 2;
108
+ if (!(!apikey && this.localStorageAdaptor)) {
109
+ _context2.next = 4;
110
+ break;
111
+ }
112
+ _context2.next = 3;
113
+ return this.localStorageAdaptor.getItem('apikey');
114
+ case 3:
115
+ apikey = _context2.sent;
116
+ case 4:
117
+ if (apikey) {
118
+ this.apikey = apikey;
119
+ this.axios.defaults.headers.common['apikey'] = this.apikey;
120
+ }
121
+ case 5:
122
+ case "end":
123
+ return _context2.stop();
124
+ }
125
+ }, _callee2, this);
126
+ }));
127
+ function initApiKey(_x2) {
128
+ return _initApiKey.apply(this, arguments);
129
+ }
130
+ return initApiKey;
131
+ }()
132
+ }, {
133
+ key: "initLocalDb",
134
+ value: function () {
135
+ var _initLocalDb = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
136
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
137
+ while (1) switch (_context3.prev = _context3.next) {
138
+ case 0:
139
+ _context3.next = 2;
107
140
  return (0, _idb.openDB)('RBTFileDatabase', 1, {
108
141
  upgrade: function upgrade(db) {
109
142
  if (!db.objectStoreNames.contains('files')) {
@@ -114,12 +147,12 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
114
147
  }
115
148
  });
116
149
  case 2:
117
- this.localDb = _context2.sent;
150
+ this.localDb = _context3.sent;
118
151
  case 3:
119
152
  case "end":
120
- return _context2.stop();
153
+ return _context3.stop();
121
154
  }
122
- }, _callee2, this);
155
+ }, _callee3, this);
123
156
  }));
124
157
  function initLocalDb() {
125
158
  return _initLocalDb.apply(this, arguments);
@@ -145,30 +178,30 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
145
178
  }, {
146
179
  key: "registerTypedefs",
147
180
  value: function () {
148
- var _registerTypedefs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(typedefs) {
181
+ var _registerTypedefs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(typedefs) {
149
182
  var response;
150
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
151
- while (1) switch (_context3.prev = _context3.next) {
183
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
184
+ while (1) switch (_context4.prev = _context4.next) {
152
185
  case 0:
153
- _context3.prev = 0;
154
- _context3.next = 3;
186
+ _context4.prev = 0;
187
+ _context4.next = 3;
155
188
  return this.axios.post('/api/doctree/registerTypedefs', [{
156
189
  typedefs: typedefs
157
190
  }]);
158
191
  case 3:
159
- response = _context3.sent;
160
- return _context3.abrupt("return", response.data);
192
+ response = _context4.sent;
193
+ return _context4.abrupt("return", response.data);
161
194
  case 7:
162
- _context3.prev = 7;
163
- _context3.t0 = _context3["catch"](0);
164
- this._handleError(_context3.t0);
195
+ _context4.prev = 7;
196
+ _context4.t0 = _context4["catch"](0);
197
+ this._handleError(_context4.t0);
165
198
  case 10:
166
199
  case "end":
167
- return _context3.stop();
200
+ return _context4.stop();
168
201
  }
169
- }, _callee3, this, [[0, 7]]);
202
+ }, _callee4, this, [[0, 7]]);
170
203
  }));
171
- function registerTypedefs(_x2) {
204
+ function registerTypedefs(_x3) {
172
205
  return _registerTypedefs.apply(this, arguments);
173
206
  }
174
207
  return registerTypedefs;
@@ -185,13 +218,13 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
185
218
  }, {
186
219
  key: "login",
187
220
  value: (function () {
188
- var _login = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(params) {
221
+ var _login = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(params) {
189
222
  var response;
190
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
191
- while (1) switch (_context4.prev = _context4.next) {
223
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
224
+ while (1) switch (_context5.prev = _context5.next) {
192
225
  case 0:
193
- _context4.prev = 0;
194
- _context4.next = 3;
226
+ _context5.prev = 0;
227
+ _context5.next = 3;
195
228
  return this.axios.post('/user_service/loginUser', [{
196
229
  email: params.email,
197
230
  password: params.password ? _cryptoJs["default"].MD5(params.password).toString(_cryptoJs["default"].enc.Hex) : null,
@@ -201,12 +234,12 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
201
234
  code: params.code || null // single-use signon code (password resets)
202
235
  }]);
203
236
  case 3:
204
- response = _context4.sent;
237
+ response = _context5.sent;
205
238
  if (!(response.data.ok === false)) {
206
- _context4.next = 6;
239
+ _context5.next = 6;
207
240
  break;
208
241
  }
209
- return _context4.abrupt("return", this._handleError(response));
242
+ return _context5.abrupt("return", this._handleError(response));
210
243
  case 6:
211
244
  this.iac_session = response.data;
212
245
  this.currentUser = this.iac_session ? new _rbt_user["default"](this.iac_session.user, this.axios) : null;
@@ -214,24 +247,24 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
214
247
  this.axios.defaults.headers.common['authtoken'] = response.data.authToken;
215
248
  this.authtoken = response.data.authToken;
216
249
  if (!this.localStorageAdaptor) {
217
- _context4.next = 13;
250
+ _context5.next = 13;
218
251
  break;
219
252
  }
220
- _context4.next = 13;
253
+ _context5.next = 13;
221
254
  return this.localStorageAdaptor.setItem('authtoken', response.data.authToken);
222
255
  case 13:
223
- return _context4.abrupt("return", response.data);
256
+ return _context5.abrupt("return", response.data);
224
257
  case 16:
225
- _context4.prev = 16;
226
- _context4.t0 = _context4["catch"](0);
227
- this._handleError(_context4.t0);
258
+ _context5.prev = 16;
259
+ _context5.t0 = _context5["catch"](0);
260
+ this._handleError(_context5.t0);
228
261
  case 19:
229
262
  case "end":
230
- return _context4.stop();
263
+ return _context5.stop();
231
264
  }
232
- }, _callee4, this, [[0, 16]]);
265
+ }, _callee5, this, [[0, 16]]);
233
266
  }));
234
- function login(_x3) {
267
+ function login(_x4) {
235
268
  return _login.apply(this, arguments);
236
269
  }
237
270
  return login;
@@ -239,21 +272,21 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
239
272
  }, {
240
273
  key: "loginWithOauth",
241
274
  value: function () {
242
- var _loginWithOauth = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(userData) {
275
+ var _loginWithOauth = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(userData) {
243
276
  var response;
244
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
245
- while (1) switch (_context5.prev = _context5.next) {
277
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
278
+ while (1) switch (_context6.prev = _context6.next) {
246
279
  case 0:
247
- _context5.prev = 0;
248
- _context5.next = 3;
280
+ _context6.prev = 0;
281
+ _context6.next = 3;
249
282
  return this.post('/api/account/registerOrSigninOauth', userData);
250
283
  case 3:
251
- response = _context5.sent;
284
+ response = _context6.sent;
252
285
  if (!(response.ok === false)) {
253
- _context5.next = 6;
286
+ _context6.next = 6;
254
287
  break;
255
288
  }
256
- return _context5.abrupt("return", this._handleError(response));
289
+ return _context6.abrupt("return", this._handleError(response));
257
290
  case 6:
258
291
  this.iac_session = response;
259
292
  this.currentUser = this.iac_session ? new _rbt_user["default"](this.iac_session.user, this.axios) : null;
@@ -261,24 +294,24 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
261
294
  this.axios.defaults.headers.common['authtoken'] = response.authToken;
262
295
  this.authtoken = response.authToken;
263
296
  if (!this.localStorageAdaptor) {
264
- _context5.next = 13;
297
+ _context6.next = 13;
265
298
  break;
266
299
  }
267
- _context5.next = 13;
300
+ _context6.next = 13;
268
301
  return this.localStorageAdaptor.setItem('authtoken', response.authToken);
269
302
  case 13:
270
- return _context5.abrupt("return", response);
303
+ return _context6.abrupt("return", response);
271
304
  case 16:
272
- _context5.prev = 16;
273
- _context5.t0 = _context5["catch"](0);
274
- this._handleError(_context5.t0);
305
+ _context6.prev = 16;
306
+ _context6.t0 = _context6["catch"](0);
307
+ this._handleError(_context6.t0);
275
308
  case 19:
276
309
  case "end":
277
- return _context5.stop();
310
+ return _context6.stop();
278
311
  }
279
- }, _callee5, this, [[0, 16]]);
312
+ }, _callee6, this, [[0, 16]]);
280
313
  }));
281
- function loginWithOauth(_x4) {
314
+ function loginWithOauth(_x5) {
282
315
  return _loginWithOauth.apply(this, arguments);
283
316
  }
284
317
  return loginWithOauth;
@@ -286,21 +319,21 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
286
319
  }, {
287
320
  key: "logout",
288
321
  value: function () {
289
- var _logout = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
322
+ var _logout = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
290
323
  var response;
291
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
292
- while (1) switch (_context6.prev = _context6.next) {
324
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
325
+ while (1) switch (_context7.prev = _context7.next) {
293
326
  case 0:
294
- _context6.prev = 0;
295
- _context6.next = 3;
327
+ _context7.prev = 0;
328
+ _context7.next = 3;
296
329
  return this.axios.post('/user_service/logoutUser');
297
330
  case 3:
298
- response = _context6.sent;
331
+ response = _context7.sent;
299
332
  if (!(response.data.ok === false)) {
300
- _context6.next = 6;
333
+ _context7.next = 6;
301
334
  break;
302
335
  }
303
- return _context6.abrupt("return", this._handleError(response));
336
+ return _context7.abrupt("return", this._handleError(response));
304
337
  case 6:
305
338
  // Clear the iac_session and remove the auth token from axios headers
306
339
  this.iac_session = null;
@@ -312,22 +345,22 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
312
345
 
313
346
  // Clear localStorage if it's being used
314
347
  if (!this.localStorageAdaptor) {
315
- _context6.next = 13;
348
+ _context7.next = 13;
316
349
  break;
317
350
  }
318
- _context6.next = 13;
351
+ _context7.next = 13;
319
352
  return this.localStorageAdaptor.removeItem('authtoken');
320
353
  case 13:
321
- return _context6.abrupt("return", response.data);
354
+ return _context7.abrupt("return", response.data);
322
355
  case 16:
323
- _context6.prev = 16;
324
- _context6.t0 = _context6["catch"](0);
325
- this._handleError(_context6.t0);
356
+ _context7.prev = 16;
357
+ _context7.t0 = _context7["catch"](0);
358
+ this._handleError(_context7.t0);
326
359
  case 19:
327
360
  case "end":
328
- return _context6.stop();
361
+ return _context7.stop();
329
362
  }
330
- }, _callee6, this, [[0, 16]]);
363
+ }, _callee7, this, [[0, 16]]);
331
364
  }));
332
365
  function logout() {
333
366
  return _logout.apply(this, arguments);
@@ -344,52 +377,58 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
344
377
  }, {
345
378
  key: "loadCurrentUser",
346
379
  value: function () {
347
- var _loadCurrentUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
380
+ var _loadCurrentUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
348
381
  var response, _response$user;
349
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
350
- while (1) switch (_context7.prev = _context7.next) {
382
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
383
+ while (1) switch (_context8.prev = _context8.next) {
351
384
  case 0:
352
- _context7.prev = 0;
385
+ _context8.prev = 0;
353
386
  if (!this.currentUser) {
354
- _context7.next = 3;
387
+ _context8.next = 3;
355
388
  break;
356
389
  }
357
- return _context7.abrupt("return", this.currentUser);
390
+ return _context8.abrupt("return", this.currentUser);
358
391
  case 3:
392
+ if (!this.apikey) {
393
+ _context8.next = 7;
394
+ break;
395
+ }
396
+ return _context8.abrupt("return", null);
397
+ case 7:
359
398
  if (!this.authtoken) {
360
- _context7.next = 13;
399
+ _context8.next = 17;
361
400
  break;
362
401
  }
363
- _context7.next = 6;
402
+ _context8.next = 10;
364
403
  return this.refreshAuthToken(this.authtoken);
365
- case 6:
366
- response = _context7.sent;
404
+ case 10:
405
+ response = _context8.sent;
367
406
  if (response) {
368
- _context7.next = 9;
407
+ _context8.next = 13;
369
408
  break;
370
409
  }
371
- return _context7.abrupt("return", null);
372
- case 9:
410
+ return _context8.abrupt("return", null);
411
+ case 13:
373
412
  if (response !== null && response !== void 0 && response.user) {
374
413
  this.currentUser = new _rbt_user["default"]({
375
414
  id: response === null || response === void 0 || (_response$user = response.user) === null || _response$user === void 0 ? void 0 : _response$user.id
376
415
  }, this.axios);
377
416
  this.currentUser.setData(response.user);
378
417
  }
379
- return _context7.abrupt("return", this.currentUser);
380
- case 13:
381
- this.currentUser = null;
382
- case 14:
383
- return _context7.abrupt("return", null);
418
+ return _context8.abrupt("return", this.currentUser);
384
419
  case 17:
385
- _context7.prev = 17;
386
- _context7.t0 = _context7["catch"](0);
387
- return _context7.abrupt("return", this._handleError(_context7.t0));
388
- case 20:
420
+ this.currentUser = null;
421
+ case 18:
422
+ return _context8.abrupt("return", null);
423
+ case 21:
424
+ _context8.prev = 21;
425
+ _context8.t0 = _context8["catch"](0);
426
+ return _context8.abrupt("return", this._handleError(_context8.t0));
427
+ case 24:
389
428
  case "end":
390
- return _context7.stop();
429
+ return _context8.stop();
391
430
  }
392
- }, _callee7, this, [[0, 17]]);
431
+ }, _callee8, this, [[0, 21]]);
393
432
  }));
394
433
  function loadCurrentUser() {
395
434
  return _loadCurrentUser.apply(this, arguments);
@@ -399,37 +438,37 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
399
438
  }, {
400
439
  key: "confirmUserEmail",
401
440
  value: function () {
402
- var _confirmUserEmail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(confirmCode) {
441
+ var _confirmUserEmail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(confirmCode) {
403
442
  var params, response;
404
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
405
- while (1) switch (_context8.prev = _context8.next) {
443
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
444
+ while (1) switch (_context9.prev = _context9.next) {
406
445
  case 0:
407
446
  params = {
408
447
  emailConfirmCode: confirmCode
409
448
  };
410
- _context8.prev = 1;
411
- _context8.next = 4;
449
+ _context9.prev = 1;
450
+ _context9.next = 4;
412
451
  return this.axios.post('/user_service/confirmUserEmail', [params]);
413
452
  case 4:
414
- response = _context8.sent;
453
+ response = _context9.sent;
415
454
  if (!(response.data.ok === false)) {
416
- _context8.next = 7;
455
+ _context9.next = 7;
417
456
  break;
418
457
  }
419
- return _context8.abrupt("return", this._handleError(response));
458
+ return _context9.abrupt("return", this._handleError(response));
420
459
  case 7:
421
- return _context8.abrupt("return", response.data);
460
+ return _context9.abrupt("return", response.data);
422
461
  case 10:
423
- _context8.prev = 10;
424
- _context8.t0 = _context8["catch"](1);
425
- return _context8.abrupt("return", this._handleError(_context8.t0));
462
+ _context9.prev = 10;
463
+ _context9.t0 = _context9["catch"](1);
464
+ return _context9.abrupt("return", this._handleError(_context9.t0));
426
465
  case 13:
427
466
  case "end":
428
- return _context8.stop();
467
+ return _context9.stop();
429
468
  }
430
- }, _callee8, this, [[1, 10]]);
469
+ }, _callee9, this, [[1, 10]]);
431
470
  }));
432
- function confirmUserEmail(_x5) {
471
+ function confirmUserEmail(_x6) {
433
472
  return _confirmUserEmail.apply(this, arguments);
434
473
  }
435
474
  return confirmUserEmail;
@@ -437,27 +476,27 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
437
476
  }, {
438
477
  key: "loadCurrentUserExtended",
439
478
  value: function () {
440
- var _loadCurrentUserExtended = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
479
+ var _loadCurrentUserExtended = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
441
480
  var currentUser;
442
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
443
- while (1) switch (_context9.prev = _context9.next) {
481
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
482
+ while (1) switch (_context10.prev = _context10.next) {
444
483
  case 0:
445
- _context9.next = 2;
484
+ _context10.next = 2;
446
485
  return this.loadCurrentUser();
447
486
  case 2:
448
- currentUser = _context9.sent;
487
+ currentUser = _context10.sent;
449
488
  if (!currentUser) {
450
- _context9.next = 7;
489
+ _context10.next = 7;
451
490
  break;
452
491
  }
453
- return _context9.abrupt("return", this.loadUser(currentUser.id));
492
+ return _context10.abrupt("return", this.loadUser(currentUser.id));
454
493
  case 7:
455
- return _context9.abrupt("return", null);
494
+ return _context10.abrupt("return", null);
456
495
  case 8:
457
496
  case "end":
458
- return _context9.stop();
497
+ return _context10.stop();
459
498
  }
460
- }, _callee9, this);
499
+ }, _callee10, this);
461
500
  }));
462
501
  function loadCurrentUserExtended() {
463
502
  return _loadCurrentUserExtended.apply(this, arguments);
@@ -467,36 +506,36 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
467
506
  }, {
468
507
  key: "loadUser",
469
508
  value: function () {
470
- var _loadUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(userId) {
509
+ var _loadUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(userId) {
471
510
  var params, _response$data, response, userData, User;
472
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
473
- while (1) switch (_context10.prev = _context10.next) {
511
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
512
+ while (1) switch (_context11.prev = _context11.next) {
474
513
  case 0:
475
514
  params = {
476
515
  id: userId
477
516
  };
478
- _context10.prev = 1;
479
- _context10.next = 4;
517
+ _context11.prev = 1;
518
+ _context11.next = 4;
480
519
  return this.axios.post('/user_service/loadUser', [params]);
481
520
  case 4:
482
- response = _context10.sent;
521
+ response = _context11.sent;
483
522
  userData = response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.user;
484
523
  User = new _rbt_user["default"]({
485
524
  id: userData.id
486
525
  }, this.axios);
487
526
  User.setData(userData);
488
- return _context10.abrupt("return", User);
527
+ return _context11.abrupt("return", User);
489
528
  case 11:
490
- _context10.prev = 11;
491
- _context10.t0 = _context10["catch"](1);
492
- return _context10.abrupt("return", this._handleError(_context10.t0));
529
+ _context11.prev = 11;
530
+ _context11.t0 = _context11["catch"](1);
531
+ return _context11.abrupt("return", this._handleError(_context11.t0));
493
532
  case 14:
494
533
  case "end":
495
- return _context10.stop();
534
+ return _context11.stop();
496
535
  }
497
- }, _callee10, this, [[1, 11]]);
536
+ }, _callee11, this, [[1, 11]]);
498
537
  }));
499
- function loadUser(_x6) {
538
+ function loadUser(_x7) {
500
539
  return _loadUser.apply(this, arguments);
501
540
  }
502
541
  return loadUser;
@@ -504,54 +543,54 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
504
543
  }, {
505
544
  key: "refreshAuthToken",
506
545
  value: function () {
507
- var _refreshAuthToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(authtoken) {
546
+ var _refreshAuthToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(authtoken) {
508
547
  var promise, response;
509
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
510
- while (1) switch (_context11.prev = _context11.next) {
548
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
549
+ while (1) switch (_context12.prev = _context12.next) {
511
550
  case 0:
512
551
  if (this.appServiceHost) {
513
- _context11.next = 3;
552
+ _context12.next = 3;
514
553
  break;
515
554
  }
516
555
  console.warn('RBTTOK not initialized');
517
- return _context11.abrupt("return", false);
556
+ return _context12.abrupt("return", false);
518
557
  case 3:
519
558
  if (!this.requestCache[authtoken]) {
520
- _context11.next = 5;
559
+ _context12.next = 5;
521
560
  break;
522
561
  }
523
- return _context11.abrupt("return", this.requestCache[authtoken]);
562
+ return _context12.abrupt("return", this.requestCache[authtoken]);
524
563
  case 5:
525
- _context11.prev = 5;
564
+ _context12.prev = 5;
526
565
  //console.log('RBTTOK Req', authtoken);
527
566
  // Create a new promise for the token refresh and store it in the cache
528
567
  promise = this.axios.post('/user_service/refreshAuthToken', [authtoken]);
529
568
  this.requestCache[authtoken] = promise;
530
569
 
531
570
  // Await the promise to get the response
532
- _context11.next = 10;
571
+ _context12.next = 10;
533
572
  return promise;
534
573
  case 10:
535
- response = _context11.sent;
574
+ response = _context12.sent;
536
575
  //console.log('RBTTOK Response ',response);
537
576
  // Once the promise resolves, delete it from the cache to allow future refreshes
538
577
  delete this.requestCache[authtoken];
539
578
 
540
579
  // Return the response data
541
- return _context11.abrupt("return", response.data);
580
+ return _context12.abrupt("return", response.data);
542
581
  case 15:
543
- _context11.prev = 15;
544
- _context11.t0 = _context11["catch"](5);
582
+ _context12.prev = 15;
583
+ _context12.t0 = _context12["catch"](5);
545
584
  // On error, remove the cached promise to allow retries
546
585
  delete this.requestCache[authtoken];
547
- this._handleError(_context11.t0);
586
+ this._handleError(_context12.t0);
548
587
  case 19:
549
588
  case "end":
550
- return _context11.stop();
589
+ return _context12.stop();
551
590
  }
552
- }, _callee11, this, [[5, 15]]);
591
+ }, _callee12, this, [[5, 15]]);
553
592
  }));
554
- function refreshAuthToken(_x7) {
593
+ function refreshAuthToken(_x8) {
555
594
  return _refreshAuthToken.apply(this, arguments);
556
595
  }
557
596
  return refreshAuthToken;
@@ -582,31 +621,31 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
582
621
  }, {
583
622
  key: "registerUser",
584
623
  value: function () {
585
- var _registerUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
624
+ var _registerUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
586
625
  var dataHash,
587
626
  response,
588
627
  record,
589
- _args12 = arguments;
590
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
591
- while (1) switch (_context12.prev = _context12.next) {
628
+ _args13 = arguments;
629
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
630
+ while (1) switch (_context13.prev = _context13.next) {
592
631
  case 0:
593
- dataHash = _args12.length > 0 && _args12[0] !== undefined ? _args12[0] : {};
594
- _context12.prev = 1;
595
- _context12.next = 4;
632
+ dataHash = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : {};
633
+ _context13.prev = 1;
634
+ _context13.next = 4;
596
635
  return this.axios.post('/user_service/registerUser', [dataHash]);
597
636
  case 4:
598
- response = _context12.sent;
637
+ response = _context13.sent;
599
638
  record = response.data;
600
- return _context12.abrupt("return", new _rbt_user["default"](record, this.axios));
639
+ return _context13.abrupt("return", new _rbt_user["default"](record, this.axios));
601
640
  case 9:
602
- _context12.prev = 9;
603
- _context12.t0 = _context12["catch"](1);
604
- return _context12.abrupt("return", this._handleError(_context12.t0));
641
+ _context13.prev = 9;
642
+ _context13.t0 = _context13["catch"](1);
643
+ return _context13.abrupt("return", this._handleError(_context13.t0));
605
644
  case 12:
606
645
  case "end":
607
- return _context12.stop();
646
+ return _context13.stop();
608
647
  }
609
- }, _callee12, this, [[1, 9]]);
648
+ }, _callee13, this, [[1, 9]]);
610
649
  }));
611
650
  function registerUser() {
612
651
  return _registerUser.apply(this, arguments);
@@ -623,32 +662,32 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
623
662
  }, {
624
663
  key: "createFile",
625
664
  value: (function () {
626
- var _createFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(dataHash) {
665
+ var _createFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(dataHash) {
627
666
  var response, record;
628
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
629
- while (1) switch (_context13.prev = _context13.next) {
667
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
668
+ while (1) switch (_context14.prev = _context14.next) {
630
669
  case 0:
631
- _context13.prev = 0;
632
- _context13.next = 3;
670
+ _context14.prev = 0;
671
+ _context14.next = 3;
633
672
  return this.axios.post('/object_service/createObject', ['<@filekit.file>', dataHash]);
634
673
  case 3:
635
- response = _context13.sent;
674
+ response = _context14.sent;
636
675
  record = response.data;
637
676
  if (dataHash) {
638
677
  record.data = dataHash;
639
678
  }
640
- return _context13.abrupt("return", new _rbt_file["default"](record, this.axios, this.localDb));
679
+ return _context14.abrupt("return", new _rbt_file["default"](record, this.axios, this.localDb));
641
680
  case 9:
642
- _context13.prev = 9;
643
- _context13.t0 = _context13["catch"](0);
644
- return _context13.abrupt("return", this._handleError(_context13.t0));
681
+ _context14.prev = 9;
682
+ _context14.t0 = _context14["catch"](0);
683
+ return _context14.abrupt("return", this._handleError(_context14.t0));
645
684
  case 12:
646
685
  case "end":
647
- return _context13.stop();
686
+ return _context14.stop();
648
687
  }
649
- }, _callee13, this, [[0, 9]]);
688
+ }, _callee14, this, [[0, 9]]);
650
689
  }));
651
- function createFile(_x8) {
690
+ function createFile(_x9) {
652
691
  return _createFile.apply(this, arguments);
653
692
  }
654
693
  return createFile;
@@ -656,35 +695,35 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
656
695
  }, {
657
696
  key: "loadFile",
658
697
  value: function () {
659
- var _loadFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(id) {
698
+ var _loadFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(id) {
660
699
  var response, record;
661
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
662
- while (1) switch (_context14.prev = _context14.next) {
700
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
701
+ while (1) switch (_context15.prev = _context15.next) {
663
702
  case 0:
664
- _context14.prev = 0;
665
- _context14.next = 3;
703
+ _context15.prev = 0;
704
+ _context15.next = 3;
666
705
  return this.load('<@filekit.file>', id);
667
706
  case 3:
668
- response = _context14.sent;
707
+ response = _context15.sent;
669
708
  if (response) {
670
- _context14.next = 6;
709
+ _context15.next = 6;
671
710
  break;
672
711
  }
673
- return _context14.abrupt("return", null);
712
+ return _context15.abrupt("return", null);
674
713
  case 6:
675
714
  record = response.toRecord();
676
- return _context14.abrupt("return", new _rbt_file["default"](record, this.axios, this.localDb));
715
+ return _context15.abrupt("return", new _rbt_file["default"](record, this.axios, this.localDb));
677
716
  case 10:
678
- _context14.prev = 10;
679
- _context14.t0 = _context14["catch"](0);
680
- return _context14.abrupt("return", this._handleError(_context14.t0));
717
+ _context15.prev = 10;
718
+ _context15.t0 = _context15["catch"](0);
719
+ return _context15.abrupt("return", this._handleError(_context15.t0));
681
720
  case 13:
682
721
  case "end":
683
- return _context14.stop();
722
+ return _context15.stop();
684
723
  }
685
- }, _callee14, this, [[0, 10]]);
724
+ }, _callee15, this, [[0, 10]]);
686
725
  }));
687
- function loadFile(_x9) {
726
+ function loadFile(_x10) {
688
727
  return _loadFile.apply(this, arguments);
689
728
  }
690
729
  return loadFile;
@@ -692,39 +731,39 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
692
731
  }, {
693
732
  key: "loadFiles",
694
733
  value: function () {
695
- var _loadFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(ids) {
734
+ var _loadFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(ids) {
696
735
  var _this = this;
697
736
  var responses;
698
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
699
- while (1) switch (_context15.prev = _context15.next) {
737
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
738
+ while (1) switch (_context16.prev = _context16.next) {
700
739
  case 0:
701
- _context15.prev = 0;
702
- _context15.next = 3;
740
+ _context16.prev = 0;
741
+ _context16.next = 3;
703
742
  return this.load('<@filekit.file>', ids);
704
743
  case 3:
705
- responses = _context15.sent;
744
+ responses = _context16.sent;
706
745
  if (!(!responses || !Array.isArray(responses))) {
707
- _context15.next = 6;
746
+ _context16.next = 6;
708
747
  break;
709
748
  }
710
- return _context15.abrupt("return", []);
749
+ return _context16.abrupt("return", []);
711
750
  case 6:
712
- return _context15.abrupt("return", responses.map(function (response) {
751
+ return _context16.abrupt("return", responses.map(function (response) {
713
752
  var record = response.toRecord();
714
753
  return new _rbt_file["default"](record, _this.axios, _this.localDb);
715
754
  }));
716
755
  case 9:
717
- _context15.prev = 9;
718
- _context15.t0 = _context15["catch"](0);
719
- this._handleError(_context15.t0); // Handle errors (log or process as needed)
720
- return _context15.abrupt("return", []);
756
+ _context16.prev = 9;
757
+ _context16.t0 = _context16["catch"](0);
758
+ this._handleError(_context16.t0); // Handle errors (log or process as needed)
759
+ return _context16.abrupt("return", []);
721
760
  case 13:
722
761
  case "end":
723
- return _context15.stop();
762
+ return _context16.stop();
724
763
  }
725
- }, _callee15, this, [[0, 9]]);
764
+ }, _callee16, this, [[0, 9]]);
726
765
  }));
727
- function loadFiles(_x10) {
766
+ function loadFiles(_x11) {
728
767
  return _loadFiles.apply(this, arguments);
729
768
  }
730
769
  return loadFiles;
@@ -739,40 +778,40 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
739
778
  }, {
740
779
  key: "create",
741
780
  value: (function () {
742
- var _create = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(type) {
781
+ var _create = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(type) {
743
782
  var dataHash,
744
783
  response,
745
784
  record,
746
- _args16 = arguments;
747
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
748
- while (1) switch (_context16.prev = _context16.next) {
785
+ _args17 = arguments;
786
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
787
+ while (1) switch (_context17.prev = _context17.next) {
749
788
  case 0:
750
- dataHash = _args16.length > 1 && _args16[1] !== undefined ? _args16[1] : {};
751
- _context16.prev = 1;
789
+ dataHash = _args17.length > 1 && _args17[1] !== undefined ? _args17[1] : {};
790
+ _context17.prev = 1;
752
791
  debugger;
753
- _context16.next = 5;
792
+ _context17.next = 5;
754
793
  return this.axios.post('/object_service/createObject', [type, dataHash]);
755
794
  case 5:
756
- response = _context16.sent;
795
+ response = _context17.sent;
757
796
  record = response.data;
758
797
  if (dataHash) {
759
798
  record.data = dataHash;
760
799
  }
761
800
  debugger;
762
- return _context16.abrupt("return", new _rbt_object["default"](record, this.axios, {
801
+ return _context17.abrupt("return", new _rbt_object["default"](record, this.axios, {
763
802
  isNew: true
764
803
  }));
765
804
  case 12:
766
- _context16.prev = 12;
767
- _context16.t0 = _context16["catch"](1);
768
- return _context16.abrupt("return", this._handleError(_context16.t0));
805
+ _context17.prev = 12;
806
+ _context17.t0 = _context17["catch"](1);
807
+ return _context17.abrupt("return", this._handleError(_context17.t0));
769
808
  case 15:
770
809
  case "end":
771
- return _context16.stop();
810
+ return _context17.stop();
772
811
  }
773
- }, _callee16, this, [[1, 12]]);
812
+ }, _callee17, this, [[1, 12]]);
774
813
  }));
775
- function create(_x11) {
814
+ function create(_x12) {
776
815
  return _create.apply(this, arguments);
777
816
  }
778
817
  return create;
@@ -851,7 +890,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
851
890
  }, {
852
891
  key: "query",
853
892
  value: (function () {
854
- var _query = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(type) {
893
+ var _query = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(type) {
855
894
  var _this2 = this;
856
895
  var params,
857
896
  defaultOrderBy,
@@ -862,12 +901,12 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
862
901
  cacheEntry,
863
902
  responsePromise,
864
903
  processingPromise,
865
- _args17 = arguments;
866
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
867
- while (1) switch (_context17.prev = _context17.next) {
904
+ _args18 = arguments;
905
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
906
+ while (1) switch (_context18.prev = _context18.next) {
868
907
  case 0:
869
- params = _args17.length > 1 && _args17[1] !== undefined ? _args17[1] : {};
870
- _context17.prev = 1;
908
+ params = _args18.length > 1 && _args18[1] !== undefined ? _args18[1] : {};
909
+ _context18.prev = 1;
871
910
  //console.log('RBTAPI.query INIT', type, params);
872
911
  params.type = type;
873
912
 
@@ -889,10 +928,10 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
889
928
  _paramsKey = JSON.stringify(mergedParams);
890
929
  cacheEntry = this.requestCache[_paramsKey];
891
930
  if (!(cacheEntry && currentTime - cacheEntry.time < 10000)) {
892
- _context17.next = 11;
931
+ _context18.next = 11;
893
932
  break;
894
933
  }
895
- return _context17.abrupt("return", cacheEntry.val);
934
+ return _context18.abrupt("return", cacheEntry.val);
896
935
  case 11:
897
936
  // Create the response promise
898
937
  responsePromise = this.axios.post('/object_service/queryObjects', [mergedParams]); // Cache the promise of processing data, not just the raw response
@@ -909,23 +948,23 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
909
948
  };
910
949
 
911
950
  // Await the processing promise for this call to get processed data
912
- _context17.next = 16;
951
+ _context18.next = 16;
913
952
  return processingPromise;
914
953
  case 16:
915
- return _context17.abrupt("return", _context17.sent);
954
+ return _context18.abrupt("return", _context18.sent);
916
955
  case 19:
917
- _context17.prev = 19;
918
- _context17.t0 = _context17["catch"](1);
956
+ _context18.prev = 19;
957
+ _context18.t0 = _context18["catch"](1);
919
958
  delete this.requestCache[paramsKey]; // Ensure cache cleanup on error
920
959
  //console.log('RBTAPI.query ERROR', paramsKey, e);
921
- return _context17.abrupt("return", this._handleError(_context17.t0));
960
+ return _context18.abrupt("return", this._handleError(_context18.t0));
922
961
  case 23:
923
962
  case "end":
924
- return _context17.stop();
963
+ return _context18.stop();
925
964
  }
926
- }, _callee17, this, [[1, 19]]);
965
+ }, _callee18, this, [[1, 19]]);
927
966
  }));
928
- function query(_x12) {
967
+ function query(_x13) {
929
968
  return _query.apply(this, arguments);
930
969
  }
931
970
  return query;
@@ -959,47 +998,47 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
959
998
  }, {
960
999
  key: "load",
961
1000
  value: (function () {
962
- var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(type, ids) {
1001
+ var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(type, ids) {
963
1002
  var params,
964
1003
  mergedParams,
965
1004
  res,
966
- _args18 = arguments;
967
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
968
- while (1) switch (_context18.prev = _context18.next) {
1005
+ _args19 = arguments;
1006
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1007
+ while (1) switch (_context19.prev = _context19.next) {
969
1008
  case 0:
970
- params = _args18.length > 2 && _args18[2] !== undefined ? _args18[2] : {};
971
- _context18.prev = 1;
1009
+ params = _args19.length > 2 && _args19[2] !== undefined ? _args19[2] : {};
1010
+ _context19.prev = 1;
972
1011
  if (!Array.isArray(ids)) {
973
- _context18.next = 7;
1012
+ _context19.next = 7;
974
1013
  break;
975
1014
  }
976
1015
  mergedParams = _objectSpread(_objectSpread({}, params), {}, {
977
1016
  where: "id IN (\"".concat(ids.join("\",\""), "\")")
978
1017
  });
979
- return _context18.abrupt("return", this.query(type, mergedParams));
1018
+ return _context19.abrupt("return", this.query(type, mergedParams));
980
1019
  case 7:
981
1020
  mergedParams = _objectSpread(_objectSpread({}, params), {}, {
982
1021
  where: "id=\"".concat(ids, "\"")
983
1022
  });
984
- _context18.next = 10;
1023
+ _context19.next = 10;
985
1024
  return this.query(type, mergedParams);
986
1025
  case 10:
987
- res = _context18.sent;
988
- return _context18.abrupt("return", res[0]);
1026
+ res = _context19.sent;
1027
+ return _context19.abrupt("return", res[0]);
989
1028
  case 12:
990
- _context18.next = 17;
1029
+ _context19.next = 17;
991
1030
  break;
992
1031
  case 14:
993
- _context18.prev = 14;
994
- _context18.t0 = _context18["catch"](1);
995
- return _context18.abrupt("return", this._handleError(_context18.t0));
1032
+ _context19.prev = 14;
1033
+ _context19.t0 = _context19["catch"](1);
1034
+ return _context19.abrupt("return", this._handleError(_context19.t0));
996
1035
  case 17:
997
1036
  case "end":
998
- return _context18.stop();
1037
+ return _context19.stop();
999
1038
  }
1000
- }, _callee18, this, [[1, 14]]);
1039
+ }, _callee19, this, [[1, 14]]);
1001
1040
  }));
1002
- function load(_x13, _x14) {
1041
+ function load(_x14, _x15) {
1003
1042
  return _load.apply(this, arguments);
1004
1043
  }
1005
1044
  return load;
@@ -1026,7 +1065,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
1026
1065
  }, {
1027
1066
  key: "runTask",
1028
1067
  value: (function () {
1029
- var _runTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
1068
+ var _runTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
1030
1069
  var params,
1031
1070
  callbacks,
1032
1071
  onProgress,
@@ -1040,20 +1079,20 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
1040
1079
  status,
1041
1080
  message,
1042
1081
  output,
1043
- _args19 = arguments;
1044
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1045
- while (1) switch (_context19.prev = _context19.next) {
1082
+ _args20 = arguments;
1083
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1084
+ while (1) switch (_context20.prev = _context20.next) {
1046
1085
  case 0:
1047
- params = _args19.length > 0 && _args19[0] !== undefined ? _args19[0] : {};
1048
- callbacks = _args19.length > 1 && _args19[1] !== undefined ? _args19[1] : {};
1086
+ params = _args20.length > 0 && _args20[0] !== undefined ? _args20[0] : {};
1087
+ callbacks = _args20.length > 1 && _args20[1] !== undefined ? _args20[1] : {};
1049
1088
  onProgress = callbacks.onProgress, onError = callbacks.onError, onStopped = callbacks.onStopped, onWaiting = callbacks.onWaiting, onDone = callbacks.onDone;
1050
- _context19.prev = 3;
1051
- _context19.next = 6;
1089
+ _context20.prev = 3;
1090
+ _context20.next = 6;
1052
1091
  return this.post('/task_service/runChain', params);
1053
1092
  case 6:
1054
- response = _context19.sent;
1093
+ response = _context20.sent;
1055
1094
  if (response) {
1056
- _context19.next = 9;
1095
+ _context20.next = 9;
1057
1096
  break;
1058
1097
  }
1059
1098
  throw new Error('Invalid server response');
@@ -1061,7 +1100,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
1061
1100
  // Validate response structure
1062
1101
  ok = response.ok, jobId = response.jobId, status = response.status, message = response.message, output = response.output;
1063
1102
  if (!(!ok || typeof jobId !== 'string' || typeof status !== 'string')) {
1064
- _context19.next = 12;
1103
+ _context20.next = 12;
1065
1104
  break;
1066
1105
  }
1067
1106
  throw new Error('Invalid response structure');
@@ -1087,7 +1126,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
1087
1126
  //console.log('Finish (request) ',response);
1088
1127
  onDone(response);
1089
1128
  }
1090
- return _context19.abrupt("return", {
1129
+ return _context20.abrupt("return", {
1091
1130
  ok: ok,
1092
1131
  jobId: jobId,
1093
1132
  status: status,
@@ -1095,24 +1134,24 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
1095
1134
  output: output
1096
1135
  });
1097
1136
  case 20:
1098
- _context19.prev = 20;
1099
- _context19.t0 = _context19["catch"](3);
1137
+ _context20.prev = 20;
1138
+ _context20.t0 = _context20["catch"](3);
1100
1139
  if (typeof onError === 'function') {
1101
- onError(_context19.t0);
1140
+ onError(_context20.t0);
1102
1141
  } else {
1103
- console.error('Error in runTask:', _context19.t0);
1142
+ console.error('Error in runTask:', _context20.t0);
1104
1143
  }
1105
- return _context19.abrupt("return", {
1144
+ return _context20.abrupt("return", {
1106
1145
  ok: false,
1107
1146
  jobId: null,
1108
1147
  status: 'ERROR',
1109
- error: _context19.t0.message
1148
+ error: _context20.t0.message
1110
1149
  });
1111
1150
  case 24:
1112
1151
  case "end":
1113
- return _context19.stop();
1152
+ return _context20.stop();
1114
1153
  }
1115
- }, _callee19, this, [[3, 20]]);
1154
+ }, _callee20, this, [[3, 20]]);
1116
1155
  }));
1117
1156
  function runTask() {
1118
1157
  return _runTask.apply(this, arguments);
@@ -1122,37 +1161,37 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
1122
1161
  }, {
1123
1162
  key: "stopJob",
1124
1163
  value: function () {
1125
- var _stopJob = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
1164
+ var _stopJob = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
1126
1165
  var params,
1127
1166
  callbacks,
1128
1167
  response,
1129
- _args20 = arguments;
1130
- return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1131
- while (1) switch (_context20.prev = _context20.next) {
1168
+ _args21 = arguments;
1169
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1170
+ while (1) switch (_context21.prev = _context21.next) {
1132
1171
  case 0:
1133
- params = _args20.length > 0 && _args20[0] !== undefined ? _args20[0] : {};
1134
- callbacks = _args20.length > 1 && _args20[1] !== undefined ? _args20[1] : {};
1135
- _context20.prev = 2;
1136
- _context20.next = 5;
1172
+ params = _args21.length > 0 && _args21[0] !== undefined ? _args21[0] : {};
1173
+ callbacks = _args21.length > 1 && _args21[1] !== undefined ? _args21[1] : {};
1174
+ _context21.prev = 2;
1175
+ _context21.next = 5;
1137
1176
  return this.post('/task_service/stopJob', params);
1138
1177
  case 5:
1139
- response = _context20.sent;
1178
+ response = _context21.sent;
1140
1179
  if (response) {
1141
- _context20.next = 8;
1180
+ _context21.next = 8;
1142
1181
  break;
1143
1182
  }
1144
1183
  throw new Error('Invalid server response');
1145
1184
  case 8:
1146
- return _context20.abrupt("return", true);
1185
+ return _context21.abrupt("return", true);
1147
1186
  case 11:
1148
- _context20.prev = 11;
1149
- _context20.t0 = _context20["catch"](2);
1187
+ _context21.prev = 11;
1188
+ _context21.t0 = _context21["catch"](2);
1150
1189
  throw 'Error in stopJob';
1151
1190
  case 14:
1152
1191
  case "end":
1153
- return _context20.stop();
1192
+ return _context21.stop();
1154
1193
  }
1155
- }, _callee20, this, [[2, 11]]);
1194
+ }, _callee21, this, [[2, 11]]);
1156
1195
  }));
1157
1196
  function stopJob() {
1158
1197
  return _stopJob.apply(this, arguments);
@@ -1172,26 +1211,26 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
1172
1211
  }, {
1173
1212
  key: "pollTaskProgress",
1174
1213
  value: (function () {
1175
- var _pollTaskProgress = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(jobId, callbacks) {
1214
+ var _pollTaskProgress = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(jobId, callbacks) {
1176
1215
  var _this4 = this;
1177
1216
  var onProgress, onError, onStopped, onWaiting, onDone, _callbacks$pollingInt, pollingInterval, checkProgress;
1178
- return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1179
- while (1) switch (_context22.prev = _context22.next) {
1217
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
1218
+ while (1) switch (_context23.prev = _context23.next) {
1180
1219
  case 0:
1181
1220
  onProgress = callbacks.onProgress, onError = callbacks.onError, onStopped = callbacks.onStopped, onWaiting = callbacks.onWaiting, onDone = callbacks.onDone, _callbacks$pollingInt = callbacks.pollingInterval, pollingInterval = _callbacks$pollingInt === void 0 ? 2000 : _callbacks$pollingInt;
1182
- _context22.prev = 1;
1221
+ _context23.prev = 1;
1183
1222
  checkProgress = /*#__PURE__*/function () {
1184
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
1223
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
1185
1224
  var response;
1186
- return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1187
- while (1) switch (_context21.prev = _context21.next) {
1225
+ return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1226
+ while (1) switch (_context22.prev = _context22.next) {
1188
1227
  case 0:
1189
- _context21.next = 2;
1228
+ _context22.next = 2;
1190
1229
  return _this4.get("/task_service/pollChainProgress", {
1191
1230
  jobId: jobId
1192
1231
  });
1193
1232
  case 2:
1194
- response = _context21.sent;
1233
+ response = _context22.sent;
1195
1234
  // If the task is still in progress, start polling for updates
1196
1235
  if (response.status === 'DONE' && onDone) {
1197
1236
  // Provide the current progress to the callback function
@@ -1222,28 +1261,28 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
1222
1261
  }
1223
1262
  case 9:
1224
1263
  case "end":
1225
- return _context21.stop();
1264
+ return _context22.stop();
1226
1265
  }
1227
- }, _callee21);
1266
+ }, _callee22);
1228
1267
  }));
1229
1268
  return function checkProgress() {
1230
1269
  return _ref2.apply(this, arguments);
1231
1270
  };
1232
1271
  }();
1233
1272
  checkProgress();
1234
- _context22.next = 9;
1273
+ _context23.next = 9;
1235
1274
  break;
1236
1275
  case 6:
1237
- _context22.prev = 6;
1238
- _context22.t0 = _context22["catch"](1);
1239
- return _context22.abrupt("return", this._handleError(_context22.t0));
1276
+ _context23.prev = 6;
1277
+ _context23.t0 = _context23["catch"](1);
1278
+ return _context23.abrupt("return", this._handleError(_context23.t0));
1240
1279
  case 9:
1241
1280
  case "end":
1242
- return _context22.stop();
1281
+ return _context23.stop();
1243
1282
  }
1244
- }, _callee22, this, [[1, 6]]);
1283
+ }, _callee23, this, [[1, 6]]);
1245
1284
  }));
1246
- function pollTaskProgress(_x15, _x16) {
1285
+ function pollTaskProgress(_x16, _x17) {
1247
1286
  return _pollTaskProgress.apply(this, arguments);
1248
1287
  }
1249
1288
  return pollTaskProgress;
@@ -1263,45 +1302,45 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
1263
1302
  }, {
1264
1303
  key: "get",
1265
1304
  value: (function () {
1266
- var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(endpoint) {
1305
+ var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(endpoint) {
1267
1306
  var params,
1268
1307
  headers,
1269
1308
  response,
1270
- _args23 = arguments;
1271
- return _regeneratorRuntime().wrap(function _callee23$(_context23) {
1272
- while (1) switch (_context23.prev = _context23.next) {
1309
+ _args24 = arguments;
1310
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
1311
+ while (1) switch (_context24.prev = _context24.next) {
1273
1312
  case 0:
1274
- params = _args23.length > 1 && _args23[1] !== undefined ? _args23[1] : {};
1275
- _context23.prev = 1;
1313
+ params = _args24.length > 1 && _args24[1] !== undefined ? _args24[1] : {};
1314
+ _context24.prev = 1;
1276
1315
  // Add the authToken to the headers
1277
1316
  headers = {
1278
1317
  authtoken: this.authtoken
1279
1318
  }; // Make the GET request using Axios
1280
- _context23.next = 5;
1319
+ _context24.next = 5;
1281
1320
  return this.axios.get(endpoint, {
1282
1321
  params: params,
1283
1322
  headers: headers
1284
1323
  });
1285
1324
  case 5:
1286
- response = _context23.sent;
1325
+ response = _context24.sent;
1287
1326
  if (!(response.data.ok === false)) {
1288
- _context23.next = 8;
1327
+ _context24.next = 8;
1289
1328
  break;
1290
1329
  }
1291
- return _context23.abrupt("return", this._handleError(response));
1330
+ return _context24.abrupt("return", this._handleError(response));
1292
1331
  case 8:
1293
- return _context23.abrupt("return", response.data);
1332
+ return _context24.abrupt("return", response.data);
1294
1333
  case 11:
1295
- _context23.prev = 11;
1296
- _context23.t0 = _context23["catch"](1);
1297
- return _context23.abrupt("return", this._handleError(_context23.t0));
1334
+ _context24.prev = 11;
1335
+ _context24.t0 = _context24["catch"](1);
1336
+ return _context24.abrupt("return", this._handleError(_context24.t0));
1298
1337
  case 14:
1299
1338
  case "end":
1300
- return _context23.stop();
1339
+ return _context24.stop();
1301
1340
  }
1302
- }, _callee23, this, [[1, 11]]);
1341
+ }, _callee24, this, [[1, 11]]);
1303
1342
  }));
1304
- function get(_x17) {
1343
+ function get(_x18) {
1305
1344
  return _get.apply(this, arguments);
1306
1345
  }
1307
1346
  return get;
@@ -1322,44 +1361,44 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
1322
1361
  }, {
1323
1362
  key: "post",
1324
1363
  value: (function () {
1325
- var _post = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(endpoint) {
1364
+ var _post = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(endpoint) {
1326
1365
  var data,
1327
1366
  headers,
1328
1367
  response,
1329
- _args24 = arguments;
1330
- return _regeneratorRuntime().wrap(function _callee24$(_context24) {
1331
- while (1) switch (_context24.prev = _context24.next) {
1368
+ _args25 = arguments;
1369
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
1370
+ while (1) switch (_context25.prev = _context25.next) {
1332
1371
  case 0:
1333
- data = _args24.length > 1 && _args24[1] !== undefined ? _args24[1] : {};
1334
- _context24.prev = 1;
1372
+ data = _args25.length > 1 && _args25[1] !== undefined ? _args25[1] : {};
1373
+ _context25.prev = 1;
1335
1374
  // Add the authToken to the headers
1336
1375
  headers = {
1337
1376
  authtoken: this.authtoken
1338
1377
  }; // Make the POST request using Axios
1339
- _context24.next = 5;
1378
+ _context25.next = 5;
1340
1379
  return this.axios.post(endpoint, data, {
1341
1380
  headers: headers
1342
1381
  });
1343
1382
  case 5:
1344
- response = _context24.sent;
1383
+ response = _context25.sent;
1345
1384
  if (!(response.data.ok === false)) {
1346
- _context24.next = 8;
1385
+ _context25.next = 8;
1347
1386
  break;
1348
1387
  }
1349
- return _context24.abrupt("return", this._handleError(response));
1388
+ return _context25.abrupt("return", this._handleError(response));
1350
1389
  case 8:
1351
- return _context24.abrupt("return", response.data);
1390
+ return _context25.abrupt("return", response.data);
1352
1391
  case 11:
1353
- _context24.prev = 11;
1354
- _context24.t0 = _context24["catch"](1);
1355
- return _context24.abrupt("return", this._handleError(_context24.t0));
1392
+ _context25.prev = 11;
1393
+ _context25.t0 = _context25["catch"](1);
1394
+ return _context25.abrupt("return", this._handleError(_context25.t0));
1356
1395
  case 14:
1357
1396
  case "end":
1358
- return _context24.stop();
1397
+ return _context25.stop();
1359
1398
  }
1360
- }, _callee24, this, [[1, 11]]);
1399
+ }, _callee25, this, [[1, 11]]);
1361
1400
  }));
1362
- function post(_x18) {
1401
+ function post(_x19) {
1363
1402
  return _post.apply(this, arguments);
1364
1403
  }
1365
1404
  return post;