roboto-js 1.4.9 → 1.4.10
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/rbt_api.cjs +272 -292
- package/dist/esm/rbt_api.js +30 -20
- package/package.json +1 -1
- package/src/rbt_api.js +28 -28
package/dist/cjs/rbt_api.cjs
CHANGED
|
@@ -191,73 +191,53 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
191
191
|
return _login.apply(this, arguments);
|
|
192
192
|
}
|
|
193
193
|
return login;
|
|
194
|
-
}())
|
|
194
|
+
}() // async loginWithOauth(userData){
|
|
195
|
+
//
|
|
196
|
+
// try {
|
|
197
|
+
// debugger;
|
|
198
|
+
// const response = await this.post('/api/account/registerOrSigninOauth', userData );
|
|
199
|
+
//
|
|
200
|
+
// if (response.ok === false) {
|
|
201
|
+
// return this._handleError(response);
|
|
202
|
+
// }
|
|
203
|
+
//
|
|
204
|
+
// this.iac_session = response;
|
|
205
|
+
// this.currentUser = (this.iac_session)? new RbtUser(this.iac_session.user, this.axios): null;
|
|
206
|
+
// // update axios instance headers with authtoken
|
|
207
|
+
// this.axios.defaults.headers.common['authtoken'] = response.authToken;
|
|
208
|
+
// this.authtoken = response.authToken;
|
|
209
|
+
//
|
|
210
|
+
// if(this.localStorageAdaptor){
|
|
211
|
+
// await this.localStorageAdaptor.setItem('authtoken', response.authToken);
|
|
212
|
+
// }
|
|
213
|
+
//
|
|
214
|
+
// return response;
|
|
215
|
+
//
|
|
216
|
+
// } catch (e) {
|
|
217
|
+
//
|
|
218
|
+
// this._handleError(e);
|
|
219
|
+
// }
|
|
220
|
+
//
|
|
221
|
+
// }
|
|
222
|
+
)
|
|
195
223
|
}, {
|
|
196
|
-
key: "
|
|
224
|
+
key: "logout",
|
|
197
225
|
value: function () {
|
|
198
|
-
var
|
|
226
|
+
var _logout = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
199
227
|
var response;
|
|
200
228
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
201
229
|
while (1) switch (_context4.prev = _context4.next) {
|
|
202
230
|
case 0:
|
|
203
231
|
_context4.prev = 0;
|
|
204
|
-
|
|
205
|
-
_context4.next = 4;
|
|
206
|
-
return this.post('/api/account/registerOrSigninOauth', userData);
|
|
207
|
-
case 4:
|
|
208
|
-
response = _context4.sent;
|
|
209
|
-
if (!(response.ok === false)) {
|
|
210
|
-
_context4.next = 7;
|
|
211
|
-
break;
|
|
212
|
-
}
|
|
213
|
-
return _context4.abrupt("return", this._handleError(response));
|
|
214
|
-
case 7:
|
|
215
|
-
this.iac_session = response;
|
|
216
|
-
this.currentUser = this.iac_session ? new _rbt_user["default"](this.iac_session.user, this.axios) : null;
|
|
217
|
-
// update axios instance headers with authtoken
|
|
218
|
-
this.axios.defaults.headers.common['authtoken'] = response.authToken;
|
|
219
|
-
this.authtoken = response.authToken;
|
|
220
|
-
if (!this.localStorageAdaptor) {
|
|
221
|
-
_context4.next = 14;
|
|
222
|
-
break;
|
|
223
|
-
}
|
|
224
|
-
_context4.next = 14;
|
|
225
|
-
return this.localStorageAdaptor.setItem('authtoken', response.authToken);
|
|
226
|
-
case 14:
|
|
227
|
-
return _context4.abrupt("return", response);
|
|
228
|
-
case 17:
|
|
229
|
-
_context4.prev = 17;
|
|
230
|
-
_context4.t0 = _context4["catch"](0);
|
|
231
|
-
this._handleError(_context4.t0);
|
|
232
|
-
case 20:
|
|
233
|
-
case "end":
|
|
234
|
-
return _context4.stop();
|
|
235
|
-
}
|
|
236
|
-
}, _callee4, this, [[0, 17]]);
|
|
237
|
-
}));
|
|
238
|
-
function loginWithOauth(_x3) {
|
|
239
|
-
return _loginWithOauth.apply(this, arguments);
|
|
240
|
-
}
|
|
241
|
-
return loginWithOauth;
|
|
242
|
-
}()
|
|
243
|
-
}, {
|
|
244
|
-
key: "logout",
|
|
245
|
-
value: function () {
|
|
246
|
-
var _logout = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
247
|
-
var response;
|
|
248
|
-
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
249
|
-
while (1) switch (_context5.prev = _context5.next) {
|
|
250
|
-
case 0:
|
|
251
|
-
_context5.prev = 0;
|
|
252
|
-
_context5.next = 3;
|
|
232
|
+
_context4.next = 3;
|
|
253
233
|
return this.axios.post('/user_service/logoutUser');
|
|
254
234
|
case 3:
|
|
255
|
-
response =
|
|
235
|
+
response = _context4.sent;
|
|
256
236
|
if (!(response.data.ok === false)) {
|
|
257
|
-
|
|
237
|
+
_context4.next = 6;
|
|
258
238
|
break;
|
|
259
239
|
}
|
|
260
|
-
return
|
|
240
|
+
return _context4.abrupt("return", this._handleError(response));
|
|
261
241
|
case 6:
|
|
262
242
|
// Clear the iac_session and remove the auth token from axios headers
|
|
263
243
|
this.iac_session = null;
|
|
@@ -269,22 +249,22 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
269
249
|
|
|
270
250
|
// Clear localStorage if it's being used
|
|
271
251
|
if (!this.localStorageAdaptor) {
|
|
272
|
-
|
|
252
|
+
_context4.next = 13;
|
|
273
253
|
break;
|
|
274
254
|
}
|
|
275
|
-
|
|
255
|
+
_context4.next = 13;
|
|
276
256
|
return this.localStorageAdaptor.removeItem('authtoken');
|
|
277
257
|
case 13:
|
|
278
|
-
return
|
|
258
|
+
return _context4.abrupt("return", response.data);
|
|
279
259
|
case 16:
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
this._handleError(
|
|
260
|
+
_context4.prev = 16;
|
|
261
|
+
_context4.t0 = _context4["catch"](0);
|
|
262
|
+
this._handleError(_context4.t0);
|
|
283
263
|
case 19:
|
|
284
264
|
case "end":
|
|
285
|
-
return
|
|
265
|
+
return _context4.stop();
|
|
286
266
|
}
|
|
287
|
-
},
|
|
267
|
+
}, _callee4, this, [[0, 16]]);
|
|
288
268
|
}));
|
|
289
269
|
function logout() {
|
|
290
270
|
return _logout.apply(this, arguments);
|
|
@@ -301,43 +281,43 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
301
281
|
}, {
|
|
302
282
|
key: "loadCurrentUser",
|
|
303
283
|
value: function () {
|
|
304
|
-
var _loadCurrentUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
284
|
+
var _loadCurrentUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
305
285
|
var response;
|
|
306
|
-
return _regeneratorRuntime().wrap(function
|
|
307
|
-
while (1) switch (
|
|
286
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
287
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
308
288
|
case 0:
|
|
309
|
-
|
|
289
|
+
_context5.prev = 0;
|
|
310
290
|
if (!this.currentUser) {
|
|
311
|
-
|
|
291
|
+
_context5.next = 3;
|
|
312
292
|
break;
|
|
313
293
|
}
|
|
314
|
-
return
|
|
294
|
+
return _context5.abrupt("return", this.currentUser);
|
|
315
295
|
case 3:
|
|
316
296
|
if (!this.authtoken) {
|
|
317
|
-
|
|
297
|
+
_context5.next = 10;
|
|
318
298
|
break;
|
|
319
299
|
}
|
|
320
|
-
|
|
300
|
+
_context5.next = 6;
|
|
321
301
|
return this.refreshAuthToken(this.authtoken);
|
|
322
302
|
case 6:
|
|
323
|
-
response =
|
|
303
|
+
response = _context5.sent;
|
|
324
304
|
this.currentUser = new _rbt_user["default"]({
|
|
325
305
|
id: response.user.id
|
|
326
306
|
}, this.axios);
|
|
327
307
|
this.currentUser.setData(response.user);
|
|
328
|
-
return
|
|
308
|
+
return _context5.abrupt("return", this.currentUser);
|
|
329
309
|
case 10:
|
|
330
310
|
this.currentUser = null;
|
|
331
|
-
return
|
|
311
|
+
return _context5.abrupt("return", null);
|
|
332
312
|
case 14:
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
return
|
|
313
|
+
_context5.prev = 14;
|
|
314
|
+
_context5.t0 = _context5["catch"](0);
|
|
315
|
+
return _context5.abrupt("return", this._handleError(_context5.t0));
|
|
336
316
|
case 17:
|
|
337
317
|
case "end":
|
|
338
|
-
return
|
|
318
|
+
return _context5.stop();
|
|
339
319
|
}
|
|
340
|
-
},
|
|
320
|
+
}, _callee5, this, [[0, 14]]);
|
|
341
321
|
}));
|
|
342
322
|
function loadCurrentUser() {
|
|
343
323
|
return _loadCurrentUser.apply(this, arguments);
|
|
@@ -347,37 +327,37 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
347
327
|
}, {
|
|
348
328
|
key: "confirmUserEmail",
|
|
349
329
|
value: function () {
|
|
350
|
-
var _confirmUserEmail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
330
|
+
var _confirmUserEmail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(confirmCode) {
|
|
351
331
|
var params, response;
|
|
352
|
-
return _regeneratorRuntime().wrap(function
|
|
353
|
-
while (1) switch (
|
|
332
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
333
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
354
334
|
case 0:
|
|
355
335
|
params = {
|
|
356
336
|
emailConfirmCode: confirmCode
|
|
357
337
|
};
|
|
358
|
-
|
|
359
|
-
|
|
338
|
+
_context6.prev = 1;
|
|
339
|
+
_context6.next = 4;
|
|
360
340
|
return this.axios.post('/user_service/confirmUserEmail', [params]);
|
|
361
341
|
case 4:
|
|
362
|
-
response =
|
|
342
|
+
response = _context6.sent;
|
|
363
343
|
if (!(response.data.ok === false)) {
|
|
364
|
-
|
|
344
|
+
_context6.next = 7;
|
|
365
345
|
break;
|
|
366
346
|
}
|
|
367
|
-
return
|
|
347
|
+
return _context6.abrupt("return", this._handleError(response));
|
|
368
348
|
case 7:
|
|
369
|
-
return
|
|
349
|
+
return _context6.abrupt("return", response.data);
|
|
370
350
|
case 10:
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
return
|
|
351
|
+
_context6.prev = 10;
|
|
352
|
+
_context6.t0 = _context6["catch"](1);
|
|
353
|
+
return _context6.abrupt("return", this._handleError(_context6.t0));
|
|
374
354
|
case 13:
|
|
375
355
|
case "end":
|
|
376
|
-
return
|
|
356
|
+
return _context6.stop();
|
|
377
357
|
}
|
|
378
|
-
},
|
|
358
|
+
}, _callee6, this, [[1, 10]]);
|
|
379
359
|
}));
|
|
380
|
-
function confirmUserEmail(
|
|
360
|
+
function confirmUserEmail(_x3) {
|
|
381
361
|
return _confirmUserEmail.apply(this, arguments);
|
|
382
362
|
}
|
|
383
363
|
return confirmUserEmail;
|
|
@@ -385,21 +365,21 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
385
365
|
}, {
|
|
386
366
|
key: "loadCurrentUserExtended",
|
|
387
367
|
value: function () {
|
|
388
|
-
var _loadCurrentUserExtended = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
368
|
+
var _loadCurrentUserExtended = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
389
369
|
var currentUser;
|
|
390
|
-
return _regeneratorRuntime().wrap(function
|
|
391
|
-
while (1) switch (
|
|
370
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
371
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
392
372
|
case 0:
|
|
393
|
-
|
|
373
|
+
_context7.next = 2;
|
|
394
374
|
return this.loadCurrentUser();
|
|
395
375
|
case 2:
|
|
396
|
-
currentUser =
|
|
397
|
-
return
|
|
376
|
+
currentUser = _context7.sent;
|
|
377
|
+
return _context7.abrupt("return", this.loadUser(currentUser.id));
|
|
398
378
|
case 4:
|
|
399
379
|
case "end":
|
|
400
|
-
return
|
|
380
|
+
return _context7.stop();
|
|
401
381
|
}
|
|
402
|
-
},
|
|
382
|
+
}, _callee7, this);
|
|
403
383
|
}));
|
|
404
384
|
function loadCurrentUserExtended() {
|
|
405
385
|
return _loadCurrentUserExtended.apply(this, arguments);
|
|
@@ -409,36 +389,36 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
409
389
|
}, {
|
|
410
390
|
key: "loadUser",
|
|
411
391
|
value: function () {
|
|
412
|
-
var _loadUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
392
|
+
var _loadUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(userId) {
|
|
413
393
|
var params, _response$data, response, userData, User;
|
|
414
|
-
return _regeneratorRuntime().wrap(function
|
|
415
|
-
while (1) switch (
|
|
394
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
395
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
416
396
|
case 0:
|
|
417
397
|
params = {
|
|
418
398
|
id: userId
|
|
419
399
|
};
|
|
420
|
-
|
|
421
|
-
|
|
400
|
+
_context8.prev = 1;
|
|
401
|
+
_context8.next = 4;
|
|
422
402
|
return this.axios.post('/user_service/loadUser', [params]);
|
|
423
403
|
case 4:
|
|
424
|
-
response =
|
|
404
|
+
response = _context8.sent;
|
|
425
405
|
userData = response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.user;
|
|
426
406
|
User = new _rbt_user["default"]({
|
|
427
407
|
id: userData.id
|
|
428
408
|
}, this.axios);
|
|
429
409
|
User.setData(userData);
|
|
430
|
-
return
|
|
410
|
+
return _context8.abrupt("return", User);
|
|
431
411
|
case 11:
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
return
|
|
412
|
+
_context8.prev = 11;
|
|
413
|
+
_context8.t0 = _context8["catch"](1);
|
|
414
|
+
return _context8.abrupt("return", this._handleError(_context8.t0));
|
|
435
415
|
case 14:
|
|
436
416
|
case "end":
|
|
437
|
-
return
|
|
417
|
+
return _context8.stop();
|
|
438
418
|
}
|
|
439
|
-
},
|
|
419
|
+
}, _callee8, this, [[1, 11]]);
|
|
440
420
|
}));
|
|
441
|
-
function loadUser(
|
|
421
|
+
function loadUser(_x4) {
|
|
442
422
|
return _loadUser.apply(this, arguments);
|
|
443
423
|
}
|
|
444
424
|
return loadUser;
|
|
@@ -446,29 +426,29 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
446
426
|
}, {
|
|
447
427
|
key: "refreshAuthToken",
|
|
448
428
|
value: function () {
|
|
449
|
-
var _refreshAuthToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
429
|
+
var _refreshAuthToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(authtoken) {
|
|
450
430
|
var response;
|
|
451
|
-
return _regeneratorRuntime().wrap(function
|
|
452
|
-
while (1) switch (
|
|
431
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
432
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
453
433
|
case 0:
|
|
454
|
-
|
|
455
|
-
|
|
434
|
+
_context9.prev = 0;
|
|
435
|
+
_context9.next = 3;
|
|
456
436
|
return this.axios.post('/user_service/refreshAuthToken', [authtoken]);
|
|
457
437
|
case 3:
|
|
458
|
-
response =
|
|
438
|
+
response = _context9.sent;
|
|
459
439
|
debugger;
|
|
460
|
-
return
|
|
440
|
+
return _context9.abrupt("return", response.data);
|
|
461
441
|
case 8:
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
this._handleError(
|
|
442
|
+
_context9.prev = 8;
|
|
443
|
+
_context9.t0 = _context9["catch"](0);
|
|
444
|
+
this._handleError(_context9.t0);
|
|
465
445
|
case 11:
|
|
466
446
|
case "end":
|
|
467
|
-
return
|
|
447
|
+
return _context9.stop();
|
|
468
448
|
}
|
|
469
|
-
},
|
|
449
|
+
}, _callee9, this, [[0, 8]]);
|
|
470
450
|
}));
|
|
471
|
-
function refreshAuthToken(
|
|
451
|
+
function refreshAuthToken(_x5) {
|
|
472
452
|
return _refreshAuthToken.apply(this, arguments);
|
|
473
453
|
}
|
|
474
454
|
return refreshAuthToken;
|
|
@@ -483,32 +463,32 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
483
463
|
}, {
|
|
484
464
|
key: "registerUser",
|
|
485
465
|
value: (function () {
|
|
486
|
-
var _registerUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
466
|
+
var _registerUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
487
467
|
var dataHash,
|
|
488
468
|
response,
|
|
489
469
|
record,
|
|
490
|
-
|
|
491
|
-
return _regeneratorRuntime().wrap(function
|
|
492
|
-
while (1) switch (
|
|
470
|
+
_args10 = arguments;
|
|
471
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
472
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
493
473
|
case 0:
|
|
494
|
-
dataHash =
|
|
495
|
-
|
|
496
|
-
|
|
474
|
+
dataHash = _args10.length > 0 && _args10[0] !== undefined ? _args10[0] : {};
|
|
475
|
+
_context10.prev = 1;
|
|
476
|
+
_context10.next = 4;
|
|
497
477
|
return this.axios.post('/user_service/registerUser', [dataHash]);
|
|
498
478
|
case 4:
|
|
499
|
-
response =
|
|
479
|
+
response = _context10.sent;
|
|
500
480
|
record = response.data;
|
|
501
|
-
return
|
|
481
|
+
return _context10.abrupt("return", new _rbt_user["default"](record, this.axios));
|
|
502
482
|
case 9:
|
|
503
|
-
|
|
504
|
-
|
|
483
|
+
_context10.prev = 9;
|
|
484
|
+
_context10.t0 = _context10["catch"](1);
|
|
505
485
|
debugger;
|
|
506
|
-
return
|
|
486
|
+
return _context10.abrupt("return", this._handleError(_context10.t0));
|
|
507
487
|
case 13:
|
|
508
488
|
case "end":
|
|
509
|
-
return
|
|
489
|
+
return _context10.stop();
|
|
510
490
|
}
|
|
511
|
-
},
|
|
491
|
+
}, _callee10, this, [[1, 9]]);
|
|
512
492
|
}));
|
|
513
493
|
function registerUser() {
|
|
514
494
|
return _registerUser.apply(this, arguments);
|
|
@@ -526,32 +506,32 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
526
506
|
}, {
|
|
527
507
|
key: "createFile",
|
|
528
508
|
value: (function () {
|
|
529
|
-
var _createFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
509
|
+
var _createFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(dataHash) {
|
|
530
510
|
var response, record;
|
|
531
|
-
return _regeneratorRuntime().wrap(function
|
|
532
|
-
while (1) switch (
|
|
511
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
512
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
533
513
|
case 0:
|
|
534
|
-
|
|
535
|
-
|
|
514
|
+
_context11.prev = 0;
|
|
515
|
+
_context11.next = 3;
|
|
536
516
|
return this.axios.post('/object_service/createObject', ['<@filekit.file>', dataHash]);
|
|
537
517
|
case 3:
|
|
538
|
-
response =
|
|
518
|
+
response = _context11.sent;
|
|
539
519
|
record = response.data;
|
|
540
520
|
if (dataHash) {
|
|
541
521
|
record.data = dataHash;
|
|
542
522
|
}
|
|
543
|
-
return
|
|
523
|
+
return _context11.abrupt("return", new _rbt_file["default"](record, this.axios, this.localDb));
|
|
544
524
|
case 9:
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
return
|
|
525
|
+
_context11.prev = 9;
|
|
526
|
+
_context11.t0 = _context11["catch"](0);
|
|
527
|
+
return _context11.abrupt("return", this._handleError(_context11.t0));
|
|
548
528
|
case 12:
|
|
549
529
|
case "end":
|
|
550
|
-
return
|
|
530
|
+
return _context11.stop();
|
|
551
531
|
}
|
|
552
|
-
},
|
|
532
|
+
}, _callee11, this, [[0, 9]]);
|
|
553
533
|
}));
|
|
554
|
-
function createFile(
|
|
534
|
+
function createFile(_x6) {
|
|
555
535
|
return _createFile.apply(this, arguments);
|
|
556
536
|
}
|
|
557
537
|
return createFile;
|
|
@@ -559,35 +539,35 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
559
539
|
}, {
|
|
560
540
|
key: "loadFile",
|
|
561
541
|
value: function () {
|
|
562
|
-
var _loadFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
542
|
+
var _loadFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(id) {
|
|
563
543
|
var response, record;
|
|
564
|
-
return _regeneratorRuntime().wrap(function
|
|
565
|
-
while (1) switch (
|
|
544
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
545
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
566
546
|
case 0:
|
|
567
|
-
|
|
568
|
-
|
|
547
|
+
_context12.prev = 0;
|
|
548
|
+
_context12.next = 3;
|
|
569
549
|
return this.load('<@filekit.file>', id);
|
|
570
550
|
case 3:
|
|
571
|
-
response =
|
|
551
|
+
response = _context12.sent;
|
|
572
552
|
if (response) {
|
|
573
|
-
|
|
553
|
+
_context12.next = 6;
|
|
574
554
|
break;
|
|
575
555
|
}
|
|
576
|
-
return
|
|
556
|
+
return _context12.abrupt("return", null);
|
|
577
557
|
case 6:
|
|
578
558
|
record = response.toRecord();
|
|
579
|
-
return
|
|
559
|
+
return _context12.abrupt("return", new _rbt_file["default"](record, this.axios, this.localDb));
|
|
580
560
|
case 10:
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
return
|
|
561
|
+
_context12.prev = 10;
|
|
562
|
+
_context12.t0 = _context12["catch"](0);
|
|
563
|
+
return _context12.abrupt("return", this._handleError(_context12.t0));
|
|
584
564
|
case 13:
|
|
585
565
|
case "end":
|
|
586
|
-
return
|
|
566
|
+
return _context12.stop();
|
|
587
567
|
}
|
|
588
|
-
},
|
|
568
|
+
}, _callee12, this, [[0, 10]]);
|
|
589
569
|
}));
|
|
590
|
-
function loadFile(
|
|
570
|
+
function loadFile(_x7) {
|
|
591
571
|
return _loadFile.apply(this, arguments);
|
|
592
572
|
}
|
|
593
573
|
return loadFile;
|
|
@@ -602,38 +582,38 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
602
582
|
}, {
|
|
603
583
|
key: "create",
|
|
604
584
|
value: (function () {
|
|
605
|
-
var _create = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
585
|
+
var _create = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(type) {
|
|
606
586
|
var dataHash,
|
|
607
587
|
response,
|
|
608
588
|
record,
|
|
609
|
-
|
|
610
|
-
return _regeneratorRuntime().wrap(function
|
|
611
|
-
while (1) switch (
|
|
589
|
+
_args13 = arguments;
|
|
590
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
591
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
612
592
|
case 0:
|
|
613
|
-
dataHash =
|
|
614
|
-
|
|
615
|
-
|
|
593
|
+
dataHash = _args13.length > 1 && _args13[1] !== undefined ? _args13[1] : {};
|
|
594
|
+
_context13.prev = 1;
|
|
595
|
+
_context13.next = 4;
|
|
616
596
|
return this.axios.post('/object_service/createObject', [type, dataHash]);
|
|
617
597
|
case 4:
|
|
618
|
-
response =
|
|
598
|
+
response = _context13.sent;
|
|
619
599
|
record = response.data;
|
|
620
600
|
if (dataHash) {
|
|
621
601
|
record.data = dataHash;
|
|
622
602
|
}
|
|
623
|
-
return
|
|
603
|
+
return _context13.abrupt("return", new _rbt_object["default"](record, this.axios, {
|
|
624
604
|
isNew: true
|
|
625
605
|
}));
|
|
626
606
|
case 10:
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
return
|
|
607
|
+
_context13.prev = 10;
|
|
608
|
+
_context13.t0 = _context13["catch"](1);
|
|
609
|
+
return _context13.abrupt("return", this._handleError(_context13.t0));
|
|
630
610
|
case 13:
|
|
631
611
|
case "end":
|
|
632
|
-
return
|
|
612
|
+
return _context13.stop();
|
|
633
613
|
}
|
|
634
|
-
},
|
|
614
|
+
}, _callee13, this, [[1, 10]]);
|
|
635
615
|
}));
|
|
636
|
-
function create(
|
|
616
|
+
function create(_x8) {
|
|
637
617
|
return _create.apply(this, arguments);
|
|
638
618
|
}
|
|
639
619
|
return create;
|
|
@@ -670,19 +650,19 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
670
650
|
}, {
|
|
671
651
|
key: "query",
|
|
672
652
|
value: (function () {
|
|
673
|
-
var _query = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
653
|
+
var _query = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(type) {
|
|
674
654
|
var _this = this;
|
|
675
655
|
var params,
|
|
676
656
|
defaultOrderBy,
|
|
677
657
|
defaultLimit,
|
|
678
658
|
mergedParams,
|
|
679
659
|
response,
|
|
680
|
-
|
|
681
|
-
return _regeneratorRuntime().wrap(function
|
|
682
|
-
while (1) switch (
|
|
660
|
+
_args14 = arguments;
|
|
661
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
662
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
683
663
|
case 0:
|
|
684
|
-
params =
|
|
685
|
-
|
|
664
|
+
params = _args14.length > 1 && _args14[1] !== undefined ? _args14[1] : {};
|
|
665
|
+
_context14.prev = 1;
|
|
686
666
|
params.type = type;
|
|
687
667
|
|
|
688
668
|
// Default ordering and pagination
|
|
@@ -699,15 +679,15 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
699
679
|
}
|
|
700
680
|
}; // Merge defaults with provided params
|
|
701
681
|
mergedParams = _objectSpread(_objectSpread(_objectSpread({}, defaultOrderBy), defaultLimit), params);
|
|
702
|
-
|
|
682
|
+
_context14.next = 8;
|
|
703
683
|
return this.axios.post('/object_service/queryObjects', [mergedParams]);
|
|
704
684
|
case 8:
|
|
705
|
-
response =
|
|
685
|
+
response = _context14.sent;
|
|
706
686
|
if (!(response.data.ok === false)) {
|
|
707
|
-
|
|
687
|
+
_context14.next = 11;
|
|
708
688
|
break;
|
|
709
689
|
}
|
|
710
|
-
return
|
|
690
|
+
return _context14.abrupt("return", this._handleError(response));
|
|
711
691
|
case 11:
|
|
712
692
|
// Process items into RbtObject instances
|
|
713
693
|
if (Array.isArray(response.data.items)) {
|
|
@@ -717,18 +697,18 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
717
697
|
});
|
|
718
698
|
});
|
|
719
699
|
}
|
|
720
|
-
return
|
|
700
|
+
return _context14.abrupt("return", response.data.items);
|
|
721
701
|
case 15:
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
return
|
|
702
|
+
_context14.prev = 15;
|
|
703
|
+
_context14.t0 = _context14["catch"](1);
|
|
704
|
+
return _context14.abrupt("return", this._handleError(_context14.t0));
|
|
725
705
|
case 18:
|
|
726
706
|
case "end":
|
|
727
|
-
return
|
|
707
|
+
return _context14.stop();
|
|
728
708
|
}
|
|
729
|
-
},
|
|
709
|
+
}, _callee14, this, [[1, 15]]);
|
|
730
710
|
}));
|
|
731
|
-
function query(
|
|
711
|
+
function query(_x9) {
|
|
732
712
|
return _query.apply(this, arguments);
|
|
733
713
|
}
|
|
734
714
|
return query;
|
|
@@ -745,47 +725,47 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
745
725
|
}, {
|
|
746
726
|
key: "load",
|
|
747
727
|
value: (function () {
|
|
748
|
-
var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
728
|
+
var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(type, ids) {
|
|
749
729
|
var params,
|
|
750
730
|
mergedParams,
|
|
751
731
|
res,
|
|
752
|
-
|
|
753
|
-
return _regeneratorRuntime().wrap(function
|
|
754
|
-
while (1) switch (
|
|
732
|
+
_args15 = arguments;
|
|
733
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
734
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
755
735
|
case 0:
|
|
756
|
-
params =
|
|
757
|
-
|
|
736
|
+
params = _args15.length > 2 && _args15[2] !== undefined ? _args15[2] : {};
|
|
737
|
+
_context15.prev = 1;
|
|
758
738
|
if (!Array.isArray(ids)) {
|
|
759
|
-
|
|
739
|
+
_context15.next = 7;
|
|
760
740
|
break;
|
|
761
741
|
}
|
|
762
742
|
mergedParams = _objectSpread(_objectSpread({}, params), {}, {
|
|
763
743
|
where: "id IN (" + ids.join(',') + ")"
|
|
764
744
|
});
|
|
765
|
-
return
|
|
745
|
+
return _context15.abrupt("return", this.query(type, mergedParams));
|
|
766
746
|
case 7:
|
|
767
747
|
mergedParams = _objectSpread(_objectSpread({}, params), {}, {
|
|
768
748
|
where: "id=" + ids
|
|
769
749
|
});
|
|
770
|
-
|
|
750
|
+
_context15.next = 10;
|
|
771
751
|
return this.query(type, mergedParams);
|
|
772
752
|
case 10:
|
|
773
|
-
res =
|
|
774
|
-
return
|
|
753
|
+
res = _context15.sent;
|
|
754
|
+
return _context15.abrupt("return", res[0]);
|
|
775
755
|
case 12:
|
|
776
|
-
|
|
756
|
+
_context15.next = 17;
|
|
777
757
|
break;
|
|
778
758
|
case 14:
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
return
|
|
759
|
+
_context15.prev = 14;
|
|
760
|
+
_context15.t0 = _context15["catch"](1);
|
|
761
|
+
return _context15.abrupt("return", this._handleError(_context15.t0));
|
|
782
762
|
case 17:
|
|
783
763
|
case "end":
|
|
784
|
-
return
|
|
764
|
+
return _context15.stop();
|
|
785
765
|
}
|
|
786
|
-
},
|
|
766
|
+
}, _callee15, this, [[1, 14]]);
|
|
787
767
|
}));
|
|
788
|
-
function load(
|
|
768
|
+
function load(_x10, _x11) {
|
|
789
769
|
return _load.apply(this, arguments);
|
|
790
770
|
}
|
|
791
771
|
return load;
|
|
@@ -807,7 +787,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
807
787
|
}, {
|
|
808
788
|
key: "runTask",
|
|
809
789
|
value: (function () {
|
|
810
|
-
var _runTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
790
|
+
var _runTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
|
|
811
791
|
var params,
|
|
812
792
|
callbacks,
|
|
813
793
|
onProgress,
|
|
@@ -819,20 +799,20 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
819
799
|
status,
|
|
820
800
|
message,
|
|
821
801
|
output,
|
|
822
|
-
|
|
823
|
-
return _regeneratorRuntime().wrap(function
|
|
824
|
-
while (1) switch (
|
|
802
|
+
_args16 = arguments;
|
|
803
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
804
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
825
805
|
case 0:
|
|
826
|
-
params =
|
|
827
|
-
callbacks =
|
|
806
|
+
params = _args16.length > 0 && _args16[0] !== undefined ? _args16[0] : {};
|
|
807
|
+
callbacks = _args16.length > 1 && _args16[1] !== undefined ? _args16[1] : {};
|
|
828
808
|
onProgress = callbacks.onProgress, onError = callbacks.onError, onFinish = callbacks.onFinish;
|
|
829
|
-
|
|
830
|
-
|
|
809
|
+
_context16.prev = 3;
|
|
810
|
+
_context16.next = 6;
|
|
831
811
|
return this.post('/task_service/runChain', params);
|
|
832
812
|
case 6:
|
|
833
|
-
response =
|
|
813
|
+
response = _context16.sent;
|
|
834
814
|
if (response) {
|
|
835
|
-
|
|
815
|
+
_context16.next = 9;
|
|
836
816
|
break;
|
|
837
817
|
}
|
|
838
818
|
throw new Error('Invalid server response');
|
|
@@ -840,7 +820,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
840
820
|
// Validate response structure
|
|
841
821
|
ok = response.ok, jobId = response.jobId, status = response.status, message = response.message, output = response.output;
|
|
842
822
|
if (!(!ok || typeof jobId !== 'string' || typeof status !== 'string')) {
|
|
843
|
-
|
|
823
|
+
_context16.next = 12;
|
|
844
824
|
break;
|
|
845
825
|
}
|
|
846
826
|
throw new Error('Invalid response structure');
|
|
@@ -858,7 +838,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
858
838
|
console.log('Finish (request) ', response);
|
|
859
839
|
onFinish(response);
|
|
860
840
|
}
|
|
861
|
-
return
|
|
841
|
+
return _context16.abrupt("return", {
|
|
862
842
|
ok: ok,
|
|
863
843
|
jobId: jobId,
|
|
864
844
|
status: status,
|
|
@@ -866,24 +846,24 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
866
846
|
output: output
|
|
867
847
|
});
|
|
868
848
|
case 18:
|
|
869
|
-
|
|
870
|
-
|
|
849
|
+
_context16.prev = 18;
|
|
850
|
+
_context16.t0 = _context16["catch"](3);
|
|
871
851
|
if (typeof onError === 'function') {
|
|
872
|
-
onError(
|
|
852
|
+
onError(_context16.t0);
|
|
873
853
|
} else {
|
|
874
|
-
console.error('Error in runTask:',
|
|
854
|
+
console.error('Error in runTask:', _context16.t0);
|
|
875
855
|
}
|
|
876
|
-
return
|
|
856
|
+
return _context16.abrupt("return", {
|
|
877
857
|
ok: false,
|
|
878
858
|
jobId: null,
|
|
879
859
|
status: 'ERROR',
|
|
880
|
-
error:
|
|
860
|
+
error: _context16.t0.message
|
|
881
861
|
});
|
|
882
862
|
case 22:
|
|
883
863
|
case "end":
|
|
884
|
-
return
|
|
864
|
+
return _context16.stop();
|
|
885
865
|
}
|
|
886
|
-
},
|
|
866
|
+
}, _callee16, this, [[3, 18]]);
|
|
887
867
|
}));
|
|
888
868
|
function runTask() {
|
|
889
869
|
return _runTask.apply(this, arguments);
|
|
@@ -904,26 +884,26 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
904
884
|
}, {
|
|
905
885
|
key: "pollTaskProgress",
|
|
906
886
|
value: (function () {
|
|
907
|
-
var _pollTaskProgress = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
887
|
+
var _pollTaskProgress = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(jobId, callbacks) {
|
|
908
888
|
var _this2 = this;
|
|
909
889
|
var onProgress, onError, onFinish, checkProgress;
|
|
910
|
-
return _regeneratorRuntime().wrap(function
|
|
911
|
-
while (1) switch (
|
|
890
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
891
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
912
892
|
case 0:
|
|
913
893
|
onProgress = callbacks.onProgress, onError = callbacks.onError, onFinish = callbacks.onFinish;
|
|
914
|
-
|
|
894
|
+
_context18.prev = 1;
|
|
915
895
|
checkProgress = /*#__PURE__*/function () {
|
|
916
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
896
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
|
|
917
897
|
var response;
|
|
918
|
-
return _regeneratorRuntime().wrap(function
|
|
919
|
-
while (1) switch (
|
|
898
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
899
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
920
900
|
case 0:
|
|
921
|
-
|
|
901
|
+
_context17.next = 2;
|
|
922
902
|
return _this2.get("/task_service/pollChainProgress", {
|
|
923
903
|
jobId: jobId
|
|
924
904
|
});
|
|
925
905
|
case 2:
|
|
926
|
-
response =
|
|
906
|
+
response = _context17.sent;
|
|
927
907
|
// If the task is still in progress, start polling for updates
|
|
928
908
|
if (response.status === 'DONE' && onFinish) {
|
|
929
909
|
// Provide the current progress to the callback function
|
|
@@ -946,28 +926,28 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
946
926
|
}
|
|
947
927
|
case 7:
|
|
948
928
|
case "end":
|
|
949
|
-
return
|
|
929
|
+
return _context17.stop();
|
|
950
930
|
}
|
|
951
|
-
},
|
|
931
|
+
}, _callee17);
|
|
952
932
|
}));
|
|
953
933
|
return function checkProgress() {
|
|
954
934
|
return _ref2.apply(this, arguments);
|
|
955
935
|
};
|
|
956
936
|
}();
|
|
957
937
|
checkProgress();
|
|
958
|
-
|
|
938
|
+
_context18.next = 9;
|
|
959
939
|
break;
|
|
960
940
|
case 6:
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
return
|
|
941
|
+
_context18.prev = 6;
|
|
942
|
+
_context18.t0 = _context18["catch"](1);
|
|
943
|
+
return _context18.abrupt("return", this._handleError(_context18.t0));
|
|
964
944
|
case 9:
|
|
965
945
|
case "end":
|
|
966
|
-
return
|
|
946
|
+
return _context18.stop();
|
|
967
947
|
}
|
|
968
|
-
},
|
|
948
|
+
}, _callee18, this, [[1, 6]]);
|
|
969
949
|
}));
|
|
970
|
-
function pollTaskProgress(
|
|
950
|
+
function pollTaskProgress(_x12, _x13) {
|
|
971
951
|
return _pollTaskProgress.apply(this, arguments);
|
|
972
952
|
}
|
|
973
953
|
return pollTaskProgress;
|
|
@@ -987,46 +967,46 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
987
967
|
}, {
|
|
988
968
|
key: "get",
|
|
989
969
|
value: (function () {
|
|
990
|
-
var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
970
|
+
var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(endpoint) {
|
|
991
971
|
var params,
|
|
992
972
|
headers,
|
|
993
973
|
response,
|
|
994
|
-
|
|
995
|
-
return _regeneratorRuntime().wrap(function
|
|
996
|
-
while (1) switch (
|
|
974
|
+
_args19 = arguments;
|
|
975
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
976
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
997
977
|
case 0:
|
|
998
|
-
params =
|
|
978
|
+
params = _args19.length > 1 && _args19[1] !== undefined ? _args19[1] : {};
|
|
999
979
|
debugger;
|
|
1000
|
-
|
|
980
|
+
_context19.prev = 2;
|
|
1001
981
|
// Add the authToken to the headers
|
|
1002
982
|
headers = {
|
|
1003
983
|
authtoken: this.authtoken
|
|
1004
984
|
}; // Make the GET request using Axios
|
|
1005
|
-
|
|
985
|
+
_context19.next = 6;
|
|
1006
986
|
return this.axios.get(endpoint, {
|
|
1007
987
|
params: params,
|
|
1008
988
|
headers: headers
|
|
1009
989
|
});
|
|
1010
990
|
case 6:
|
|
1011
|
-
response =
|
|
991
|
+
response = _context19.sent;
|
|
1012
992
|
if (!(response.data.ok === false)) {
|
|
1013
|
-
|
|
993
|
+
_context19.next = 9;
|
|
1014
994
|
break;
|
|
1015
995
|
}
|
|
1016
|
-
return
|
|
996
|
+
return _context19.abrupt("return", this._handleError(response));
|
|
1017
997
|
case 9:
|
|
1018
|
-
return
|
|
998
|
+
return _context19.abrupt("return", response.data);
|
|
1019
999
|
case 12:
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
return
|
|
1000
|
+
_context19.prev = 12;
|
|
1001
|
+
_context19.t0 = _context19["catch"](2);
|
|
1002
|
+
return _context19.abrupt("return", this._handleError(_context19.t0));
|
|
1023
1003
|
case 15:
|
|
1024
1004
|
case "end":
|
|
1025
|
-
return
|
|
1005
|
+
return _context19.stop();
|
|
1026
1006
|
}
|
|
1027
|
-
},
|
|
1007
|
+
}, _callee19, this, [[2, 12]]);
|
|
1028
1008
|
}));
|
|
1029
|
-
function get(
|
|
1009
|
+
function get(_x14) {
|
|
1030
1010
|
return _get.apply(this, arguments);
|
|
1031
1011
|
}
|
|
1032
1012
|
return get;
|
|
@@ -1047,44 +1027,44 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
1047
1027
|
}, {
|
|
1048
1028
|
key: "post",
|
|
1049
1029
|
value: (function () {
|
|
1050
|
-
var _post = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1030
|
+
var _post = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(endpoint) {
|
|
1051
1031
|
var data,
|
|
1052
1032
|
headers,
|
|
1053
1033
|
response,
|
|
1054
|
-
|
|
1055
|
-
return _regeneratorRuntime().wrap(function
|
|
1056
|
-
while (1) switch (
|
|
1034
|
+
_args20 = arguments;
|
|
1035
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
1036
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1057
1037
|
case 0:
|
|
1058
|
-
data =
|
|
1059
|
-
|
|
1038
|
+
data = _args20.length > 1 && _args20[1] !== undefined ? _args20[1] : {};
|
|
1039
|
+
_context20.prev = 1;
|
|
1060
1040
|
// Add the authToken to the headers
|
|
1061
1041
|
headers = {
|
|
1062
1042
|
authtoken: this.authtoken
|
|
1063
1043
|
}; // Make the POST request using Axios
|
|
1064
|
-
|
|
1044
|
+
_context20.next = 5;
|
|
1065
1045
|
return this.axios.post(endpoint, data, {
|
|
1066
1046
|
headers: headers
|
|
1067
1047
|
});
|
|
1068
1048
|
case 5:
|
|
1069
|
-
response =
|
|
1049
|
+
response = _context20.sent;
|
|
1070
1050
|
if (!(response.data.ok === false)) {
|
|
1071
|
-
|
|
1051
|
+
_context20.next = 8;
|
|
1072
1052
|
break;
|
|
1073
1053
|
}
|
|
1074
|
-
return
|
|
1054
|
+
return _context20.abrupt("return", this._handleError(response));
|
|
1075
1055
|
case 8:
|
|
1076
|
-
return
|
|
1056
|
+
return _context20.abrupt("return", response.data);
|
|
1077
1057
|
case 11:
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
return
|
|
1058
|
+
_context20.prev = 11;
|
|
1059
|
+
_context20.t0 = _context20["catch"](1);
|
|
1060
|
+
return _context20.abrupt("return", this._handleError(_context20.t0));
|
|
1081
1061
|
case 14:
|
|
1082
1062
|
case "end":
|
|
1083
|
-
return
|
|
1063
|
+
return _context20.stop();
|
|
1084
1064
|
}
|
|
1085
|
-
},
|
|
1065
|
+
}, _callee20, this, [[1, 11]]);
|
|
1086
1066
|
}));
|
|
1087
|
-
function post(
|
|
1067
|
+
function post(_x15) {
|
|
1088
1068
|
return _post.apply(this, arguments);
|
|
1089
1069
|
}
|
|
1090
1070
|
return post;
|
package/dist/esm/rbt_api.js
CHANGED
|
@@ -93,26 +93,36 @@ export default class RbtApi {
|
|
|
93
93
|
this._handleError(e);
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
this.
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
this.
|
|
114
|
-
|
|
115
|
-
}
|
|
96
|
+
|
|
97
|
+
// async loginWithOauth(userData){
|
|
98
|
+
//
|
|
99
|
+
// try {
|
|
100
|
+
// debugger;
|
|
101
|
+
// const response = await this.post('/api/account/registerOrSigninOauth', userData );
|
|
102
|
+
//
|
|
103
|
+
// if (response.ok === false) {
|
|
104
|
+
// return this._handleError(response);
|
|
105
|
+
// }
|
|
106
|
+
//
|
|
107
|
+
// this.iac_session = response;
|
|
108
|
+
// this.currentUser = (this.iac_session)? new RbtUser(this.iac_session.user, this.axios): null;
|
|
109
|
+
// // update axios instance headers with authtoken
|
|
110
|
+
// this.axios.defaults.headers.common['authtoken'] = response.authToken;
|
|
111
|
+
// this.authtoken = response.authToken;
|
|
112
|
+
//
|
|
113
|
+
// if(this.localStorageAdaptor){
|
|
114
|
+
// await this.localStorageAdaptor.setItem('authtoken', response.authToken);
|
|
115
|
+
// }
|
|
116
|
+
//
|
|
117
|
+
// return response;
|
|
118
|
+
//
|
|
119
|
+
// } catch (e) {
|
|
120
|
+
//
|
|
121
|
+
// this._handleError(e);
|
|
122
|
+
// }
|
|
123
|
+
//
|
|
124
|
+
// }
|
|
125
|
+
|
|
116
126
|
async logout() {
|
|
117
127
|
try {
|
|
118
128
|
// Call logout endpoint if necessary. Here, I assume there's a '/user_service/logoutUser' endpoint.
|
package/package.json
CHANGED
package/src/rbt_api.js
CHANGED
|
@@ -111,34 +111,34 @@ export default class RbtApi {
|
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
async loginWithOauth(userData){
|
|
115
|
-
|
|
116
|
-
try {
|
|
117
|
-
debugger;
|
|
118
|
-
const response = await this.post('/api/account/registerOrSigninOauth', userData );
|
|
119
|
-
|
|
120
|
-
if (response.ok === false) {
|
|
121
|
-
return this._handleError(response);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
this.iac_session = response;
|
|
125
|
-
this.currentUser = (this.iac_session)? new RbtUser(this.iac_session.user, this.axios): null;
|
|
126
|
-
// update axios instance headers with authtoken
|
|
127
|
-
this.axios.defaults.headers.common['authtoken'] = response.authToken;
|
|
128
|
-
this.authtoken = response.authToken;
|
|
129
|
-
|
|
130
|
-
if(this.localStorageAdaptor){
|
|
131
|
-
await this.localStorageAdaptor.setItem('authtoken', response.authToken);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
return response;
|
|
135
|
-
|
|
136
|
-
} catch (e) {
|
|
137
|
-
|
|
138
|
-
this._handleError(e);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
}
|
|
114
|
+
// async loginWithOauth(userData){
|
|
115
|
+
//
|
|
116
|
+
// try {
|
|
117
|
+
// debugger;
|
|
118
|
+
// const response = await this.post('/api/account/registerOrSigninOauth', userData );
|
|
119
|
+
//
|
|
120
|
+
// if (response.ok === false) {
|
|
121
|
+
// return this._handleError(response);
|
|
122
|
+
// }
|
|
123
|
+
//
|
|
124
|
+
// this.iac_session = response;
|
|
125
|
+
// this.currentUser = (this.iac_session)? new RbtUser(this.iac_session.user, this.axios): null;
|
|
126
|
+
// // update axios instance headers with authtoken
|
|
127
|
+
// this.axios.defaults.headers.common['authtoken'] = response.authToken;
|
|
128
|
+
// this.authtoken = response.authToken;
|
|
129
|
+
//
|
|
130
|
+
// if(this.localStorageAdaptor){
|
|
131
|
+
// await this.localStorageAdaptor.setItem('authtoken', response.authToken);
|
|
132
|
+
// }
|
|
133
|
+
//
|
|
134
|
+
// return response;
|
|
135
|
+
//
|
|
136
|
+
// } catch (e) {
|
|
137
|
+
//
|
|
138
|
+
// this._handleError(e);
|
|
139
|
+
// }
|
|
140
|
+
//
|
|
141
|
+
// }
|
|
142
142
|
|
|
143
143
|
async logout() {
|
|
144
144
|
try {
|