roboto-js 1.4.3 → 1.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs +86 -67
- package/dist/cjs/rbt_api.cjs +205 -181
- package/dist/esm/index.js +3 -0
- package/dist/esm/rbt_api.js +5 -1
- package/package.json +1 -1
- package/src/index.js +4 -0
- package/src/rbt_api.js +9 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -222,38 +222,57 @@ var Roboto = exports["default"] = /*#__PURE__*/function () {
|
|
|
222
222
|
return loadCurrentUser;
|
|
223
223
|
}()
|
|
224
224
|
}, {
|
|
225
|
-
key: "
|
|
225
|
+
key: "loadCurrentUserExtended",
|
|
226
226
|
value: function () {
|
|
227
|
-
var
|
|
227
|
+
var _loadCurrentUserExtended = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
228
228
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
229
229
|
while (1) switch (_context7.prev = _context7.next) {
|
|
230
230
|
case 0:
|
|
231
|
-
return _context7.abrupt("return", this.api.
|
|
231
|
+
return _context7.abrupt("return", this.api.loadCurrentUserExtended());
|
|
232
232
|
case 1:
|
|
233
233
|
case "end":
|
|
234
234
|
return _context7.stop();
|
|
235
235
|
}
|
|
236
236
|
}, _callee7, this);
|
|
237
237
|
}));
|
|
238
|
-
function
|
|
239
|
-
return
|
|
238
|
+
function loadCurrentUserExtended() {
|
|
239
|
+
return _loadCurrentUserExtended.apply(this, arguments);
|
|
240
240
|
}
|
|
241
|
-
return
|
|
241
|
+
return loadCurrentUserExtended;
|
|
242
242
|
}()
|
|
243
243
|
}, {
|
|
244
|
-
key: "
|
|
244
|
+
key: "getCurrentUser",
|
|
245
245
|
value: function () {
|
|
246
|
-
var
|
|
246
|
+
var _getCurrentUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
247
247
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
248
248
|
while (1) switch (_context8.prev = _context8.next) {
|
|
249
249
|
case 0:
|
|
250
|
-
return _context8.abrupt("return", this.api.
|
|
250
|
+
return _context8.abrupt("return", this.api.getCurrentUser());
|
|
251
251
|
case 1:
|
|
252
252
|
case "end":
|
|
253
253
|
return _context8.stop();
|
|
254
254
|
}
|
|
255
255
|
}, _callee8, this);
|
|
256
256
|
}));
|
|
257
|
+
function getCurrentUser() {
|
|
258
|
+
return _getCurrentUser.apply(this, arguments);
|
|
259
|
+
}
|
|
260
|
+
return getCurrentUser;
|
|
261
|
+
}()
|
|
262
|
+
}, {
|
|
263
|
+
key: "confirmUserEmail",
|
|
264
|
+
value: function () {
|
|
265
|
+
var _confirmUserEmail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(params) {
|
|
266
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
267
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
268
|
+
case 0:
|
|
269
|
+
return _context9.abrupt("return", this.api.confirmUserEmail(params));
|
|
270
|
+
case 1:
|
|
271
|
+
case "end":
|
|
272
|
+
return _context9.stop();
|
|
273
|
+
}
|
|
274
|
+
}, _callee9, this);
|
|
275
|
+
}));
|
|
257
276
|
function confirmUserEmail(_x4) {
|
|
258
277
|
return _confirmUserEmail.apply(this, arguments);
|
|
259
278
|
}
|
|
@@ -264,19 +283,19 @@ var Roboto = exports["default"] = /*#__PURE__*/function () {
|
|
|
264
283
|
}, {
|
|
265
284
|
key: "createFile",
|
|
266
285
|
value: function () {
|
|
267
|
-
var _createFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
286
|
+
var _createFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
268
287
|
var data,
|
|
269
|
-
|
|
270
|
-
return _regeneratorRuntime().wrap(function
|
|
271
|
-
while (1) switch (
|
|
288
|
+
_args10 = arguments;
|
|
289
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
290
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
272
291
|
case 0:
|
|
273
|
-
data =
|
|
274
|
-
return
|
|
292
|
+
data = _args10.length > 0 && _args10[0] !== undefined ? _args10[0] : {};
|
|
293
|
+
return _context10.abrupt("return", this.api.createFile(data));
|
|
275
294
|
case 2:
|
|
276
295
|
case "end":
|
|
277
|
-
return
|
|
296
|
+
return _context10.stop();
|
|
278
297
|
}
|
|
279
|
-
},
|
|
298
|
+
}, _callee10, this);
|
|
280
299
|
}));
|
|
281
300
|
function createFile() {
|
|
282
301
|
return _createFile.apply(this, arguments);
|
|
@@ -286,16 +305,16 @@ var Roboto = exports["default"] = /*#__PURE__*/function () {
|
|
|
286
305
|
}, {
|
|
287
306
|
key: "loadFile",
|
|
288
307
|
value: function () {
|
|
289
|
-
var _loadFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
290
|
-
return _regeneratorRuntime().wrap(function
|
|
291
|
-
while (1) switch (
|
|
308
|
+
var _loadFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(id) {
|
|
309
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
310
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
292
311
|
case 0:
|
|
293
|
-
return
|
|
312
|
+
return _context11.abrupt("return", this.api.loadFile(id));
|
|
294
313
|
case 1:
|
|
295
314
|
case "end":
|
|
296
|
-
return
|
|
315
|
+
return _context11.stop();
|
|
297
316
|
}
|
|
298
|
-
},
|
|
317
|
+
}, _callee11, this);
|
|
299
318
|
}));
|
|
300
319
|
function loadFile(_x5) {
|
|
301
320
|
return _loadFile.apply(this, arguments);
|
|
@@ -307,19 +326,19 @@ var Roboto = exports["default"] = /*#__PURE__*/function () {
|
|
|
307
326
|
}, {
|
|
308
327
|
key: "create",
|
|
309
328
|
value: function () {
|
|
310
|
-
var _create = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
329
|
+
var _create = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(params) {
|
|
311
330
|
var data,
|
|
312
|
-
|
|
313
|
-
return _regeneratorRuntime().wrap(function
|
|
314
|
-
while (1) switch (
|
|
331
|
+
_args12 = arguments;
|
|
332
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
333
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
315
334
|
case 0:
|
|
316
|
-
data =
|
|
317
|
-
return
|
|
335
|
+
data = _args12.length > 1 && _args12[1] !== undefined ? _args12[1] : {};
|
|
336
|
+
return _context12.abrupt("return", this.api.create(params, data));
|
|
318
337
|
case 2:
|
|
319
338
|
case "end":
|
|
320
|
-
return
|
|
339
|
+
return _context12.stop();
|
|
321
340
|
}
|
|
322
|
-
},
|
|
341
|
+
}, _callee12, this);
|
|
323
342
|
}));
|
|
324
343
|
function create(_x6) {
|
|
325
344
|
return _create.apply(this, arguments);
|
|
@@ -329,16 +348,16 @@ var Roboto = exports["default"] = /*#__PURE__*/function () {
|
|
|
329
348
|
}, {
|
|
330
349
|
key: "load",
|
|
331
350
|
value: function () {
|
|
332
|
-
var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
333
|
-
return _regeneratorRuntime().wrap(function
|
|
334
|
-
while (1) switch (
|
|
351
|
+
var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(type, ids, options) {
|
|
352
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
353
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
335
354
|
case 0:
|
|
336
|
-
return
|
|
355
|
+
return _context13.abrupt("return", this.api.load(type, ids, options));
|
|
337
356
|
case 1:
|
|
338
357
|
case "end":
|
|
339
|
-
return
|
|
358
|
+
return _context13.stop();
|
|
340
359
|
}
|
|
341
|
-
},
|
|
360
|
+
}, _callee13, this);
|
|
342
361
|
}));
|
|
343
362
|
function load(_x7, _x8, _x9) {
|
|
344
363
|
return _load.apply(this, arguments);
|
|
@@ -348,16 +367,16 @@ var Roboto = exports["default"] = /*#__PURE__*/function () {
|
|
|
348
367
|
}, {
|
|
349
368
|
key: "query",
|
|
350
369
|
value: function () {
|
|
351
|
-
var _query = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
352
|
-
return _regeneratorRuntime().wrap(function
|
|
353
|
-
while (1) switch (
|
|
370
|
+
var _query = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(type, params) {
|
|
371
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
372
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
354
373
|
case 0:
|
|
355
|
-
return
|
|
374
|
+
return _context14.abrupt("return", this.api.query(type, params));
|
|
356
375
|
case 1:
|
|
357
376
|
case "end":
|
|
358
|
-
return
|
|
377
|
+
return _context14.stop();
|
|
359
378
|
}
|
|
360
|
-
},
|
|
379
|
+
}, _callee14, this);
|
|
361
380
|
}));
|
|
362
381
|
function query(_x10, _x11) {
|
|
363
382
|
return _query.apply(this, arguments);
|
|
@@ -369,16 +388,16 @@ var Roboto = exports["default"] = /*#__PURE__*/function () {
|
|
|
369
388
|
}, {
|
|
370
389
|
key: "runTask",
|
|
371
390
|
value: function () {
|
|
372
|
-
var _runTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
373
|
-
return _regeneratorRuntime().wrap(function
|
|
374
|
-
while (1) switch (
|
|
391
|
+
var _runTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(params, callbacks) {
|
|
392
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
393
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
375
394
|
case 0:
|
|
376
|
-
return
|
|
395
|
+
return _context15.abrupt("return", this.api.runTask(params, callbacks));
|
|
377
396
|
case 1:
|
|
378
397
|
case "end":
|
|
379
|
-
return
|
|
398
|
+
return _context15.stop();
|
|
380
399
|
}
|
|
381
|
-
},
|
|
400
|
+
}, _callee15, this);
|
|
382
401
|
}));
|
|
383
402
|
function runTask(_x12, _x13) {
|
|
384
403
|
return _runTask.apply(this, arguments);
|
|
@@ -388,16 +407,16 @@ var Roboto = exports["default"] = /*#__PURE__*/function () {
|
|
|
388
407
|
}, {
|
|
389
408
|
key: "pollTaskProgress",
|
|
390
409
|
value: function () {
|
|
391
|
-
var _pollTaskProgress = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
392
|
-
return _regeneratorRuntime().wrap(function
|
|
393
|
-
while (1) switch (
|
|
410
|
+
var _pollTaskProgress = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(params) {
|
|
411
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
412
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
394
413
|
case 0:
|
|
395
|
-
return
|
|
414
|
+
return _context16.abrupt("return", this.api.pollTaskProgress(params));
|
|
396
415
|
case 1:
|
|
397
416
|
case "end":
|
|
398
|
-
return
|
|
417
|
+
return _context16.stop();
|
|
399
418
|
}
|
|
400
|
-
},
|
|
419
|
+
}, _callee16, this);
|
|
401
420
|
}));
|
|
402
421
|
function pollTaskProgress(_x14) {
|
|
403
422
|
return _pollTaskProgress.apply(this, arguments);
|
|
@@ -409,16 +428,16 @@ var Roboto = exports["default"] = /*#__PURE__*/function () {
|
|
|
409
428
|
}, {
|
|
410
429
|
key: "get",
|
|
411
430
|
value: function () {
|
|
412
|
-
var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
413
|
-
return _regeneratorRuntime().wrap(function
|
|
414
|
-
while (1) switch (
|
|
431
|
+
var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(endpoint, params) {
|
|
432
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
433
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
415
434
|
case 0:
|
|
416
|
-
return
|
|
435
|
+
return _context17.abrupt("return", this.api.get(endpoint, params));
|
|
417
436
|
case 1:
|
|
418
437
|
case "end":
|
|
419
|
-
return
|
|
438
|
+
return _context17.stop();
|
|
420
439
|
}
|
|
421
|
-
},
|
|
440
|
+
}, _callee17, this);
|
|
422
441
|
}));
|
|
423
442
|
function get(_x15, _x16) {
|
|
424
443
|
return _get.apply(this, arguments);
|
|
@@ -428,16 +447,16 @@ var Roboto = exports["default"] = /*#__PURE__*/function () {
|
|
|
428
447
|
}, {
|
|
429
448
|
key: "post",
|
|
430
449
|
value: function () {
|
|
431
|
-
var _post = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
432
|
-
return _regeneratorRuntime().wrap(function
|
|
433
|
-
while (1) switch (
|
|
450
|
+
var _post = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(endpoint, data) {
|
|
451
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
452
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
434
453
|
case 0:
|
|
435
|
-
return
|
|
454
|
+
return _context18.abrupt("return", this.api.post(endpoint, data));
|
|
436
455
|
case 1:
|
|
437
456
|
case "end":
|
|
438
|
-
return
|
|
457
|
+
return _context18.stop();
|
|
439
458
|
}
|
|
440
|
-
},
|
|
459
|
+
}, _callee18, this);
|
|
441
460
|
}));
|
|
442
461
|
function post(_x17, _x18) {
|
|
443
462
|
return _post.apply(this, arguments);
|
package/dist/cjs/rbt_api.cjs
CHANGED
|
@@ -176,7 +176,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
176
176
|
_context3.next = 14;
|
|
177
177
|
return this.localStorageAdaptor.setItem('authtoken', response.data.authToken);
|
|
178
178
|
case 14:
|
|
179
|
-
return _context3.abrupt("return",
|
|
179
|
+
return _context3.abrupt("return", this.currentUser);
|
|
180
180
|
case 17:
|
|
181
181
|
_context3.prev = 17;
|
|
182
182
|
_context3.t0 = _context3["catch"](0);
|
|
@@ -335,36 +335,60 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
335
335
|
return confirmUserEmail;
|
|
336
336
|
}()
|
|
337
337
|
}, {
|
|
338
|
-
key: "
|
|
338
|
+
key: "loadCurrentUserExtended",
|
|
339
339
|
value: function () {
|
|
340
|
-
var
|
|
341
|
-
var
|
|
340
|
+
var _loadCurrentUserExtended = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
341
|
+
var currentUser;
|
|
342
342
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
343
343
|
while (1) switch (_context7.prev = _context7.next) {
|
|
344
|
+
case 0:
|
|
345
|
+
_context7.next = 2;
|
|
346
|
+
return this.loadCurrentUser();
|
|
347
|
+
case 2:
|
|
348
|
+
currentUser = _context7.sent;
|
|
349
|
+
return _context7.abrupt("return", this.loadUser(currentUser.id));
|
|
350
|
+
case 4:
|
|
351
|
+
case "end":
|
|
352
|
+
return _context7.stop();
|
|
353
|
+
}
|
|
354
|
+
}, _callee7, this);
|
|
355
|
+
}));
|
|
356
|
+
function loadCurrentUserExtended() {
|
|
357
|
+
return _loadCurrentUserExtended.apply(this, arguments);
|
|
358
|
+
}
|
|
359
|
+
return loadCurrentUserExtended;
|
|
360
|
+
}()
|
|
361
|
+
}, {
|
|
362
|
+
key: "loadUser",
|
|
363
|
+
value: function () {
|
|
364
|
+
var _loadUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(userId) {
|
|
365
|
+
var params, _response$data, response, userData, User;
|
|
366
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
367
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
344
368
|
case 0:
|
|
345
369
|
params = {
|
|
346
370
|
id: userId
|
|
347
371
|
};
|
|
348
|
-
|
|
349
|
-
|
|
372
|
+
_context8.prev = 1;
|
|
373
|
+
_context8.next = 4;
|
|
350
374
|
return this.axios.post('/user_service/loadUser', [params]);
|
|
351
375
|
case 4:
|
|
352
|
-
response =
|
|
376
|
+
response = _context8.sent;
|
|
353
377
|
userData = response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.user;
|
|
354
378
|
User = new _rbt_user["default"]({
|
|
355
379
|
id: userData.id
|
|
356
380
|
}, this.axios);
|
|
357
381
|
User.setData(userData);
|
|
358
|
-
return
|
|
382
|
+
return _context8.abrupt("return", User);
|
|
359
383
|
case 11:
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
return
|
|
384
|
+
_context8.prev = 11;
|
|
385
|
+
_context8.t0 = _context8["catch"](1);
|
|
386
|
+
return _context8.abrupt("return", this._handleError(_context8.t0));
|
|
363
387
|
case 14:
|
|
364
388
|
case "end":
|
|
365
|
-
return
|
|
389
|
+
return _context8.stop();
|
|
366
390
|
}
|
|
367
|
-
},
|
|
391
|
+
}, _callee8, this, [[1, 11]]);
|
|
368
392
|
}));
|
|
369
393
|
function loadUser(_x4) {
|
|
370
394
|
return _loadUser.apply(this, arguments);
|
|
@@ -374,27 +398,27 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
374
398
|
}, {
|
|
375
399
|
key: "refreshAuthToken",
|
|
376
400
|
value: function () {
|
|
377
|
-
var _refreshAuthToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
401
|
+
var _refreshAuthToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(authtoken) {
|
|
378
402
|
var response;
|
|
379
|
-
return _regeneratorRuntime().wrap(function
|
|
380
|
-
while (1) switch (
|
|
403
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
404
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
381
405
|
case 0:
|
|
382
|
-
|
|
383
|
-
|
|
406
|
+
_context9.prev = 0;
|
|
407
|
+
_context9.next = 3;
|
|
384
408
|
return this.axios.post('/user_service/refreshAuthToken', [authtoken]);
|
|
385
409
|
case 3:
|
|
386
|
-
response =
|
|
410
|
+
response = _context9.sent;
|
|
387
411
|
debugger;
|
|
388
|
-
return
|
|
412
|
+
return _context9.abrupt("return", response.data);
|
|
389
413
|
case 8:
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
this._handleError(
|
|
414
|
+
_context9.prev = 8;
|
|
415
|
+
_context9.t0 = _context9["catch"](0);
|
|
416
|
+
this._handleError(_context9.t0);
|
|
393
417
|
case 11:
|
|
394
418
|
case "end":
|
|
395
|
-
return
|
|
419
|
+
return _context9.stop();
|
|
396
420
|
}
|
|
397
|
-
},
|
|
421
|
+
}, _callee9, this, [[0, 8]]);
|
|
398
422
|
}));
|
|
399
423
|
function refreshAuthToken(_x5) {
|
|
400
424
|
return _refreshAuthToken.apply(this, arguments);
|
|
@@ -411,32 +435,32 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
411
435
|
}, {
|
|
412
436
|
key: "registerUser",
|
|
413
437
|
value: (function () {
|
|
414
|
-
var _registerUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
438
|
+
var _registerUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
415
439
|
var dataHash,
|
|
416
440
|
response,
|
|
417
441
|
record,
|
|
418
|
-
|
|
419
|
-
return _regeneratorRuntime().wrap(function
|
|
420
|
-
while (1) switch (
|
|
442
|
+
_args10 = arguments;
|
|
443
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
444
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
421
445
|
case 0:
|
|
422
|
-
dataHash =
|
|
423
|
-
|
|
424
|
-
|
|
446
|
+
dataHash = _args10.length > 0 && _args10[0] !== undefined ? _args10[0] : {};
|
|
447
|
+
_context10.prev = 1;
|
|
448
|
+
_context10.next = 4;
|
|
425
449
|
return this.axios.post('/user_service/registerUser', [dataHash]);
|
|
426
450
|
case 4:
|
|
427
|
-
response =
|
|
451
|
+
response = _context10.sent;
|
|
428
452
|
record = response.data;
|
|
429
|
-
return
|
|
453
|
+
return _context10.abrupt("return", new _rbt_user["default"](record, this.axios));
|
|
430
454
|
case 9:
|
|
431
|
-
|
|
432
|
-
|
|
455
|
+
_context10.prev = 9;
|
|
456
|
+
_context10.t0 = _context10["catch"](1);
|
|
433
457
|
debugger;
|
|
434
|
-
return
|
|
458
|
+
return _context10.abrupt("return", this._handleError(_context10.t0));
|
|
435
459
|
case 13:
|
|
436
460
|
case "end":
|
|
437
|
-
return
|
|
461
|
+
return _context10.stop();
|
|
438
462
|
}
|
|
439
|
-
},
|
|
463
|
+
}, _callee10, this, [[1, 9]]);
|
|
440
464
|
}));
|
|
441
465
|
function registerUser() {
|
|
442
466
|
return _registerUser.apply(this, arguments);
|
|
@@ -454,30 +478,30 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
454
478
|
}, {
|
|
455
479
|
key: "createFile",
|
|
456
480
|
value: (function () {
|
|
457
|
-
var _createFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
481
|
+
var _createFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(dataHash) {
|
|
458
482
|
var response, record;
|
|
459
|
-
return _regeneratorRuntime().wrap(function
|
|
460
|
-
while (1) switch (
|
|
483
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
484
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
461
485
|
case 0:
|
|
462
|
-
|
|
463
|
-
|
|
486
|
+
_context11.prev = 0;
|
|
487
|
+
_context11.next = 3;
|
|
464
488
|
return this.axios.post('/object_service/createObject', ['<@filekit.file>', dataHash]);
|
|
465
489
|
case 3:
|
|
466
|
-
response =
|
|
490
|
+
response = _context11.sent;
|
|
467
491
|
record = response.data;
|
|
468
492
|
if (dataHash) {
|
|
469
493
|
record.data = dataHash;
|
|
470
494
|
}
|
|
471
|
-
return
|
|
495
|
+
return _context11.abrupt("return", new _rbt_file["default"](record, this.axios, this.localDb));
|
|
472
496
|
case 9:
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
return
|
|
497
|
+
_context11.prev = 9;
|
|
498
|
+
_context11.t0 = _context11["catch"](0);
|
|
499
|
+
return _context11.abrupt("return", this._handleError(_context11.t0));
|
|
476
500
|
case 12:
|
|
477
501
|
case "end":
|
|
478
|
-
return
|
|
502
|
+
return _context11.stop();
|
|
479
503
|
}
|
|
480
|
-
},
|
|
504
|
+
}, _callee11, this, [[0, 9]]);
|
|
481
505
|
}));
|
|
482
506
|
function createFile(_x6) {
|
|
483
507
|
return _createFile.apply(this, arguments);
|
|
@@ -487,33 +511,33 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
487
511
|
}, {
|
|
488
512
|
key: "loadFile",
|
|
489
513
|
value: function () {
|
|
490
|
-
var _loadFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
514
|
+
var _loadFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(id) {
|
|
491
515
|
var response, record;
|
|
492
|
-
return _regeneratorRuntime().wrap(function
|
|
493
|
-
while (1) switch (
|
|
516
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
517
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
494
518
|
case 0:
|
|
495
|
-
|
|
496
|
-
|
|
519
|
+
_context12.prev = 0;
|
|
520
|
+
_context12.next = 3;
|
|
497
521
|
return this.load('<@filekit.file>', id);
|
|
498
522
|
case 3:
|
|
499
|
-
response =
|
|
523
|
+
response = _context12.sent;
|
|
500
524
|
if (response) {
|
|
501
|
-
|
|
525
|
+
_context12.next = 6;
|
|
502
526
|
break;
|
|
503
527
|
}
|
|
504
|
-
return
|
|
528
|
+
return _context12.abrupt("return", null);
|
|
505
529
|
case 6:
|
|
506
530
|
record = response.toRecord();
|
|
507
|
-
return
|
|
531
|
+
return _context12.abrupt("return", new _rbt_file["default"](record, this.axios, this.localDb));
|
|
508
532
|
case 10:
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
return
|
|
533
|
+
_context12.prev = 10;
|
|
534
|
+
_context12.t0 = _context12["catch"](0);
|
|
535
|
+
return _context12.abrupt("return", this._handleError(_context12.t0));
|
|
512
536
|
case 13:
|
|
513
537
|
case "end":
|
|
514
|
-
return
|
|
538
|
+
return _context12.stop();
|
|
515
539
|
}
|
|
516
|
-
},
|
|
540
|
+
}, _callee12, this, [[0, 10]]);
|
|
517
541
|
}));
|
|
518
542
|
function loadFile(_x7) {
|
|
519
543
|
return _loadFile.apply(this, arguments);
|
|
@@ -530,36 +554,36 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
530
554
|
}, {
|
|
531
555
|
key: "create",
|
|
532
556
|
value: (function () {
|
|
533
|
-
var _create = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
557
|
+
var _create = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(type) {
|
|
534
558
|
var dataHash,
|
|
535
559
|
response,
|
|
536
560
|
record,
|
|
537
|
-
|
|
538
|
-
return _regeneratorRuntime().wrap(function
|
|
539
|
-
while (1) switch (
|
|
561
|
+
_args13 = arguments;
|
|
562
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
563
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
540
564
|
case 0:
|
|
541
|
-
dataHash =
|
|
542
|
-
|
|
543
|
-
|
|
565
|
+
dataHash = _args13.length > 1 && _args13[1] !== undefined ? _args13[1] : {};
|
|
566
|
+
_context13.prev = 1;
|
|
567
|
+
_context13.next = 4;
|
|
544
568
|
return this.axios.post('/object_service/createObject', [type, dataHash]);
|
|
545
569
|
case 4:
|
|
546
|
-
response =
|
|
570
|
+
response = _context13.sent;
|
|
547
571
|
record = response.data;
|
|
548
572
|
if (dataHash) {
|
|
549
573
|
record.data = dataHash;
|
|
550
574
|
}
|
|
551
|
-
return
|
|
575
|
+
return _context13.abrupt("return", new _rbt_object["default"](record, this.axios, {
|
|
552
576
|
isNew: true
|
|
553
577
|
}));
|
|
554
578
|
case 10:
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
return
|
|
579
|
+
_context13.prev = 10;
|
|
580
|
+
_context13.t0 = _context13["catch"](1);
|
|
581
|
+
return _context13.abrupt("return", this._handleError(_context13.t0));
|
|
558
582
|
case 13:
|
|
559
583
|
case "end":
|
|
560
|
-
return
|
|
584
|
+
return _context13.stop();
|
|
561
585
|
}
|
|
562
|
-
},
|
|
586
|
+
}, _callee13, this, [[1, 10]]);
|
|
563
587
|
}));
|
|
564
588
|
function create(_x8) {
|
|
565
589
|
return _create.apply(this, arguments);
|
|
@@ -598,19 +622,19 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
598
622
|
}, {
|
|
599
623
|
key: "query",
|
|
600
624
|
value: (function () {
|
|
601
|
-
var _query = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
625
|
+
var _query = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(type) {
|
|
602
626
|
var _this = this;
|
|
603
627
|
var params,
|
|
604
628
|
defaultOrderBy,
|
|
605
629
|
defaultLimit,
|
|
606
630
|
mergedParams,
|
|
607
631
|
response,
|
|
608
|
-
|
|
609
|
-
return _regeneratorRuntime().wrap(function
|
|
610
|
-
while (1) switch (
|
|
632
|
+
_args14 = arguments;
|
|
633
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
634
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
611
635
|
case 0:
|
|
612
|
-
params =
|
|
613
|
-
|
|
636
|
+
params = _args14.length > 1 && _args14[1] !== undefined ? _args14[1] : {};
|
|
637
|
+
_context14.prev = 1;
|
|
614
638
|
params.type = type;
|
|
615
639
|
|
|
616
640
|
// Default ordering and pagination
|
|
@@ -627,15 +651,15 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
627
651
|
}
|
|
628
652
|
}; // Merge defaults with provided params
|
|
629
653
|
mergedParams = _objectSpread(_objectSpread(_objectSpread({}, defaultOrderBy), defaultLimit), params);
|
|
630
|
-
|
|
654
|
+
_context14.next = 8;
|
|
631
655
|
return this.axios.post('/object_service/queryObjects', [mergedParams]);
|
|
632
656
|
case 8:
|
|
633
|
-
response =
|
|
657
|
+
response = _context14.sent;
|
|
634
658
|
if (!(response.data.ok === false)) {
|
|
635
|
-
|
|
659
|
+
_context14.next = 11;
|
|
636
660
|
break;
|
|
637
661
|
}
|
|
638
|
-
return
|
|
662
|
+
return _context14.abrupt("return", this._handleError(response));
|
|
639
663
|
case 11:
|
|
640
664
|
// Process items into RbtObject instances
|
|
641
665
|
if (Array.isArray(response.data.items)) {
|
|
@@ -645,16 +669,16 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
645
669
|
});
|
|
646
670
|
});
|
|
647
671
|
}
|
|
648
|
-
return
|
|
672
|
+
return _context14.abrupt("return", response.data.items);
|
|
649
673
|
case 15:
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
return
|
|
674
|
+
_context14.prev = 15;
|
|
675
|
+
_context14.t0 = _context14["catch"](1);
|
|
676
|
+
return _context14.abrupt("return", this._handleError(_context14.t0));
|
|
653
677
|
case 18:
|
|
654
678
|
case "end":
|
|
655
|
-
return
|
|
679
|
+
return _context14.stop();
|
|
656
680
|
}
|
|
657
|
-
},
|
|
681
|
+
}, _callee14, this, [[1, 15]]);
|
|
658
682
|
}));
|
|
659
683
|
function query(_x9) {
|
|
660
684
|
return _query.apply(this, arguments);
|
|
@@ -673,45 +697,45 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
673
697
|
}, {
|
|
674
698
|
key: "load",
|
|
675
699
|
value: (function () {
|
|
676
|
-
var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
700
|
+
var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(type, ids) {
|
|
677
701
|
var params,
|
|
678
702
|
mergedParams,
|
|
679
703
|
res,
|
|
680
|
-
|
|
681
|
-
return _regeneratorRuntime().wrap(function
|
|
682
|
-
while (1) switch (
|
|
704
|
+
_args15 = arguments;
|
|
705
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
706
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
683
707
|
case 0:
|
|
684
|
-
params =
|
|
685
|
-
|
|
708
|
+
params = _args15.length > 2 && _args15[2] !== undefined ? _args15[2] : {};
|
|
709
|
+
_context15.prev = 1;
|
|
686
710
|
if (!Array.isArray(ids)) {
|
|
687
|
-
|
|
711
|
+
_context15.next = 7;
|
|
688
712
|
break;
|
|
689
713
|
}
|
|
690
714
|
mergedParams = _objectSpread(_objectSpread({}, params), {}, {
|
|
691
715
|
where: "id IN (" + ids.join(',') + ")"
|
|
692
716
|
});
|
|
693
|
-
return
|
|
717
|
+
return _context15.abrupt("return", this.query(type, mergedParams));
|
|
694
718
|
case 7:
|
|
695
719
|
mergedParams = _objectSpread(_objectSpread({}, params), {}, {
|
|
696
720
|
where: "id=" + ids
|
|
697
721
|
});
|
|
698
|
-
|
|
722
|
+
_context15.next = 10;
|
|
699
723
|
return this.query(type, mergedParams);
|
|
700
724
|
case 10:
|
|
701
|
-
res =
|
|
702
|
-
return
|
|
725
|
+
res = _context15.sent;
|
|
726
|
+
return _context15.abrupt("return", res[0]);
|
|
703
727
|
case 12:
|
|
704
|
-
|
|
728
|
+
_context15.next = 17;
|
|
705
729
|
break;
|
|
706
730
|
case 14:
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
return
|
|
731
|
+
_context15.prev = 14;
|
|
732
|
+
_context15.t0 = _context15["catch"](1);
|
|
733
|
+
return _context15.abrupt("return", this._handleError(_context15.t0));
|
|
710
734
|
case 17:
|
|
711
735
|
case "end":
|
|
712
|
-
return
|
|
736
|
+
return _context15.stop();
|
|
713
737
|
}
|
|
714
|
-
},
|
|
738
|
+
}, _callee15, this, [[1, 14]]);
|
|
715
739
|
}));
|
|
716
740
|
function load(_x10, _x11) {
|
|
717
741
|
return _load.apply(this, arguments);
|
|
@@ -735,7 +759,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
735
759
|
}, {
|
|
736
760
|
key: "runTask",
|
|
737
761
|
value: (function () {
|
|
738
|
-
var _runTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
762
|
+
var _runTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
|
|
739
763
|
var params,
|
|
740
764
|
callbacks,
|
|
741
765
|
onProgress,
|
|
@@ -747,20 +771,20 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
747
771
|
status,
|
|
748
772
|
message,
|
|
749
773
|
output,
|
|
750
|
-
|
|
751
|
-
return _regeneratorRuntime().wrap(function
|
|
752
|
-
while (1) switch (
|
|
774
|
+
_args16 = arguments;
|
|
775
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
776
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
753
777
|
case 0:
|
|
754
|
-
params =
|
|
755
|
-
callbacks =
|
|
778
|
+
params = _args16.length > 0 && _args16[0] !== undefined ? _args16[0] : {};
|
|
779
|
+
callbacks = _args16.length > 1 && _args16[1] !== undefined ? _args16[1] : {};
|
|
756
780
|
onProgress = callbacks.onProgress, onError = callbacks.onError, onFinish = callbacks.onFinish;
|
|
757
|
-
|
|
758
|
-
|
|
781
|
+
_context16.prev = 3;
|
|
782
|
+
_context16.next = 6;
|
|
759
783
|
return this.post('/task_service/runChain', params);
|
|
760
784
|
case 6:
|
|
761
|
-
response =
|
|
785
|
+
response = _context16.sent;
|
|
762
786
|
if (response) {
|
|
763
|
-
|
|
787
|
+
_context16.next = 9;
|
|
764
788
|
break;
|
|
765
789
|
}
|
|
766
790
|
throw new Error('Invalid server response');
|
|
@@ -768,7 +792,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
768
792
|
// Validate response structure
|
|
769
793
|
ok = response.ok, jobId = response.jobId, status = response.status, message = response.message, output = response.output;
|
|
770
794
|
if (!(!ok || typeof jobId !== 'string' || typeof status !== 'string')) {
|
|
771
|
-
|
|
795
|
+
_context16.next = 12;
|
|
772
796
|
break;
|
|
773
797
|
}
|
|
774
798
|
throw new Error('Invalid response structure');
|
|
@@ -786,7 +810,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
786
810
|
console.log('Finish (request) ', response);
|
|
787
811
|
onFinish(response);
|
|
788
812
|
}
|
|
789
|
-
return
|
|
813
|
+
return _context16.abrupt("return", {
|
|
790
814
|
ok: ok,
|
|
791
815
|
jobId: jobId,
|
|
792
816
|
status: status,
|
|
@@ -794,24 +818,24 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
794
818
|
output: output
|
|
795
819
|
});
|
|
796
820
|
case 18:
|
|
797
|
-
|
|
798
|
-
|
|
821
|
+
_context16.prev = 18;
|
|
822
|
+
_context16.t0 = _context16["catch"](3);
|
|
799
823
|
if (typeof onError === 'function') {
|
|
800
|
-
onError(
|
|
824
|
+
onError(_context16.t0);
|
|
801
825
|
} else {
|
|
802
|
-
console.error('Error in runTask:',
|
|
826
|
+
console.error('Error in runTask:', _context16.t0);
|
|
803
827
|
}
|
|
804
|
-
return
|
|
828
|
+
return _context16.abrupt("return", {
|
|
805
829
|
ok: false,
|
|
806
830
|
jobId: null,
|
|
807
831
|
status: 'ERROR',
|
|
808
|
-
error:
|
|
832
|
+
error: _context16.t0.message
|
|
809
833
|
});
|
|
810
834
|
case 22:
|
|
811
835
|
case "end":
|
|
812
|
-
return
|
|
836
|
+
return _context16.stop();
|
|
813
837
|
}
|
|
814
|
-
},
|
|
838
|
+
}, _callee16, this, [[3, 18]]);
|
|
815
839
|
}));
|
|
816
840
|
function runTask() {
|
|
817
841
|
return _runTask.apply(this, arguments);
|
|
@@ -832,26 +856,26 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
832
856
|
}, {
|
|
833
857
|
key: "pollTaskProgress",
|
|
834
858
|
value: (function () {
|
|
835
|
-
var _pollTaskProgress = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
859
|
+
var _pollTaskProgress = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(jobId, callbacks) {
|
|
836
860
|
var _this2 = this;
|
|
837
861
|
var onProgress, onError, onFinish, checkProgress;
|
|
838
|
-
return _regeneratorRuntime().wrap(function
|
|
839
|
-
while (1) switch (
|
|
862
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
863
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
840
864
|
case 0:
|
|
841
865
|
onProgress = callbacks.onProgress, onError = callbacks.onError, onFinish = callbacks.onFinish;
|
|
842
|
-
|
|
866
|
+
_context18.prev = 1;
|
|
843
867
|
checkProgress = /*#__PURE__*/function () {
|
|
844
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
868
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
|
|
845
869
|
var response;
|
|
846
|
-
return _regeneratorRuntime().wrap(function
|
|
847
|
-
while (1) switch (
|
|
870
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
871
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
848
872
|
case 0:
|
|
849
|
-
|
|
873
|
+
_context17.next = 2;
|
|
850
874
|
return _this2.get("/task_service/pollChainProgress", {
|
|
851
875
|
jobId: jobId
|
|
852
876
|
});
|
|
853
877
|
case 2:
|
|
854
|
-
response =
|
|
878
|
+
response = _context17.sent;
|
|
855
879
|
// If the task is still in progress, start polling for updates
|
|
856
880
|
if (response.status === 'DONE' && onFinish) {
|
|
857
881
|
// Provide the current progress to the callback function
|
|
@@ -874,26 +898,26 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
874
898
|
}
|
|
875
899
|
case 7:
|
|
876
900
|
case "end":
|
|
877
|
-
return
|
|
901
|
+
return _context17.stop();
|
|
878
902
|
}
|
|
879
|
-
},
|
|
903
|
+
}, _callee17);
|
|
880
904
|
}));
|
|
881
905
|
return function checkProgress() {
|
|
882
906
|
return _ref2.apply(this, arguments);
|
|
883
907
|
};
|
|
884
908
|
}();
|
|
885
909
|
checkProgress();
|
|
886
|
-
|
|
910
|
+
_context18.next = 9;
|
|
887
911
|
break;
|
|
888
912
|
case 6:
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
return
|
|
913
|
+
_context18.prev = 6;
|
|
914
|
+
_context18.t0 = _context18["catch"](1);
|
|
915
|
+
return _context18.abrupt("return", this._handleError(_context18.t0));
|
|
892
916
|
case 9:
|
|
893
917
|
case "end":
|
|
894
|
-
return
|
|
918
|
+
return _context18.stop();
|
|
895
919
|
}
|
|
896
|
-
},
|
|
920
|
+
}, _callee18, this, [[1, 6]]);
|
|
897
921
|
}));
|
|
898
922
|
function pollTaskProgress(_x12, _x13) {
|
|
899
923
|
return _pollTaskProgress.apply(this, arguments);
|
|
@@ -915,44 +939,44 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
915
939
|
}, {
|
|
916
940
|
key: "get",
|
|
917
941
|
value: (function () {
|
|
918
|
-
var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
942
|
+
var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(endpoint) {
|
|
919
943
|
var params,
|
|
920
944
|
headers,
|
|
921
945
|
response,
|
|
922
|
-
|
|
923
|
-
return _regeneratorRuntime().wrap(function
|
|
924
|
-
while (1) switch (
|
|
946
|
+
_args19 = arguments;
|
|
947
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
948
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
925
949
|
case 0:
|
|
926
|
-
params =
|
|
950
|
+
params = _args19.length > 1 && _args19[1] !== undefined ? _args19[1] : {};
|
|
927
951
|
debugger;
|
|
928
|
-
|
|
952
|
+
_context19.prev = 2;
|
|
929
953
|
// Add the authToken to the headers
|
|
930
954
|
headers = {
|
|
931
955
|
authtoken: this.authtoken
|
|
932
956
|
}; // Make the GET request using Axios
|
|
933
|
-
|
|
957
|
+
_context19.next = 6;
|
|
934
958
|
return this.axios.get(endpoint, {
|
|
935
959
|
params: params,
|
|
936
960
|
headers: headers
|
|
937
961
|
});
|
|
938
962
|
case 6:
|
|
939
|
-
response =
|
|
963
|
+
response = _context19.sent;
|
|
940
964
|
if (!(response.data.ok === false)) {
|
|
941
|
-
|
|
965
|
+
_context19.next = 9;
|
|
942
966
|
break;
|
|
943
967
|
}
|
|
944
|
-
return
|
|
968
|
+
return _context19.abrupt("return", this._handleError(response));
|
|
945
969
|
case 9:
|
|
946
|
-
return
|
|
970
|
+
return _context19.abrupt("return", response.data);
|
|
947
971
|
case 12:
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
return
|
|
972
|
+
_context19.prev = 12;
|
|
973
|
+
_context19.t0 = _context19["catch"](2);
|
|
974
|
+
return _context19.abrupt("return", this._handleError(_context19.t0));
|
|
951
975
|
case 15:
|
|
952
976
|
case "end":
|
|
953
|
-
return
|
|
977
|
+
return _context19.stop();
|
|
954
978
|
}
|
|
955
|
-
},
|
|
979
|
+
}, _callee19, this, [[2, 12]]);
|
|
956
980
|
}));
|
|
957
981
|
function get(_x14) {
|
|
958
982
|
return _get.apply(this, arguments);
|
|
@@ -975,42 +999,42 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
975
999
|
}, {
|
|
976
1000
|
key: "post",
|
|
977
1001
|
value: (function () {
|
|
978
|
-
var _post = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1002
|
+
var _post = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(endpoint) {
|
|
979
1003
|
var data,
|
|
980
1004
|
headers,
|
|
981
1005
|
response,
|
|
982
|
-
|
|
983
|
-
return _regeneratorRuntime().wrap(function
|
|
984
|
-
while (1) switch (
|
|
1006
|
+
_args20 = arguments;
|
|
1007
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
1008
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
985
1009
|
case 0:
|
|
986
|
-
data =
|
|
987
|
-
|
|
1010
|
+
data = _args20.length > 1 && _args20[1] !== undefined ? _args20[1] : {};
|
|
1011
|
+
_context20.prev = 1;
|
|
988
1012
|
// Add the authToken to the headers
|
|
989
1013
|
headers = {
|
|
990
1014
|
authtoken: this.authtoken
|
|
991
1015
|
}; // Make the POST request using Axios
|
|
992
|
-
|
|
1016
|
+
_context20.next = 5;
|
|
993
1017
|
return this.axios.post(endpoint, data, {
|
|
994
1018
|
headers: headers
|
|
995
1019
|
});
|
|
996
1020
|
case 5:
|
|
997
|
-
response =
|
|
1021
|
+
response = _context20.sent;
|
|
998
1022
|
if (!(response.data.ok === false)) {
|
|
999
|
-
|
|
1023
|
+
_context20.next = 8;
|
|
1000
1024
|
break;
|
|
1001
1025
|
}
|
|
1002
|
-
return
|
|
1026
|
+
return _context20.abrupt("return", this._handleError(response));
|
|
1003
1027
|
case 8:
|
|
1004
|
-
return
|
|
1028
|
+
return _context20.abrupt("return", response.data);
|
|
1005
1029
|
case 11:
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
return
|
|
1030
|
+
_context20.prev = 11;
|
|
1031
|
+
_context20.t0 = _context20["catch"](1);
|
|
1032
|
+
return _context20.abrupt("return", this._handleError(_context20.t0));
|
|
1009
1033
|
case 14:
|
|
1010
1034
|
case "end":
|
|
1011
|
-
return
|
|
1035
|
+
return _context20.stop();
|
|
1012
1036
|
}
|
|
1013
|
-
},
|
|
1037
|
+
}, _callee20, this, [[1, 11]]);
|
|
1014
1038
|
}));
|
|
1015
1039
|
function post(_x15) {
|
|
1016
1040
|
return _post.apply(this, arguments);
|
package/dist/esm/index.js
CHANGED
|
@@ -86,6 +86,9 @@ export default class Roboto {
|
|
|
86
86
|
async loadCurrentUser() {
|
|
87
87
|
return this.api.loadCurrentUser();
|
|
88
88
|
}
|
|
89
|
+
async loadCurrentUserExtended() {
|
|
90
|
+
return this.api.loadCurrentUserExtended();
|
|
91
|
+
}
|
|
89
92
|
async getCurrentUser() {
|
|
90
93
|
return this.api.getCurrentUser();
|
|
91
94
|
}
|
package/dist/esm/rbt_api.js
CHANGED
|
@@ -88,7 +88,7 @@ export default class RbtApi {
|
|
|
88
88
|
if (this.localStorageAdaptor) {
|
|
89
89
|
await this.localStorageAdaptor.setItem('authtoken', response.data.authToken);
|
|
90
90
|
}
|
|
91
|
-
return
|
|
91
|
+
return this.currentUser;
|
|
92
92
|
} catch (e) {
|
|
93
93
|
this._handleError(e);
|
|
94
94
|
}
|
|
@@ -162,6 +162,10 @@ export default class RbtApi {
|
|
|
162
162
|
return this._handleError(e);
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
|
+
async loadCurrentUserExtended() {
|
|
166
|
+
let currentUser = await this.loadCurrentUser();
|
|
167
|
+
return this.loadUser(currentUser.id);
|
|
168
|
+
}
|
|
165
169
|
async loadUser(userId) {
|
|
166
170
|
let params = {
|
|
167
171
|
id: userId
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -51,6 +51,7 @@ export default class Roboto{
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
Roboto.instance = this;
|
|
54
|
+
|
|
54
55
|
}
|
|
55
56
|
|
|
56
57
|
setAppServiceHost(host){
|
|
@@ -103,6 +104,9 @@ export default class Roboto{
|
|
|
103
104
|
async loadCurrentUser(){
|
|
104
105
|
return this.api.loadCurrentUser();
|
|
105
106
|
}
|
|
107
|
+
async loadCurrentUserExtended(){
|
|
108
|
+
return this.api.loadCurrentUserExtended();
|
|
109
|
+
}
|
|
106
110
|
async getCurrentUser(){
|
|
107
111
|
return this.api.getCurrentUser();
|
|
108
112
|
}
|
package/src/rbt_api.js
CHANGED
|
@@ -103,7 +103,8 @@ export default class RbtApi {
|
|
|
103
103
|
await this.localStorageAdaptor.setItem('authtoken', response.data.authToken);
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
return
|
|
106
|
+
return this.currentUser;
|
|
107
|
+
|
|
107
108
|
} catch (e) {
|
|
108
109
|
|
|
109
110
|
this._handleError(e);
|
|
@@ -199,6 +200,13 @@ export default class RbtApi {
|
|
|
199
200
|
|
|
200
201
|
}
|
|
201
202
|
|
|
203
|
+
async loadCurrentUserExtended(){
|
|
204
|
+
|
|
205
|
+
let currentUser = await this.loadCurrentUser();
|
|
206
|
+
return this.loadUser(currentUser.id);
|
|
207
|
+
|
|
208
|
+
}
|
|
209
|
+
|
|
202
210
|
|
|
203
211
|
async loadUser(userId){
|
|
204
212
|
|