roboto-js 1.0.20 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -71,6 +71,17 @@ var Roboto = exports["default"] = /*#__PURE__*/function () {
71
71
  Roboto.instance = this;
72
72
  }
73
73
  _createClass(Roboto, [{
74
+ key: "setErrorHandler",
75
+ value: function setErrorHandler(customErrorHandler) {
76
+ if (this.api) {
77
+ this.api.setErrorHandler(customErrorHandler);
78
+ }
79
+ }
80
+
81
+ //
82
+ // User register, login, and refresh token
83
+ //
84
+ }, {
74
85
  key: "login",
75
86
  value: function () {
76
87
  var _login = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(params) {
@@ -90,62 +101,104 @@ var Roboto = exports["default"] = /*#__PURE__*/function () {
90
101
  return login;
91
102
  }()
92
103
  }, {
93
- key: "registerUser",
104
+ key: "refreshAuthToken",
94
105
  value: function () {
95
- var _registerUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params) {
106
+ var _refreshAuthToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
96
107
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
97
108
  while (1) switch (_context2.prev = _context2.next) {
98
109
  case 0:
99
- return _context2.abrupt("return", this.api.registerUser(params));
110
+ return _context2.abrupt("return", this.api.refreshAuthToken(this.config.authtoken));
100
111
  case 1:
101
112
  case "end":
102
113
  return _context2.stop();
103
114
  }
104
115
  }, _callee2, this);
105
116
  }));
117
+ function refreshAuthToken() {
118
+ return _refreshAuthToken.apply(this, arguments);
119
+ }
120
+ return refreshAuthToken;
121
+ }()
122
+ }, {
123
+ key: "registerUser",
124
+ value: function () {
125
+ var _registerUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(params) {
126
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
127
+ while (1) switch (_context3.prev = _context3.next) {
128
+ case 0:
129
+ return _context3.abrupt("return", this.api.registerUser(params));
130
+ case 1:
131
+ case "end":
132
+ return _context3.stop();
133
+ }
134
+ }, _callee3, this);
135
+ }));
106
136
  function registerUser(_x2) {
107
137
  return _registerUser.apply(this, arguments);
108
138
  }
109
139
  return registerUser;
110
140
  }()
141
+ }, {
142
+ key: "loadCurrentUser",
143
+ value: function () {
144
+ var _loadCurrentUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
145
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
146
+ while (1) switch (_context4.prev = _context4.next) {
147
+ case 0:
148
+ return _context4.abrupt("return", this.api.loadCurrentUser());
149
+ case 1:
150
+ case "end":
151
+ return _context4.stop();
152
+ }
153
+ }, _callee4, this);
154
+ }));
155
+ function loadCurrentUser() {
156
+ return _loadCurrentUser.apply(this, arguments);
157
+ }
158
+ return loadCurrentUser;
159
+ }() //
160
+ // create and upload files
161
+ //
111
162
  }, {
112
163
  key: "createFile",
113
164
  value: function () {
114
- var _createFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
165
+ var _createFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
115
166
  var data,
116
- _args3 = arguments;
117
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
118
- while (1) switch (_context3.prev = _context3.next) {
167
+ _args5 = arguments;
168
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
169
+ while (1) switch (_context5.prev = _context5.next) {
119
170
  case 0:
120
- data = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : {};
121
- return _context3.abrupt("return", this.api.createFile(data));
171
+ data = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {};
172
+ return _context5.abrupt("return", this.api.createFile(data));
122
173
  case 2:
123
174
  case "end":
124
- return _context3.stop();
175
+ return _context5.stop();
125
176
  }
126
- }, _callee3, this);
177
+ }, _callee5, this);
127
178
  }));
128
179
  function createFile() {
129
180
  return _createFile.apply(this, arguments);
130
181
  }
131
182
  return createFile;
132
- }()
183
+ }() //
184
+ //
185
+ //
133
186
  }, {
134
187
  key: "create",
135
188
  value: function () {
136
- var _create = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(params) {
189
+ var _create = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(params) {
137
190
  var data,
138
- _args4 = arguments;
139
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
140
- while (1) switch (_context4.prev = _context4.next) {
191
+ _args6 = arguments;
192
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
193
+ while (1) switch (_context6.prev = _context6.next) {
141
194
  case 0:
142
- data = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : {};
143
- return _context4.abrupt("return", this.api.create(params, data));
195
+ data = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : {};
196
+ return _context6.abrupt("return", this.api.create(params, data));
144
197
  case 2:
145
198
  case "end":
146
- return _context4.stop();
199
+ return _context6.stop();
147
200
  }
148
- }, _callee4, this);
201
+ }, _callee6, this);
149
202
  }));
150
203
  function create(_x3) {
151
204
  return _create.apply(this, arguments);
@@ -155,18 +208,18 @@ var Roboto = exports["default"] = /*#__PURE__*/function () {
155
208
  }, {
156
209
  key: "load",
157
210
  value: function () {
158
- var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(type, ids) {
159
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
160
- while (1) switch (_context5.prev = _context5.next) {
211
+ var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(type, ids, options) {
212
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
213
+ while (1) switch (_context7.prev = _context7.next) {
161
214
  case 0:
162
- return _context5.abrupt("return", this.api.load(type, ids));
215
+ return _context7.abrupt("return", this.api.load(type, ids, options));
163
216
  case 1:
164
217
  case "end":
165
- return _context5.stop();
218
+ return _context7.stop();
166
219
  }
167
- }, _callee5, this);
220
+ }, _callee7, this);
168
221
  }));
169
- function load(_x4, _x5) {
222
+ function load(_x4, _x5, _x6) {
170
223
  return _load.apply(this, arguments);
171
224
  }
172
225
  return load;
@@ -174,37 +227,79 @@ var Roboto = exports["default"] = /*#__PURE__*/function () {
174
227
  }, {
175
228
  key: "query",
176
229
  value: function () {
177
- var _query = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(type, params) {
178
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
179
- while (1) switch (_context6.prev = _context6.next) {
230
+ var _query = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(type, params) {
231
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
232
+ while (1) switch (_context8.prev = _context8.next) {
180
233
  case 0:
181
- return _context6.abrupt("return", this.api.query(type, params));
234
+ return _context8.abrupt("return", this.api.query(type, params));
182
235
  case 1:
183
236
  case "end":
184
- return _context6.stop();
237
+ return _context8.stop();
185
238
  }
186
- }, _callee6, this);
239
+ }, _callee8, this);
187
240
  }));
188
- function query(_x6, _x7) {
241
+ function query(_x7, _x8) {
189
242
  return _query.apply(this, arguments);
190
243
  }
191
244
  return query;
245
+ }() //
246
+ //
247
+ //
248
+ }, {
249
+ key: "runTask",
250
+ value: function () {
251
+ var _runTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(params, callbacks) {
252
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
253
+ while (1) switch (_context9.prev = _context9.next) {
254
+ case 0:
255
+ return _context9.abrupt("return", this.api.runTask(params, callbacks));
256
+ case 1:
257
+ case "end":
258
+ return _context9.stop();
259
+ }
260
+ }, _callee9, this);
261
+ }));
262
+ function runTask(_x9, _x10) {
263
+ return _runTask.apply(this, arguments);
264
+ }
265
+ return runTask;
192
266
  }()
267
+ }, {
268
+ key: "pollTaskProgress",
269
+ value: function () {
270
+ var _pollTaskProgress = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(params) {
271
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
272
+ while (1) switch (_context10.prev = _context10.next) {
273
+ case 0:
274
+ return _context10.abrupt("return", this.api.pollTaskProgress(params));
275
+ case 1:
276
+ case "end":
277
+ return _context10.stop();
278
+ }
279
+ }, _callee10, this);
280
+ }));
281
+ function pollTaskProgress(_x11) {
282
+ return _pollTaskProgress.apply(this, arguments);
283
+ }
284
+ return pollTaskProgress;
285
+ }() //
286
+ // Get/Post to endpoint with Roboto authtoken
287
+ //
193
288
  }, {
194
289
  key: "get",
195
290
  value: function () {
196
- var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(endpoint, params) {
197
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
198
- while (1) switch (_context7.prev = _context7.next) {
291
+ var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(endpoint, params) {
292
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
293
+ while (1) switch (_context11.prev = _context11.next) {
199
294
  case 0:
200
- return _context7.abrupt("return", this.api.get(endpoint, params));
295
+ return _context11.abrupt("return", this.api.get(endpoint, params));
201
296
  case 1:
202
297
  case "end":
203
- return _context7.stop();
298
+ return _context11.stop();
204
299
  }
205
- }, _callee7, this);
300
+ }, _callee11, this);
206
301
  }));
207
- function get(_x8, _x9) {
302
+ function get(_x12, _x13) {
208
303
  return _get.apply(this, arguments);
209
304
  }
210
305
  return get;
@@ -212,18 +307,18 @@ var Roboto = exports["default"] = /*#__PURE__*/function () {
212
307
  }, {
213
308
  key: "post",
214
309
  value: function () {
215
- var _post = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(endpoint, data) {
216
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
217
- while (1) switch (_context8.prev = _context8.next) {
310
+ var _post = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(endpoint, data) {
311
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
312
+ while (1) switch (_context12.prev = _context12.next) {
218
313
  case 0:
219
- return _context8.abrupt("return", this.api.post(endpoint, data));
314
+ return _context12.abrupt("return", this.api.post(endpoint, data));
220
315
  case 1:
221
316
  case "end":
222
- return _context8.stop();
317
+ return _context12.stop();
223
318
  }
224
- }, _callee8, this);
319
+ }, _callee12, this);
225
320
  }));
226
- function post(_x10, _x11) {
321
+ function post(_x14, _x15) {
227
322
  return _post.apply(this, arguments);
228
323
  }
229
324
  return post;