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.
- package/dist/cjs/index.cjs +143 -48
- package/dist/cjs/rbt_api.cjs +466 -130
- package/dist/cjs/rbt_object.cjs +41 -17
- package/dist/cjs/rbt_user.cjs +172 -0
- package/dist/esm/index.js +143 -48
- package/dist/esm/rbt_api.js +466 -130
- package/dist/esm/rbt_object.js +41 -17
- package/dist/esm/rbt_user.js +172 -0
- package/package.json +1 -1
- package/src/index.js +37 -2
- package/src/rbt_api.js +244 -19
- package/src/rbt_object.js +36 -13
- 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,104 @@ var Roboto = exports["default"] = /*#__PURE__*/function () {
|
|
|
90
101
|
return login;
|
|
91
102
|
}()
|
|
92
103
|
}, {
|
|
93
|
-
key: "
|
|
104
|
+
key: "refreshAuthToken",
|
|
94
105
|
value: function () {
|
|
95
|
-
var
|
|
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.
|
|
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
|
|
165
|
+
var _createFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
115
166
|
var data,
|
|
116
|
-
|
|
117
|
-
return _regeneratorRuntime().wrap(function
|
|
118
|
-
while (1) switch (
|
|
167
|
+
_args5 = arguments;
|
|
168
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
169
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
119
170
|
case 0:
|
|
120
|
-
data =
|
|
121
|
-
return
|
|
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
|
|
175
|
+
return _context5.stop();
|
|
125
176
|
}
|
|
126
|
-
},
|
|
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
|
|
189
|
+
var _create = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(params) {
|
|
137
190
|
var data,
|
|
138
|
-
|
|
139
|
-
return _regeneratorRuntime().wrap(function
|
|
140
|
-
while (1) switch (
|
|
191
|
+
_args6 = arguments;
|
|
192
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
193
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
141
194
|
case 0:
|
|
142
|
-
data =
|
|
143
|
-
return
|
|
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
|
|
199
|
+
return _context6.stop();
|
|
147
200
|
}
|
|
148
|
-
},
|
|
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
|
|
159
|
-
return _regeneratorRuntime().wrap(function
|
|
160
|
-
while (1) switch (
|
|
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
|
|
215
|
+
return _context7.abrupt("return", this.api.load(type, ids, options));
|
|
163
216
|
case 1:
|
|
164
217
|
case "end":
|
|
165
|
-
return
|
|
218
|
+
return _context7.stop();
|
|
166
219
|
}
|
|
167
|
-
},
|
|
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
|
|
178
|
-
return _regeneratorRuntime().wrap(function
|
|
179
|
-
while (1) switch (
|
|
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
|
|
234
|
+
return _context8.abrupt("return", this.api.query(type, params));
|
|
182
235
|
case 1:
|
|
183
236
|
case "end":
|
|
184
|
-
return
|
|
237
|
+
return _context8.stop();
|
|
185
238
|
}
|
|
186
|
-
},
|
|
239
|
+
}, _callee8, this);
|
|
187
240
|
}));
|
|
188
|
-
function query(
|
|
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
|
|
197
|
-
return _regeneratorRuntime().wrap(function
|
|
198
|
-
while (1) switch (
|
|
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
|
|
295
|
+
return _context11.abrupt("return", this.api.get(endpoint, params));
|
|
201
296
|
case 1:
|
|
202
297
|
case "end":
|
|
203
|
-
return
|
|
298
|
+
return _context11.stop();
|
|
204
299
|
}
|
|
205
|
-
},
|
|
300
|
+
}, _callee11, this);
|
|
206
301
|
}));
|
|
207
|
-
function get(
|
|
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
|
|
216
|
-
return _regeneratorRuntime().wrap(function
|
|
217
|
-
while (1) switch (
|
|
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
|
|
314
|
+
return _context12.abrupt("return", this.api.post(endpoint, data));
|
|
220
315
|
case 1:
|
|
221
316
|
case "end":
|
|
222
|
-
return
|
|
317
|
+
return _context12.stop();
|
|
223
318
|
}
|
|
224
|
-
},
|
|
319
|
+
}, _callee12, this);
|
|
225
320
|
}));
|
|
226
|
-
function post(
|
|
321
|
+
function post(_x14, _x15) {
|
|
227
322
|
return _post.apply(this, arguments);
|
|
228
323
|
}
|
|
229
324
|
return post;
|