roboto-js 1.7.1 → 1.7.5

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.
@@ -11,21 +11,25 @@ var _rbt_user = _interopRequireDefault(require("./rbt_user.cjs"));
11
11
  var _rbt_file = _interopRequireDefault(require("./rbt_file.cjs"));
12
12
  var _lodash = _interopRequireDefault(require("lodash"));
13
13
  var _idb = require("idb");
14
+ var _excluded = ["enableRealtime"],
15
+ _excluded2 = ["enableRealtime"];
14
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
15
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); }
16
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
17
- 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."); }
18
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
19
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
18
+ 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
+ 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
20
  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
21
  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
22
  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; }
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
- 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); } }
25
- 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); }); }; }
24
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
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."); }
26
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
27
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
26
28
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
27
29
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
28
30
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
31
+ 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); } }
32
+ 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); }); }; }
29
33
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
30
34
  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); } }
31
35
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
@@ -77,28 +81,11 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
77
81
  };
78
82
  }
79
83
 
80
- // Synchronous browser hydration: set auth header and in-memory user immediately
81
- if (typeof localStorage !== 'undefined') {
82
- try {
83
- var token = localStorage.getItem('authtoken');
84
- if (token) {
85
- this.authtoken = token;
86
- this.axios.defaults.headers.common['authtoken'] = token;
87
- }
88
- } catch (_unused) {}
89
- try {
90
- var cachedUser = localStorage.getItem('rbtUser');
91
- if (cachedUser) {
92
- var parsed = JSON.parse(cachedUser);
93
- if (parsed && parsed.id) {
94
- this.currentUser = new _rbt_user["default"]({
95
- id: parsed.id
96
- }, this.axios);
97
- this.currentUser.setData(parsed);
98
- }
99
- }
100
- } catch (_unused2) {}
101
- }
84
+ // Asynchronous browser hydration: set auth header and in-memory user
85
+ // Use storage adaptor if available, otherwise fallback to localStorage
86
+ this._initializeFromStorage()["catch"](function (e) {
87
+ return console.warn('[RbtApi] Storage initialization failed:', e);
88
+ });
102
89
  this.localDb = null;
103
90
  this.iac_session = null;
104
91
  this.appServiceHost = baseUrl;
@@ -110,7 +97,109 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
110
97
  this.initAuthToken(authtoken);
111
98
  this.initApiKey(apikey);
112
99
  }
100
+
101
+ // Initialize authtoken and user from storage (cookies or localStorage)
113
102
  _createClass(RbtApi, [{
103
+ key: "_initializeFromStorage",
104
+ value: function () {
105
+ var _initializeFromStorage2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
106
+ var token, cookies, _iterator, _step, cookie, _cookie$trim$split, _cookie$trim$split2, name, value, cachedUser, parsed;
107
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
108
+ while (1) switch (_context.prev = _context.next) {
109
+ case 0:
110
+ if (this.localStorageAdaptor) {
111
+ _context.next = 2;
112
+ break;
113
+ }
114
+ return _context.abrupt("return");
115
+ case 2:
116
+ _context.prev = 2;
117
+ _context.next = 5;
118
+ return this.localStorageAdaptor.getItem('authtoken');
119
+ case 5:
120
+ token = _context.sent;
121
+ if (!(!token && typeof document !== 'undefined')) {
122
+ _context.next = 27;
123
+ break;
124
+ }
125
+ // Try to get from raw cookie
126
+ cookies = document.cookie.split(';');
127
+ _iterator = _createForOfIteratorHelper(cookies);
128
+ _context.prev = 9;
129
+ _iterator.s();
130
+ case 11:
131
+ if ((_step = _iterator.n()).done) {
132
+ _context.next = 19;
133
+ break;
134
+ }
135
+ cookie = _step.value;
136
+ _cookie$trim$split = cookie.trim().split('='), _cookie$trim$split2 = _slicedToArray(_cookie$trim$split, 2), name = _cookie$trim$split2[0], value = _cookie$trim$split2[1];
137
+ if (!(name === 'authtoken')) {
138
+ _context.next = 17;
139
+ break;
140
+ }
141
+ token = decodeURIComponent(value);
142
+ return _context.abrupt("break", 19);
143
+ case 17:
144
+ _context.next = 11;
145
+ break;
146
+ case 19:
147
+ _context.next = 24;
148
+ break;
149
+ case 21:
150
+ _context.prev = 21;
151
+ _context.t0 = _context["catch"](9);
152
+ _iterator.e(_context.t0);
153
+ case 24:
154
+ _context.prev = 24;
155
+ _iterator.f();
156
+ return _context.finish(24);
157
+ case 27:
158
+ if (token) {
159
+ this.authtoken = token;
160
+ this.axios.defaults.headers.common['authtoken'] = token;
161
+ console.log('[RbtApi] Loaded authtoken from storage adaptor');
162
+ }
163
+ _context.next = 33;
164
+ break;
165
+ case 30:
166
+ _context.prev = 30;
167
+ _context.t1 = _context["catch"](2);
168
+ console.warn('[RbtApi] Failed to load authtoken from storage adaptor:', _context.t1);
169
+ case 33:
170
+ _context.prev = 33;
171
+ _context.next = 36;
172
+ return this.localStorageAdaptor.getItem('rbtUser');
173
+ case 36:
174
+ cachedUser = _context.sent;
175
+ if (cachedUser) {
176
+ parsed = typeof cachedUser === 'string' ? JSON.parse(cachedUser) : cachedUser;
177
+ if (parsed && parsed.id) {
178
+ this.currentUser = new _rbt_user["default"]({
179
+ id: parsed.id
180
+ }, this.axios);
181
+ this.currentUser.setData(parsed);
182
+ console.log('[RbtApi] Loaded user from storage adaptor');
183
+ }
184
+ }
185
+ _context.next = 43;
186
+ break;
187
+ case 40:
188
+ _context.prev = 40;
189
+ _context.t2 = _context["catch"](33);
190
+ console.warn('[RbtApi] Failed to load user from storage adaptor:', _context.t2);
191
+ case 43:
192
+ case "end":
193
+ return _context.stop();
194
+ }
195
+ }, _callee, this, [[2, 30], [9, 21, 24, 27], [33, 40]]);
196
+ }));
197
+ function _initializeFromStorage() {
198
+ return _initializeFromStorage2.apply(this, arguments);
199
+ }
200
+ return _initializeFromStorage;
201
+ }()
202
+ }, {
114
203
  key: "getWebSocketClient",
115
204
  value: function getWebSocketClient() {
116
205
  // Reuse existing WebSocket if it's OPEN or CONNECTING (to prevent race condition)
@@ -136,20 +225,20 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
136
225
 
137
226
  // Re-subscribe to all objects that were previously subscribed
138
227
  if (_this._wsSubscriptions) {
139
- var _iterator = _createForOfIteratorHelper(_this._wsSubscriptions),
140
- _step;
228
+ var _iterator2 = _createForOfIteratorHelper(_this._wsSubscriptions),
229
+ _step2;
141
230
  try {
142
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
143
- var objectId = _step.value;
231
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
232
+ var objectId = _step2.value;
144
233
  ws.send(JSON.stringify({
145
234
  type: 'subscribe',
146
235
  objectId: objectId
147
236
  }));
148
237
  }
149
238
  } catch (err) {
150
- _iterator.e(err);
239
+ _iterator2.e(err);
151
240
  } finally {
152
- _iterator.f();
241
+ _iterator2.f();
153
242
  }
154
243
  }
155
244
  };
@@ -215,18 +304,18 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
215
304
  }, {
216
305
  key: "initAuthToken",
217
306
  value: function () {
218
- var _initAuthToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(authtoken) {
219
- return _regeneratorRuntime().wrap(function _callee$(_context) {
220
- while (1) switch (_context.prev = _context.next) {
307
+ var _initAuthToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(authtoken) {
308
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
309
+ while (1) switch (_context2.prev = _context2.next) {
221
310
  case 0:
222
311
  if (!(!authtoken && this.localStorageAdaptor)) {
223
- _context.next = 4;
312
+ _context2.next = 4;
224
313
  break;
225
314
  }
226
- _context.next = 3;
315
+ _context2.next = 3;
227
316
  return this.localStorageAdaptor.getItem('authtoken');
228
317
  case 3:
229
- authtoken = _context.sent;
318
+ authtoken = _context2.sent;
230
319
  case 4:
231
320
  if (authtoken) {
232
321
  this.authtoken = authtoken;
@@ -234,9 +323,9 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
234
323
  }
235
324
  case 5:
236
325
  case "end":
237
- return _context.stop();
326
+ return _context2.stop();
238
327
  }
239
- }, _callee, this);
328
+ }, _callee2, this);
240
329
  }));
241
330
  function initAuthToken(_x) {
242
331
  return _initAuthToken.apply(this, arguments);
@@ -246,18 +335,18 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
246
335
  }, {
247
336
  key: "initApiKey",
248
337
  value: function () {
249
- var _initApiKey = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(apikey) {
250
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
251
- while (1) switch (_context2.prev = _context2.next) {
338
+ var _initApiKey = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(apikey) {
339
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
340
+ while (1) switch (_context3.prev = _context3.next) {
252
341
  case 0:
253
342
  if (!(!apikey && this.localStorageAdaptor)) {
254
- _context2.next = 4;
343
+ _context3.next = 4;
255
344
  break;
256
345
  }
257
- _context2.next = 3;
346
+ _context3.next = 3;
258
347
  return this.localStorageAdaptor.getItem('apikey');
259
348
  case 3:
260
- apikey = _context2.sent;
349
+ apikey = _context3.sent;
261
350
  case 4:
262
351
  if (apikey) {
263
352
  this.apikey = apikey;
@@ -265,9 +354,9 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
265
354
  }
266
355
  case 5:
267
356
  case "end":
268
- return _context2.stop();
357
+ return _context3.stop();
269
358
  }
270
- }, _callee2, this);
359
+ }, _callee3, this);
271
360
  }));
272
361
  function initApiKey(_x2) {
273
362
  return _initApiKey.apply(this, arguments);
@@ -277,11 +366,11 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
277
366
  }, {
278
367
  key: "initLocalDb",
279
368
  value: function () {
280
- var _initLocalDb = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
281
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
282
- while (1) switch (_context3.prev = _context3.next) {
369
+ var _initLocalDb = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
370
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
371
+ while (1) switch (_context4.prev = _context4.next) {
283
372
  case 0:
284
- _context3.next = 2;
373
+ _context4.next = 2;
285
374
  return (0, _idb.openDB)('RBTFileDatabase', 1, {
286
375
  upgrade: function upgrade(db) {
287
376
  if (!db.objectStoreNames.contains('files')) {
@@ -292,12 +381,12 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
292
381
  }
293
382
  });
294
383
  case 2:
295
- this.localDb = _context3.sent;
384
+ this.localDb = _context4.sent;
296
385
  case 3:
297
386
  case "end":
298
- return _context3.stop();
387
+ return _context4.stop();
299
388
  }
300
- }, _callee3, this);
389
+ }, _callee4, this);
301
390
  }));
302
391
  function initLocalDb() {
303
392
  return _initLocalDb.apply(this, arguments);
@@ -327,28 +416,28 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
327
416
  }, {
328
417
  key: "registerTypedefs",
329
418
  value: function () {
330
- var _registerTypedefs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(typedefs) {
419
+ var _registerTypedefs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(typedefs) {
331
420
  var response;
332
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
333
- while (1) switch (_context4.prev = _context4.next) {
421
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
422
+ while (1) switch (_context5.prev = _context5.next) {
334
423
  case 0:
335
- _context4.prev = 0;
336
- _context4.next = 3;
424
+ _context5.prev = 0;
425
+ _context5.next = 3;
337
426
  return this.axios.post('/api/doctree/registerTypedefs', [{
338
427
  typedefs: typedefs
339
428
  }]);
340
429
  case 3:
341
- response = _context4.sent;
342
- return _context4.abrupt("return", response.data);
430
+ response = _context5.sent;
431
+ return _context5.abrupt("return", response.data);
343
432
  case 7:
344
- _context4.prev = 7;
345
- _context4.t0 = _context4["catch"](0);
346
- this._handleError(_context4.t0);
433
+ _context5.prev = 7;
434
+ _context5.t0 = _context5["catch"](0);
435
+ this._handleError(_context5.t0);
347
436
  case 10:
348
437
  case "end":
349
- return _context4.stop();
438
+ return _context5.stop();
350
439
  }
351
- }, _callee4, this, [[0, 7]]);
440
+ }, _callee5, this, [[0, 7]]);
352
441
  }));
353
442
  function registerTypedefs(_x3) {
354
443
  return _registerTypedefs.apply(this, arguments);
@@ -367,13 +456,13 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
367
456
  }, {
368
457
  key: "login",
369
458
  value: (function () {
370
- var _login = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(params) {
459
+ var _login = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(params) {
371
460
  var response, _this$iac_session;
372
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
373
- while (1) switch (_context5.prev = _context5.next) {
461
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
462
+ while (1) switch (_context6.prev = _context6.next) {
374
463
  case 0:
375
- _context5.prev = 0;
376
- _context5.next = 3;
464
+ _context6.prev = 0;
465
+ _context6.next = 3;
377
466
  return this.axios.post('/user_service/loginUser', [{
378
467
  email: params.email,
379
468
  password: params.password ? _cryptoJs["default"].MD5(params.password).toString(_cryptoJs["default"].enc.Hex) : null,
@@ -383,12 +472,12 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
383
472
  code: params.code || null // single-use signon code (password resets)
384
473
  }]);
385
474
  case 3:
386
- response = _context5.sent;
475
+ response = _context6.sent;
387
476
  if (!(response.data.ok === false)) {
388
- _context5.next = 6;
477
+ _context6.next = 6;
389
478
  break;
390
479
  }
391
- return _context5.abrupt("return", this._handleError(response));
480
+ return _context6.abrupt("return", this._handleError(response));
392
481
  case 6:
393
482
  this.iac_session = response.data;
394
483
  this.currentUser = this.iac_session ? new _rbt_user["default"](this.iac_session.user, this.axios) : null;
@@ -396,29 +485,29 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
396
485
  this.axios.defaults.headers.common['authtoken'] = response.data.authToken;
397
486
  this.authtoken = response.data.authToken;
398
487
  if (!this.localStorageAdaptor) {
399
- _context5.next = 16;
488
+ _context6.next = 16;
400
489
  break;
401
490
  }
402
- _context5.next = 13;
491
+ _context6.next = 13;
403
492
  return this.localStorageAdaptor.setItem('authtoken', response.data.authToken);
404
493
  case 13:
405
494
  if (!((_this$iac_session = this.iac_session) !== null && _this$iac_session !== void 0 && _this$iac_session.user)) {
406
- _context5.next = 16;
495
+ _context6.next = 16;
407
496
  break;
408
497
  }
409
- _context5.next = 16;
498
+ _context6.next = 16;
410
499
  return this.localStorageAdaptor.setItem('rbtUser', JSON.stringify(this.iac_session.user));
411
500
  case 16:
412
- return _context5.abrupt("return", response.data);
501
+ return _context6.abrupt("return", response.data);
413
502
  case 19:
414
- _context5.prev = 19;
415
- _context5.t0 = _context5["catch"](0);
416
- this._handleError(_context5.t0);
503
+ _context6.prev = 19;
504
+ _context6.t0 = _context6["catch"](0);
505
+ this._handleError(_context6.t0);
417
506
  case 22:
418
507
  case "end":
419
- return _context5.stop();
508
+ return _context6.stop();
420
509
  }
421
- }, _callee5, this, [[0, 19]]);
510
+ }, _callee6, this, [[0, 19]]);
422
511
  }));
423
512
  function login(_x4) {
424
513
  return _login.apply(this, arguments);
@@ -428,21 +517,21 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
428
517
  }, {
429
518
  key: "loginWithOauth",
430
519
  value: function () {
431
- var _loginWithOauth = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(userData) {
520
+ var _loginWithOauth = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(userData) {
432
521
  var response;
433
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
434
- while (1) switch (_context6.prev = _context6.next) {
522
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
523
+ while (1) switch (_context7.prev = _context7.next) {
435
524
  case 0:
436
- _context6.prev = 0;
437
- _context6.next = 3;
525
+ _context7.prev = 0;
526
+ _context7.next = 3;
438
527
  return this.post('/api/account/registerOrSigninOauth', userData);
439
528
  case 3:
440
- response = _context6.sent;
529
+ response = _context7.sent;
441
530
  if (!(response.ok === false)) {
442
- _context6.next = 6;
531
+ _context7.next = 6;
443
532
  break;
444
533
  }
445
- return _context6.abrupt("return", this._handleError(response));
534
+ return _context7.abrupt("return", this._handleError(response));
446
535
  case 6:
447
536
  this.iac_session = response;
448
537
  this.currentUser = this.iac_session ? new _rbt_user["default"](this.iac_session.user, this.axios) : null;
@@ -450,22 +539,22 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
450
539
  this.axios.defaults.headers.common['authtoken'] = response.authToken;
451
540
  this.authtoken = response.authToken;
452
541
  if (!this.localStorageAdaptor) {
453
- _context6.next = 13;
542
+ _context7.next = 13;
454
543
  break;
455
544
  }
456
- _context6.next = 13;
545
+ _context7.next = 13;
457
546
  return this.localStorageAdaptor.setItem('authtoken', response.authToken);
458
547
  case 13:
459
- return _context6.abrupt("return", response);
548
+ return _context7.abrupt("return", response);
460
549
  case 16:
461
- _context6.prev = 16;
462
- _context6.t0 = _context6["catch"](0);
463
- this._handleError(_context6.t0);
550
+ _context7.prev = 16;
551
+ _context7.t0 = _context7["catch"](0);
552
+ this._handleError(_context7.t0);
464
553
  case 19:
465
554
  case "end":
466
- return _context6.stop();
555
+ return _context7.stop();
467
556
  }
468
- }, _callee6, this, [[0, 16]]);
557
+ }, _callee7, this, [[0, 16]]);
469
558
  }));
470
559
  function loginWithOauth(_x5) {
471
560
  return _loginWithOauth.apply(this, arguments);
@@ -475,21 +564,21 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
475
564
  }, {
476
565
  key: "logout",
477
566
  value: function () {
478
- var _logout = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
567
+ var _logout = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
479
568
  var response;
480
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
481
- while (1) switch (_context7.prev = _context7.next) {
569
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
570
+ while (1) switch (_context8.prev = _context8.next) {
482
571
  case 0:
483
- _context7.prev = 0;
484
- _context7.next = 3;
572
+ _context8.prev = 0;
573
+ _context8.next = 3;
485
574
  return this.axios.post('/user_service/logoutUser');
486
575
  case 3:
487
- response = _context7.sent;
576
+ response = _context8.sent;
488
577
  if (!(response.data.ok === false)) {
489
- _context7.next = 6;
578
+ _context8.next = 6;
490
579
  break;
491
580
  }
492
- return _context7.abrupt("return", this._handleError(response));
581
+ return _context8.abrupt("return", this._handleError(response));
493
582
  case 6:
494
583
  // Clear the iac_session and remove the auth token from axios headers
495
584
  this.iac_session = null;
@@ -501,22 +590,22 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
501
590
 
502
591
  // Clear localStorage if it's being used
503
592
  if (!this.localStorageAdaptor) {
504
- _context7.next = 13;
593
+ _context8.next = 13;
505
594
  break;
506
595
  }
507
- _context7.next = 13;
596
+ _context8.next = 13;
508
597
  return this.localStorageAdaptor.removeItem('authtoken');
509
598
  case 13:
510
- return _context7.abrupt("return", response.data);
599
+ return _context8.abrupt("return", response.data);
511
600
  case 16:
512
- _context7.prev = 16;
513
- _context7.t0 = _context7["catch"](0);
514
- this._handleError(_context7.t0);
601
+ _context8.prev = 16;
602
+ _context8.t0 = _context8["catch"](0);
603
+ this._handleError(_context8.t0);
515
604
  case 19:
516
605
  case "end":
517
- return _context7.stop();
606
+ return _context8.stop();
518
607
  }
519
- }, _callee7, this, [[0, 16]]);
608
+ }, _callee8, this, [[0, 16]]);
520
609
  }));
521
610
  function logout() {
522
611
  return _logout.apply(this, arguments);
@@ -533,52 +622,52 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
533
622
  }, {
534
623
  key: "loadCurrentUser",
535
624
  value: function () {
536
- var _loadCurrentUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
625
+ var _loadCurrentUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
537
626
  var _this2 = this;
538
627
  var result;
539
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
540
- while (1) switch (_context9.prev = _context9.next) {
628
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
629
+ while (1) switch (_context10.prev = _context10.next) {
541
630
  case 0:
542
- _context9.prev = 0;
631
+ _context10.prev = 0;
543
632
  if (!this._loadCurrentUserPromise) {
544
- _context9.next = 3;
633
+ _context10.next = 3;
545
634
  break;
546
635
  }
547
- return _context9.abrupt("return", this._loadCurrentUserPromise);
636
+ return _context10.abrupt("return", this._loadCurrentUserPromise);
548
637
  case 3:
549
638
  if (!this.currentUser) {
550
- _context9.next = 5;
639
+ _context10.next = 5;
551
640
  break;
552
641
  }
553
- return _context9.abrupt("return", this.currentUser);
642
+ return _context10.abrupt("return", this.currentUser);
554
643
  case 5:
555
644
  if (!this.apikey) {
556
- _context9.next = 9;
645
+ _context10.next = 9;
557
646
  break;
558
647
  }
559
- return _context9.abrupt("return", null);
648
+ return _context10.abrupt("return", null);
560
649
  case 9:
561
650
  if (!this.authtoken) {
562
- _context9.next = 18;
651
+ _context10.next = 18;
563
652
  break;
564
653
  }
565
- this._loadCurrentUserPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
654
+ this._loadCurrentUserPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
566
655
  var response, _response$user;
567
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
568
- while (1) switch (_context8.prev = _context8.next) {
656
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
657
+ while (1) switch (_context9.prev = _context9.next) {
569
658
  case 0:
570
- _context8.next = 2;
659
+ _context9.next = 2;
571
660
  return _this2.refreshAuthToken(_this2.authtoken);
572
661
  case 2:
573
- response = _context8.sent;
662
+ response = _context9.sent;
574
663
  if (response) {
575
- _context8.next = 5;
664
+ _context9.next = 5;
576
665
  break;
577
666
  }
578
- return _context8.abrupt("return", null);
667
+ return _context9.abrupt("return", null);
579
668
  case 5:
580
669
  if (!(response !== null && response !== void 0 && response.user)) {
581
- _context8.next = 11;
670
+ _context9.next = 11;
582
671
  break;
583
672
  }
584
673
  _this2.currentUser = new _rbt_user["default"]({
@@ -586,38 +675,38 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
586
675
  }, _this2.axios);
587
676
  _this2.currentUser.setData(response.user);
588
677
  if (!_this2.localStorageAdaptor) {
589
- _context8.next = 11;
678
+ _context9.next = 11;
590
679
  break;
591
680
  }
592
- _context8.next = 11;
681
+ _context9.next = 11;
593
682
  return _this2.localStorageAdaptor.setItem('rbtUser', JSON.stringify(response.user));
594
683
  case 11:
595
- return _context8.abrupt("return", _this2.currentUser);
684
+ return _context9.abrupt("return", _this2.currentUser);
596
685
  case 12:
597
686
  case "end":
598
- return _context8.stop();
687
+ return _context9.stop();
599
688
  }
600
- }, _callee8);
689
+ }, _callee9);
601
690
  }))();
602
- _context9.next = 13;
691
+ _context10.next = 13;
603
692
  return this._loadCurrentUserPromise;
604
693
  case 13:
605
- result = _context9.sent;
694
+ result = _context10.sent;
606
695
  this._loadCurrentUserPromise = null;
607
- return _context9.abrupt("return", result);
696
+ return _context10.abrupt("return", result);
608
697
  case 18:
609
698
  this.currentUser = null;
610
699
  case 19:
611
- return _context9.abrupt("return", null);
700
+ return _context10.abrupt("return", null);
612
701
  case 22:
613
- _context9.prev = 22;
614
- _context9.t0 = _context9["catch"](0);
615
- return _context9.abrupt("return", this._handleError(_context9.t0));
702
+ _context10.prev = 22;
703
+ _context10.t0 = _context10["catch"](0);
704
+ return _context10.abrupt("return", this._handleError(_context10.t0));
616
705
  case 25:
617
706
  case "end":
618
- return _context9.stop();
707
+ return _context10.stop();
619
708
  }
620
- }, _callee9, this, [[0, 22]]);
709
+ }, _callee10, this, [[0, 22]]);
621
710
  }));
622
711
  function loadCurrentUser() {
623
712
  return _loadCurrentUser.apply(this, arguments);
@@ -627,35 +716,35 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
627
716
  }, {
628
717
  key: "confirmUserEmail",
629
718
  value: function () {
630
- var _confirmUserEmail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(confirmCode) {
719
+ var _confirmUserEmail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(confirmCode) {
631
720
  var params, response;
632
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
633
- while (1) switch (_context10.prev = _context10.next) {
721
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
722
+ while (1) switch (_context11.prev = _context11.next) {
634
723
  case 0:
635
724
  params = {
636
725
  emailConfirmCode: confirmCode
637
726
  };
638
- _context10.prev = 1;
639
- _context10.next = 4;
727
+ _context11.prev = 1;
728
+ _context11.next = 4;
640
729
  return this.axios.post('/user_service/confirmUserEmail', [params]);
641
730
  case 4:
642
- response = _context10.sent;
731
+ response = _context11.sent;
643
732
  if (!(response.data.ok === false)) {
644
- _context10.next = 7;
733
+ _context11.next = 7;
645
734
  break;
646
735
  }
647
- return _context10.abrupt("return", this._handleError(response));
736
+ return _context11.abrupt("return", this._handleError(response));
648
737
  case 7:
649
- return _context10.abrupt("return", response.data);
738
+ return _context11.abrupt("return", response.data);
650
739
  case 10:
651
- _context10.prev = 10;
652
- _context10.t0 = _context10["catch"](1);
653
- return _context10.abrupt("return", this._handleError(_context10.t0));
740
+ _context11.prev = 10;
741
+ _context11.t0 = _context11["catch"](1);
742
+ return _context11.abrupt("return", this._handleError(_context11.t0));
654
743
  case 13:
655
744
  case "end":
656
- return _context10.stop();
745
+ return _context11.stop();
657
746
  }
658
- }, _callee10, this, [[1, 10]]);
747
+ }, _callee11, this, [[1, 10]]);
659
748
  }));
660
749
  function confirmUserEmail(_x6) {
661
750
  return _confirmUserEmail.apply(this, arguments);
@@ -665,53 +754,53 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
665
754
  }, {
666
755
  key: "loadCurrentUserExtended",
667
756
  value: function () {
668
- var _loadCurrentUserExtended = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
757
+ var _loadCurrentUserExtended = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
669
758
  var _this3 = this;
670
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
671
- while (1) switch (_context12.prev = _context12.next) {
759
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
760
+ while (1) switch (_context13.prev = _context13.next) {
672
761
  case 0:
673
762
  if (!this._loadCurrentUserExtendedPromise) {
674
- _context12.next = 2;
763
+ _context13.next = 2;
675
764
  break;
676
765
  }
677
- return _context12.abrupt("return", this._loadCurrentUserExtendedPromise);
766
+ return _context13.abrupt("return", this._loadCurrentUserExtendedPromise);
678
767
  case 2:
679
- this._loadCurrentUserExtendedPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
768
+ this._loadCurrentUserExtendedPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
680
769
  var currentUser;
681
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
682
- while (1) switch (_context11.prev = _context11.next) {
770
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
771
+ while (1) switch (_context12.prev = _context12.next) {
683
772
  case 0:
684
- _context11.next = 2;
773
+ _context12.next = 2;
685
774
  return _this3.loadCurrentUser();
686
775
  case 2:
687
- currentUser = _context11.sent;
776
+ currentUser = _context12.sent;
688
777
  if (!currentUser) {
689
- _context11.next = 7;
778
+ _context12.next = 7;
690
779
  break;
691
780
  }
692
- return _context11.abrupt("return", _this3.loadUser(currentUser.id));
781
+ return _context12.abrupt("return", _this3.loadUser(currentUser.id));
693
782
  case 7:
694
- return _context11.abrupt("return", null);
783
+ return _context12.abrupt("return", null);
695
784
  case 8:
696
785
  case "end":
697
- return _context11.stop();
786
+ return _context12.stop();
698
787
  }
699
- }, _callee11);
788
+ }, _callee12);
700
789
  }))();
701
- _context12.prev = 3;
702
- _context12.next = 6;
790
+ _context13.prev = 3;
791
+ _context13.next = 6;
703
792
  return this._loadCurrentUserExtendedPromise;
704
793
  case 6:
705
- return _context12.abrupt("return", _context12.sent);
794
+ return _context13.abrupt("return", _context13.sent);
706
795
  case 7:
707
- _context12.prev = 7;
796
+ _context13.prev = 7;
708
797
  this._loadCurrentUserExtendedPromise = null;
709
- return _context12.finish(7);
798
+ return _context13.finish(7);
710
799
  case 10:
711
800
  case "end":
712
- return _context12.stop();
801
+ return _context13.stop();
713
802
  }
714
- }, _callee12, this, [[3,, 7, 10]]);
803
+ }, _callee13, this, [[3,, 7, 10]]);
715
804
  }));
716
805
  function loadCurrentUserExtended() {
717
806
  return _loadCurrentUserExtended.apply(this, arguments);
@@ -721,11 +810,11 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
721
810
  }, {
722
811
  key: "loadUser",
723
812
  value: function () {
724
- var _loadUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(userId) {
813
+ var _loadUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(userId) {
725
814
  var _this4 = this;
726
815
  var params, cacheKey, now, existing, p;
727
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
728
- while (1) switch (_context14.prev = _context14.next) {
816
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
817
+ while (1) switch (_context15.prev = _context15.next) {
729
818
  case 0:
730
819
  params = {
731
820
  id: userId
@@ -734,51 +823,51 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
734
823
  now = Date.now();
735
824
  existing = this.requestCache[cacheKey];
736
825
  if (!(existing && now - existing.time < 10000)) {
737
- _context14.next = 6;
826
+ _context15.next = 6;
738
827
  break;
739
828
  }
740
- return _context14.abrupt("return", existing.val);
829
+ return _context15.abrupt("return", existing.val);
741
830
  case 6:
742
- _context14.prev = 6;
743
- p = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
831
+ _context15.prev = 6;
832
+ p = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
744
833
  var _response$data;
745
834
  var response, userData, User;
746
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
747
- while (1) switch (_context13.prev = _context13.next) {
835
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
836
+ while (1) switch (_context14.prev = _context14.next) {
748
837
  case 0:
749
- _context13.next = 2;
838
+ _context14.next = 2;
750
839
  return _this4.axios.post('/user_service/loadUser', [params]);
751
840
  case 2:
752
- response = _context13.sent;
841
+ response = _context14.sent;
753
842
  userData = response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.user;
754
843
  User = new _rbt_user["default"]({
755
844
  id: userData.id
756
845
  }, _this4.axios);
757
846
  User.setData(userData);
758
- return _context13.abrupt("return", User);
847
+ return _context14.abrupt("return", User);
759
848
  case 7:
760
849
  case "end":
761
- return _context13.stop();
850
+ return _context14.stop();
762
851
  }
763
- }, _callee13);
852
+ }, _callee14);
764
853
  }))();
765
854
  this.requestCache[cacheKey] = {
766
855
  val: p,
767
856
  time: now
768
857
  };
769
- _context14.next = 11;
858
+ _context15.next = 11;
770
859
  return p;
771
860
  case 11:
772
- return _context14.abrupt("return", _context14.sent);
861
+ return _context15.abrupt("return", _context15.sent);
773
862
  case 14:
774
- _context14.prev = 14;
775
- _context14.t0 = _context14["catch"](6);
776
- return _context14.abrupt("return", this._handleError(_context14.t0));
863
+ _context15.prev = 14;
864
+ _context15.t0 = _context15["catch"](6);
865
+ return _context15.abrupt("return", this._handleError(_context15.t0));
777
866
  case 17:
778
867
  case "end":
779
- return _context14.stop();
868
+ return _context15.stop();
780
869
  }
781
- }, _callee14, this, [[6, 14]]);
870
+ }, _callee15, this, [[6, 14]]);
782
871
  }));
783
872
  function loadUser(_x7) {
784
873
  return _loadUser.apply(this, arguments);
@@ -788,52 +877,52 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
788
877
  }, {
789
878
  key: "refreshAuthToken",
790
879
  value: function () {
791
- var _refreshAuthToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(authtoken) {
880
+ var _refreshAuthToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(authtoken) {
792
881
  var promise, response;
793
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
794
- while (1) switch (_context15.prev = _context15.next) {
882
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
883
+ while (1) switch (_context16.prev = _context16.next) {
795
884
  case 0:
796
885
  if (this.appServiceHost) {
797
- _context15.next = 3;
886
+ _context16.next = 3;
798
887
  break;
799
888
  }
800
889
  console.warn('RBTTOK not initialized');
801
- return _context15.abrupt("return", false);
890
+ return _context16.abrupt("return", false);
802
891
  case 3:
803
892
  if (!this.requestCache[authtoken]) {
804
- _context15.next = 5;
893
+ _context16.next = 5;
805
894
  break;
806
895
  }
807
- return _context15.abrupt("return", this.requestCache[authtoken]);
896
+ return _context16.abrupt("return", this.requestCache[authtoken]);
808
897
  case 5:
809
- _context15.prev = 5;
898
+ _context16.prev = 5;
810
899
  //console.log('RBTTOK Req', authtoken);
811
900
  // Create a new promise for the token refresh and store it in the cache
812
901
  promise = this.axios.post('/user_service/refreshAuthToken', [authtoken]);
813
902
  this.requestCache[authtoken] = promise;
814
903
 
815
904
  // Await the promise to get the response
816
- _context15.next = 10;
905
+ _context16.next = 10;
817
906
  return promise;
818
907
  case 10:
819
- response = _context15.sent;
908
+ response = _context16.sent;
820
909
  //console.log('RBTTOK Response ',response);
821
910
  // Once the promise resolves, delete it from the cache to allow future refreshes
822
911
  delete this.requestCache[authtoken];
823
912
 
824
913
  // Return the response data
825
- return _context15.abrupt("return", response.data);
914
+ return _context16.abrupt("return", response.data);
826
915
  case 15:
827
- _context15.prev = 15;
828
- _context15.t0 = _context15["catch"](5);
916
+ _context16.prev = 15;
917
+ _context16.t0 = _context16["catch"](5);
829
918
  // On error, remove the cached promise to allow retries
830
919
  delete this.requestCache[authtoken];
831
- this._handleError(_context15.t0);
920
+ this._handleError(_context16.t0);
832
921
  case 19:
833
922
  case "end":
834
- return _context15.stop();
923
+ return _context16.stop();
835
924
  }
836
- }, _callee15, this, [[5, 15]]);
925
+ }, _callee16, this, [[5, 15]]);
837
926
  }));
838
927
  function refreshAuthToken(_x8) {
839
928
  return _refreshAuthToken.apply(this, arguments);
@@ -866,31 +955,31 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
866
955
  }, {
867
956
  key: "registerUser",
868
957
  value: function () {
869
- var _registerUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
958
+ var _registerUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
870
959
  var dataHash,
871
960
  response,
872
961
  record,
873
- _args16 = arguments;
874
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
875
- while (1) switch (_context16.prev = _context16.next) {
962
+ _args17 = arguments;
963
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
964
+ while (1) switch (_context17.prev = _context17.next) {
876
965
  case 0:
877
- dataHash = _args16.length > 0 && _args16[0] !== undefined ? _args16[0] : {};
878
- _context16.prev = 1;
879
- _context16.next = 4;
966
+ dataHash = _args17.length > 0 && _args17[0] !== undefined ? _args17[0] : {};
967
+ _context17.prev = 1;
968
+ _context17.next = 4;
880
969
  return this.axios.post('/user_service/registerUser', [dataHash]);
881
970
  case 4:
882
- response = _context16.sent;
971
+ response = _context17.sent;
883
972
  record = response.data;
884
- return _context16.abrupt("return", new _rbt_user["default"](record, this.axios));
973
+ return _context17.abrupt("return", new _rbt_user["default"](record, this.axios));
885
974
  case 9:
886
- _context16.prev = 9;
887
- _context16.t0 = _context16["catch"](1);
888
- return _context16.abrupt("return", this._handleError(_context16.t0));
975
+ _context17.prev = 9;
976
+ _context17.t0 = _context17["catch"](1);
977
+ return _context17.abrupt("return", this._handleError(_context17.t0));
889
978
  case 12:
890
979
  case "end":
891
- return _context16.stop();
980
+ return _context17.stop();
892
981
  }
893
- }, _callee16, this, [[1, 9]]);
982
+ }, _callee17, this, [[1, 9]]);
894
983
  }));
895
984
  function registerUser() {
896
985
  return _registerUser.apply(this, arguments);
@@ -907,30 +996,30 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
907
996
  }, {
908
997
  key: "createFile",
909
998
  value: (function () {
910
- var _createFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(dataHash) {
999
+ var _createFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(dataHash) {
911
1000
  var response, record;
912
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
913
- while (1) switch (_context17.prev = _context17.next) {
1001
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1002
+ while (1) switch (_context18.prev = _context18.next) {
914
1003
  case 0:
915
- _context17.prev = 0;
916
- _context17.next = 3;
1004
+ _context18.prev = 0;
1005
+ _context18.next = 3;
917
1006
  return this.axios.post('/object_service/createObject', ['<@filekit.file>', dataHash]);
918
1007
  case 3:
919
- response = _context17.sent;
1008
+ response = _context18.sent;
920
1009
  record = response.data;
921
1010
  if (dataHash) {
922
1011
  record.data = dataHash;
923
1012
  }
924
- return _context17.abrupt("return", new _rbt_file["default"](record, this.axios, this.localDb));
1013
+ return _context18.abrupt("return", new _rbt_file["default"](record, this.axios, this.localDb));
925
1014
  case 9:
926
- _context17.prev = 9;
927
- _context17.t0 = _context17["catch"](0);
928
- return _context17.abrupt("return", this._handleError(_context17.t0));
1015
+ _context18.prev = 9;
1016
+ _context18.t0 = _context18["catch"](0);
1017
+ return _context18.abrupt("return", this._handleError(_context18.t0));
929
1018
  case 12:
930
1019
  case "end":
931
- return _context17.stop();
1020
+ return _context18.stop();
932
1021
  }
933
- }, _callee17, this, [[0, 9]]);
1022
+ }, _callee18, this, [[0, 9]]);
934
1023
  }));
935
1024
  function createFile(_x9) {
936
1025
  return _createFile.apply(this, arguments);
@@ -940,33 +1029,33 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
940
1029
  }, {
941
1030
  key: "loadFile",
942
1031
  value: function () {
943
- var _loadFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(id) {
1032
+ var _loadFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(id) {
944
1033
  var response, record;
945
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
946
- while (1) switch (_context18.prev = _context18.next) {
1034
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1035
+ while (1) switch (_context19.prev = _context19.next) {
947
1036
  case 0:
948
- _context18.prev = 0;
949
- _context18.next = 3;
1037
+ _context19.prev = 0;
1038
+ _context19.next = 3;
950
1039
  return this.load('<@filekit.file>', id);
951
1040
  case 3:
952
- response = _context18.sent;
1041
+ response = _context19.sent;
953
1042
  if (response) {
954
- _context18.next = 6;
1043
+ _context19.next = 6;
955
1044
  break;
956
1045
  }
957
- return _context18.abrupt("return", null);
1046
+ return _context19.abrupt("return", null);
958
1047
  case 6:
959
1048
  record = response.toRecord();
960
- return _context18.abrupt("return", new _rbt_file["default"](record, this.axios, this.localDb));
1049
+ return _context19.abrupt("return", new _rbt_file["default"](record, this.axios, this.localDb));
961
1050
  case 10:
962
- _context18.prev = 10;
963
- _context18.t0 = _context18["catch"](0);
964
- return _context18.abrupt("return", this._handleError(_context18.t0));
1051
+ _context19.prev = 10;
1052
+ _context19.t0 = _context19["catch"](0);
1053
+ return _context19.abrupt("return", this._handleError(_context19.t0));
965
1054
  case 13:
966
1055
  case "end":
967
- return _context18.stop();
1056
+ return _context19.stop();
968
1057
  }
969
- }, _callee18, this, [[0, 10]]);
1058
+ }, _callee19, this, [[0, 10]]);
970
1059
  }));
971
1060
  function loadFile(_x10) {
972
1061
  return _loadFile.apply(this, arguments);
@@ -976,37 +1065,37 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
976
1065
  }, {
977
1066
  key: "loadFiles",
978
1067
  value: function () {
979
- var _loadFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(ids) {
1068
+ var _loadFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(ids) {
980
1069
  var _this5 = this;
981
1070
  var responses;
982
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
983
- while (1) switch (_context19.prev = _context19.next) {
1071
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1072
+ while (1) switch (_context20.prev = _context20.next) {
984
1073
  case 0:
985
- _context19.prev = 0;
986
- _context19.next = 3;
1074
+ _context20.prev = 0;
1075
+ _context20.next = 3;
987
1076
  return this.load('<@filekit.file>', ids);
988
1077
  case 3:
989
- responses = _context19.sent;
1078
+ responses = _context20.sent;
990
1079
  if (!(!responses || !Array.isArray(responses))) {
991
- _context19.next = 6;
1080
+ _context20.next = 6;
992
1081
  break;
993
1082
  }
994
- return _context19.abrupt("return", []);
1083
+ return _context20.abrupt("return", []);
995
1084
  case 6:
996
- return _context19.abrupt("return", responses.map(function (response) {
1085
+ return _context20.abrupt("return", responses.map(function (response) {
997
1086
  var record = response.toRecord();
998
1087
  return new _rbt_file["default"](record, _this5.axios, _this5.localDb);
999
1088
  }));
1000
1089
  case 9:
1001
- _context19.prev = 9;
1002
- _context19.t0 = _context19["catch"](0);
1003
- this._handleError(_context19.t0); // Handle errors (log or process as needed)
1004
- return _context19.abrupt("return", []);
1090
+ _context20.prev = 9;
1091
+ _context20.t0 = _context20["catch"](0);
1092
+ this._handleError(_context20.t0); // Handle errors (log or process as needed)
1093
+ return _context20.abrupt("return", []);
1005
1094
  case 13:
1006
1095
  case "end":
1007
- return _context19.stop();
1096
+ return _context20.stop();
1008
1097
  }
1009
- }, _callee19, this, [[0, 9]]);
1098
+ }, _callee20, this, [[0, 9]]);
1010
1099
  }));
1011
1100
  function loadFiles(_x11) {
1012
1101
  return _loadFiles.apply(this, arguments);
@@ -1024,40 +1113,40 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
1024
1113
  }, {
1025
1114
  key: "create",
1026
1115
  value: (function () {
1027
- var _create = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(type) {
1116
+ var _create = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(type) {
1028
1117
  var dataHash,
1029
1118
  options,
1030
1119
  response,
1031
1120
  record,
1032
- _args20 = arguments;
1033
- return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1034
- while (1) switch (_context20.prev = _context20.next) {
1121
+ _args21 = arguments;
1122
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1123
+ while (1) switch (_context21.prev = _context21.next) {
1035
1124
  case 0:
1036
- dataHash = _args20.length > 1 && _args20[1] !== undefined ? _args20[1] : {};
1037
- options = _args20.length > 2 && _args20[2] !== undefined ? _args20[2] : {};
1038
- _context20.prev = 2;
1039
- _context20.next = 5;
1125
+ dataHash = _args21.length > 1 && _args21[1] !== undefined ? _args21[1] : {};
1126
+ options = _args21.length > 2 && _args21[2] !== undefined ? _args21[2] : {};
1127
+ _context21.prev = 2;
1128
+ _context21.next = 5;
1040
1129
  return this.axios.post('/object_service/createObject', [type, dataHash]);
1041
1130
  case 5:
1042
- response = _context20.sent;
1131
+ response = _context21.sent;
1043
1132
  record = response.data;
1044
1133
  if (dataHash) {
1045
1134
  record.data = dataHash;
1046
1135
  }
1047
- return _context20.abrupt("return", new _rbt_object["default"](record, this.axios, {
1136
+ return _context21.abrupt("return", new _rbt_object["default"](record, this.axios, {
1048
1137
  isNew: true,
1049
1138
  websocketClient: this.websocketClient,
1050
1139
  enableRealtime: options.enableRealtime || false
1051
1140
  }));
1052
1141
  case 11:
1053
- _context20.prev = 11;
1054
- _context20.t0 = _context20["catch"](2);
1055
- return _context20.abrupt("return", this._handleError(_context20.t0));
1142
+ _context21.prev = 11;
1143
+ _context21.t0 = _context21["catch"](2);
1144
+ return _context21.abrupt("return", this._handleError(_context21.t0));
1056
1145
  case 14:
1057
1146
  case "end":
1058
- return _context20.stop();
1147
+ return _context21.stop();
1059
1148
  }
1060
- }, _callee20, this, [[2, 11]]);
1149
+ }, _callee21, this, [[2, 11]]);
1061
1150
  }));
1062
1151
  function create(_x12) {
1063
1152
  return _create.apply(this, arguments);
@@ -1079,6 +1168,10 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
1079
1168
  * - limit: An object to control the pagination of results. It includes:
1080
1169
  * - offset: The starting point from where to fetch the results.
1081
1170
  * - results: The maximum number of results to return.
1171
+ * - requestAttrs: An array of attribute paths to include in the response (e.g., ['id', 'configs.title', 'configs.description']).
1172
+ * If not provided, all attributes are returned.
1173
+ * - excludeAttrs: An array of attribute paths to exclude from the response (e.g., ['details.log', 'internalData']).
1174
+ * Excludes the specified paths and all their subpaths.
1082
1175
  * - resolveReferences: An array of attribute names whose references should be resolved in the returned objects.
1083
1176
  * - timeout: A numerical value in milliseconds to set a maximum time limit for the query execution.
1084
1177
  *
@@ -1087,6 +1180,8 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
1087
1180
  * where: 'email="tom@pospa.com"',
1088
1181
  * orderBy: { column: 'timeCreated', direction: 'DESC' },
1089
1182
  * limit: { offset: 0, results: 50 },
1183
+ * requestAttrs: ['id', 'configs.title'],
1184
+ * excludeAttrs: ['details.log'],
1090
1185
  * resolveReferences: ['translatableContent']
1091
1186
  * });
1092
1187
  *
@@ -1096,10 +1191,12 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
1096
1191
  }, {
1097
1192
  key: "query",
1098
1193
  value: (function () {
1099
- var _query = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(type) {
1194
+ var _query = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(type) {
1100
1195
  var _this6 = this;
1101
1196
  var params,
1102
1197
  paramsKey,
1198
+ validParams,
1199
+ invalidParams,
1103
1200
  defaultOrderBy,
1104
1201
  defaultLimit,
1105
1202
  mergedParams,
@@ -1107,13 +1204,28 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
1107
1204
  cacheEntry,
1108
1205
  responsePromise,
1109
1206
  processingPromise,
1110
- _args21 = arguments;
1111
- return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1112
- while (1) switch (_context21.prev = _context21.next) {
1207
+ _args22 = arguments;
1208
+ return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1209
+ while (1) switch (_context22.prev = _context22.next) {
1113
1210
  case 0:
1114
- params = _args21.length > 1 && _args21[1] !== undefined ? _args21[1] : {};
1115
- _context21.prev = 1;
1211
+ params = _args22.length > 1 && _args22[1] !== undefined ? _args22[1] : {};
1212
+ _context22.prev = 1;
1116
1213
  //console.log('RBTAPI.query INIT', type, params);
1214
+ // Validate parameters - reject invalid parameter names
1215
+ validParams = ['type', 'where', 'orderBy', 'limit', 'resolveReferences', 'requestAttrs', 'excludeAttrs', 'timeout', 'enableRealtime'];
1216
+ invalidParams = Object.keys(params).filter(function (key) {
1217
+ return !validParams.includes(key);
1218
+ });
1219
+ if (!(invalidParams.length > 0)) {
1220
+ _context22.next = 6;
1221
+ break;
1222
+ }
1223
+ throw new Error("Invalid query parameter(s): ".concat(invalidParams.join(', '), ". Valid parameters are: ").concat(validParams.join(', ')));
1224
+ case 6:
1225
+ // Warn if enableRealtime is passed to query() - it should only be used by load()
1226
+ if (params.enableRealtime) {
1227
+ console.warn('[roboto-js] enableRealtime should not be passed to query(), only to load(). This parameter will be ignored.');
1228
+ }
1117
1229
  params.type = type;
1118
1230
 
1119
1231
  // Default ordering and pagination
@@ -1134,11 +1246,11 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
1134
1246
  paramsKey = JSON.stringify(mergedParams);
1135
1247
  cacheEntry = this.requestCache[paramsKey];
1136
1248
  if (!(cacheEntry && currentTime - cacheEntry.time < 10000)) {
1137
- _context21.next = 11;
1249
+ _context22.next = 16;
1138
1250
  break;
1139
1251
  }
1140
- return _context21.abrupt("return", cacheEntry.val);
1141
- case 11:
1252
+ return _context22.abrupt("return", cacheEntry.val);
1253
+ case 16:
1142
1254
  // Create the response promise
1143
1255
  responsePromise = this.axios.post('/object_service/queryObjects', [mergedParams]); // Cache the promise of processing data, not just the raw response
1144
1256
  processingPromise = responsePromise.then(function (response) {
@@ -1154,21 +1266,21 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
1154
1266
  };
1155
1267
 
1156
1268
  // Await the processing promise for this call to get processed data
1157
- _context21.next = 16;
1269
+ _context22.next = 21;
1158
1270
  return processingPromise;
1159
- case 16:
1160
- return _context21.abrupt("return", _context21.sent);
1161
- case 19:
1162
- _context21.prev = 19;
1163
- _context21.t0 = _context21["catch"](1);
1271
+ case 21:
1272
+ return _context22.abrupt("return", _context22.sent);
1273
+ case 24:
1274
+ _context22.prev = 24;
1275
+ _context22.t0 = _context22["catch"](1);
1164
1276
  delete this.requestCache[paramsKey]; // Ensure cache cleanup on error
1165
1277
  //console.log('RBTAPI.query ERROR', paramsKey, e);
1166
- return _context21.abrupt("return", this._handleError(_context21.t0));
1167
- case 23:
1278
+ return _context22.abrupt("return", this._handleError(_context22.t0));
1279
+ case 28:
1168
1280
  case "end":
1169
- return _context21.stop();
1281
+ return _context22.stop();
1170
1282
  }
1171
- }, _callee21, this, [[1, 19]]);
1283
+ }, _callee22, this, [[1, 24]]);
1172
1284
  }));
1173
1285
  function query(_x13) {
1174
1286
  return _query.apply(this, arguments);
@@ -1220,28 +1332,30 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
1220
1332
  }, {
1221
1333
  key: "load",
1222
1334
  value: (function () {
1223
- var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(type, ids) {
1335
+ var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(type, ids) {
1224
1336
  var _this8 = this;
1225
1337
  var params,
1226
1338
  mergedParams,
1227
1339
  cachedObjects,
1228
1340
  missingIds,
1229
- _iterator2,
1230
- _step2,
1341
+ _iterator3,
1342
+ _step3,
1231
1343
  id,
1232
1344
  _cacheKey,
1233
1345
  cached,
1234
1346
  hitLogKey,
1235
1347
  loadedObjects,
1236
1348
  bulkMissLogKey,
1237
- _iterator3,
1238
- _step3,
1349
+ enableRealtime,
1350
+ queryParams,
1351
+ _iterator4,
1352
+ _step4,
1239
1353
  obj,
1240
1354
  cacheKey,
1241
1355
  setLogKey,
1242
1356
  result,
1243
- _iterator4,
1244
- _step4,
1357
+ _iterator5,
1358
+ _step5,
1245
1359
  _id,
1246
1360
  _cacheKey2,
1247
1361
  _obj,
@@ -1251,26 +1365,26 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
1251
1365
  pendingKey,
1252
1366
  missLogKey,
1253
1367
  loadPromise,
1254
- _args23 = arguments;
1255
- return _regeneratorRuntime().wrap(function _callee23$(_context23) {
1256
- while (1) switch (_context23.prev = _context23.next) {
1368
+ _args24 = arguments;
1369
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
1370
+ while (1) switch (_context24.prev = _context24.next) {
1257
1371
  case 0:
1258
- params = _args23.length > 2 && _args23[2] !== undefined ? _args23[2] : {};
1372
+ params = _args24.length > 2 && _args24[2] !== undefined ? _args24[2] : {};
1259
1373
  if (type == '<@iac.user>') {
1260
1374
  debugger;
1261
1375
  }
1262
- _context23.prev = 2;
1376
+ _context24.prev = 2;
1263
1377
  if (!Array.isArray(ids)) {
1264
- _context23.next = 24;
1378
+ _context24.next = 25;
1265
1379
  break;
1266
1380
  }
1267
1381
  // For array requests, check cache for each ID and only load missing ones
1268
1382
  cachedObjects = [];
1269
1383
  missingIds = [];
1270
- _iterator2 = _createForOfIteratorHelper(ids);
1384
+ _iterator3 = _createForOfIteratorHelper(ids);
1271
1385
  try {
1272
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
1273
- id = _step2.value;
1386
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
1387
+ id = _step3.value;
1274
1388
  _cacheKey = "".concat(type, ":").concat(id);
1275
1389
  cached = this._objectCache.get(_cacheKey);
1276
1390
  if (cached) {
@@ -1302,13 +1416,13 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
1302
1416
 
1303
1417
  // Load missing objects
1304
1418
  } catch (err) {
1305
- _iterator2.e(err);
1419
+ _iterator3.e(err);
1306
1420
  } finally {
1307
- _iterator2.f();
1421
+ _iterator3.f();
1308
1422
  }
1309
1423
  loadedObjects = [];
1310
1424
  if (!(missingIds.length > 0)) {
1311
- _context23.next = 18;
1425
+ _context24.next = 19;
1312
1426
  break;
1313
1427
  }
1314
1428
  // Only log bulk cache miss once
@@ -1320,18 +1434,21 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
1320
1434
  });
1321
1435
  this._loggedCacheEvents.add(bulkMissLogKey);
1322
1436
  }
1323
- mergedParams = _objectSpread(_objectSpread({}, params), {}, {
1437
+
1438
+ // Remove load-specific params that shouldn't be passed to query
1439
+ enableRealtime = params.enableRealtime, queryParams = _objectWithoutProperties(params, _excluded);
1440
+ mergedParams = _objectSpread(_objectSpread({}, queryParams), {}, {
1324
1441
  where: "id IN (\"".concat(missingIds.join("\",\""), "\")")
1325
1442
  });
1326
- _context23.next = 15;
1443
+ _context24.next = 16;
1327
1444
  return this.query(type, mergedParams);
1328
- case 15:
1329
- loadedObjects = _context23.sent;
1445
+ case 16:
1446
+ loadedObjects = _context24.sent;
1330
1447
  // Cache the newly loaded objects
1331
- _iterator3 = _createForOfIteratorHelper(loadedObjects);
1448
+ _iterator4 = _createForOfIteratorHelper(loadedObjects);
1332
1449
  try {
1333
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
1334
- obj = _step3.value;
1450
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
1451
+ obj = _step4.value;
1335
1452
  cacheKey = "".concat(type, ":").concat(obj.id);
1336
1453
  this._objectCache.set(cacheKey, obj);
1337
1454
 
@@ -1346,17 +1463,17 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
1346
1463
  }
1347
1464
  }
1348
1465
  } catch (err) {
1349
- _iterator3.e(err);
1466
+ _iterator4.e(err);
1350
1467
  } finally {
1351
- _iterator3.f();
1468
+ _iterator4.f();
1352
1469
  }
1353
- case 18:
1470
+ case 19:
1354
1471
  // Return combined results in original order
1355
1472
  result = [];
1356
- _iterator4 = _createForOfIteratorHelper(ids);
1473
+ _iterator5 = _createForOfIteratorHelper(ids);
1357
1474
  try {
1358
- for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
1359
- _id = _step4.value;
1475
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
1476
+ _id = _step5.value;
1360
1477
  _cacheKey2 = "".concat(type, ":").concat(_id);
1361
1478
  _obj = this._objectCache.get(_cacheKey2);
1362
1479
  if (_obj) {
@@ -1368,17 +1485,17 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
1368
1485
  }
1369
1486
  }
1370
1487
  } catch (err) {
1371
- _iterator4.e(err);
1488
+ _iterator5.e(err);
1372
1489
  } finally {
1373
- _iterator4.f();
1490
+ _iterator5.f();
1374
1491
  }
1375
- return _context23.abrupt("return", result);
1376
- case 24:
1492
+ return _context24.abrupt("return", result);
1493
+ case 25:
1377
1494
  // For single object requests, check cache first
1378
1495
  _cacheKey3 = "".concat(type, ":").concat(ids);
1379
1496
  _cached = this._objectCache.get(_cacheKey3);
1380
1497
  if (!_cached) {
1381
- _context23.next = 31;
1498
+ _context24.next = 32;
1382
1499
  break;
1383
1500
  }
1384
1501
  // Only log cache hits once per object to reduce spam
@@ -1400,19 +1517,19 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
1400
1517
  });
1401
1518
  _cached._initRealtime();
1402
1519
  }
1403
- return _context23.abrupt("return", _cached);
1404
- case 31:
1520
+ return _context24.abrupt("return", _cached);
1521
+ case 32:
1405
1522
  // Check if we're already loading this object
1406
1523
  pendingKey = "".concat(type, ":").concat(ids);
1407
1524
  if (!this._pendingLoads.has(pendingKey)) {
1408
- _context23.next = 36;
1525
+ _context24.next = 37;
1409
1526
  break;
1410
1527
  }
1411
- _context23.next = 35;
1528
+ _context24.next = 36;
1412
1529
  return this._pendingLoads.get(pendingKey);
1413
- case 35:
1414
- return _context23.abrupt("return", _context23.sent);
1415
1530
  case 36:
1531
+ return _context24.abrupt("return", _context24.sent);
1532
+ case 37:
1416
1533
  // Only log cache miss once per object to reduce spam
1417
1534
  missLogKey = "miss:".concat(_cacheKey3);
1418
1535
  if (!this._loggedCacheEvents.has(missLogKey)) {
@@ -1424,19 +1541,21 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
1424
1541
  }
1425
1542
 
1426
1543
  // Create the loading promise and store it to prevent duplicate requests
1427
- loadPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
1428
- var res, _obj2, _setLogKey;
1429
- return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1430
- while (1) switch (_context22.prev = _context22.next) {
1544
+ loadPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
1545
+ var _enableRealtime, _queryParams, res, _obj2, _setLogKey;
1546
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
1547
+ while (1) switch (_context23.prev = _context23.next) {
1431
1548
  case 0:
1432
- _context22.prev = 0;
1433
- mergedParams = _objectSpread(_objectSpread({}, params), {}, {
1549
+ _context23.prev = 0;
1550
+ // Remove load-specific params that shouldn't be passed to query
1551
+ _enableRealtime = params.enableRealtime, _queryParams = _objectWithoutProperties(params, _excluded2);
1552
+ mergedParams = _objectSpread(_objectSpread({}, _queryParams), {}, {
1434
1553
  where: "id=\"".concat(ids, "\"")
1435
1554
  });
1436
- _context22.next = 4;
1555
+ _context23.next = 5;
1437
1556
  return _this8.query(type, mergedParams);
1438
- case 4:
1439
- res = _context22.sent;
1557
+ case 5:
1558
+ res = _context23.sent;
1440
1559
  _obj2 = res[0];
1441
1560
  if (_obj2) {
1442
1561
  // Cache the loaded object
@@ -1452,35 +1571,35 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
1452
1571
  _this8._loggedCacheEvents.add(_setLogKey);
1453
1572
  }
1454
1573
  }
1455
- return _context22.abrupt("return", _obj2);
1456
- case 8:
1457
- _context22.prev = 8;
1574
+ return _context23.abrupt("return", _obj2);
1575
+ case 9:
1576
+ _context23.prev = 9;
1458
1577
  // Remove from pending loads
1459
1578
  _this8._pendingLoads["delete"](pendingKey);
1460
- return _context22.finish(8);
1461
- case 11:
1579
+ return _context23.finish(9);
1580
+ case 12:
1462
1581
  case "end":
1463
- return _context22.stop();
1582
+ return _context23.stop();
1464
1583
  }
1465
- }, _callee22, null, [[0,, 8, 11]]);
1584
+ }, _callee23, null, [[0,, 9, 12]]);
1466
1585
  }))(); // Store the promise so other concurrent requests can await it
1467
1586
  this._pendingLoads.set(pendingKey, loadPromise);
1468
- _context23.next = 42;
1587
+ _context24.next = 43;
1469
1588
  return loadPromise;
1470
- case 42:
1471
- return _context23.abrupt("return", _context23.sent);
1472
1589
  case 43:
1473
- _context23.next = 48;
1590
+ return _context24.abrupt("return", _context24.sent);
1591
+ case 44:
1592
+ _context24.next = 49;
1474
1593
  break;
1475
- case 45:
1476
- _context23.prev = 45;
1477
- _context23.t0 = _context23["catch"](2);
1478
- return _context23.abrupt("return", this._handleError(_context23.t0));
1479
- case 48:
1594
+ case 46:
1595
+ _context24.prev = 46;
1596
+ _context24.t0 = _context24["catch"](2);
1597
+ return _context24.abrupt("return", this._handleError(_context24.t0));
1598
+ case 49:
1480
1599
  case "end":
1481
- return _context23.stop();
1600
+ return _context24.stop();
1482
1601
  }
1483
- }, _callee23, this, [[2, 45]]);
1602
+ }, _callee24, this, [[2, 46]]);
1484
1603
  }));
1485
1604
  function load(_x14, _x15) {
1486
1605
  return _load.apply(this, arguments);
@@ -1515,12 +1634,12 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
1515
1634
  } else if (type) {
1516
1635
  // Clear all objects of a specific type
1517
1636
  var removedCount = 0;
1518
- var _iterator5 = _createForOfIteratorHelper(this._objectCache),
1519
- _step5;
1637
+ var _iterator6 = _createForOfIteratorHelper(this._objectCache),
1638
+ _step6;
1520
1639
  try {
1521
- for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
1522
- var _step5$value = _slicedToArray(_step5.value, 1),
1523
- key = _step5$value[0];
1640
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
1641
+ var _step6$value = _slicedToArray(_step6.value, 1),
1642
+ key = _step6$value[0];
1524
1643
  if (key.startsWith("".concat(type, ":"))) {
1525
1644
  this._objectCache["delete"](key);
1526
1645
  removedCount++;
@@ -1529,23 +1648,23 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
1529
1648
 
1530
1649
  // Clear related log tracking for this type
1531
1650
  } catch (err) {
1532
- _iterator5.e(err);
1651
+ _iterator6.e(err);
1533
1652
  } finally {
1534
- _iterator5.f();
1653
+ _iterator6.f();
1535
1654
  }
1536
- var _iterator6 = _createForOfIteratorHelper(this._loggedCacheEvents),
1537
- _step6;
1655
+ var _iterator7 = _createForOfIteratorHelper(this._loggedCacheEvents),
1656
+ _step7;
1538
1657
  try {
1539
- for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
1540
- var logKey = _step6.value;
1658
+ for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
1659
+ var logKey = _step7.value;
1541
1660
  if (logKey.includes("".concat(type, ":"))) {
1542
1661
  this._loggedCacheEvents["delete"](logKey);
1543
1662
  }
1544
1663
  }
1545
1664
  } catch (err) {
1546
- _iterator6.e(err);
1665
+ _iterator7.e(err);
1547
1666
  } finally {
1548
- _iterator6.f();
1667
+ _iterator7.f();
1549
1668
  }
1550
1669
  console.log('[AgentProviderSync] 🗑️ roboto.clearCache by type:', {
1551
1670
  type: type,
@@ -1612,7 +1731,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
1612
1731
  }, {
1613
1732
  key: "runTask",
1614
1733
  value: (function () {
1615
- var _runTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
1734
+ var _runTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
1616
1735
  var params,
1617
1736
  callbacks,
1618
1737
  onProgress,
@@ -1626,20 +1745,20 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
1626
1745
  status,
1627
1746
  message,
1628
1747
  output,
1629
- _args24 = arguments;
1630
- return _regeneratorRuntime().wrap(function _callee24$(_context24) {
1631
- while (1) switch (_context24.prev = _context24.next) {
1748
+ _args25 = arguments;
1749
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
1750
+ while (1) switch (_context25.prev = _context25.next) {
1632
1751
  case 0:
1633
- params = _args24.length > 0 && _args24[0] !== undefined ? _args24[0] : {};
1634
- callbacks = _args24.length > 1 && _args24[1] !== undefined ? _args24[1] : {};
1752
+ params = _args25.length > 0 && _args25[0] !== undefined ? _args25[0] : {};
1753
+ callbacks = _args25.length > 1 && _args25[1] !== undefined ? _args25[1] : {};
1635
1754
  onProgress = callbacks.onProgress, onError = callbacks.onError, onStopped = callbacks.onStopped, onWaiting = callbacks.onWaiting, onDone = callbacks.onDone;
1636
- _context24.prev = 3;
1637
- _context24.next = 6;
1755
+ _context25.prev = 3;
1756
+ _context25.next = 6;
1638
1757
  return this.post('/task_service/runChain', params);
1639
1758
  case 6:
1640
- response = _context24.sent;
1759
+ response = _context25.sent;
1641
1760
  if (response) {
1642
- _context24.next = 9;
1761
+ _context25.next = 9;
1643
1762
  break;
1644
1763
  }
1645
1764
  throw new Error('Invalid server response');
@@ -1647,7 +1766,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
1647
1766
  // Validate response structure
1648
1767
  ok = response.ok, jobId = response.jobId, status = response.status, message = response.message, output = response.output;
1649
1768
  if (!(!ok || typeof jobId !== 'string' || typeof status !== 'string')) {
1650
- _context24.next = 12;
1769
+ _context25.next = 12;
1651
1770
  break;
1652
1771
  }
1653
1772
  throw new Error('Invalid response structure');
@@ -1673,7 +1792,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
1673
1792
  //console.log('Finish (request) ',response);
1674
1793
  onDone(response);
1675
1794
  }
1676
- return _context24.abrupt("return", {
1795
+ return _context25.abrupt("return", {
1677
1796
  ok: ok,
1678
1797
  jobId: jobId,
1679
1798
  status: status,
@@ -1681,24 +1800,24 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
1681
1800
  output: output
1682
1801
  });
1683
1802
  case 20:
1684
- _context24.prev = 20;
1685
- _context24.t0 = _context24["catch"](3);
1803
+ _context25.prev = 20;
1804
+ _context25.t0 = _context25["catch"](3);
1686
1805
  if (typeof onError === 'function') {
1687
- onError(_context24.t0);
1806
+ onError(_context25.t0);
1688
1807
  } else {
1689
- console.error('Error in runTask:', _context24.t0);
1808
+ console.error('Error in runTask:', _context25.t0);
1690
1809
  }
1691
- return _context24.abrupt("return", {
1810
+ return _context25.abrupt("return", {
1692
1811
  ok: false,
1693
1812
  jobId: null,
1694
1813
  status: 'ERROR',
1695
- error: _context24.t0.message
1814
+ error: _context25.t0.message
1696
1815
  });
1697
1816
  case 24:
1698
1817
  case "end":
1699
- return _context24.stop();
1818
+ return _context25.stop();
1700
1819
  }
1701
- }, _callee24, this, [[3, 20]]);
1820
+ }, _callee25, this, [[3, 20]]);
1702
1821
  }));
1703
1822
  function runTask() {
1704
1823
  return _runTask.apply(this, arguments);
@@ -1708,37 +1827,37 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
1708
1827
  }, {
1709
1828
  key: "stopJob",
1710
1829
  value: function () {
1711
- var _stopJob = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
1830
+ var _stopJob = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
1712
1831
  var params,
1713
1832
  callbacks,
1714
1833
  response,
1715
- _args25 = arguments;
1716
- return _regeneratorRuntime().wrap(function _callee25$(_context25) {
1717
- while (1) switch (_context25.prev = _context25.next) {
1834
+ _args26 = arguments;
1835
+ return _regeneratorRuntime().wrap(function _callee26$(_context26) {
1836
+ while (1) switch (_context26.prev = _context26.next) {
1718
1837
  case 0:
1719
- params = _args25.length > 0 && _args25[0] !== undefined ? _args25[0] : {};
1720
- callbacks = _args25.length > 1 && _args25[1] !== undefined ? _args25[1] : {};
1721
- _context25.prev = 2;
1722
- _context25.next = 5;
1838
+ params = _args26.length > 0 && _args26[0] !== undefined ? _args26[0] : {};
1839
+ callbacks = _args26.length > 1 && _args26[1] !== undefined ? _args26[1] : {};
1840
+ _context26.prev = 2;
1841
+ _context26.next = 5;
1723
1842
  return this.post('/task_service/stopJob', params);
1724
1843
  case 5:
1725
- response = _context25.sent;
1844
+ response = _context26.sent;
1726
1845
  if (response) {
1727
- _context25.next = 8;
1846
+ _context26.next = 8;
1728
1847
  break;
1729
1848
  }
1730
1849
  throw new Error('Invalid server response');
1731
1850
  case 8:
1732
- return _context25.abrupt("return", true);
1851
+ return _context26.abrupt("return", true);
1733
1852
  case 11:
1734
- _context25.prev = 11;
1735
- _context25.t0 = _context25["catch"](2);
1853
+ _context26.prev = 11;
1854
+ _context26.t0 = _context26["catch"](2);
1736
1855
  throw 'Error in stopJob';
1737
1856
  case 14:
1738
1857
  case "end":
1739
- return _context25.stop();
1858
+ return _context26.stop();
1740
1859
  }
1741
- }, _callee25, this, [[2, 11]]);
1860
+ }, _callee26, this, [[2, 11]]);
1742
1861
  }));
1743
1862
  function stopJob() {
1744
1863
  return _stopJob.apply(this, arguments);
@@ -1758,26 +1877,26 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
1758
1877
  }, {
1759
1878
  key: "pollTaskProgress",
1760
1879
  value: (function () {
1761
- var _pollTaskProgress = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(jobId, callbacks) {
1880
+ var _pollTaskProgress = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(jobId, callbacks) {
1762
1881
  var _this9 = this;
1763
1882
  var onProgress, onError, onStopped, onWaiting, onDone, _callbacks$pollingInt, pollingInterval, checkProgress;
1764
- return _regeneratorRuntime().wrap(function _callee27$(_context27) {
1765
- while (1) switch (_context27.prev = _context27.next) {
1883
+ return _regeneratorRuntime().wrap(function _callee28$(_context28) {
1884
+ while (1) switch (_context28.prev = _context28.next) {
1766
1885
  case 0:
1767
1886
  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;
1768
- _context27.prev = 1;
1887
+ _context28.prev = 1;
1769
1888
  checkProgress = /*#__PURE__*/function () {
1770
- var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
1889
+ var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
1771
1890
  var response;
1772
- return _regeneratorRuntime().wrap(function _callee26$(_context26) {
1773
- while (1) switch (_context26.prev = _context26.next) {
1891
+ return _regeneratorRuntime().wrap(function _callee27$(_context27) {
1892
+ while (1) switch (_context27.prev = _context27.next) {
1774
1893
  case 0:
1775
- _context26.next = 2;
1894
+ _context27.next = 2;
1776
1895
  return _this9.get("/task_service/pollChainProgress", {
1777
1896
  jobId: jobId
1778
1897
  });
1779
1898
  case 2:
1780
- response = _context26.sent;
1899
+ response = _context27.sent;
1781
1900
  // If the task is still in progress, start polling for updates
1782
1901
  if (response.status === 'DONE' && onDone) {
1783
1902
  // Provide the current progress to the callback function
@@ -1808,26 +1927,26 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
1808
1927
  }
1809
1928
  case 9:
1810
1929
  case "end":
1811
- return _context26.stop();
1930
+ return _context27.stop();
1812
1931
  }
1813
- }, _callee26);
1932
+ }, _callee27);
1814
1933
  }));
1815
1934
  return function checkProgress() {
1816
1935
  return _ref8.apply(this, arguments);
1817
1936
  };
1818
1937
  }();
1819
1938
  checkProgress();
1820
- _context27.next = 9;
1939
+ _context28.next = 9;
1821
1940
  break;
1822
1941
  case 6:
1823
- _context27.prev = 6;
1824
- _context27.t0 = _context27["catch"](1);
1825
- return _context27.abrupt("return", this._handleError(_context27.t0));
1942
+ _context28.prev = 6;
1943
+ _context28.t0 = _context28["catch"](1);
1944
+ return _context28.abrupt("return", this._handleError(_context28.t0));
1826
1945
  case 9:
1827
1946
  case "end":
1828
- return _context27.stop();
1947
+ return _context28.stop();
1829
1948
  }
1830
- }, _callee27, this, [[1, 6]]);
1949
+ }, _callee28, this, [[1, 6]]);
1831
1950
  }));
1832
1951
  function pollTaskProgress(_x16, _x17) {
1833
1952
  return _pollTaskProgress.apply(this, arguments);
@@ -1849,43 +1968,43 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
1849
1968
  }, {
1850
1969
  key: "get",
1851
1970
  value: (function () {
1852
- var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(endpoint) {
1971
+ var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(endpoint) {
1853
1972
  var params,
1854
1973
  headers,
1855
1974
  response,
1856
- _args28 = arguments;
1857
- return _regeneratorRuntime().wrap(function _callee28$(_context28) {
1858
- while (1) switch (_context28.prev = _context28.next) {
1975
+ _args29 = arguments;
1976
+ return _regeneratorRuntime().wrap(function _callee29$(_context29) {
1977
+ while (1) switch (_context29.prev = _context29.next) {
1859
1978
  case 0:
1860
- params = _args28.length > 1 && _args28[1] !== undefined ? _args28[1] : {};
1861
- _context28.prev = 1;
1979
+ params = _args29.length > 1 && _args29[1] !== undefined ? _args29[1] : {};
1980
+ _context29.prev = 1;
1862
1981
  // Add the authToken to the headers
1863
1982
  headers = {
1864
1983
  authtoken: this.authtoken
1865
1984
  }; // Make the GET request using Axios
1866
- _context28.next = 5;
1985
+ _context29.next = 5;
1867
1986
  return this.axios.get(endpoint, {
1868
1987
  params: params,
1869
1988
  headers: headers
1870
1989
  });
1871
1990
  case 5:
1872
- response = _context28.sent;
1991
+ response = _context29.sent;
1873
1992
  if (!(response.data.ok === false)) {
1874
- _context28.next = 8;
1993
+ _context29.next = 8;
1875
1994
  break;
1876
1995
  }
1877
- return _context28.abrupt("return", this._handleError(response));
1996
+ return _context29.abrupt("return", this._handleError(response));
1878
1997
  case 8:
1879
- return _context28.abrupt("return", response.data);
1998
+ return _context29.abrupt("return", response.data);
1880
1999
  case 11:
1881
- _context28.prev = 11;
1882
- _context28.t0 = _context28["catch"](1);
1883
- return _context28.abrupt("return", this._handleError(_context28.t0));
2000
+ _context29.prev = 11;
2001
+ _context29.t0 = _context29["catch"](1);
2002
+ return _context29.abrupt("return", this._handleError(_context29.t0));
1884
2003
  case 14:
1885
2004
  case "end":
1886
- return _context28.stop();
2005
+ return _context29.stop();
1887
2006
  }
1888
- }, _callee28, this, [[1, 11]]);
2007
+ }, _callee29, this, [[1, 11]]);
1889
2008
  }));
1890
2009
  function get(_x18) {
1891
2010
  return _get.apply(this, arguments);
@@ -1908,42 +2027,42 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
1908
2027
  }, {
1909
2028
  key: "post",
1910
2029
  value: (function () {
1911
- var _post = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(endpoint) {
2030
+ var _post = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(endpoint) {
1912
2031
  var data,
1913
2032
  headers,
1914
2033
  response,
1915
- _args29 = arguments;
1916
- return _regeneratorRuntime().wrap(function _callee29$(_context29) {
1917
- while (1) switch (_context29.prev = _context29.next) {
2034
+ _args30 = arguments;
2035
+ return _regeneratorRuntime().wrap(function _callee30$(_context30) {
2036
+ while (1) switch (_context30.prev = _context30.next) {
1918
2037
  case 0:
1919
- data = _args29.length > 1 && _args29[1] !== undefined ? _args29[1] : {};
1920
- _context29.prev = 1;
2038
+ data = _args30.length > 1 && _args30[1] !== undefined ? _args30[1] : {};
2039
+ _context30.prev = 1;
1921
2040
  // Add the authToken to the headers
1922
2041
  headers = {
1923
2042
  authtoken: this.authtoken
1924
2043
  }; // Make the POST request using Axios
1925
- _context29.next = 5;
2044
+ _context30.next = 5;
1926
2045
  return this.axios.post(endpoint, data, {
1927
2046
  headers: headers
1928
2047
  });
1929
2048
  case 5:
1930
- response = _context29.sent;
2049
+ response = _context30.sent;
1931
2050
  if (!(response.data.ok === false)) {
1932
- _context29.next = 8;
2051
+ _context30.next = 8;
1933
2052
  break;
1934
2053
  }
1935
- return _context29.abrupt("return", this._handleError(response));
2054
+ return _context30.abrupt("return", this._handleError(response));
1936
2055
  case 8:
1937
- return _context29.abrupt("return", response.data);
2056
+ return _context30.abrupt("return", response.data);
1938
2057
  case 11:
1939
- _context29.prev = 11;
1940
- _context29.t0 = _context29["catch"](1);
1941
- return _context29.abrupt("return", this._handleError(_context29.t0));
2058
+ _context30.prev = 11;
2059
+ _context30.t0 = _context30["catch"](1);
2060
+ return _context30.abrupt("return", this._handleError(_context30.t0));
1942
2061
  case 14:
1943
2062
  case "end":
1944
- return _context29.stop();
2063
+ return _context30.stop();
1945
2064
  }
1946
- }, _callee29, this, [[1, 11]]);
2065
+ }, _callee30, this, [[1, 11]]);
1947
2066
  }));
1948
2067
  function post(_x19) {
1949
2068
  return _post.apply(this, arguments);