roboto-js 1.3.8 → 1.3.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.
@@ -217,19 +217,38 @@ var Roboto = exports["default"] = /*#__PURE__*/function () {
217
217
  return loadCurrentUser;
218
218
  }()
219
219
  }, {
220
- key: "confirmUserEmail",
220
+ key: "getCurrentUser",
221
221
  value: function () {
222
- var _confirmUserEmail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(params) {
222
+ var _getCurrentUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
223
223
  return _regeneratorRuntime().wrap(function _callee7$(_context7) {
224
224
  while (1) switch (_context7.prev = _context7.next) {
225
225
  case 0:
226
- return _context7.abrupt("return", this.api.confirmUserEmail(params));
226
+ return _context7.abrupt("return", this.api.getCurrentUser());
227
227
  case 1:
228
228
  case "end":
229
229
  return _context7.stop();
230
230
  }
231
231
  }, _callee7, this);
232
232
  }));
233
+ function getCurrentUser() {
234
+ return _getCurrentUser.apply(this, arguments);
235
+ }
236
+ return getCurrentUser;
237
+ }()
238
+ }, {
239
+ key: "confirmUserEmail",
240
+ value: function () {
241
+ var _confirmUserEmail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(params) {
242
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
243
+ while (1) switch (_context8.prev = _context8.next) {
244
+ case 0:
245
+ return _context8.abrupt("return", this.api.confirmUserEmail(params));
246
+ case 1:
247
+ case "end":
248
+ return _context8.stop();
249
+ }
250
+ }, _callee8, this);
251
+ }));
233
252
  function confirmUserEmail(_x4) {
234
253
  return _confirmUserEmail.apply(this, arguments);
235
254
  }
@@ -240,19 +259,19 @@ var Roboto = exports["default"] = /*#__PURE__*/function () {
240
259
  }, {
241
260
  key: "createFile",
242
261
  value: function () {
243
- var _createFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
262
+ var _createFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
244
263
  var data,
245
- _args8 = arguments;
246
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
247
- while (1) switch (_context8.prev = _context8.next) {
264
+ _args9 = arguments;
265
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
266
+ while (1) switch (_context9.prev = _context9.next) {
248
267
  case 0:
249
- data = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : {};
250
- return _context8.abrupt("return", this.api.createFile(data));
268
+ data = _args9.length > 0 && _args9[0] !== undefined ? _args9[0] : {};
269
+ return _context9.abrupt("return", this.api.createFile(data));
251
270
  case 2:
252
271
  case "end":
253
- return _context8.stop();
272
+ return _context9.stop();
254
273
  }
255
- }, _callee8, this);
274
+ }, _callee9, this);
256
275
  }));
257
276
  function createFile() {
258
277
  return _createFile.apply(this, arguments);
@@ -264,19 +283,19 @@ var Roboto = exports["default"] = /*#__PURE__*/function () {
264
283
  }, {
265
284
  key: "create",
266
285
  value: function () {
267
- var _create = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(params) {
286
+ var _create = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(params) {
268
287
  var data,
269
- _args9 = arguments;
270
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
271
- while (1) switch (_context9.prev = _context9.next) {
288
+ _args10 = arguments;
289
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
290
+ while (1) switch (_context10.prev = _context10.next) {
272
291
  case 0:
273
- data = _args9.length > 1 && _args9[1] !== undefined ? _args9[1] : {};
274
- return _context9.abrupt("return", this.api.create(params, data));
292
+ data = _args10.length > 1 && _args10[1] !== undefined ? _args10[1] : {};
293
+ return _context10.abrupt("return", this.api.create(params, data));
275
294
  case 2:
276
295
  case "end":
277
- return _context9.stop();
296
+ return _context10.stop();
278
297
  }
279
- }, _callee9, this);
298
+ }, _callee10, this);
280
299
  }));
281
300
  function create(_x5) {
282
301
  return _create.apply(this, arguments);
@@ -286,16 +305,16 @@ var Roboto = exports["default"] = /*#__PURE__*/function () {
286
305
  }, {
287
306
  key: "load",
288
307
  value: function () {
289
- var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(type, ids, options) {
290
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
291
- while (1) switch (_context10.prev = _context10.next) {
308
+ var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(type, ids, options) {
309
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
310
+ while (1) switch (_context11.prev = _context11.next) {
292
311
  case 0:
293
- return _context10.abrupt("return", this.api.load(type, ids, options));
312
+ return _context11.abrupt("return", this.api.load(type, ids, options));
294
313
  case 1:
295
314
  case "end":
296
- return _context10.stop();
315
+ return _context11.stop();
297
316
  }
298
- }, _callee10, this);
317
+ }, _callee11, this);
299
318
  }));
300
319
  function load(_x6, _x7, _x8) {
301
320
  return _load.apply(this, arguments);
@@ -305,16 +324,16 @@ var Roboto = exports["default"] = /*#__PURE__*/function () {
305
324
  }, {
306
325
  key: "query",
307
326
  value: function () {
308
- var _query = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(type, params) {
309
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
310
- while (1) switch (_context11.prev = _context11.next) {
327
+ var _query = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(type, params) {
328
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
329
+ while (1) switch (_context12.prev = _context12.next) {
311
330
  case 0:
312
- return _context11.abrupt("return", this.api.query(type, params));
331
+ return _context12.abrupt("return", this.api.query(type, params));
313
332
  case 1:
314
333
  case "end":
315
- return _context11.stop();
334
+ return _context12.stop();
316
335
  }
317
- }, _callee11, this);
336
+ }, _callee12, this);
318
337
  }));
319
338
  function query(_x9, _x10) {
320
339
  return _query.apply(this, arguments);
@@ -326,16 +345,16 @@ var Roboto = exports["default"] = /*#__PURE__*/function () {
326
345
  }, {
327
346
  key: "runTask",
328
347
  value: function () {
329
- var _runTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(params, callbacks) {
330
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
331
- while (1) switch (_context12.prev = _context12.next) {
348
+ var _runTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(params, callbacks) {
349
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
350
+ while (1) switch (_context13.prev = _context13.next) {
332
351
  case 0:
333
- return _context12.abrupt("return", this.api.runTask(params, callbacks));
352
+ return _context13.abrupt("return", this.api.runTask(params, callbacks));
334
353
  case 1:
335
354
  case "end":
336
- return _context12.stop();
355
+ return _context13.stop();
337
356
  }
338
- }, _callee12, this);
357
+ }, _callee13, this);
339
358
  }));
340
359
  function runTask(_x11, _x12) {
341
360
  return _runTask.apply(this, arguments);
@@ -345,16 +364,16 @@ var Roboto = exports["default"] = /*#__PURE__*/function () {
345
364
  }, {
346
365
  key: "pollTaskProgress",
347
366
  value: function () {
348
- var _pollTaskProgress = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(params) {
349
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
350
- while (1) switch (_context13.prev = _context13.next) {
367
+ var _pollTaskProgress = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(params) {
368
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
369
+ while (1) switch (_context14.prev = _context14.next) {
351
370
  case 0:
352
- return _context13.abrupt("return", this.api.pollTaskProgress(params));
371
+ return _context14.abrupt("return", this.api.pollTaskProgress(params));
353
372
  case 1:
354
373
  case "end":
355
- return _context13.stop();
374
+ return _context14.stop();
356
375
  }
357
- }, _callee13, this);
376
+ }, _callee14, this);
358
377
  }));
359
378
  function pollTaskProgress(_x13) {
360
379
  return _pollTaskProgress.apply(this, arguments);
@@ -366,16 +385,16 @@ var Roboto = exports["default"] = /*#__PURE__*/function () {
366
385
  }, {
367
386
  key: "get",
368
387
  value: function () {
369
- var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(endpoint, params) {
370
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
371
- while (1) switch (_context14.prev = _context14.next) {
388
+ var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(endpoint, params) {
389
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
390
+ while (1) switch (_context15.prev = _context15.next) {
372
391
  case 0:
373
- return _context14.abrupt("return", this.api.get(endpoint, params));
392
+ return _context15.abrupt("return", this.api.get(endpoint, params));
374
393
  case 1:
375
394
  case "end":
376
- return _context14.stop();
395
+ return _context15.stop();
377
396
  }
378
- }, _callee14, this);
397
+ }, _callee15, this);
379
398
  }));
380
399
  function get(_x14, _x15) {
381
400
  return _get.apply(this, arguments);
@@ -385,16 +404,16 @@ var Roboto = exports["default"] = /*#__PURE__*/function () {
385
404
  }, {
386
405
  key: "post",
387
406
  value: function () {
388
- var _post = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(endpoint, data) {
389
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
390
- while (1) switch (_context15.prev = _context15.next) {
407
+ var _post = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(endpoint, data) {
408
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
409
+ while (1) switch (_context16.prev = _context16.next) {
391
410
  case 0:
392
- return _context15.abrupt("return", this.api.post(endpoint, data));
411
+ return _context16.abrupt("return", this.api.post(endpoint, data));
393
412
  case 1:
394
413
  case "end":
395
- return _context15.stop();
414
+ return _context16.stop();
396
415
  }
397
- }, _callee15, this);
416
+ }, _callee16, this);
398
417
  }));
399
418
  function post(_x16, _x17) {
400
419
  return _post.apply(this, arguments);
@@ -165,23 +165,24 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
165
165
  this.currentUser = this.iac_session ? new _rbt_user["default"](this.iac_session.user, this.axios) : null;
166
166
  // update axios instance headers with authtoken
167
167
  this.axios.defaults.headers.common['authtoken'] = response.data.authToken;
168
+ this.authtoken = response.data.authToken;
168
169
  if (!this.localStorageAdaptor) {
169
- _context3.next = 13;
170
+ _context3.next = 14;
170
171
  break;
171
172
  }
172
- _context3.next = 13;
173
+ _context3.next = 14;
173
174
  return this.localStorageAdaptor.setItem('authtoken', response.data.authToken);
174
- case 13:
175
+ case 14:
175
176
  return _context3.abrupt("return", response.data);
176
- case 16:
177
- _context3.prev = 16;
177
+ case 17:
178
+ _context3.prev = 17;
178
179
  _context3.t0 = _context3["catch"](0);
179
180
  this._handleError(_context3.t0);
180
- case 19:
181
+ case 20:
181
182
  case "end":
182
183
  return _context3.stop();
183
184
  }
184
- }, _callee3, this, [[0, 16]]);
185
+ }, _callee3, this, [[0, 17]]);
185
186
  }));
186
187
  function login(_x2) {
187
188
  return _login.apply(this, arguments);
@@ -210,34 +211,42 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
210
211
  // Clear the iac_session and remove the auth token from axios headers
211
212
  this.iac_session = null;
212
213
  this.currentUser = null;
214
+ this.authtoken = null;
213
215
  if (this.axios.defaults.headers.common['authtoken']) {
214
216
  delete this.axios.defaults.headers.common['authtoken'];
215
217
  }
216
218
 
217
219
  // Clear localStorage if it's being used
218
220
  if (!this.localStorageAdaptor) {
219
- _context4.next = 12;
221
+ _context4.next = 13;
220
222
  break;
221
223
  }
222
- _context4.next = 12;
224
+ _context4.next = 13;
223
225
  return this.localStorageAdaptor.removeItem('authtoken');
224
- case 12:
226
+ case 13:
225
227
  return _context4.abrupt("return", response.data);
226
- case 15:
227
- _context4.prev = 15;
228
+ case 16:
229
+ _context4.prev = 16;
228
230
  _context4.t0 = _context4["catch"](0);
229
231
  this._handleError(_context4.t0);
230
- case 18:
232
+ case 19:
231
233
  case "end":
232
234
  return _context4.stop();
233
235
  }
234
- }, _callee4, this, [[0, 15]]);
236
+ }, _callee4, this, [[0, 16]]);
235
237
  }));
236
238
  function logout() {
237
239
  return _logout.apply(this, arguments);
238
240
  }
239
241
  return logout;
240
242
  }()
243
+ }, {
244
+ key: "getCurrentUser",
245
+ value: function getCurrentUser() {
246
+ if (this.currentUser) {
247
+ return this.currentUser;
248
+ }
249
+ }
241
250
  }, {
242
251
  key: "loadCurrentUser",
243
252
  value: function () {
package/dist/esm/index.js CHANGED
@@ -83,6 +83,9 @@ export default class Roboto {
83
83
  async loadCurrentUser() {
84
84
  return this.api.loadCurrentUser();
85
85
  }
86
+ async getCurrentUser() {
87
+ return this.api.getCurrentUser();
88
+ }
86
89
  async confirmUserEmail(params) {
87
90
  return this.api.confirmUserEmail(params);
88
91
  }
@@ -83,6 +83,7 @@ export default class RbtApi {
83
83
  this.currentUser = this.iac_session ? new RbtUser(this.iac_session.user, this.axios) : null;
84
84
  // update axios instance headers with authtoken
85
85
  this.axios.defaults.headers.common['authtoken'] = response.data.authToken;
86
+ this.authtoken = response.data.authToken;
86
87
  if (this.localStorageAdaptor) {
87
88
  await this.localStorageAdaptor.setItem('authtoken', response.data.authToken);
88
89
  }
@@ -103,6 +104,7 @@ export default class RbtApi {
103
104
  // Clear the iac_session and remove the auth token from axios headers
104
105
  this.iac_session = null;
105
106
  this.currentUser = null;
107
+ this.authtoken = null;
106
108
  if (this.axios.defaults.headers.common['authtoken']) {
107
109
  delete this.axios.defaults.headers.common['authtoken'];
108
110
  }
@@ -118,6 +120,11 @@ export default class RbtApi {
118
120
  this._handleError(e);
119
121
  }
120
122
  }
123
+ getCurrentUser() {
124
+ if (this.currentUser) {
125
+ return this.currentUser;
126
+ }
127
+ }
121
128
  async loadCurrentUser() {
122
129
  try {
123
130
  if (this.currentUser) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "roboto-js",
3
- "version": "1.3.8",
3
+ "version": "1.3.10",
4
4
  "type": "module",
5
5
  "description": "",
6
6
  "main": "dist/cjs/index.cjs",
package/src/index.js CHANGED
@@ -97,6 +97,9 @@ export default class Roboto{
97
97
  async loadCurrentUser(){
98
98
  return this.api.loadCurrentUser();
99
99
  }
100
+ async getCurrentUser(){
101
+ return this.api.getCurrentUser();
102
+ }
100
103
  async confirmUserEmail(params){
101
104
  return this.api.confirmUserEmail(params);
102
105
  }
package/src/rbt_api.js CHANGED
@@ -96,7 +96,8 @@ export default class RbtApi {
96
96
  this.currentUser = (this.iac_session)? new RbtUser(this.iac_session.user, this.axios): null;
97
97
  // update axios instance headers with authtoken
98
98
  this.axios.defaults.headers.common['authtoken'] = response.data.authToken;
99
-
99
+ this.authtoken = response.data.authToken;
100
+
100
101
  if(this.localStorageAdaptor){
101
102
  await this.localStorageAdaptor.setItem('authtoken', response.data.authToken);
102
103
  }
@@ -121,6 +122,7 @@ export default class RbtApi {
121
122
  // Clear the iac_session and remove the auth token from axios headers
122
123
  this.iac_session = null;
123
124
  this.currentUser = null;
125
+ this.authtoken = null;
124
126
  if (this.axios.defaults.headers.common['authtoken']) {
125
127
  delete this.axios.defaults.headers.common['authtoken'];
126
128
  }
@@ -137,6 +139,14 @@ export default class RbtApi {
137
139
  }
138
140
  }
139
141
 
142
+ getCurrentUser(){
143
+
144
+ if(this.currentUser){
145
+ return this.currentUser;
146
+ }
147
+
148
+ }
149
+
140
150
  async loadCurrentUser(){
141
151
 
142
152
  try {