roboto-js 1.4.49 → 1.5.0
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 +77 -58
- package/dist/cjs/rbt_api.cjs +198 -160
- package/dist/cjs/rbt_file.cjs +70 -426
- package/dist/esm/index.js +3 -0
- package/dist/esm/rbt_api.js +24 -5
- package/dist/esm/rbt_file.js +61 -166
- package/package.json +3 -2
- package/src/index.js +3 -0
- package/src/rbt_api.js +26 -5
- package/src/rbt_file.js +64 -210
package/dist/cjs/rbt_file.cjs
CHANGED
|
@@ -1,21 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports["default"] = void 0;
|
|
8
|
+
var _tusJsClient = require("tus-js-client");
|
|
7
9
|
var _lodash = _interopRequireDefault(require("lodash"));
|
|
8
10
|
var _eventemitter = _interopRequireDefault(require("eventemitter3"));
|
|
9
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
10
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
11
12
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
12
13
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
13
14
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
14
15
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
15
16
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
17
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
16
18
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
17
19
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
18
20
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
21
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
22
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
19
23
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
20
24
|
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
21
25
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
@@ -23,24 +27,19 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
23
27
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
24
28
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
25
29
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
26
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
27
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
28
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
29
30
|
var RbtFile = exports["default"] = /*#__PURE__*/function (_EventEmitter) {
|
|
30
31
|
_inherits(RbtFile, _EventEmitter);
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
function RbtFile(record, axiosInstance, localDb) {
|
|
32
|
+
function RbtFile(record, axiosInstance) {
|
|
34
33
|
var _this;
|
|
35
34
|
_classCallCheck(this, RbtFile);
|
|
36
35
|
_this = _callSuper(this, RbtFile); // Call the constructor of EventEmitter
|
|
36
|
+
|
|
37
|
+
_this.isRbtFile = true;
|
|
37
38
|
_this.id = record.id;
|
|
38
39
|
_this._axios = axiosInstance;
|
|
39
40
|
_this._internalData = record;
|
|
40
41
|
_this._data = record.data ? record.data : record.dataJson ? JSON.parse(record.dataJson) : {};
|
|
41
|
-
_this._localDb = localDb;
|
|
42
42
|
_this.progress = 0;
|
|
43
|
-
_this.fileHeader = {};
|
|
44
43
|
return _this;
|
|
45
44
|
}
|
|
46
45
|
_createClass(RbtFile, [{
|
|
@@ -58,6 +57,13 @@ var RbtFile = exports["default"] = /*#__PURE__*/function (_EventEmitter) {
|
|
|
58
57
|
value: function getData() {
|
|
59
58
|
return _objectSpread({}, this._data);
|
|
60
59
|
}
|
|
60
|
+
}, {
|
|
61
|
+
key: "setData",
|
|
62
|
+
value: function setData(data) {
|
|
63
|
+
// Use lodash's merge to deeply merge the incoming data into _data
|
|
64
|
+
_lodash["default"].merge(this._data, data);
|
|
65
|
+
return _objectSpread({}, this._data); // Return the updated _data as a new object
|
|
66
|
+
}
|
|
61
67
|
}, {
|
|
62
68
|
key: "toRecord",
|
|
63
69
|
value: function toRecord() {
|
|
@@ -126,7 +132,7 @@ var RbtFile = exports["default"] = /*#__PURE__*/function (_EventEmitter) {
|
|
|
126
132
|
_context2.prev = 2;
|
|
127
133
|
record = this.toRecord();
|
|
128
134
|
_context2.next = 6;
|
|
129
|
-
return this._axios
|
|
135
|
+
return this._axios["delete"]("/object_service/deleteObject/".concat(this.id));
|
|
130
136
|
case 6:
|
|
131
137
|
response = _context2.sent;
|
|
132
138
|
if (!(response.data.ok === false)) {
|
|
@@ -154,41 +160,59 @@ var RbtFile = exports["default"] = /*#__PURE__*/function (_EventEmitter) {
|
|
|
154
160
|
return _delete;
|
|
155
161
|
}()
|
|
156
162
|
}, {
|
|
157
|
-
key: "
|
|
158
|
-
value: function () {
|
|
159
|
-
var
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
163
|
+
key: "uploadFile",
|
|
164
|
+
value: function uploadFile(file) {
|
|
165
|
+
var _this2 = this;
|
|
166
|
+
var upload = new _tusJsClient.Upload(file, {
|
|
167
|
+
endpoint: this._axios.defaults.baseURL + "/file_service/files",
|
|
168
|
+
retryDelays: [0, 1000, 3000, 5000],
|
|
169
|
+
metadata: {
|
|
170
|
+
rbtfileid: this.id,
|
|
171
|
+
filename: file.name,
|
|
172
|
+
filetype: file.type
|
|
173
|
+
},
|
|
174
|
+
onError: function onError(error) {
|
|
175
|
+
console.error("Failed because:", error);
|
|
176
|
+
_this2.emit('error', error);
|
|
177
|
+
},
|
|
178
|
+
onProgress: function onProgress(bytesUploaded, bytesTotal) {
|
|
179
|
+
console.log("File progress", bytesUploaded, bytesTotal);
|
|
180
|
+
var percentage = (bytesUploaded / bytesTotal * 100).toFixed(2);
|
|
181
|
+
_this2.setProgress(percentage / 100); // Update progress normalized between 0 and 1
|
|
182
|
+
},
|
|
183
|
+
onSuccess: function onSuccess() {
|
|
184
|
+
console.log("File uploaded to:", upload.url);
|
|
185
|
+
|
|
186
|
+
// Remove the `options.endpoint` from the start of the `url`
|
|
187
|
+
var m1 = upload.url.match(/\/([^\/]+)$/);
|
|
188
|
+
var remoteId = m1 ? m1[1] : null;
|
|
189
|
+
_this2.setData({
|
|
190
|
+
'remoteId': remoteId,
|
|
191
|
+
'sourceFile': {
|
|
192
|
+
name: upload.file.name,
|
|
193
|
+
size: upload.file.size,
|
|
194
|
+
type: upload.file.type,
|
|
195
|
+
lastModified: upload.file.lastModified
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
_this2.save().then(function () {
|
|
199
|
+
_this2.emit('success', upload.url);
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
// Check if there are any previous uploads to continue.
|
|
205
|
+
// upload.findPreviousUploads().then(function (previousUploads) {
|
|
206
|
+
// // Found previous uploads so we select the first one.
|
|
207
|
+
// if (previousUploads.length) {
|
|
208
|
+
// upload.resumeFromPreviousUpload(previousUploads[0])
|
|
209
|
+
// }
|
|
210
|
+
|
|
211
|
+
// // Start the upload
|
|
212
|
+
// upload.start();
|
|
213
|
+
// })
|
|
214
|
+
upload.start();
|
|
215
|
+
}
|
|
192
216
|
}, {
|
|
193
217
|
key: "setProgress",
|
|
194
218
|
value: function setProgress(newProgress) {
|
|
@@ -196,386 +220,6 @@ var RbtFile = exports["default"] = /*#__PURE__*/function (_EventEmitter) {
|
|
|
196
220
|
console.log("Progress: ".concat(this.progress * 100, "%"));
|
|
197
221
|
this.emit('progress', this.progress); // Emit a progress event
|
|
198
222
|
}
|
|
199
|
-
}, {
|
|
200
|
-
key: "readAndStoreFile",
|
|
201
|
-
value: function () {
|
|
202
|
-
var _readAndStoreFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(file) {
|
|
203
|
-
var _this2 = this;
|
|
204
|
-
var offset, _loop;
|
|
205
|
-
return _regeneratorRuntime().wrap(function _callee5$(_context6) {
|
|
206
|
-
while (1) switch (_context6.prev = _context6.next) {
|
|
207
|
-
case 0:
|
|
208
|
-
offset = 0;
|
|
209
|
-
this.fileHeader = {
|
|
210
|
-
id: this.id,
|
|
211
|
-
name: file.name,
|
|
212
|
-
size: file.size,
|
|
213
|
-
ext: this._extractFileExtension(file.name),
|
|
214
|
-
mimeType: file.type,
|
|
215
|
-
numFrames: Math.ceil(file.size / RbtFile.FRAME_SIZE)
|
|
216
|
-
};
|
|
217
|
-
_loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop() {
|
|
218
|
-
var chunk;
|
|
219
|
-
return _regeneratorRuntime().wrap(function _loop$(_context5) {
|
|
220
|
-
while (1) switch (_context5.prev = _context5.next) {
|
|
221
|
-
case 0:
|
|
222
|
-
chunk = file.slice(offset, offset + RbtFile.FRAME_SIZE);
|
|
223
|
-
_context5.next = 3;
|
|
224
|
-
return new Promise(function (resolve, reject) {
|
|
225
|
-
var reader = new FileReader();
|
|
226
|
-
reader.onload = /*#__PURE__*/function () {
|
|
227
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(e) {
|
|
228
|
-
var arrayBuffer, frameIndex;
|
|
229
|
-
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
230
|
-
while (1) switch (_context4.prev = _context4.next) {
|
|
231
|
-
case 0:
|
|
232
|
-
arrayBuffer = e.target.result;
|
|
233
|
-
frameIndex = offset / RbtFile.FRAME_SIZE;
|
|
234
|
-
_context4.next = 4;
|
|
235
|
-
return _this2._storeChunkInIDB(arrayBuffer, frameIndex, _this2.fileHeader);
|
|
236
|
-
case 4:
|
|
237
|
-
_this2.setProgress((frameIndex + 1) / _this2.fileHeader.numFrames);
|
|
238
|
-
resolve();
|
|
239
|
-
case 6:
|
|
240
|
-
case "end":
|
|
241
|
-
return _context4.stop();
|
|
242
|
-
}
|
|
243
|
-
}, _callee4);
|
|
244
|
-
}));
|
|
245
|
-
return function (_x2) {
|
|
246
|
-
return _ref.apply(this, arguments);
|
|
247
|
-
};
|
|
248
|
-
}();
|
|
249
|
-
reader.onerror = function () {
|
|
250
|
-
return reject(reader.error);
|
|
251
|
-
};
|
|
252
|
-
reader.readAsArrayBuffer(chunk);
|
|
253
|
-
});
|
|
254
|
-
case 3:
|
|
255
|
-
offset += RbtFile.FRAME_SIZE;
|
|
256
|
-
case 4:
|
|
257
|
-
case "end":
|
|
258
|
-
return _context5.stop();
|
|
259
|
-
}
|
|
260
|
-
}, _loop);
|
|
261
|
-
});
|
|
262
|
-
case 3:
|
|
263
|
-
if (!(offset < file.size)) {
|
|
264
|
-
_context6.next = 7;
|
|
265
|
-
break;
|
|
266
|
-
}
|
|
267
|
-
return _context6.delegateYield(_loop(), "t0", 5);
|
|
268
|
-
case 5:
|
|
269
|
-
_context6.next = 3;
|
|
270
|
-
break;
|
|
271
|
-
case 7:
|
|
272
|
-
case "end":
|
|
273
|
-
return _context6.stop();
|
|
274
|
-
}
|
|
275
|
-
}, _callee5, this);
|
|
276
|
-
}));
|
|
277
|
-
function readAndStoreFile(_x) {
|
|
278
|
-
return _readAndStoreFile.apply(this, arguments);
|
|
279
|
-
}
|
|
280
|
-
return readAndStoreFile;
|
|
281
|
-
}()
|
|
282
|
-
}, {
|
|
283
|
-
key: "_extractFileExtension",
|
|
284
|
-
value: function _extractFileExtension(fileName) {
|
|
285
|
-
// Find the last dot in the filename
|
|
286
|
-
var lastDotIndex = fileName.lastIndexOf('.');
|
|
287
|
-
|
|
288
|
-
// No dot found, or the dot is the first character (hidden files)
|
|
289
|
-
if (lastDotIndex === -1 || lastDotIndex === 0) return '';
|
|
290
|
-
|
|
291
|
-
// Extract the extension
|
|
292
|
-
return fileName.substring(lastDotIndex + 1);
|
|
293
|
-
}
|
|
294
|
-
}, {
|
|
295
|
-
key: "_storeChunkInIDB",
|
|
296
|
-
value: function () {
|
|
297
|
-
var _storeChunkInIDB2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(chunk, frameIndex, fileHeader) {
|
|
298
|
-
var db, tx, frameKey;
|
|
299
|
-
return _regeneratorRuntime().wrap(function _callee6$(_context7) {
|
|
300
|
-
while (1) switch (_context7.prev = _context7.next) {
|
|
301
|
-
case 0:
|
|
302
|
-
db = this._localDb;
|
|
303
|
-
if (db) {
|
|
304
|
-
_context7.next = 4;
|
|
305
|
-
break;
|
|
306
|
-
}
|
|
307
|
-
console.error('Database not initialized');
|
|
308
|
-
return _context7.abrupt("return");
|
|
309
|
-
case 4:
|
|
310
|
-
tx = db.transaction('files', 'readwrite');
|
|
311
|
-
frameKey = "".concat(this.id, "_").concat(frameIndex); // Unique key combining id and frameIndex
|
|
312
|
-
_context7.next = 8;
|
|
313
|
-
return tx.store.put({
|
|
314
|
-
key: frameKey,
|
|
315
|
-
chunk: chunk,
|
|
316
|
-
fileHeader: fileHeader
|
|
317
|
-
}, frameKey);
|
|
318
|
-
case 8:
|
|
319
|
-
_context7.next = 10;
|
|
320
|
-
return tx.done;
|
|
321
|
-
case 10:
|
|
322
|
-
case "end":
|
|
323
|
-
return _context7.stop();
|
|
324
|
-
}
|
|
325
|
-
}, _callee6, this);
|
|
326
|
-
}));
|
|
327
|
-
function _storeChunkInIDB(_x3, _x4, _x5) {
|
|
328
|
-
return _storeChunkInIDB2.apply(this, arguments);
|
|
329
|
-
}
|
|
330
|
-
return _storeChunkInIDB;
|
|
331
|
-
}()
|
|
332
|
-
}, {
|
|
333
|
-
key: "_readFrameFromIDB",
|
|
334
|
-
value: function () {
|
|
335
|
-
var _readFrameFromIDB2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(frameIndex) {
|
|
336
|
-
var db, frameKey, tx, frame;
|
|
337
|
-
return _regeneratorRuntime().wrap(function _callee7$(_context8) {
|
|
338
|
-
while (1) switch (_context8.prev = _context8.next) {
|
|
339
|
-
case 0:
|
|
340
|
-
db = this._localDb;
|
|
341
|
-
if (db) {
|
|
342
|
-
_context8.next = 4;
|
|
343
|
-
break;
|
|
344
|
-
}
|
|
345
|
-
console.error('Database not initialized');
|
|
346
|
-
return _context8.abrupt("return", null);
|
|
347
|
-
case 4:
|
|
348
|
-
frameKey = "".concat(this.id, "_").concat(frameIndex); // Same key as used in _storeChunkInIDB
|
|
349
|
-
tx = db.transaction('files', 'readonly');
|
|
350
|
-
_context8.next = 8;
|
|
351
|
-
return tx.store.get(frameKey);
|
|
352
|
-
case 8:
|
|
353
|
-
frame = _context8.sent;
|
|
354
|
-
return _context8.abrupt("return", frame ? frame.chunk : null);
|
|
355
|
-
case 10:
|
|
356
|
-
case "end":
|
|
357
|
-
return _context8.stop();
|
|
358
|
-
}
|
|
359
|
-
}, _callee7, this);
|
|
360
|
-
}));
|
|
361
|
-
function _readFrameFromIDB(_x6) {
|
|
362
|
-
return _readFrameFromIDB2.apply(this, arguments);
|
|
363
|
-
}
|
|
364
|
-
return _readFrameFromIDB;
|
|
365
|
-
}()
|
|
366
|
-
}, {
|
|
367
|
-
key: "uploadFile",
|
|
368
|
-
value: function () {
|
|
369
|
-
var _uploadFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
370
|
-
var frameRes, frameIndex, frameData, statusRes;
|
|
371
|
-
return _regeneratorRuntime().wrap(function _callee8$(_context9) {
|
|
372
|
-
while (1) switch (_context9.prev = _context9.next) {
|
|
373
|
-
case 0:
|
|
374
|
-
if (!(!this.fileHeader || !this.fileHeader.numFrames)) {
|
|
375
|
-
_context9.next = 2;
|
|
376
|
-
break;
|
|
377
|
-
}
|
|
378
|
-
throw new Error("File not ready for upload.");
|
|
379
|
-
case 2:
|
|
380
|
-
this.fileRecord = this.toRecord();
|
|
381
|
-
frameIndex = 0;
|
|
382
|
-
case 4:
|
|
383
|
-
if (!(frameIndex < this.fileHeader.numFrames)) {
|
|
384
|
-
_context9.next = 24;
|
|
385
|
-
break;
|
|
386
|
-
}
|
|
387
|
-
_context9.prev = 5;
|
|
388
|
-
_context9.next = 8;
|
|
389
|
-
return this._readFrameFromIDB(frameIndex);
|
|
390
|
-
case 8:
|
|
391
|
-
frameData = _context9.sent;
|
|
392
|
-
if (frameData) {
|
|
393
|
-
_context9.next = 11;
|
|
394
|
-
break;
|
|
395
|
-
}
|
|
396
|
-
throw new Error("Failed to read frame ".concat(frameIndex));
|
|
397
|
-
case 11:
|
|
398
|
-
_context9.next = 13;
|
|
399
|
-
return this._uploadFrameToServer(frameData, frameIndex, this.fileHeader, this.fileRecord);
|
|
400
|
-
case 13:
|
|
401
|
-
frameRes = _context9.sent;
|
|
402
|
-
// Update progress after each frame is uploaded
|
|
403
|
-
this.setProgress((frameIndex + 1) / this.fileHeader.numFrames);
|
|
404
|
-
_context9.next = 21;
|
|
405
|
-
break;
|
|
406
|
-
case 17:
|
|
407
|
-
_context9.prev = 17;
|
|
408
|
-
_context9.t0 = _context9["catch"](5);
|
|
409
|
-
console.error("Error uploading frame ".concat(frameIndex, ":"), _context9.t0);
|
|
410
|
-
throw _context9.t0;
|
|
411
|
-
case 21:
|
|
412
|
-
frameIndex++;
|
|
413
|
-
_context9.next = 4;
|
|
414
|
-
break;
|
|
415
|
-
case 24:
|
|
416
|
-
_context9.prev = 24;
|
|
417
|
-
_context9.next = 27;
|
|
418
|
-
return this._checkUploadStatusUntilDone(this.fileRecord);
|
|
419
|
-
case 27:
|
|
420
|
-
statusRes = _context9.sent;
|
|
421
|
-
this.set('remoteSrc', statusRes.remoteSrc);
|
|
422
|
-
this.set('progress', 1);
|
|
423
|
-
_context9.next = 32;
|
|
424
|
-
return this.save();
|
|
425
|
-
case 32:
|
|
426
|
-
_context9.next = 37;
|
|
427
|
-
break;
|
|
428
|
-
case 34:
|
|
429
|
-
_context9.prev = 34;
|
|
430
|
-
_context9.t1 = _context9["catch"](24);
|
|
431
|
-
console.error('Error during upload status check:', _context9.t1);
|
|
432
|
-
// Handle error, possibly update UI or retry logic
|
|
433
|
-
case 37:
|
|
434
|
-
case "end":
|
|
435
|
-
return _context9.stop();
|
|
436
|
-
}
|
|
437
|
-
}, _callee8, this, [[5, 17], [24, 34]]);
|
|
438
|
-
}));
|
|
439
|
-
function uploadFile() {
|
|
440
|
-
return _uploadFile.apply(this, arguments);
|
|
441
|
-
}
|
|
442
|
-
return uploadFile;
|
|
443
|
-
}()
|
|
444
|
-
}, {
|
|
445
|
-
key: "_uploadFrameToServer",
|
|
446
|
-
value: function () {
|
|
447
|
-
var _uploadFrameToServer2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(frameData, frameIndex, fileHeader, fileRecord) {
|
|
448
|
-
var base64Data, payload, response;
|
|
449
|
-
return _regeneratorRuntime().wrap(function _callee9$(_context10) {
|
|
450
|
-
while (1) switch (_context10.prev = _context10.next) {
|
|
451
|
-
case 0:
|
|
452
|
-
base64Data = this.convertToBase64(frameData);
|
|
453
|
-
payload = ["@filekit.ffs_server_receiveAndStore_toS3_flow", {
|
|
454
|
-
"fileObject": fileRecord,
|
|
455
|
-
// using fileRecord from newFile.toRecord()
|
|
456
|
-
"fileHeader": fileHeader,
|
|
457
|
-
"frameIndex": frameIndex,
|
|
458
|
-
"frameData": "rpcBase64:".concat(base64Data),
|
|
459
|
-
"timeout": 86400000
|
|
460
|
-
}];
|
|
461
|
-
console.log(payload);
|
|
462
|
-
_context10.next = 5;
|
|
463
|
-
return this._axios.post('/file_service/ffs_runFlow', payload);
|
|
464
|
-
case 5:
|
|
465
|
-
response = _context10.sent;
|
|
466
|
-
if (!(!response || response.status != 200)) {
|
|
467
|
-
_context10.next = 8;
|
|
468
|
-
break;
|
|
469
|
-
}
|
|
470
|
-
throw new Error('Error uploading frame to server');
|
|
471
|
-
case 8:
|
|
472
|
-
return _context10.abrupt("return", response);
|
|
473
|
-
case 9:
|
|
474
|
-
case "end":
|
|
475
|
-
return _context10.stop();
|
|
476
|
-
}
|
|
477
|
-
}, _callee9, this);
|
|
478
|
-
}));
|
|
479
|
-
function _uploadFrameToServer(_x7, _x8, _x9, _x10) {
|
|
480
|
-
return _uploadFrameToServer2.apply(this, arguments);
|
|
481
|
-
}
|
|
482
|
-
return _uploadFrameToServer;
|
|
483
|
-
}()
|
|
484
|
-
}, {
|
|
485
|
-
key: "_checkUploadStatusUntilDone",
|
|
486
|
-
value: function () {
|
|
487
|
-
var _checkUploadStatusUntilDone2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(fileRecord) {
|
|
488
|
-
var _this3 = this;
|
|
489
|
-
return _regeneratorRuntime().wrap(function _callee11$(_context12) {
|
|
490
|
-
while (1) switch (_context12.prev = _context12.next) {
|
|
491
|
-
case 0:
|
|
492
|
-
return _context12.abrupt("return", new Promise(function (resolve, reject) {
|
|
493
|
-
var intervalId = setInterval( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
494
|
-
var statusRes;
|
|
495
|
-
return _regeneratorRuntime().wrap(function _callee10$(_context11) {
|
|
496
|
-
while (1) switch (_context11.prev = _context11.next) {
|
|
497
|
-
case 0:
|
|
498
|
-
_context11.prev = 0;
|
|
499
|
-
_context11.next = 3;
|
|
500
|
-
return _this3._uploadGetStatusUpdate(fileRecord);
|
|
501
|
-
case 3:
|
|
502
|
-
statusRes = _context11.sent;
|
|
503
|
-
if (statusRes.data && statusRes.data.fileHeader && statusRes.data.fileHeader.status === 'DONE') {
|
|
504
|
-
clearInterval(intervalId); // Stop the interval
|
|
505
|
-
resolve(statusRes.data.fileHeader); // Resolve the promise with the final status
|
|
506
|
-
} else {
|
|
507
|
-
// Optionally update progress or handle other status cases here
|
|
508
|
-
//this.emit('progress', statusRes.progress); // Emit progress updates if available
|
|
509
|
-
}
|
|
510
|
-
_context11.next = 11;
|
|
511
|
-
break;
|
|
512
|
-
case 7:
|
|
513
|
-
_context11.prev = 7;
|
|
514
|
-
_context11.t0 = _context11["catch"](0);
|
|
515
|
-
clearInterval(intervalId); // Stop the interval on error
|
|
516
|
-
reject(_context11.t0); // Reject the promise if there's an error
|
|
517
|
-
case 11:
|
|
518
|
-
case "end":
|
|
519
|
-
return _context11.stop();
|
|
520
|
-
}
|
|
521
|
-
}, _callee10, null, [[0, 7]]);
|
|
522
|
-
})), 2000); // Check every 2 seconds
|
|
523
|
-
}));
|
|
524
|
-
case 1:
|
|
525
|
-
case "end":
|
|
526
|
-
return _context12.stop();
|
|
527
|
-
}
|
|
528
|
-
}, _callee11);
|
|
529
|
-
}));
|
|
530
|
-
function _checkUploadStatusUntilDone(_x11) {
|
|
531
|
-
return _checkUploadStatusUntilDone2.apply(this, arguments);
|
|
532
|
-
}
|
|
533
|
-
return _checkUploadStatusUntilDone;
|
|
534
|
-
}()
|
|
535
|
-
}, {
|
|
536
|
-
key: "_uploadGetStatusUpdate",
|
|
537
|
-
value: function () {
|
|
538
|
-
var _uploadGetStatusUpdate2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(fileRecord) {
|
|
539
|
-
var payload, response;
|
|
540
|
-
return _regeneratorRuntime().wrap(function _callee12$(_context13) {
|
|
541
|
-
while (1) switch (_context13.prev = _context13.next) {
|
|
542
|
-
case 0:
|
|
543
|
-
payload = ["@filekit.ffs_server_receiveAndStore_toS3_flow", {
|
|
544
|
-
"fileObject": fileRecord,
|
|
545
|
-
// using fileRecord from newFile.toRecord()
|
|
546
|
-
"getStatusUpdate": true
|
|
547
|
-
}];
|
|
548
|
-
console.log(payload);
|
|
549
|
-
_context13.next = 4;
|
|
550
|
-
return this._axios.post('/file_service/ffs_runFlow', payload);
|
|
551
|
-
case 4:
|
|
552
|
-
response = _context13.sent;
|
|
553
|
-
if (!(!response || response.status != 200)) {
|
|
554
|
-
_context13.next = 7;
|
|
555
|
-
break;
|
|
556
|
-
}
|
|
557
|
-
throw new Error('Error getting upload status');
|
|
558
|
-
case 7:
|
|
559
|
-
return _context13.abrupt("return", response);
|
|
560
|
-
case 8:
|
|
561
|
-
case "end":
|
|
562
|
-
return _context13.stop();
|
|
563
|
-
}
|
|
564
|
-
}, _callee12, this);
|
|
565
|
-
}));
|
|
566
|
-
function _uploadGetStatusUpdate(_x12) {
|
|
567
|
-
return _uploadGetStatusUpdate2.apply(this, arguments);
|
|
568
|
-
}
|
|
569
|
-
return _uploadGetStatusUpdate;
|
|
570
|
-
}()
|
|
571
|
-
}, {
|
|
572
|
-
key: "convertToBase64",
|
|
573
|
-
value: function convertToBase64(buffer) {
|
|
574
|
-
return btoa(new Uint8Array(buffer).reduce(function (data, _byte) {
|
|
575
|
-
return data + String.fromCharCode(_byte);
|
|
576
|
-
}, ''));
|
|
577
|
-
}
|
|
578
223
|
}]);
|
|
579
224
|
return RbtFile;
|
|
580
|
-
}(_eventemitter["default"]);
|
|
581
|
-
_defineProperty(RbtFile, "FRAME_SIZE", 1024 * 1024);
|
|
225
|
+
}(_eventemitter["default"]);
|
package/dist/esm/index.js
CHANGED
package/dist/esm/rbt_api.js
CHANGED
|
@@ -229,18 +229,19 @@ export default class RbtApi {
|
|
|
229
229
|
}
|
|
230
230
|
if (this.requestCache[authtoken]) {
|
|
231
231
|
// If there's already a pending promise to refresh this token, return it
|
|
232
|
-
console.log('RBTTOK Using cached promise for token refresh');
|
|
232
|
+
//console.log('RBTTOK Using cached promise for token refresh');
|
|
233
233
|
return this.requestCache[authtoken];
|
|
234
234
|
}
|
|
235
235
|
try {
|
|
236
|
-
console.log('RBTTOK Req', authtoken);
|
|
236
|
+
//console.log('RBTTOK Req', authtoken);
|
|
237
237
|
// Create a new promise for the token refresh and store it in the cache
|
|
238
238
|
const promise = this.axios.post('/user_service/refreshAuthToken', [authtoken]);
|
|
239
239
|
this.requestCache[authtoken] = promise;
|
|
240
240
|
|
|
241
241
|
// Await the promise to get the response
|
|
242
242
|
const response = await promise;
|
|
243
|
-
|
|
243
|
+
|
|
244
|
+
//console.log('RBTTOK Response ',response);
|
|
244
245
|
// Once the promise resolves, delete it from the cache to allow future refreshes
|
|
245
246
|
delete this.requestCache[authtoken];
|
|
246
247
|
|
|
@@ -321,6 +322,24 @@ export default class RbtApi {
|
|
|
321
322
|
return this._handleError(e);
|
|
322
323
|
}
|
|
323
324
|
}
|
|
325
|
+
async loadFiles(ids) {
|
|
326
|
+
try {
|
|
327
|
+
// Use the bulk load method with the provided IDs
|
|
328
|
+
const responses = await this.load('<@filekit.file>', ids);
|
|
329
|
+
if (!responses || !Array.isArray(responses)) {
|
|
330
|
+
return []; // Return an empty array if no responses or invalid data
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
// Map over the responses to create RbtFile instances
|
|
334
|
+
return responses.map(response => {
|
|
335
|
+
const record = response.toRecord();
|
|
336
|
+
return new RbtFile(record, this.axios, this.localDb);
|
|
337
|
+
});
|
|
338
|
+
} catch (e) {
|
|
339
|
+
this._handleError(e); // Handle errors (log or process as needed)
|
|
340
|
+
return []; // Return an empty array on failure
|
|
341
|
+
}
|
|
342
|
+
}
|
|
324
343
|
|
|
325
344
|
/**
|
|
326
345
|
* Creates a new object of the given type.
|
|
@@ -601,7 +620,7 @@ export default class RbtApi {
|
|
|
601
620
|
}
|
|
602
621
|
if (status === 'DONE' && onDone) {
|
|
603
622
|
// Provide the current progress to the callback function
|
|
604
|
-
console.log('Finish (request) ',
|
|
623
|
+
//console.log('Finish (request) ',response);
|
|
605
624
|
onDone(response);
|
|
606
625
|
}
|
|
607
626
|
return {
|
|
@@ -666,7 +685,7 @@ export default class RbtApi {
|
|
|
666
685
|
// If the task is still in progress, start polling for updates
|
|
667
686
|
if (response.status === 'DONE' && onDone) {
|
|
668
687
|
// Provide the current progress to the callback function
|
|
669
|
-
console.log('Finish (progress) ',
|
|
688
|
+
//console.log('Finish (progress) ',response);
|
|
670
689
|
onDone(response);
|
|
671
690
|
}
|
|
672
691
|
if (response.status === 'ERROR' && onError) {
|