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