roboto-js 1.9.5 → 1.9.9
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/.last-build +1 -1
- package/README.md +580 -0
- package/dist/cjs/cookie_storage_adaptor.cjs +22 -7
- package/dist/cjs/index.cjs +156 -79
- package/dist/cjs/rbt_api.cjs +644 -298
- package/dist/cjs/version.cjs +2 -2
- package/dist/cookie_storage_adaptor.js +12 -26
- package/dist/esm/cookie_storage_adaptor.js +22 -7
- package/dist/esm/index.js +156 -79
- package/dist/esm/rbt_api.js +644 -298
- package/dist/esm/version.js +2 -2
- package/dist/index.js +118 -3
- package/dist/version.js +2 -2
- package/package.json +1 -1
- package/src/cookie_storage_adaptor.js +14 -15
- package/src/index.js +19 -0
- package/src/rbt_api.js +245 -0
- package/src/version.js +2 -2
package/dist/cjs/rbt_api.cjs
CHANGED
|
@@ -14,12 +14,12 @@ var _idb = require("idb");
|
|
|
14
14
|
var _excluded = ["enableRealtime"],
|
|
15
15
|
_excluded2 = ["enableRealtime"];
|
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
17
|
-
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); }
|
|
18
17
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
19
18
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
20
19
|
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; }
|
|
21
20
|
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; }
|
|
22
21
|
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; }
|
|
22
|
+
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); }
|
|
23
23
|
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; }
|
|
24
24
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
25
25
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -95,6 +95,8 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
95
95
|
this.requestCache = {};
|
|
96
96
|
this._loadCurrentUserPromise = null;
|
|
97
97
|
this._loadCurrentUserExtendedPromise = null;
|
|
98
|
+
this.currentOrganization = null;
|
|
99
|
+
this._loadCurrentOrgPromise = null;
|
|
98
100
|
|
|
99
101
|
// Use the storageAdaptor to get the authToken, if available
|
|
100
102
|
this.initAuthToken(authtoken);
|
|
@@ -500,16 +502,23 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
500
502
|
_context6.next = 16;
|
|
501
503
|
return this.localStorageAdaptor.setItem('rbtUser', JSON.stringify(this.iac_session.user));
|
|
502
504
|
case 16:
|
|
505
|
+
// Optionally load organization after login (can be disabled with loadOrganization: false)
|
|
506
|
+
if (params.loadOrganization !== false) {
|
|
507
|
+
// Kick off org load asynchronously but don't wait for it
|
|
508
|
+
this.loadCurrentOrganization()["catch"](function (err) {
|
|
509
|
+
return void 0;
|
|
510
|
+
});
|
|
511
|
+
}
|
|
503
512
|
return _context6.abrupt("return", response.data);
|
|
504
|
-
case
|
|
505
|
-
_context6.prev =
|
|
513
|
+
case 20:
|
|
514
|
+
_context6.prev = 20;
|
|
506
515
|
_context6.t0 = _context6["catch"](0);
|
|
507
516
|
this._handleError(_context6.t0);
|
|
508
|
-
case
|
|
517
|
+
case 23:
|
|
509
518
|
case "end":
|
|
510
519
|
return _context6.stop();
|
|
511
520
|
}
|
|
512
|
-
}, _callee6, this, [[0,
|
|
521
|
+
}, _callee6, this, [[0, 20]]);
|
|
513
522
|
}));
|
|
514
523
|
function login(_x4) {
|
|
515
524
|
return _login.apply(this, arguments);
|
|
@@ -547,16 +556,20 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
547
556
|
_context7.next = 13;
|
|
548
557
|
return this.localStorageAdaptor.setItem('authtoken', response.authToken);
|
|
549
558
|
case 13:
|
|
559
|
+
// Load organization after OAuth login
|
|
560
|
+
this.loadCurrentOrganization()["catch"](function (err) {
|
|
561
|
+
return void 0;
|
|
562
|
+
});
|
|
550
563
|
return _context7.abrupt("return", response);
|
|
551
|
-
case
|
|
552
|
-
_context7.prev =
|
|
564
|
+
case 17:
|
|
565
|
+
_context7.prev = 17;
|
|
553
566
|
_context7.t0 = _context7["catch"](0);
|
|
554
567
|
this._handleError(_context7.t0);
|
|
555
|
-
case
|
|
568
|
+
case 20:
|
|
556
569
|
case "end":
|
|
557
570
|
return _context7.stop();
|
|
558
571
|
}
|
|
559
|
-
}, _callee7, this, [[0,
|
|
572
|
+
}, _callee7, this, [[0, 17]]);
|
|
560
573
|
}));
|
|
561
574
|
function loginWithOauth(_x5) {
|
|
562
575
|
return _loginWithOauth.apply(this, arguments);
|
|
@@ -585,6 +598,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
585
598
|
// Clear the iac_session and remove the auth token from axios headers
|
|
586
599
|
this.iac_session = null;
|
|
587
600
|
this.currentUser = null;
|
|
601
|
+
this.currentOrganization = null;
|
|
588
602
|
this.authtoken = null;
|
|
589
603
|
if (this.axios.defaults.headers.common['authtoken']) {
|
|
590
604
|
delete this.axios.defaults.headers.common['authtoken'];
|
|
@@ -592,22 +606,28 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
592
606
|
|
|
593
607
|
// Clear localStorage if it's being used
|
|
594
608
|
if (!this.localStorageAdaptor) {
|
|
595
|
-
_context8.next =
|
|
609
|
+
_context8.next = 18;
|
|
596
610
|
break;
|
|
597
611
|
}
|
|
598
|
-
_context8.next =
|
|
612
|
+
_context8.next = 14;
|
|
599
613
|
return this.localStorageAdaptor.removeItem('authtoken');
|
|
600
|
-
case
|
|
601
|
-
|
|
614
|
+
case 14:
|
|
615
|
+
_context8.next = 16;
|
|
616
|
+
return this.localStorageAdaptor.removeItem('rbtUser');
|
|
602
617
|
case 16:
|
|
603
|
-
_context8.
|
|
618
|
+
_context8.next = 18;
|
|
619
|
+
return this.localStorageAdaptor.removeItem('currentOrgId');
|
|
620
|
+
case 18:
|
|
621
|
+
return _context8.abrupt("return", response.data);
|
|
622
|
+
case 21:
|
|
623
|
+
_context8.prev = 21;
|
|
604
624
|
_context8.t0 = _context8["catch"](0);
|
|
605
625
|
this._handleError(_context8.t0);
|
|
606
|
-
case
|
|
626
|
+
case 24:
|
|
607
627
|
case "end":
|
|
608
628
|
return _context8.stop();
|
|
609
629
|
}
|
|
610
|
-
}, _callee8, this, [[0,
|
|
630
|
+
}, _callee8, this, [[0, 21]]);
|
|
611
631
|
}));
|
|
612
632
|
function logout() {
|
|
613
633
|
return _logout.apply(this, arguments);
|
|
@@ -809,14 +829,340 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
809
829
|
}
|
|
810
830
|
return loadCurrentUserExtended;
|
|
811
831
|
}()
|
|
832
|
+
/**
|
|
833
|
+
* Load current organization for the authenticated user
|
|
834
|
+
* Organization is determined by:
|
|
835
|
+
* 1. User's mod.currentOrgId preference
|
|
836
|
+
* 2. First organization in user.organizations array
|
|
837
|
+
* 3. null if user has no organizations
|
|
838
|
+
*
|
|
839
|
+
* @param {boolean} forceReload - Force reload from server even if cached
|
|
840
|
+
* @returns {Promise<RbtObject|null>} Organization object or null
|
|
841
|
+
*/
|
|
812
842
|
}, {
|
|
813
|
-
key: "
|
|
814
|
-
value: function () {
|
|
815
|
-
var
|
|
843
|
+
key: "loadCurrentOrganization",
|
|
844
|
+
value: (function () {
|
|
845
|
+
var _loadCurrentOrganization = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
|
|
816
846
|
var _this4 = this;
|
|
817
|
-
var
|
|
847
|
+
var forceReload,
|
|
848
|
+
result,
|
|
849
|
+
_args15 = arguments;
|
|
818
850
|
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
819
851
|
while (1) switch (_context15.prev = _context15.next) {
|
|
852
|
+
case 0:
|
|
853
|
+
forceReload = _args15.length > 0 && _args15[0] !== undefined ? _args15[0] : false;
|
|
854
|
+
_context15.prev = 1;
|
|
855
|
+
if (!(this.currentOrganization && !forceReload)) {
|
|
856
|
+
_context15.next = 4;
|
|
857
|
+
break;
|
|
858
|
+
}
|
|
859
|
+
return _context15.abrupt("return", this.currentOrganization);
|
|
860
|
+
case 4:
|
|
861
|
+
if (!this._loadCurrentOrgPromise) {
|
|
862
|
+
_context15.next = 6;
|
|
863
|
+
break;
|
|
864
|
+
}
|
|
865
|
+
return _context15.abrupt("return", this._loadCurrentOrgPromise);
|
|
866
|
+
case 6:
|
|
867
|
+
this._loadCurrentOrgPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
868
|
+
var _userData$organizatio, _userData$mod, user, userData, firstOrg, orgId, cachedOrgId, org;
|
|
869
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
870
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
871
|
+
case 0:
|
|
872
|
+
_context14.prev = 0;
|
|
873
|
+
_context14.next = 3;
|
|
874
|
+
return _this4.loadCurrentUser();
|
|
875
|
+
case 3:
|
|
876
|
+
user = _context14.sent;
|
|
877
|
+
if (user) {
|
|
878
|
+
_context14.next = 6;
|
|
879
|
+
break;
|
|
880
|
+
}
|
|
881
|
+
return _context14.abrupt("return", null);
|
|
882
|
+
case 6:
|
|
883
|
+
// Get organization ID from user preferences or first org
|
|
884
|
+
userData = user.getData(); // organizations array format: [{ id: 'org123', roles: ['owner'] }, ...]
|
|
885
|
+
firstOrg = (_userData$organizatio = userData.organizations) === null || _userData$organizatio === void 0 ? void 0 : _userData$organizatio[0];
|
|
886
|
+
orgId = ((_userData$mod = userData.mod) === null || _userData$mod === void 0 ? void 0 : _userData$mod.currentOrgId) || (_typeof(firstOrg) === 'object' ? firstOrg === null || firstOrg === void 0 ? void 0 : firstOrg.id : firstOrg);
|
|
887
|
+
if (orgId) {
|
|
888
|
+
_context14.next = 11;
|
|
889
|
+
break;
|
|
890
|
+
}
|
|
891
|
+
return _context14.abrupt("return", null);
|
|
892
|
+
case 11:
|
|
893
|
+
if (!_this4.localStorageAdaptor) {
|
|
894
|
+
_context14.next = 16;
|
|
895
|
+
break;
|
|
896
|
+
}
|
|
897
|
+
_context14.next = 14;
|
|
898
|
+
return _this4.localStorageAdaptor.getItem('currentOrgId');
|
|
899
|
+
case 14:
|
|
900
|
+
cachedOrgId = _context14.sent;
|
|
901
|
+
if (cachedOrgId && cachedOrgId !== orgId) {}
|
|
902
|
+
case 16:
|
|
903
|
+
_context14.next = 18;
|
|
904
|
+
return _this4.get('<@iac.organization>', orgId);
|
|
905
|
+
case 18:
|
|
906
|
+
org = _context14.sent;
|
|
907
|
+
if (!org) {
|
|
908
|
+
_context14.next = 26;
|
|
909
|
+
break;
|
|
910
|
+
}
|
|
911
|
+
_this4.currentOrganization = org; // Already an RbtObject
|
|
912
|
+
if (!_this4.localStorageAdaptor) {
|
|
913
|
+
_context14.next = 24;
|
|
914
|
+
break;
|
|
915
|
+
}
|
|
916
|
+
_context14.next = 24;
|
|
917
|
+
return _this4.localStorageAdaptor.setItem('currentOrgId', orgId);
|
|
918
|
+
case 24:
|
|
919
|
+
_context14.next = 26;
|
|
920
|
+
break;
|
|
921
|
+
case 26:
|
|
922
|
+
return _context14.abrupt("return", _this4.currentOrganization);
|
|
923
|
+
case 29:
|
|
924
|
+
_context14.prev = 29;
|
|
925
|
+
_context14.t0 = _context14["catch"](0);
|
|
926
|
+
console.error('[RbtApi] Failed to load current organization:', _context14.t0);
|
|
927
|
+
_this4.currentOrganization = null;
|
|
928
|
+
return _context14.abrupt("return", null);
|
|
929
|
+
case 34:
|
|
930
|
+
case "end":
|
|
931
|
+
return _context14.stop();
|
|
932
|
+
}
|
|
933
|
+
}, _callee14, null, [[0, 29]]);
|
|
934
|
+
}))();
|
|
935
|
+
_context15.next = 9;
|
|
936
|
+
return this._loadCurrentOrgPromise;
|
|
937
|
+
case 9:
|
|
938
|
+
result = _context15.sent;
|
|
939
|
+
this._loadCurrentOrgPromise = null;
|
|
940
|
+
return _context15.abrupt("return", result);
|
|
941
|
+
case 14:
|
|
942
|
+
_context15.prev = 14;
|
|
943
|
+
_context15.t0 = _context15["catch"](1);
|
|
944
|
+
this._loadCurrentOrgPromise = null;
|
|
945
|
+
return _context15.abrupt("return", this._handleError(_context15.t0));
|
|
946
|
+
case 18:
|
|
947
|
+
case "end":
|
|
948
|
+
return _context15.stop();
|
|
949
|
+
}
|
|
950
|
+
}, _callee15, this, [[1, 14]]);
|
|
951
|
+
}));
|
|
952
|
+
function loadCurrentOrganization() {
|
|
953
|
+
return _loadCurrentOrganization.apply(this, arguments);
|
|
954
|
+
}
|
|
955
|
+
return loadCurrentOrganization;
|
|
956
|
+
}()
|
|
957
|
+
/**
|
|
958
|
+
* Switch to a different organization
|
|
959
|
+
* Updates user preference and loads the new organization
|
|
960
|
+
*
|
|
961
|
+
* @param {string} orgId - Organization ID to switch to
|
|
962
|
+
* @returns {Promise<RbtObject>} The new current organization
|
|
963
|
+
*/
|
|
964
|
+
)
|
|
965
|
+
}, {
|
|
966
|
+
key: "switchOrganization",
|
|
967
|
+
value: (function () {
|
|
968
|
+
var _switchOrganization = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(orgId) {
|
|
969
|
+
var org, userObj;
|
|
970
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
971
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
972
|
+
case 0:
|
|
973
|
+
_context16.prev = 0;
|
|
974
|
+
if (this.currentUser) {
|
|
975
|
+
_context16.next = 3;
|
|
976
|
+
break;
|
|
977
|
+
}
|
|
978
|
+
throw new Error('Must be logged in to switch organization');
|
|
979
|
+
case 3:
|
|
980
|
+
_context16.next = 5;
|
|
981
|
+
return this.get('<@iac.organization>', orgId);
|
|
982
|
+
case 5:
|
|
983
|
+
org = _context16.sent;
|
|
984
|
+
if (org) {
|
|
985
|
+
_context16.next = 8;
|
|
986
|
+
break;
|
|
987
|
+
}
|
|
988
|
+
throw new Error("Organization ".concat(orgId, " not found or not accessible"));
|
|
989
|
+
case 8:
|
|
990
|
+
this.currentOrganization = org;
|
|
991
|
+
|
|
992
|
+
// Save preference to user
|
|
993
|
+
_context16.prev = 9;
|
|
994
|
+
_context16.next = 12;
|
|
995
|
+
return this.loadUser(this.currentUser.id);
|
|
996
|
+
case 12:
|
|
997
|
+
userObj = _context16.sent;
|
|
998
|
+
userObj.set('mod.currentOrgId', orgId);
|
|
999
|
+
_context16.next = 16;
|
|
1000
|
+
return userObj.save();
|
|
1001
|
+
case 16:
|
|
1002
|
+
if (!this.localStorageAdaptor) {
|
|
1003
|
+
_context16.next = 19;
|
|
1004
|
+
break;
|
|
1005
|
+
}
|
|
1006
|
+
_context16.next = 19;
|
|
1007
|
+
return this.localStorageAdaptor.setItem('currentOrgId', orgId);
|
|
1008
|
+
case 19:
|
|
1009
|
+
_context16.next = 23;
|
|
1010
|
+
break;
|
|
1011
|
+
case 21:
|
|
1012
|
+
_context16.prev = 21;
|
|
1013
|
+
_context16.t0 = _context16["catch"](9);
|
|
1014
|
+
case 23:
|
|
1015
|
+
return _context16.abrupt("return", org);
|
|
1016
|
+
case 26:
|
|
1017
|
+
_context16.prev = 26;
|
|
1018
|
+
_context16.t1 = _context16["catch"](0);
|
|
1019
|
+
return _context16.abrupt("return", this._handleError(_context16.t1));
|
|
1020
|
+
case 29:
|
|
1021
|
+
case "end":
|
|
1022
|
+
return _context16.stop();
|
|
1023
|
+
}
|
|
1024
|
+
}, _callee16, this, [[0, 26], [9, 21]]);
|
|
1025
|
+
}));
|
|
1026
|
+
function switchOrganization(_x7) {
|
|
1027
|
+
return _switchOrganization.apply(this, arguments);
|
|
1028
|
+
}
|
|
1029
|
+
return switchOrganization;
|
|
1030
|
+
}()
|
|
1031
|
+
/**
|
|
1032
|
+
* Get current organization (null-safe)
|
|
1033
|
+
* Returns cached organization without triggering a load
|
|
1034
|
+
*
|
|
1035
|
+
* @returns {RbtObject|null} Current organization or null
|
|
1036
|
+
*/
|
|
1037
|
+
)
|
|
1038
|
+
}, {
|
|
1039
|
+
key: "getCurrentOrganization",
|
|
1040
|
+
value: function getCurrentOrganization() {
|
|
1041
|
+
return this.currentOrganization;
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
/**
|
|
1045
|
+
* Select and link an organization to the current user
|
|
1046
|
+
* This adds the organization to the user's organizations array (if not already there)
|
|
1047
|
+
* and sets it as the current organization preference
|
|
1048
|
+
*
|
|
1049
|
+
* @param {string} orgId - Organization ID to select
|
|
1050
|
+
* @param {string} role - Role for the user in this organization (default: 'owner')
|
|
1051
|
+
* @returns {Promise<RbtObject>} The selected organization
|
|
1052
|
+
*/
|
|
1053
|
+
}, {
|
|
1054
|
+
key: "selectCurrentOrganization",
|
|
1055
|
+
value: (function () {
|
|
1056
|
+
var _selectCurrentOrganization = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(orgId) {
|
|
1057
|
+
var role,
|
|
1058
|
+
org,
|
|
1059
|
+
user,
|
|
1060
|
+
userOrgs,
|
|
1061
|
+
orgExists,
|
|
1062
|
+
modData,
|
|
1063
|
+
_args17 = arguments;
|
|
1064
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
1065
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
1066
|
+
case 0:
|
|
1067
|
+
role = _args17.length > 1 && _args17[1] !== undefined ? _args17[1] : 'owner';
|
|
1068
|
+
_context17.prev = 1;
|
|
1069
|
+
if (this.currentUser) {
|
|
1070
|
+
_context17.next = 7;
|
|
1071
|
+
break;
|
|
1072
|
+
}
|
|
1073
|
+
_context17.next = 5;
|
|
1074
|
+
return this.loadCurrentUser();
|
|
1075
|
+
case 5:
|
|
1076
|
+
if (this.currentUser) {
|
|
1077
|
+
_context17.next = 7;
|
|
1078
|
+
break;
|
|
1079
|
+
}
|
|
1080
|
+
throw new Error('Must be logged in to select organization');
|
|
1081
|
+
case 7:
|
|
1082
|
+
_context17.next = 9;
|
|
1083
|
+
return this.get('<@iac.organization>', orgId);
|
|
1084
|
+
case 9:
|
|
1085
|
+
org = _context17.sent;
|
|
1086
|
+
if (org) {
|
|
1087
|
+
_context17.next = 12;
|
|
1088
|
+
break;
|
|
1089
|
+
}
|
|
1090
|
+
throw new Error("Organization ".concat(orgId, " not found or not accessible"));
|
|
1091
|
+
case 12:
|
|
1092
|
+
_context17.next = 14;
|
|
1093
|
+
return this.loadUser(this.currentUser.id);
|
|
1094
|
+
case 14:
|
|
1095
|
+
user = _context17.sent;
|
|
1096
|
+
if (user) {
|
|
1097
|
+
_context17.next = 17;
|
|
1098
|
+
break;
|
|
1099
|
+
}
|
|
1100
|
+
throw new Error('Failed to load user object');
|
|
1101
|
+
case 17:
|
|
1102
|
+
// Update user's organizations array
|
|
1103
|
+
userOrgs = user.get('organizations') || [];
|
|
1104
|
+
orgExists = userOrgs.some(function (o) {
|
|
1105
|
+
return (o === null || o === void 0 ? void 0 : o.id) === orgId;
|
|
1106
|
+
});
|
|
1107
|
+
if (!orgExists) {
|
|
1108
|
+
userOrgs.unshift({
|
|
1109
|
+
id: orgId,
|
|
1110
|
+
roles: [role]
|
|
1111
|
+
});
|
|
1112
|
+
user.set('organizations', userOrgs);
|
|
1113
|
+
} else {}
|
|
1114
|
+
|
|
1115
|
+
// Set as current organization preference - handle both nested path formats
|
|
1116
|
+
modData = user.get('mod') || {};
|
|
1117
|
+
modData.currentOrgId = orgId;
|
|
1118
|
+
user.set('mod', modData);
|
|
1119
|
+
|
|
1120
|
+
// Save user record
|
|
1121
|
+
_context17.next = 25;
|
|
1122
|
+
return user.save();
|
|
1123
|
+
case 25:
|
|
1124
|
+
// Clear cached organization to force reload
|
|
1125
|
+
this.currentOrganization = null;
|
|
1126
|
+
|
|
1127
|
+
// Update the current user reference
|
|
1128
|
+
this.currentUser = user;
|
|
1129
|
+
|
|
1130
|
+
// Set the new current organization
|
|
1131
|
+
this.currentOrganization = org;
|
|
1132
|
+
|
|
1133
|
+
// Update cache
|
|
1134
|
+
if (!this.localStorageAdaptor) {
|
|
1135
|
+
_context17.next = 31;
|
|
1136
|
+
break;
|
|
1137
|
+
}
|
|
1138
|
+
_context17.next = 31;
|
|
1139
|
+
return this.localStorageAdaptor.setItem('currentOrgId', orgId);
|
|
1140
|
+
case 31:
|
|
1141
|
+
return _context17.abrupt("return", org);
|
|
1142
|
+
case 34:
|
|
1143
|
+
_context17.prev = 34;
|
|
1144
|
+
_context17.t0 = _context17["catch"](1);
|
|
1145
|
+
console.error('[RbtApi] Error in selectCurrentOrganization:', _context17.t0);
|
|
1146
|
+
return _context17.abrupt("return", this._handleError(_context17.t0));
|
|
1147
|
+
case 38:
|
|
1148
|
+
case "end":
|
|
1149
|
+
return _context17.stop();
|
|
1150
|
+
}
|
|
1151
|
+
}, _callee17, this, [[1, 34]]);
|
|
1152
|
+
}));
|
|
1153
|
+
function selectCurrentOrganization(_x8) {
|
|
1154
|
+
return _selectCurrentOrganization.apply(this, arguments);
|
|
1155
|
+
}
|
|
1156
|
+
return selectCurrentOrganization;
|
|
1157
|
+
}())
|
|
1158
|
+
}, {
|
|
1159
|
+
key: "loadUser",
|
|
1160
|
+
value: function () {
|
|
1161
|
+
var _loadUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(userId) {
|
|
1162
|
+
var _this5 = this;
|
|
1163
|
+
var params, cacheKey, now, existing, p;
|
|
1164
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
1165
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
820
1166
|
case 0:
|
|
821
1167
|
params = {
|
|
822
1168
|
id: userId
|
|
@@ -825,53 +1171,53 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
825
1171
|
now = Date.now();
|
|
826
1172
|
existing = this.requestCache[cacheKey];
|
|
827
1173
|
if (!(existing && now - existing.time < 10000)) {
|
|
828
|
-
|
|
1174
|
+
_context19.next = 6;
|
|
829
1175
|
break;
|
|
830
1176
|
}
|
|
831
|
-
return
|
|
1177
|
+
return _context19.abrupt("return", existing.val);
|
|
832
1178
|
case 6:
|
|
833
|
-
|
|
834
|
-
p = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1179
|
+
_context19.prev = 6;
|
|
1180
|
+
p = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
|
|
835
1181
|
var _response$data;
|
|
836
1182
|
var response, userData, User;
|
|
837
|
-
return _regeneratorRuntime().wrap(function
|
|
838
|
-
while (1) switch (
|
|
1183
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1184
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
839
1185
|
case 0:
|
|
840
|
-
|
|
841
|
-
return
|
|
1186
|
+
_context18.next = 2;
|
|
1187
|
+
return _this5.axios.post('/user_service/loadUser', [params]);
|
|
842
1188
|
case 2:
|
|
843
|
-
response =
|
|
1189
|
+
response = _context18.sent;
|
|
844
1190
|
userData = response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.user;
|
|
845
1191
|
User = new _rbt_user["default"]({
|
|
846
1192
|
id: userData.id
|
|
847
|
-
},
|
|
1193
|
+
}, _this5.axios);
|
|
848
1194
|
User.setData(userData);
|
|
849
|
-
return
|
|
1195
|
+
return _context18.abrupt("return", User);
|
|
850
1196
|
case 7:
|
|
851
1197
|
case "end":
|
|
852
|
-
return
|
|
1198
|
+
return _context18.stop();
|
|
853
1199
|
}
|
|
854
|
-
},
|
|
1200
|
+
}, _callee18);
|
|
855
1201
|
}))();
|
|
856
1202
|
this.requestCache[cacheKey] = {
|
|
857
1203
|
val: p,
|
|
858
1204
|
time: now
|
|
859
1205
|
};
|
|
860
|
-
|
|
1206
|
+
_context19.next = 11;
|
|
861
1207
|
return p;
|
|
862
1208
|
case 11:
|
|
863
|
-
return
|
|
1209
|
+
return _context19.abrupt("return", _context19.sent);
|
|
864
1210
|
case 14:
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
return
|
|
1211
|
+
_context19.prev = 14;
|
|
1212
|
+
_context19.t0 = _context19["catch"](6);
|
|
1213
|
+
return _context19.abrupt("return", this._handleError(_context19.t0));
|
|
868
1214
|
case 17:
|
|
869
1215
|
case "end":
|
|
870
|
-
return
|
|
1216
|
+
return _context19.stop();
|
|
871
1217
|
}
|
|
872
|
-
},
|
|
1218
|
+
}, _callee19, this, [[6, 14]]);
|
|
873
1219
|
}));
|
|
874
|
-
function loadUser(
|
|
1220
|
+
function loadUser(_x9) {
|
|
875
1221
|
return _loadUser.apply(this, arguments);
|
|
876
1222
|
}
|
|
877
1223
|
return loadUser;
|
|
@@ -879,53 +1225,53 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
879
1225
|
}, {
|
|
880
1226
|
key: "refreshAuthToken",
|
|
881
1227
|
value: function () {
|
|
882
|
-
var _refreshAuthToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1228
|
+
var _refreshAuthToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(authtoken) {
|
|
883
1229
|
var promise, response;
|
|
884
|
-
return _regeneratorRuntime().wrap(function
|
|
885
|
-
while (1) switch (
|
|
1230
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
1231
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
886
1232
|
case 0:
|
|
887
1233
|
if (this.appServiceHost) {
|
|
888
|
-
|
|
1234
|
+
_context20.next = 2;
|
|
889
1235
|
break;
|
|
890
1236
|
}
|
|
891
|
-
return
|
|
1237
|
+
return _context20.abrupt("return", false);
|
|
892
1238
|
case 2:
|
|
893
1239
|
if (!this.requestCache[authtoken]) {
|
|
894
|
-
|
|
1240
|
+
_context20.next = 4;
|
|
895
1241
|
break;
|
|
896
1242
|
}
|
|
897
|
-
return
|
|
1243
|
+
return _context20.abrupt("return", this.requestCache[authtoken]);
|
|
898
1244
|
case 4:
|
|
899
|
-
|
|
1245
|
+
_context20.prev = 4;
|
|
900
1246
|
//console.log('RBTTOK Req', authtoken);
|
|
901
1247
|
// Create a new promise for the token refresh and store it in the cache
|
|
902
1248
|
promise = this.axios.post('/user_service/refreshAuthToken', [authtoken]);
|
|
903
1249
|
this.requestCache[authtoken] = promise;
|
|
904
1250
|
|
|
905
1251
|
// Await the promise to get the response
|
|
906
|
-
|
|
1252
|
+
_context20.next = 9;
|
|
907
1253
|
return promise;
|
|
908
1254
|
case 9:
|
|
909
|
-
response =
|
|
1255
|
+
response = _context20.sent;
|
|
910
1256
|
//console.log('RBTTOK Response ',response);
|
|
911
1257
|
// Once the promise resolves, delete it from the cache to allow future refreshes
|
|
912
1258
|
delete this.requestCache[authtoken];
|
|
913
1259
|
|
|
914
1260
|
// Return the response data
|
|
915
|
-
return
|
|
1261
|
+
return _context20.abrupt("return", response.data);
|
|
916
1262
|
case 14:
|
|
917
|
-
|
|
918
|
-
|
|
1263
|
+
_context20.prev = 14;
|
|
1264
|
+
_context20.t0 = _context20["catch"](4);
|
|
919
1265
|
// On error, remove the cached promise to allow retries
|
|
920
1266
|
delete this.requestCache[authtoken];
|
|
921
|
-
this._handleError(
|
|
1267
|
+
this._handleError(_context20.t0);
|
|
922
1268
|
case 18:
|
|
923
1269
|
case "end":
|
|
924
|
-
return
|
|
1270
|
+
return _context20.stop();
|
|
925
1271
|
}
|
|
926
|
-
},
|
|
1272
|
+
}, _callee20, this, [[4, 14]]);
|
|
927
1273
|
}));
|
|
928
|
-
function refreshAuthToken(
|
|
1274
|
+
function refreshAuthToken(_x10) {
|
|
929
1275
|
return _refreshAuthToken.apply(this, arguments);
|
|
930
1276
|
}
|
|
931
1277
|
return refreshAuthToken;
|
|
@@ -956,31 +1302,31 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
956
1302
|
}, {
|
|
957
1303
|
key: "registerUser",
|
|
958
1304
|
value: function () {
|
|
959
|
-
var _registerUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1305
|
+
var _registerUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
|
|
960
1306
|
var dataHash,
|
|
961
1307
|
response,
|
|
962
1308
|
record,
|
|
963
|
-
|
|
964
|
-
return _regeneratorRuntime().wrap(function
|
|
965
|
-
while (1) switch (
|
|
1309
|
+
_args21 = arguments;
|
|
1310
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
1311
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
966
1312
|
case 0:
|
|
967
|
-
dataHash =
|
|
968
|
-
|
|
969
|
-
|
|
1313
|
+
dataHash = _args21.length > 0 && _args21[0] !== undefined ? _args21[0] : {};
|
|
1314
|
+
_context21.prev = 1;
|
|
1315
|
+
_context21.next = 4;
|
|
970
1316
|
return this.axios.post('/user_service/registerUser', [dataHash]);
|
|
971
1317
|
case 4:
|
|
972
|
-
response =
|
|
1318
|
+
response = _context21.sent;
|
|
973
1319
|
record = response.data;
|
|
974
|
-
return
|
|
1320
|
+
return _context21.abrupt("return", new _rbt_user["default"](record, this.axios));
|
|
975
1321
|
case 9:
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
return
|
|
1322
|
+
_context21.prev = 9;
|
|
1323
|
+
_context21.t0 = _context21["catch"](1);
|
|
1324
|
+
return _context21.abrupt("return", this._handleError(_context21.t0));
|
|
979
1325
|
case 12:
|
|
980
1326
|
case "end":
|
|
981
|
-
return
|
|
1327
|
+
return _context21.stop();
|
|
982
1328
|
}
|
|
983
|
-
},
|
|
1329
|
+
}, _callee21, this, [[1, 9]]);
|
|
984
1330
|
}));
|
|
985
1331
|
function registerUser() {
|
|
986
1332
|
return _registerUser.apply(this, arguments);
|
|
@@ -997,32 +1343,32 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
997
1343
|
}, {
|
|
998
1344
|
key: "createFile",
|
|
999
1345
|
value: (function () {
|
|
1000
|
-
var _createFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1346
|
+
var _createFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(dataHash) {
|
|
1001
1347
|
var response, record;
|
|
1002
|
-
return _regeneratorRuntime().wrap(function
|
|
1003
|
-
while (1) switch (
|
|
1348
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
1349
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
1004
1350
|
case 0:
|
|
1005
|
-
|
|
1006
|
-
|
|
1351
|
+
_context22.prev = 0;
|
|
1352
|
+
_context22.next = 3;
|
|
1007
1353
|
return this.axios.post('/object_service/createObject', ['<@filekit.file>', dataHash]);
|
|
1008
1354
|
case 3:
|
|
1009
|
-
response =
|
|
1355
|
+
response = _context22.sent;
|
|
1010
1356
|
record = response.data;
|
|
1011
1357
|
if (dataHash) {
|
|
1012
1358
|
record.data = dataHash;
|
|
1013
1359
|
}
|
|
1014
|
-
return
|
|
1360
|
+
return _context22.abrupt("return", new _rbt_file["default"](record, this.axios, this.localDb));
|
|
1015
1361
|
case 9:
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
return
|
|
1362
|
+
_context22.prev = 9;
|
|
1363
|
+
_context22.t0 = _context22["catch"](0);
|
|
1364
|
+
return _context22.abrupt("return", this._handleError(_context22.t0));
|
|
1019
1365
|
case 12:
|
|
1020
1366
|
case "end":
|
|
1021
|
-
return
|
|
1367
|
+
return _context22.stop();
|
|
1022
1368
|
}
|
|
1023
|
-
},
|
|
1369
|
+
}, _callee22, this, [[0, 9]]);
|
|
1024
1370
|
}));
|
|
1025
|
-
function createFile(
|
|
1371
|
+
function createFile(_x11) {
|
|
1026
1372
|
return _createFile.apply(this, arguments);
|
|
1027
1373
|
}
|
|
1028
1374
|
return createFile;
|
|
@@ -1030,35 +1376,35 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
1030
1376
|
}, {
|
|
1031
1377
|
key: "loadFile",
|
|
1032
1378
|
value: function () {
|
|
1033
|
-
var _loadFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1379
|
+
var _loadFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(id) {
|
|
1034
1380
|
var response, record;
|
|
1035
|
-
return _regeneratorRuntime().wrap(function
|
|
1036
|
-
while (1) switch (
|
|
1381
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
1382
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
1037
1383
|
case 0:
|
|
1038
|
-
|
|
1039
|
-
|
|
1384
|
+
_context23.prev = 0;
|
|
1385
|
+
_context23.next = 3;
|
|
1040
1386
|
return this.load('<@filekit.file>', id);
|
|
1041
1387
|
case 3:
|
|
1042
|
-
response =
|
|
1388
|
+
response = _context23.sent;
|
|
1043
1389
|
if (response) {
|
|
1044
|
-
|
|
1390
|
+
_context23.next = 6;
|
|
1045
1391
|
break;
|
|
1046
1392
|
}
|
|
1047
|
-
return
|
|
1393
|
+
return _context23.abrupt("return", null);
|
|
1048
1394
|
case 6:
|
|
1049
1395
|
record = response.toRecord();
|
|
1050
|
-
return
|
|
1396
|
+
return _context23.abrupt("return", new _rbt_file["default"](record, this.axios, this.localDb));
|
|
1051
1397
|
case 10:
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
return
|
|
1398
|
+
_context23.prev = 10;
|
|
1399
|
+
_context23.t0 = _context23["catch"](0);
|
|
1400
|
+
return _context23.abrupt("return", this._handleError(_context23.t0));
|
|
1055
1401
|
case 13:
|
|
1056
1402
|
case "end":
|
|
1057
|
-
return
|
|
1403
|
+
return _context23.stop();
|
|
1058
1404
|
}
|
|
1059
|
-
},
|
|
1405
|
+
}, _callee23, this, [[0, 10]]);
|
|
1060
1406
|
}));
|
|
1061
|
-
function loadFile(
|
|
1407
|
+
function loadFile(_x12) {
|
|
1062
1408
|
return _loadFile.apply(this, arguments);
|
|
1063
1409
|
}
|
|
1064
1410
|
return loadFile;
|
|
@@ -1066,39 +1412,39 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
1066
1412
|
}, {
|
|
1067
1413
|
key: "loadFiles",
|
|
1068
1414
|
value: function () {
|
|
1069
|
-
var _loadFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1070
|
-
var
|
|
1415
|
+
var _loadFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(ids) {
|
|
1416
|
+
var _this6 = this;
|
|
1071
1417
|
var responses;
|
|
1072
|
-
return _regeneratorRuntime().wrap(function
|
|
1073
|
-
while (1) switch (
|
|
1418
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
1419
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
1074
1420
|
case 0:
|
|
1075
|
-
|
|
1076
|
-
|
|
1421
|
+
_context24.prev = 0;
|
|
1422
|
+
_context24.next = 3;
|
|
1077
1423
|
return this.load('<@filekit.file>', ids);
|
|
1078
1424
|
case 3:
|
|
1079
|
-
responses =
|
|
1425
|
+
responses = _context24.sent;
|
|
1080
1426
|
if (!(!responses || !Array.isArray(responses))) {
|
|
1081
|
-
|
|
1427
|
+
_context24.next = 6;
|
|
1082
1428
|
break;
|
|
1083
1429
|
}
|
|
1084
|
-
return
|
|
1430
|
+
return _context24.abrupt("return", []);
|
|
1085
1431
|
case 6:
|
|
1086
|
-
return
|
|
1432
|
+
return _context24.abrupt("return", responses.map(function (response) {
|
|
1087
1433
|
var record = response.toRecord();
|
|
1088
|
-
return new _rbt_file["default"](record,
|
|
1434
|
+
return new _rbt_file["default"](record, _this6.axios, _this6.localDb);
|
|
1089
1435
|
}));
|
|
1090
1436
|
case 9:
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
this._handleError(
|
|
1094
|
-
return
|
|
1437
|
+
_context24.prev = 9;
|
|
1438
|
+
_context24.t0 = _context24["catch"](0);
|
|
1439
|
+
this._handleError(_context24.t0); // Handle errors (log or process as needed)
|
|
1440
|
+
return _context24.abrupt("return", []);
|
|
1095
1441
|
case 13:
|
|
1096
1442
|
case "end":
|
|
1097
|
-
return
|
|
1443
|
+
return _context24.stop();
|
|
1098
1444
|
}
|
|
1099
|
-
},
|
|
1445
|
+
}, _callee24, this, [[0, 9]]);
|
|
1100
1446
|
}));
|
|
1101
|
-
function loadFiles(
|
|
1447
|
+
function loadFiles(_x13) {
|
|
1102
1448
|
return _loadFiles.apply(this, arguments);
|
|
1103
1449
|
}
|
|
1104
1450
|
return loadFiles;
|
|
@@ -1114,42 +1460,42 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
1114
1460
|
}, {
|
|
1115
1461
|
key: "create",
|
|
1116
1462
|
value: (function () {
|
|
1117
|
-
var _create = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1463
|
+
var _create = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(type) {
|
|
1118
1464
|
var dataHash,
|
|
1119
1465
|
options,
|
|
1120
1466
|
response,
|
|
1121
1467
|
record,
|
|
1122
|
-
|
|
1123
|
-
return _regeneratorRuntime().wrap(function
|
|
1124
|
-
while (1) switch (
|
|
1468
|
+
_args25 = arguments;
|
|
1469
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
1470
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
1125
1471
|
case 0:
|
|
1126
|
-
dataHash =
|
|
1127
|
-
options =
|
|
1128
|
-
|
|
1129
|
-
|
|
1472
|
+
dataHash = _args25.length > 1 && _args25[1] !== undefined ? _args25[1] : {};
|
|
1473
|
+
options = _args25.length > 2 && _args25[2] !== undefined ? _args25[2] : {};
|
|
1474
|
+
_context25.prev = 2;
|
|
1475
|
+
_context25.next = 5;
|
|
1130
1476
|
return this.axios.post('/object_service/createObject', [type, dataHash]);
|
|
1131
1477
|
case 5:
|
|
1132
|
-
response =
|
|
1478
|
+
response = _context25.sent;
|
|
1133
1479
|
record = response.data;
|
|
1134
1480
|
if (dataHash) {
|
|
1135
1481
|
record.data = dataHash;
|
|
1136
1482
|
}
|
|
1137
|
-
return
|
|
1483
|
+
return _context25.abrupt("return", new _rbt_object["default"](record, this.axios, {
|
|
1138
1484
|
isNew: true,
|
|
1139
1485
|
websocketClient: this.websocketClient,
|
|
1140
1486
|
enableRealtime: options.enableRealtime || false
|
|
1141
1487
|
}));
|
|
1142
1488
|
case 11:
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
return
|
|
1489
|
+
_context25.prev = 11;
|
|
1490
|
+
_context25.t0 = _context25["catch"](2);
|
|
1491
|
+
return _context25.abrupt("return", this._handleError(_context25.t0));
|
|
1146
1492
|
case 14:
|
|
1147
1493
|
case "end":
|
|
1148
|
-
return
|
|
1494
|
+
return _context25.stop();
|
|
1149
1495
|
}
|
|
1150
|
-
},
|
|
1496
|
+
}, _callee25, this, [[2, 11]]);
|
|
1151
1497
|
}));
|
|
1152
|
-
function create(
|
|
1498
|
+
function create(_x14) {
|
|
1153
1499
|
return _create.apply(this, arguments);
|
|
1154
1500
|
}
|
|
1155
1501
|
return create;
|
|
@@ -1192,8 +1538,8 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
1192
1538
|
}, {
|
|
1193
1539
|
key: "query",
|
|
1194
1540
|
value: (function () {
|
|
1195
|
-
var _query = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1196
|
-
var
|
|
1541
|
+
var _query = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(type) {
|
|
1542
|
+
var _this7 = this;
|
|
1197
1543
|
var params,
|
|
1198
1544
|
paramsKey,
|
|
1199
1545
|
validParams,
|
|
@@ -1205,12 +1551,12 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
1205
1551
|
cacheEntry,
|
|
1206
1552
|
responsePromise,
|
|
1207
1553
|
processingPromise,
|
|
1208
|
-
|
|
1209
|
-
return _regeneratorRuntime().wrap(function
|
|
1210
|
-
while (1) switch (
|
|
1554
|
+
_args26 = arguments;
|
|
1555
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
1556
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
1211
1557
|
case 0:
|
|
1212
|
-
params =
|
|
1213
|
-
|
|
1558
|
+
params = _args26.length > 1 && _args26[1] !== undefined ? _args26[1] : {};
|
|
1559
|
+
_context26.prev = 1;
|
|
1214
1560
|
//console.log('RBTAPI.query INIT', type, params);
|
|
1215
1561
|
// Validate parameters - reject invalid parameter names
|
|
1216
1562
|
validParams = ['type', 'where', 'orderBy', 'limit', 'resolveReferences', 'requestAttrs', 'excludeAttrs', 'timeout', 'enableRealtime'];
|
|
@@ -1218,7 +1564,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
1218
1564
|
return !validParams.includes(key);
|
|
1219
1565
|
});
|
|
1220
1566
|
if (!(invalidParams.length > 0)) {
|
|
1221
|
-
|
|
1567
|
+
_context26.next = 6;
|
|
1222
1568
|
break;
|
|
1223
1569
|
}
|
|
1224
1570
|
throw new Error("Invalid query parameter(s): ".concat(invalidParams.join(', '), ". Valid parameters are: ").concat(validParams.join(', ')));
|
|
@@ -1245,19 +1591,19 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
1245
1591
|
paramsKey = JSON.stringify(mergedParams);
|
|
1246
1592
|
cacheEntry = this.requestCache[paramsKey];
|
|
1247
1593
|
if (!(cacheEntry && currentTime - cacheEntry.time < 10000)) {
|
|
1248
|
-
|
|
1594
|
+
_context26.next = 16;
|
|
1249
1595
|
break;
|
|
1250
1596
|
}
|
|
1251
|
-
return
|
|
1597
|
+
return _context26.abrupt("return", cacheEntry.val);
|
|
1252
1598
|
case 16:
|
|
1253
1599
|
// Create the response promise
|
|
1254
1600
|
responsePromise = this.axios.post('/object_service/queryObjects', [mergedParams]); // Cache the promise of processing data, not just the raw response
|
|
1255
1601
|
processingPromise = responsePromise.then(function (response) {
|
|
1256
|
-
return
|
|
1602
|
+
return _this7._processResponseData(response, params);
|
|
1257
1603
|
})["catch"](function (e) {
|
|
1258
|
-
delete
|
|
1604
|
+
delete _this7.requestCache[paramsKey]; // Ensure cache cleanup on failure
|
|
1259
1605
|
//console.log('RBTAPI.query ERROR (Processing)', paramsKey, e);
|
|
1260
|
-
return
|
|
1606
|
+
return _this7._handleError(e);
|
|
1261
1607
|
}); // Store the promise of the processed data in the cache
|
|
1262
1608
|
this.requestCache[paramsKey] = {
|
|
1263
1609
|
val: processingPromise,
|
|
@@ -1265,23 +1611,23 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
1265
1611
|
};
|
|
1266
1612
|
|
|
1267
1613
|
// Await the processing promise for this call to get processed data
|
|
1268
|
-
|
|
1614
|
+
_context26.next = 21;
|
|
1269
1615
|
return processingPromise;
|
|
1270
1616
|
case 21:
|
|
1271
|
-
return
|
|
1617
|
+
return _context26.abrupt("return", _context26.sent);
|
|
1272
1618
|
case 24:
|
|
1273
|
-
|
|
1274
|
-
|
|
1619
|
+
_context26.prev = 24;
|
|
1620
|
+
_context26.t0 = _context26["catch"](1);
|
|
1275
1621
|
delete this.requestCache[paramsKey]; // Ensure cache cleanup on error
|
|
1276
1622
|
//console.log('RBTAPI.query ERROR', paramsKey, e);
|
|
1277
|
-
return
|
|
1623
|
+
return _context26.abrupt("return", this._handleError(_context26.t0));
|
|
1278
1624
|
case 28:
|
|
1279
1625
|
case "end":
|
|
1280
|
-
return
|
|
1626
|
+
return _context26.stop();
|
|
1281
1627
|
}
|
|
1282
|
-
},
|
|
1628
|
+
}, _callee26, this, [[1, 24]]);
|
|
1283
1629
|
}));
|
|
1284
|
-
function query(
|
|
1630
|
+
function query(_x15) {
|
|
1285
1631
|
return _query.apply(this, arguments);
|
|
1286
1632
|
}
|
|
1287
1633
|
return query;
|
|
@@ -1289,7 +1635,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
1289
1635
|
}, {
|
|
1290
1636
|
key: "_processResponseData",
|
|
1291
1637
|
value: function _processResponseData(response) {
|
|
1292
|
-
var
|
|
1638
|
+
var _this8 = this;
|
|
1293
1639
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1294
1640
|
if (response.data.ok === false) {
|
|
1295
1641
|
return this._handleError(response);
|
|
@@ -1303,7 +1649,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
1303
1649
|
websocketClient = this.getWebSocketClient();
|
|
1304
1650
|
}
|
|
1305
1651
|
response.data.items = response.data.items.map(function (record) {
|
|
1306
|
-
return new _rbt_object["default"](record,
|
|
1652
|
+
return new _rbt_object["default"](record, _this8.axios, {
|
|
1307
1653
|
websocketClient: websocketClient,
|
|
1308
1654
|
enableRealtime: options.enableRealtime || false
|
|
1309
1655
|
});
|
|
@@ -1325,8 +1671,8 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
1325
1671
|
}, {
|
|
1326
1672
|
key: "load",
|
|
1327
1673
|
value: (function () {
|
|
1328
|
-
var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1329
|
-
var
|
|
1674
|
+
var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(type, ids) {
|
|
1675
|
+
var _this9 = this;
|
|
1330
1676
|
var params,
|
|
1331
1677
|
mergedParams,
|
|
1332
1678
|
cachedObjects,
|
|
@@ -1358,17 +1704,17 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
1358
1704
|
pendingKey,
|
|
1359
1705
|
missLogKey,
|
|
1360
1706
|
loadPromise,
|
|
1361
|
-
|
|
1362
|
-
return _regeneratorRuntime().wrap(function
|
|
1363
|
-
while (1) switch (
|
|
1707
|
+
_args28 = arguments;
|
|
1708
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
1709
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
1364
1710
|
case 0:
|
|
1365
|
-
params =
|
|
1711
|
+
params = _args28.length > 2 && _args28[2] !== undefined ? _args28[2] : {};
|
|
1366
1712
|
if (type == '<@iac.user>') {
|
|
1367
1713
|
debugger;
|
|
1368
1714
|
}
|
|
1369
|
-
|
|
1715
|
+
_context28.prev = 2;
|
|
1370
1716
|
if (!Array.isArray(ids)) {
|
|
1371
|
-
|
|
1717
|
+
_context28.next = 25;
|
|
1372
1718
|
break;
|
|
1373
1719
|
}
|
|
1374
1720
|
// For array requests, check cache for each ID and only load missing ones
|
|
@@ -1405,7 +1751,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
1405
1751
|
}
|
|
1406
1752
|
loadedObjects = [];
|
|
1407
1753
|
if (!(missingIds.length > 0)) {
|
|
1408
|
-
|
|
1754
|
+
_context28.next = 19;
|
|
1409
1755
|
break;
|
|
1410
1756
|
}
|
|
1411
1757
|
// Only log bulk cache miss once
|
|
@@ -1419,10 +1765,10 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
1419
1765
|
mergedParams = _objectSpread(_objectSpread({}, queryParams), {}, {
|
|
1420
1766
|
where: "id IN (\"".concat(missingIds.join("\",\""), "\")")
|
|
1421
1767
|
});
|
|
1422
|
-
|
|
1768
|
+
_context28.next = 16;
|
|
1423
1769
|
return this.query(type, mergedParams);
|
|
1424
1770
|
case 16:
|
|
1425
|
-
loadedObjects =
|
|
1771
|
+
loadedObjects = _context28.sent;
|
|
1426
1772
|
// Cache the newly loaded objects
|
|
1427
1773
|
_iterator4 = _createForOfIteratorHelper(loadedObjects);
|
|
1428
1774
|
try {
|
|
@@ -1464,13 +1810,13 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
1464
1810
|
} finally {
|
|
1465
1811
|
_iterator5.f();
|
|
1466
1812
|
}
|
|
1467
|
-
return
|
|
1813
|
+
return _context28.abrupt("return", result);
|
|
1468
1814
|
case 25:
|
|
1469
1815
|
// For single object requests, check cache first
|
|
1470
1816
|
_cacheKey3 = "".concat(type, ":").concat(ids);
|
|
1471
1817
|
_cached = this._objectCache.get(_cacheKey3);
|
|
1472
1818
|
if (!_cached) {
|
|
1473
|
-
|
|
1819
|
+
_context28.next = 32;
|
|
1474
1820
|
break;
|
|
1475
1821
|
}
|
|
1476
1822
|
// Only log cache hits once per object to reduce spam
|
|
@@ -1483,18 +1829,18 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
1483
1829
|
if (params.enableRealtime && !_cached._realtime) {
|
|
1484
1830
|
_cached._initRealtime();
|
|
1485
1831
|
}
|
|
1486
|
-
return
|
|
1832
|
+
return _context28.abrupt("return", _cached);
|
|
1487
1833
|
case 32:
|
|
1488
1834
|
// Check if we're already loading this object
|
|
1489
1835
|
pendingKey = "".concat(type, ":").concat(ids);
|
|
1490
1836
|
if (!this._pendingLoads.has(pendingKey)) {
|
|
1491
|
-
|
|
1837
|
+
_context28.next = 37;
|
|
1492
1838
|
break;
|
|
1493
1839
|
}
|
|
1494
|
-
|
|
1840
|
+
_context28.next = 36;
|
|
1495
1841
|
return this._pendingLoads.get(pendingKey);
|
|
1496
1842
|
case 36:
|
|
1497
|
-
return
|
|
1843
|
+
return _context28.abrupt("return", _context28.sent);
|
|
1498
1844
|
case 37:
|
|
1499
1845
|
// Only log cache miss once per object to reduce spam
|
|
1500
1846
|
missLogKey = "miss:".concat(_cacheKey3);
|
|
@@ -1503,63 +1849,63 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
1503
1849
|
}
|
|
1504
1850
|
|
|
1505
1851
|
// Create the loading promise and store it to prevent duplicate requests
|
|
1506
|
-
loadPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1852
|
+
loadPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
|
|
1507
1853
|
var _enableRealtime, _queryParams, res, _obj2, _setLogKey;
|
|
1508
|
-
return _regeneratorRuntime().wrap(function
|
|
1509
|
-
while (1) switch (
|
|
1854
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
1855
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
1510
1856
|
case 0:
|
|
1511
|
-
|
|
1857
|
+
_context27.prev = 0;
|
|
1512
1858
|
// Remove load-specific params that shouldn't be passed to query
|
|
1513
1859
|
_enableRealtime = params.enableRealtime, _queryParams = _objectWithoutProperties(params, _excluded2);
|
|
1514
1860
|
mergedParams = _objectSpread(_objectSpread({}, _queryParams), {}, {
|
|
1515
1861
|
where: "id=\"".concat(ids, "\"")
|
|
1516
1862
|
});
|
|
1517
|
-
|
|
1518
|
-
return
|
|
1863
|
+
_context27.next = 5;
|
|
1864
|
+
return _this9.query(type, mergedParams);
|
|
1519
1865
|
case 5:
|
|
1520
|
-
res =
|
|
1866
|
+
res = _context27.sent;
|
|
1521
1867
|
_obj2 = res[0];
|
|
1522
1868
|
if (_obj2) {
|
|
1523
1869
|
// Cache the loaded object
|
|
1524
|
-
|
|
1870
|
+
_this9._objectCache.set(_cacheKey3, _obj2);
|
|
1525
1871
|
|
|
1526
1872
|
// Only log cache set once per object to reduce spam
|
|
1527
1873
|
_setLogKey = "set:".concat(_cacheKey3);
|
|
1528
|
-
if (!
|
|
1529
|
-
|
|
1874
|
+
if (!_this9._loggedCacheEvents.has(_setLogKey)) {
|
|
1875
|
+
_this9._loggedCacheEvents.add(_setLogKey);
|
|
1530
1876
|
}
|
|
1531
1877
|
}
|
|
1532
|
-
return
|
|
1878
|
+
return _context27.abrupt("return", _obj2);
|
|
1533
1879
|
case 9:
|
|
1534
|
-
|
|
1880
|
+
_context27.prev = 9;
|
|
1535
1881
|
// Remove from pending loads
|
|
1536
|
-
|
|
1537
|
-
return
|
|
1882
|
+
_this9._pendingLoads["delete"](pendingKey);
|
|
1883
|
+
return _context27.finish(9);
|
|
1538
1884
|
case 12:
|
|
1539
1885
|
case "end":
|
|
1540
|
-
return
|
|
1886
|
+
return _context27.stop();
|
|
1541
1887
|
}
|
|
1542
|
-
},
|
|
1888
|
+
}, _callee27, null, [[0,, 9, 12]]);
|
|
1543
1889
|
}))(); // Store the promise so other concurrent requests can await it
|
|
1544
1890
|
this._pendingLoads.set(pendingKey, loadPromise);
|
|
1545
|
-
|
|
1891
|
+
_context28.next = 43;
|
|
1546
1892
|
return loadPromise;
|
|
1547
1893
|
case 43:
|
|
1548
|
-
return
|
|
1894
|
+
return _context28.abrupt("return", _context28.sent);
|
|
1549
1895
|
case 44:
|
|
1550
|
-
|
|
1896
|
+
_context28.next = 49;
|
|
1551
1897
|
break;
|
|
1552
1898
|
case 46:
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
return
|
|
1899
|
+
_context28.prev = 46;
|
|
1900
|
+
_context28.t0 = _context28["catch"](2);
|
|
1901
|
+
return _context28.abrupt("return", this._handleError(_context28.t0));
|
|
1556
1902
|
case 49:
|
|
1557
1903
|
case "end":
|
|
1558
|
-
return
|
|
1904
|
+
return _context28.stop();
|
|
1559
1905
|
}
|
|
1560
|
-
},
|
|
1906
|
+
}, _callee28, this, [[2, 46]]);
|
|
1561
1907
|
}));
|
|
1562
|
-
function load(
|
|
1908
|
+
function load(_x16, _x17) {
|
|
1563
1909
|
return _load.apply(this, arguments);
|
|
1564
1910
|
}
|
|
1565
1911
|
return load;
|
|
@@ -1635,11 +1981,11 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
1635
1981
|
}, {
|
|
1636
1982
|
key: "getCacheStatus",
|
|
1637
1983
|
value: function getCacheStatus() {
|
|
1638
|
-
var cacheEntries = Array.from(this._objectCache.entries()).map(function (
|
|
1984
|
+
var cacheEntries = Array.from(this._objectCache.entries()).map(function (_ref7) {
|
|
1639
1985
|
var _obj$_internalData;
|
|
1640
|
-
var
|
|
1641
|
-
key =
|
|
1642
|
-
obj =
|
|
1986
|
+
var _ref8 = _slicedToArray(_ref7, 2),
|
|
1987
|
+
key = _ref8[0],
|
|
1988
|
+
obj = _ref8[1];
|
|
1643
1989
|
return {
|
|
1644
1990
|
key: key,
|
|
1645
1991
|
id: obj.id,
|
|
@@ -1677,7 +2023,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
1677
2023
|
}, {
|
|
1678
2024
|
key: "runTask",
|
|
1679
2025
|
value: (function () {
|
|
1680
|
-
var _runTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2026
|
+
var _runTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
|
|
1681
2027
|
var params,
|
|
1682
2028
|
callbacks,
|
|
1683
2029
|
onProgress,
|
|
@@ -1692,20 +2038,20 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
1692
2038
|
message,
|
|
1693
2039
|
output,
|
|
1694
2040
|
errorResponse,
|
|
1695
|
-
|
|
1696
|
-
return _regeneratorRuntime().wrap(function
|
|
1697
|
-
while (1) switch (
|
|
2041
|
+
_args29 = arguments;
|
|
2042
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
2043
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
1698
2044
|
case 0:
|
|
1699
|
-
params =
|
|
1700
|
-
callbacks =
|
|
2045
|
+
params = _args29.length > 0 && _args29[0] !== undefined ? _args29[0] : {};
|
|
2046
|
+
callbacks = _args29.length > 1 && _args29[1] !== undefined ? _args29[1] : {};
|
|
1701
2047
|
onProgress = callbacks.onProgress, onError = callbacks.onError, onStopped = callbacks.onStopped, onWaiting = callbacks.onWaiting, onDone = callbacks.onDone;
|
|
1702
|
-
|
|
1703
|
-
|
|
2048
|
+
_context29.prev = 3;
|
|
2049
|
+
_context29.next = 6;
|
|
1704
2050
|
return this.post('/task_service/runChain', params);
|
|
1705
2051
|
case 6:
|
|
1706
|
-
response =
|
|
2052
|
+
response = _context29.sent;
|
|
1707
2053
|
if (response) {
|
|
1708
|
-
|
|
2054
|
+
_context29.next = 9;
|
|
1709
2055
|
break;
|
|
1710
2056
|
}
|
|
1711
2057
|
throw new Error('Invalid server response');
|
|
@@ -1713,7 +2059,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
1713
2059
|
// Validate response structure
|
|
1714
2060
|
ok = response.ok, jobId = response.jobId, status = response.status, message = response.message, output = response.output;
|
|
1715
2061
|
if (!(!ok || typeof jobId !== 'string' || typeof status !== 'string')) {
|
|
1716
|
-
|
|
2062
|
+
_context29.next = 12;
|
|
1717
2063
|
break;
|
|
1718
2064
|
}
|
|
1719
2065
|
throw new Error('Invalid response structure');
|
|
@@ -1739,7 +2085,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
1739
2085
|
//console.log('Finish (request) ',response); s
|
|
1740
2086
|
onDone(response);
|
|
1741
2087
|
}
|
|
1742
|
-
return
|
|
2088
|
+
return _context29.abrupt("return", {
|
|
1743
2089
|
ok: ok,
|
|
1744
2090
|
jobId: jobId,
|
|
1745
2091
|
status: status,
|
|
@@ -1747,21 +2093,21 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
1747
2093
|
output: output
|
|
1748
2094
|
});
|
|
1749
2095
|
case 20:
|
|
1750
|
-
|
|
1751
|
-
|
|
2096
|
+
_context29.prev = 20;
|
|
2097
|
+
_context29.t0 = _context29["catch"](3);
|
|
1752
2098
|
// Standardize error format to match task response object
|
|
1753
2099
|
// Support RbtError format with label and message
|
|
1754
2100
|
errorResponse = {
|
|
1755
2101
|
ok: false,
|
|
1756
2102
|
jobId: null,
|
|
1757
2103
|
status: 'ERROR',
|
|
1758
|
-
message:
|
|
1759
|
-
label:
|
|
2104
|
+
message: _context29.t0.message || _context29.t0.toString() || 'Unknown error',
|
|
2105
|
+
label: _context29.t0.label || _context29.t0.name || 'Error',
|
|
1760
2106
|
output: {
|
|
1761
|
-
error:
|
|
1762
|
-
label:
|
|
1763
|
-
stack:
|
|
1764
|
-
originalError:
|
|
2107
|
+
error: _context29.t0.message,
|
|
2108
|
+
label: _context29.t0.label,
|
|
2109
|
+
stack: _context29.t0.stack,
|
|
2110
|
+
originalError: _context29.t0
|
|
1765
2111
|
}
|
|
1766
2112
|
};
|
|
1767
2113
|
if (typeof onError === 'function') {
|
|
@@ -1769,12 +2115,12 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
1769
2115
|
} else {
|
|
1770
2116
|
console.error('Error in runTask:', errorResponse.message);
|
|
1771
2117
|
}
|
|
1772
|
-
return
|
|
2118
|
+
return _context29.abrupt("return", errorResponse);
|
|
1773
2119
|
case 25:
|
|
1774
2120
|
case "end":
|
|
1775
|
-
return
|
|
2121
|
+
return _context29.stop();
|
|
1776
2122
|
}
|
|
1777
|
-
},
|
|
2123
|
+
}, _callee29, this, [[3, 20]]);
|
|
1778
2124
|
}));
|
|
1779
2125
|
function runTask() {
|
|
1780
2126
|
return _runTask.apply(this, arguments);
|
|
@@ -1784,37 +2130,37 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
1784
2130
|
}, {
|
|
1785
2131
|
key: "stopJob",
|
|
1786
2132
|
value: function () {
|
|
1787
|
-
var _stopJob = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2133
|
+
var _stopJob = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
|
|
1788
2134
|
var params,
|
|
1789
2135
|
callbacks,
|
|
1790
2136
|
response,
|
|
1791
|
-
|
|
1792
|
-
return _regeneratorRuntime().wrap(function
|
|
1793
|
-
while (1) switch (
|
|
2137
|
+
_args30 = arguments;
|
|
2138
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
2139
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
1794
2140
|
case 0:
|
|
1795
|
-
params =
|
|
1796
|
-
callbacks =
|
|
1797
|
-
|
|
1798
|
-
|
|
2141
|
+
params = _args30.length > 0 && _args30[0] !== undefined ? _args30[0] : {};
|
|
2142
|
+
callbacks = _args30.length > 1 && _args30[1] !== undefined ? _args30[1] : {};
|
|
2143
|
+
_context30.prev = 2;
|
|
2144
|
+
_context30.next = 5;
|
|
1799
2145
|
return this.post('/task_service/stopJob', params);
|
|
1800
2146
|
case 5:
|
|
1801
|
-
response =
|
|
2147
|
+
response = _context30.sent;
|
|
1802
2148
|
if (response) {
|
|
1803
|
-
|
|
2149
|
+
_context30.next = 8;
|
|
1804
2150
|
break;
|
|
1805
2151
|
}
|
|
1806
2152
|
throw new Error('Invalid server response');
|
|
1807
2153
|
case 8:
|
|
1808
|
-
return
|
|
2154
|
+
return _context30.abrupt("return", true);
|
|
1809
2155
|
case 11:
|
|
1810
|
-
|
|
1811
|
-
|
|
2156
|
+
_context30.prev = 11;
|
|
2157
|
+
_context30.t0 = _context30["catch"](2);
|
|
1812
2158
|
throw 'Error in stopJob';
|
|
1813
2159
|
case 14:
|
|
1814
2160
|
case "end":
|
|
1815
|
-
return
|
|
2161
|
+
return _context30.stop();
|
|
1816
2162
|
}
|
|
1817
|
-
},
|
|
2163
|
+
}, _callee30, this, [[2, 11]]);
|
|
1818
2164
|
}));
|
|
1819
2165
|
function stopJob() {
|
|
1820
2166
|
return _stopJob.apply(this, arguments);
|
|
@@ -1862,26 +2208,26 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
1862
2208
|
}, {
|
|
1863
2209
|
key: "pollTaskProgress",
|
|
1864
2210
|
value: (function () {
|
|
1865
|
-
var _pollTaskProgress = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1866
|
-
var
|
|
2211
|
+
var _pollTaskProgress = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(jobId, callbacks) {
|
|
2212
|
+
var _this10 = this;
|
|
1867
2213
|
var onProgress, onError, onStopped, onWaiting, onDone, _callbacks$pollingInt, pollingInterval, checkProgress;
|
|
1868
|
-
return _regeneratorRuntime().wrap(function
|
|
1869
|
-
while (1) switch (
|
|
2214
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
2215
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
1870
2216
|
case 0:
|
|
1871
2217
|
onProgress = callbacks.onProgress, onError = callbacks.onError, onStopped = callbacks.onStopped, onWaiting = callbacks.onWaiting, onDone = callbacks.onDone, _callbacks$pollingInt = callbacks.pollingInterval, pollingInterval = _callbacks$pollingInt === void 0 ? 2000 : _callbacks$pollingInt;
|
|
1872
|
-
|
|
2218
|
+
_context32.prev = 1;
|
|
1873
2219
|
checkProgress = /*#__PURE__*/function () {
|
|
1874
|
-
var
|
|
2220
|
+
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
|
|
1875
2221
|
var response;
|
|
1876
|
-
return _regeneratorRuntime().wrap(function
|
|
1877
|
-
while (1) switch (
|
|
2222
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
2223
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
1878
2224
|
case 0:
|
|
1879
|
-
|
|
1880
|
-
return
|
|
2225
|
+
_context31.next = 2;
|
|
2226
|
+
return _this10.get("/task_service/pollChainProgress", {
|
|
1881
2227
|
jobId: jobId
|
|
1882
2228
|
});
|
|
1883
2229
|
case 2:
|
|
1884
|
-
response =
|
|
2230
|
+
response = _context31.sent;
|
|
1885
2231
|
// If the task is still in progress, start polling for updates
|
|
1886
2232
|
if (response.status === 'DONE' && onDone) {
|
|
1887
2233
|
// Provide the current progress to the callback function
|
|
@@ -1890,7 +2236,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
1890
2236
|
}
|
|
1891
2237
|
if (response.status === 'ERROR' && onError) {
|
|
1892
2238
|
// Normalize error response to have consistent message/label at top level
|
|
1893
|
-
onError(
|
|
2239
|
+
onError(_this10._normalizeErrorResponse(response));
|
|
1894
2240
|
}
|
|
1895
2241
|
if (response.status === 'STOPPED' && onStopped) {
|
|
1896
2242
|
// Provide the current progress to the callback function
|
|
@@ -1912,28 +2258,28 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
1912
2258
|
}
|
|
1913
2259
|
case 9:
|
|
1914
2260
|
case "end":
|
|
1915
|
-
return
|
|
2261
|
+
return _context31.stop();
|
|
1916
2262
|
}
|
|
1917
|
-
},
|
|
2263
|
+
}, _callee31);
|
|
1918
2264
|
}));
|
|
1919
2265
|
return function checkProgress() {
|
|
1920
|
-
return
|
|
2266
|
+
return _ref9.apply(this, arguments);
|
|
1921
2267
|
};
|
|
1922
2268
|
}();
|
|
1923
2269
|
checkProgress();
|
|
1924
|
-
|
|
2270
|
+
_context32.next = 9;
|
|
1925
2271
|
break;
|
|
1926
2272
|
case 6:
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
return
|
|
2273
|
+
_context32.prev = 6;
|
|
2274
|
+
_context32.t0 = _context32["catch"](1);
|
|
2275
|
+
return _context32.abrupt("return", this._handleError(_context32.t0));
|
|
1930
2276
|
case 9:
|
|
1931
2277
|
case "end":
|
|
1932
|
-
return
|
|
2278
|
+
return _context32.stop();
|
|
1933
2279
|
}
|
|
1934
|
-
},
|
|
2280
|
+
}, _callee32, this, [[1, 6]]);
|
|
1935
2281
|
}));
|
|
1936
|
-
function pollTaskProgress(
|
|
2282
|
+
function pollTaskProgress(_x18, _x19) {
|
|
1937
2283
|
return _pollTaskProgress.apply(this, arguments);
|
|
1938
2284
|
}
|
|
1939
2285
|
return pollTaskProgress;
|
|
@@ -1954,18 +2300,18 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
1954
2300
|
}, {
|
|
1955
2301
|
key: "get",
|
|
1956
2302
|
value: (function () {
|
|
1957
|
-
var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2303
|
+
var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(endpoint) {
|
|
1958
2304
|
var params,
|
|
1959
2305
|
customHeaders,
|
|
1960
2306
|
config,
|
|
1961
2307
|
response,
|
|
1962
|
-
|
|
1963
|
-
return _regeneratorRuntime().wrap(function
|
|
1964
|
-
while (1) switch (
|
|
2308
|
+
_args33 = arguments;
|
|
2309
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
2310
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
1965
2311
|
case 0:
|
|
1966
|
-
params =
|
|
1967
|
-
customHeaders =
|
|
1968
|
-
|
|
2312
|
+
params = _args33.length > 1 && _args33[1] !== undefined ? _args33[1] : {};
|
|
2313
|
+
customHeaders = _args33.length > 2 && _args33[2] !== undefined ? _args33[2] : null;
|
|
2314
|
+
_context33.prev = 2;
|
|
1969
2315
|
// Build request config
|
|
1970
2316
|
config = {
|
|
1971
2317
|
params: params
|
|
@@ -1980,28 +2326,28 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
1980
2326
|
// Otherwise, don't set config.headers at all - let axios use its defaults
|
|
1981
2327
|
|
|
1982
2328
|
// Make the GET request using Axios
|
|
1983
|
-
|
|
2329
|
+
_context33.next = 7;
|
|
1984
2330
|
return this.axios.get(endpoint, config);
|
|
1985
2331
|
case 7:
|
|
1986
|
-
response =
|
|
2332
|
+
response = _context33.sent;
|
|
1987
2333
|
if (!(response.data.ok === false)) {
|
|
1988
|
-
|
|
2334
|
+
_context33.next = 10;
|
|
1989
2335
|
break;
|
|
1990
2336
|
}
|
|
1991
|
-
return
|
|
2337
|
+
return _context33.abrupt("return", this._handleError(response));
|
|
1992
2338
|
case 10:
|
|
1993
|
-
return
|
|
2339
|
+
return _context33.abrupt("return", response.data);
|
|
1994
2340
|
case 13:
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
return
|
|
2341
|
+
_context33.prev = 13;
|
|
2342
|
+
_context33.t0 = _context33["catch"](2);
|
|
2343
|
+
return _context33.abrupt("return", this._handleError(_context33.t0));
|
|
1998
2344
|
case 16:
|
|
1999
2345
|
case "end":
|
|
2000
|
-
return
|
|
2346
|
+
return _context33.stop();
|
|
2001
2347
|
}
|
|
2002
|
-
},
|
|
2348
|
+
}, _callee33, this, [[2, 13]]);
|
|
2003
2349
|
}));
|
|
2004
|
-
function get(
|
|
2350
|
+
function get(_x20) {
|
|
2005
2351
|
return _get.apply(this, arguments);
|
|
2006
2352
|
}
|
|
2007
2353
|
return get;
|
|
@@ -2022,44 +2368,44 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
2022
2368
|
}, {
|
|
2023
2369
|
key: "post",
|
|
2024
2370
|
value: (function () {
|
|
2025
|
-
var _post = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2371
|
+
var _post = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(endpoint) {
|
|
2026
2372
|
var data,
|
|
2027
2373
|
headers,
|
|
2028
2374
|
response,
|
|
2029
|
-
|
|
2030
|
-
return _regeneratorRuntime().wrap(function
|
|
2031
|
-
while (1) switch (
|
|
2375
|
+
_args34 = arguments;
|
|
2376
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
2377
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
2032
2378
|
case 0:
|
|
2033
|
-
data =
|
|
2034
|
-
|
|
2379
|
+
data = _args34.length > 1 && _args34[1] !== undefined ? _args34[1] : {};
|
|
2380
|
+
_context34.prev = 1;
|
|
2035
2381
|
// Add the authToken to the headers
|
|
2036
2382
|
headers = {
|
|
2037
2383
|
authtoken: this.authtoken
|
|
2038
2384
|
}; // Make the POST request using Axios
|
|
2039
|
-
|
|
2385
|
+
_context34.next = 5;
|
|
2040
2386
|
return this.axios.post(endpoint, data, {
|
|
2041
2387
|
headers: headers
|
|
2042
2388
|
});
|
|
2043
2389
|
case 5:
|
|
2044
|
-
response =
|
|
2390
|
+
response = _context34.sent;
|
|
2045
2391
|
if (!(response.data.ok === false)) {
|
|
2046
|
-
|
|
2392
|
+
_context34.next = 8;
|
|
2047
2393
|
break;
|
|
2048
2394
|
}
|
|
2049
|
-
return
|
|
2395
|
+
return _context34.abrupt("return", this._handleError(response));
|
|
2050
2396
|
case 8:
|
|
2051
|
-
return
|
|
2397
|
+
return _context34.abrupt("return", response.data);
|
|
2052
2398
|
case 11:
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
return
|
|
2399
|
+
_context34.prev = 11;
|
|
2400
|
+
_context34.t0 = _context34["catch"](1);
|
|
2401
|
+
return _context34.abrupt("return", this._handleError(_context34.t0));
|
|
2056
2402
|
case 14:
|
|
2057
2403
|
case "end":
|
|
2058
|
-
return
|
|
2404
|
+
return _context34.stop();
|
|
2059
2405
|
}
|
|
2060
|
-
},
|
|
2406
|
+
}, _callee34, this, [[1, 11]]);
|
|
2061
2407
|
}));
|
|
2062
|
-
function post(
|
|
2408
|
+
function post(_x21) {
|
|
2063
2409
|
return _post.apply(this, arguments);
|
|
2064
2410
|
}
|
|
2065
2411
|
return post;
|