roboto-js 1.0.21 → 1.1.2
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 +162 -48
- package/dist/cjs/rbt_api.cjs +521 -132
- package/dist/cjs/rbt_object.cjs +59 -19
- package/dist/cjs/rbt_user.cjs +172 -0
- package/dist/esm/index.js +162 -48
- package/dist/esm/rbt_api.js +521 -132
- package/dist/esm/rbt_object.js +59 -19
- package/dist/esm/rbt_user.js +172 -0
- package/package.json +1 -1
- package/src/index.js +40 -2
- package/src/rbt_api.js +280 -19
- package/src/rbt_object.js +53 -15
- package/src/rbt_user.js +135 -0
package/dist/cjs/index.cjs
CHANGED
|
@@ -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,123 @@ var Roboto = exports["default"] = /*#__PURE__*/function () {
|
|
|
90
101
|
return login;
|
|
91
102
|
}()
|
|
92
103
|
}, {
|
|
93
|
-
key: "
|
|
104
|
+
key: "logout",
|
|
94
105
|
value: function () {
|
|
95
|
-
var
|
|
106
|
+
var _logout = _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.
|
|
110
|
+
return _context2.abrupt("return", this.api.logout());
|
|
100
111
|
case 1:
|
|
101
112
|
case "end":
|
|
102
113
|
return _context2.stop();
|
|
103
114
|
}
|
|
104
115
|
}, _callee2, this);
|
|
105
116
|
}));
|
|
117
|
+
function logout() {
|
|
118
|
+
return _logout.apply(this, arguments);
|
|
119
|
+
}
|
|
120
|
+
return logout;
|
|
121
|
+
}()
|
|
122
|
+
}, {
|
|
123
|
+
key: "refreshAuthToken",
|
|
124
|
+
value: function () {
|
|
125
|
+
var _refreshAuthToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
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.refreshAuthToken(this.config.authtoken));
|
|
130
|
+
case 1:
|
|
131
|
+
case "end":
|
|
132
|
+
return _context3.stop();
|
|
133
|
+
}
|
|
134
|
+
}, _callee3, this);
|
|
135
|
+
}));
|
|
136
|
+
function refreshAuthToken() {
|
|
137
|
+
return _refreshAuthToken.apply(this, arguments);
|
|
138
|
+
}
|
|
139
|
+
return refreshAuthToken;
|
|
140
|
+
}()
|
|
141
|
+
}, {
|
|
142
|
+
key: "registerUser",
|
|
143
|
+
value: function () {
|
|
144
|
+
var _registerUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(params) {
|
|
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.registerUser(params));
|
|
149
|
+
case 1:
|
|
150
|
+
case "end":
|
|
151
|
+
return _context4.stop();
|
|
152
|
+
}
|
|
153
|
+
}, _callee4, this);
|
|
154
|
+
}));
|
|
106
155
|
function registerUser(_x2) {
|
|
107
156
|
return _registerUser.apply(this, arguments);
|
|
108
157
|
}
|
|
109
158
|
return registerUser;
|
|
110
159
|
}()
|
|
160
|
+
}, {
|
|
161
|
+
key: "loadCurrentUser",
|
|
162
|
+
value: function () {
|
|
163
|
+
var _loadCurrentUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
164
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
165
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
166
|
+
case 0:
|
|
167
|
+
return _context5.abrupt("return", this.api.loadCurrentUser());
|
|
168
|
+
case 1:
|
|
169
|
+
case "end":
|
|
170
|
+
return _context5.stop();
|
|
171
|
+
}
|
|
172
|
+
}, _callee5, this);
|
|
173
|
+
}));
|
|
174
|
+
function loadCurrentUser() {
|
|
175
|
+
return _loadCurrentUser.apply(this, arguments);
|
|
176
|
+
}
|
|
177
|
+
return loadCurrentUser;
|
|
178
|
+
}() //
|
|
179
|
+
// create and upload files
|
|
180
|
+
//
|
|
111
181
|
}, {
|
|
112
182
|
key: "createFile",
|
|
113
183
|
value: function () {
|
|
114
|
-
var _createFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
184
|
+
var _createFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
115
185
|
var data,
|
|
116
|
-
|
|
117
|
-
return _regeneratorRuntime().wrap(function
|
|
118
|
-
while (1) switch (
|
|
186
|
+
_args6 = arguments;
|
|
187
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
188
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
119
189
|
case 0:
|
|
120
|
-
data =
|
|
121
|
-
return
|
|
190
|
+
data = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {};
|
|
191
|
+
return _context6.abrupt("return", this.api.createFile(data));
|
|
122
192
|
case 2:
|
|
123
193
|
case "end":
|
|
124
|
-
return
|
|
194
|
+
return _context6.stop();
|
|
125
195
|
}
|
|
126
|
-
},
|
|
196
|
+
}, _callee6, this);
|
|
127
197
|
}));
|
|
128
198
|
function createFile() {
|
|
129
199
|
return _createFile.apply(this, arguments);
|
|
130
200
|
}
|
|
131
201
|
return createFile;
|
|
132
|
-
}()
|
|
202
|
+
}() //
|
|
203
|
+
//
|
|
204
|
+
//
|
|
133
205
|
}, {
|
|
134
206
|
key: "create",
|
|
135
207
|
value: function () {
|
|
136
|
-
var _create = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
208
|
+
var _create = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(params) {
|
|
137
209
|
var data,
|
|
138
|
-
|
|
139
|
-
return _regeneratorRuntime().wrap(function
|
|
140
|
-
while (1) switch (
|
|
210
|
+
_args7 = arguments;
|
|
211
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
212
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
141
213
|
case 0:
|
|
142
|
-
data =
|
|
143
|
-
return
|
|
214
|
+
data = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : {};
|
|
215
|
+
return _context7.abrupt("return", this.api.create(params, data));
|
|
144
216
|
case 2:
|
|
145
217
|
case "end":
|
|
146
|
-
return
|
|
218
|
+
return _context7.stop();
|
|
147
219
|
}
|
|
148
|
-
},
|
|
220
|
+
}, _callee7, this);
|
|
149
221
|
}));
|
|
150
222
|
function create(_x3) {
|
|
151
223
|
return _create.apply(this, arguments);
|
|
@@ -155,18 +227,18 @@ var Roboto = exports["default"] = /*#__PURE__*/function () {
|
|
|
155
227
|
}, {
|
|
156
228
|
key: "load",
|
|
157
229
|
value: function () {
|
|
158
|
-
var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
159
|
-
return _regeneratorRuntime().wrap(function
|
|
160
|
-
while (1) switch (
|
|
230
|
+
var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(type, ids, options) {
|
|
231
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
232
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
161
233
|
case 0:
|
|
162
|
-
return
|
|
234
|
+
return _context8.abrupt("return", this.api.load(type, ids, options));
|
|
163
235
|
case 1:
|
|
164
236
|
case "end":
|
|
165
|
-
return
|
|
237
|
+
return _context8.stop();
|
|
166
238
|
}
|
|
167
|
-
},
|
|
239
|
+
}, _callee8, this);
|
|
168
240
|
}));
|
|
169
|
-
function load(_x4, _x5) {
|
|
241
|
+
function load(_x4, _x5, _x6) {
|
|
170
242
|
return _load.apply(this, arguments);
|
|
171
243
|
}
|
|
172
244
|
return load;
|
|
@@ -174,37 +246,79 @@ var Roboto = exports["default"] = /*#__PURE__*/function () {
|
|
|
174
246
|
}, {
|
|
175
247
|
key: "query",
|
|
176
248
|
value: function () {
|
|
177
|
-
var _query = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
178
|
-
return _regeneratorRuntime().wrap(function
|
|
179
|
-
while (1) switch (
|
|
249
|
+
var _query = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(type, params) {
|
|
250
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
251
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
180
252
|
case 0:
|
|
181
|
-
return
|
|
253
|
+
return _context9.abrupt("return", this.api.query(type, params));
|
|
182
254
|
case 1:
|
|
183
255
|
case "end":
|
|
184
|
-
return
|
|
256
|
+
return _context9.stop();
|
|
185
257
|
}
|
|
186
|
-
},
|
|
258
|
+
}, _callee9, this);
|
|
187
259
|
}));
|
|
188
|
-
function query(
|
|
260
|
+
function query(_x7, _x8) {
|
|
189
261
|
return _query.apply(this, arguments);
|
|
190
262
|
}
|
|
191
263
|
return query;
|
|
264
|
+
}() //
|
|
265
|
+
//
|
|
266
|
+
//
|
|
267
|
+
}, {
|
|
268
|
+
key: "runTask",
|
|
269
|
+
value: function () {
|
|
270
|
+
var _runTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(params, callbacks) {
|
|
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.runTask(params, callbacks));
|
|
275
|
+
case 1:
|
|
276
|
+
case "end":
|
|
277
|
+
return _context10.stop();
|
|
278
|
+
}
|
|
279
|
+
}, _callee10, this);
|
|
280
|
+
}));
|
|
281
|
+
function runTask(_x9, _x10) {
|
|
282
|
+
return _runTask.apply(this, arguments);
|
|
283
|
+
}
|
|
284
|
+
return runTask;
|
|
192
285
|
}()
|
|
286
|
+
}, {
|
|
287
|
+
key: "pollTaskProgress",
|
|
288
|
+
value: function () {
|
|
289
|
+
var _pollTaskProgress = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(params) {
|
|
290
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
291
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
292
|
+
case 0:
|
|
293
|
+
return _context11.abrupt("return", this.api.pollTaskProgress(params));
|
|
294
|
+
case 1:
|
|
295
|
+
case "end":
|
|
296
|
+
return _context11.stop();
|
|
297
|
+
}
|
|
298
|
+
}, _callee11, this);
|
|
299
|
+
}));
|
|
300
|
+
function pollTaskProgress(_x11) {
|
|
301
|
+
return _pollTaskProgress.apply(this, arguments);
|
|
302
|
+
}
|
|
303
|
+
return pollTaskProgress;
|
|
304
|
+
}() //
|
|
305
|
+
// Get/Post to endpoint with Roboto authtoken
|
|
306
|
+
//
|
|
193
307
|
}, {
|
|
194
308
|
key: "get",
|
|
195
309
|
value: function () {
|
|
196
|
-
var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
197
|
-
return _regeneratorRuntime().wrap(function
|
|
198
|
-
while (1) switch (
|
|
310
|
+
var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(endpoint, params) {
|
|
311
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
312
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
199
313
|
case 0:
|
|
200
|
-
return
|
|
314
|
+
return _context12.abrupt("return", this.api.get(endpoint, params));
|
|
201
315
|
case 1:
|
|
202
316
|
case "end":
|
|
203
|
-
return
|
|
317
|
+
return _context12.stop();
|
|
204
318
|
}
|
|
205
|
-
},
|
|
319
|
+
}, _callee12, this);
|
|
206
320
|
}));
|
|
207
|
-
function get(
|
|
321
|
+
function get(_x12, _x13) {
|
|
208
322
|
return _get.apply(this, arguments);
|
|
209
323
|
}
|
|
210
324
|
return get;
|
|
@@ -212,18 +326,18 @@ var Roboto = exports["default"] = /*#__PURE__*/function () {
|
|
|
212
326
|
}, {
|
|
213
327
|
key: "post",
|
|
214
328
|
value: function () {
|
|
215
|
-
var _post = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
216
|
-
return _regeneratorRuntime().wrap(function
|
|
217
|
-
while (1) switch (
|
|
329
|
+
var _post = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(endpoint, data) {
|
|
330
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
331
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
218
332
|
case 0:
|
|
219
|
-
return
|
|
333
|
+
return _context13.abrupt("return", this.api.post(endpoint, data));
|
|
220
334
|
case 1:
|
|
221
335
|
case "end":
|
|
222
|
-
return
|
|
336
|
+
return _context13.stop();
|
|
223
337
|
}
|
|
224
|
-
},
|
|
338
|
+
}, _callee13, this);
|
|
225
339
|
}));
|
|
226
|
-
function post(
|
|
340
|
+
function post(_x14, _x15) {
|
|
227
341
|
return _post.apply(this, arguments);
|
|
228
342
|
}
|
|
229
343
|
return post;
|