roboto-js 1.8.5 → 1.8.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.js CHANGED
@@ -1,3 +1,12 @@
1
+ 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); }
2
+ 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; }
3
+ 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); } }
4
+ 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); }); }; }
5
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6
+ 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); } }
7
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
8
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
9
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
1
10
  import RbtApi from './rbt_api.js';
2
11
  import RbtObject from './rbt_object.js';
3
12
  import RbtFile from './rbt_file.js';
@@ -7,28 +16,31 @@ export { RbtApi, RbtObject, RbtFile, CookieStorageAdaptor
7
16
  //User,
8
17
  //Site
9
18
  };
10
- export default class Roboto {
11
- getVersion() {
12
- return '1.7.3';
13
- }
14
- constructor({
15
- host,
16
- accessKey,
17
- localStorageAdaptor,
18
- disableWebSocket = false,
19
- metricsHost,
20
- useCookies = true
21
- }, proxyReq = null) {
19
+ var Roboto = /*#__PURE__*/function () {
20
+ function Roboto(_ref) {
21
+ var _this = this;
22
+ var host = _ref.host,
23
+ accessKey = _ref.accessKey,
24
+ apiKey = _ref.apiKey,
25
+ authToken = _ref.authToken,
26
+ localStorageAdaptor = _ref.localStorageAdaptor,
27
+ _ref$disableWebSocket = _ref.disableWebSocket,
28
+ disableWebSocket = _ref$disableWebSocket === void 0 ? false : _ref$disableWebSocket,
29
+ metricsHost = _ref.metricsHost,
30
+ _ref$useCookies = _ref.useCookies,
31
+ useCookies = _ref$useCookies === void 0 ? true : _ref$useCookies;
32
+ var proxyReq = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
33
+ _classCallCheck(this, Roboto);
22
34
  if (Roboto.instance && !proxyReq) {
23
35
  // if on client, there can only be one instance
24
36
  // on server, with proxyReq, each request has its own instance
25
37
  return Roboto.instance;
26
38
  }
27
- const isBrowser = typeof window !== "undefined";
39
+ var isBrowser = typeof window !== "undefined";
28
40
  this.data = {};
29
41
 
30
42
  // Auto-configure storage adaptor
31
- let storageAdaptor = localStorageAdaptor;
43
+ var storageAdaptor = localStorageAdaptor;
32
44
  if (!storageAdaptor && isBrowser && useCookies) {
33
45
  // Use cookies by default in browser for better server-side compatibility
34
46
  storageAdaptor = new CookieStorageAdaptor({
@@ -36,38 +48,46 @@ export default class Roboto {
36
48
  sameSite: 'Lax',
37
49
  maxAge: 24 * 60 * 60 // 24 hours
38
50
  });
39
- console.log('[Roboto] Using CookieStorageAdaptor for authentication tokens');
40
-
41
51
  // Set accessKey for server-side authentication (handled automatically by adapter)
42
52
  if (accessKey) {
43
- storageAdaptor.setItem('accessKey', accessKey).catch(e => console.warn('[Roboto] Failed to set accessKey cookie:', e));
53
+ storageAdaptor.setItem('accessKey', accessKey)["catch"](function (e) {
54
+ return void 0;
55
+ });
44
56
  }
45
57
  }
46
58
  this.config = {
47
- accessKey: accessKey,
59
+ accesskey: accessKey,
48
60
  // Use passed accessKey
49
- baseUrl: `https://${host}`,
61
+ baseUrl: "https://".concat(host),
50
62
  // Use passed host
51
63
  localStorageAdaptor: storageAdaptor
52
64
  };
53
65
 
66
+ // Add apikey and authtoken if provided directly
67
+ if (apiKey) {
68
+ this.config.apikey = apiKey;
69
+ }
70
+ if (authToken) {
71
+ this.config.authtoken = authToken;
72
+ }
73
+
54
74
  // DEVELOPMENT
55
75
  this.config.baseUrl = this._stripHttpsForDomains(this.config.baseUrl, ['localhost']);
56
76
 
57
77
  // Check if a request object is provided
58
78
  if (proxyReq && proxyReq.headers) {
59
- const authtoken = proxyReq.headers.authtoken;
60
- const accesskey = proxyReq.headers.accesskey;
61
- const apikey = proxyReq.headers.apikey;
79
+ var header_authtoken = proxyReq.headers.authtoken;
80
+ var header_accesskey = proxyReq.headers.accesskey;
81
+ var header_apikey = proxyReq.headers.apikey;
62
82
  // Optionally add more headers as needed
63
- if (authtoken) {
64
- this.config.authtoken = authtoken; // Set the authtoken in the config
83
+ if (header_authtoken) {
84
+ this.config.authtoken = header_authtoken; // Set the authtoken in the config
65
85
  }
66
- if (apikey) {
67
- this.config.apikey = apikey; // Set the authtoken in the config
86
+ if (header_apikey) {
87
+ this.config.apikey = header_apikey; // Set the authtoken in the config
68
88
  }
69
- if (accesskey) {
70
- this.config.accesskey = accesskey; // Set the accesskey in the config
89
+ if (header_accesskey) {
90
+ this.config.accesskey = header_accesskey; // Set the accesskey in the config
71
91
  }
72
92
  }
73
93
  this.api = new RbtApi(this.config);
@@ -76,14 +96,15 @@ export default class Roboto {
76
96
 
77
97
  // Add global debug method for cookie storage adapter
78
98
  if (this.config.localStorageAdaptor && this.config.localStorageAdaptor.debugState) {
79
- window.debugRobotoCookies = () => this.config.localStorageAdaptor.debugState();
80
- console.log('[Roboto] Added global debug method: window.debugRobotoCookies()');
99
+ window.debugRobotoCookies = function () {
100
+ return _this.config.localStorageAdaptor.debugState();
101
+ };
81
102
  }
82
103
  }
83
104
 
84
105
  // METRICS API instance (separate host or same)
85
106
  if (metricsHost && metricsHost !== host) {
86
- const metricsUrl = metricsHost.startsWith('http') ? metricsHost : `https://${metricsHost}`;
107
+ var metricsUrl = metricsHost.startsWith('http') ? metricsHost : "https://".concat(metricsHost);
87
108
  // You can customize headers if needed
88
109
  this.metrics = new RbtMetricsApi({
89
110
  config: {
@@ -101,147 +122,522 @@ export default class Roboto {
101
122
  }
102
123
  Roboto.instance = this;
103
124
  }
104
- setSiteEnv(siteEnv) {
105
- this.api.setSiteEnv(siteEnv);
106
- }
107
- getSiteEnv(key = null) {
108
- return this.api.getSiteEnv(key);
109
- }
110
- setItem(key, value) {
111
- this.data[key] = value;
112
- }
113
- getItem(key) {
114
- return this.data[key];
115
- }
116
- setAppServiceHost(host) {
117
- // DEVELOPMENT
118
- host = this._stripHttpsForDomains(host, ['localhost']);
119
- this.api.setAppServiceHost(host);
120
- }
121
- setMetricsHost(host) {
122
- this.metricsHost = host;
123
- const metricsUrl = host.startsWith('http') ? host : `https://${host}`;
124
- this.metrics = new RbtMetricsApi({
125
- config: {
126
- baseURL: this._stripHttpsForDomains(metricsUrl, ['localhost']),
127
- headers: {
128
- accesskey: this.config.accessKey
125
+ _createClass(Roboto, [{
126
+ key: "getVersion",
127
+ value: function getVersion() {
128
+ return '1.7.3';
129
+ }
130
+ }, {
131
+ key: "setSiteEnv",
132
+ value: function setSiteEnv(siteEnv) {
133
+ this.api.setSiteEnv(siteEnv);
134
+ }
135
+ }, {
136
+ key: "getSiteEnv",
137
+ value: function getSiteEnv() {
138
+ var key = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
139
+ return this.api.getSiteEnv(key);
140
+ }
141
+ }, {
142
+ key: "setItem",
143
+ value: function setItem(key, value) {
144
+ this.data[key] = value;
145
+ }
146
+ }, {
147
+ key: "getItem",
148
+ value: function getItem(key) {
149
+ return this.data[key];
150
+ }
151
+ }, {
152
+ key: "setAppServiceHost",
153
+ value: function setAppServiceHost(host) {
154
+ // DEVELOPMENT
155
+ host = this._stripHttpsForDomains(host, ['localhost']);
156
+ this.api.setAppServiceHost(host);
157
+ }
158
+ }, {
159
+ key: "setMetricsHost",
160
+ value: function setMetricsHost(host) {
161
+ this.metricsHost = host;
162
+ var metricsUrl = host.startsWith('http') ? host : "https://".concat(host);
163
+ this.metrics = new RbtMetricsApi({
164
+ config: {
165
+ baseURL: this._stripHttpsForDomains(metricsUrl, ['localhost']),
166
+ headers: {
167
+ accesskey: this.config.accessKey
168
+ }
129
169
  }
170
+ });
171
+ }
172
+ }, {
173
+ key: "registerTypedefs",
174
+ value: function registerTypedefs(typedefs) {
175
+ this.api.registerTypedefs(typedefs);
176
+ }
177
+ }, {
178
+ key: "setErrorHandler",
179
+ value: function setErrorHandler(customErrorHandler) {
180
+ if (this.api) {
181
+ this.api.setErrorHandler(customErrorHandler);
130
182
  }
131
- });
132
- }
133
- registerTypedefs(typedefs) {
134
- this.api.registerTypedefs(typedefs);
135
- }
136
- setErrorHandler(customErrorHandler) {
137
- if (this.api) {
138
- this.api.setErrorHandler(customErrorHandler);
139
183
  }
140
- }
141
- recordToInstance(recordHash) {
142
- return new RbtObject(recordHash, this.api.axios);
143
- }
144
- _stripHttpsForDomains(baseUrl, domains) {
145
- return baseUrl.replace(new RegExp(`^https://(${domains.map(domain => domain.replace(/\./g, '\\.')).join('|')})`), 'http://$1');
146
- }
147
-
148
- //
149
- // User register, login, and refresh token
150
- //
151
- async login(params) {
152
- return this.api.login(params);
153
- }
154
- async loginWithOauth(params) {
155
- return this.api.loginWithOauth(params);
156
- }
157
- async logout() {
158
- const result = await this.api.logout();
159
-
160
- // Clear accessKey and authtoken using standard localStorage interface
161
- if (this.config.localStorageAdaptor) {
162
- await this.config.localStorageAdaptor.removeItem('accessKey');
163
- await this.config.localStorageAdaptor.removeItem('authtoken');
184
+ }, {
185
+ key: "recordToInstance",
186
+ value: function recordToInstance(recordHash) {
187
+ return new RbtObject(recordHash, this.api.axios);
188
+ }
189
+ }, {
190
+ key: "_stripHttpsForDomains",
191
+ value: function _stripHttpsForDomains(baseUrl, domains) {
192
+ return baseUrl.replace(new RegExp("^https://(".concat(domains.map(function (domain) {
193
+ return domain.replace(/\./g, '\\.');
194
+ }).join('|'), ")")), 'http://$1');
164
195
  }
165
- return result;
166
- }
167
- async refreshAuthToken() {
168
- return this.api.refreshAuthToken(this.config.authtoken);
169
- }
170
- async registerUser(params) {
171
- // TODO - need to
172
-
173
- return this.api.registerUser(params);
174
- }
175
- async loadUser(params) {
176
- return this.api.loadUser(params);
177
- }
178
- async loadCurrentUser() {
179
- return this.api.loadCurrentUser();
180
- }
181
- async loadCurrentUserExtended() {
182
- return this.api.loadCurrentUserExtended();
183
- }
184
- async getCurrentUser() {
185
- return this.api.getCurrentUser();
186
- }
187
- async confirmUserEmail(params) {
188
- return this.api.confirmUserEmail(params);
189
- }
190
-
191
- //
192
- // create and upload files
193
- //
194
- async createFile(data = {}) {
195
- return this.api.createFile(data);
196
- }
197
- async loadFile(id) {
198
- return this.api.loadFile(id);
199
- }
200
- async loadFiles(ids) {
201
- return this.api.loadFiles(ids);
202
- }
203
-
204
- //
205
- //
206
- //
207
- async create(params, data = {}) {
208
- return this.api.create(params, data);
209
- }
210
- async load(type, ids, options) {
211
- return this.api.load(type, ids, options);
212
- }
213
- async query(type, params) {
214
- return this.api.query(type, params);
215
- }
216
-
217
- // WebSocket methods
218
- getWebSocketClient() {
219
- return this.api.getWebSocketClient();
220
- }
221
- closeWebSocket() {
222
- return this.api.closeWebSocket();
223
- }
224
196
 
225
- //
226
- //
227
- //
228
- async runTask(params, callbacks) {
229
- return this.api.runTask(params, callbacks);
230
- }
231
- async stopJob(params, callbacks) {
232
- return this.api.stopJob(params, callbacks);
233
- }
234
- async pollTaskProgress(params) {
235
- return this.api.pollTaskProgress(params);
236
- }
197
+ //
198
+ // User register, login, and refresh token
199
+ //
200
+ }, {
201
+ key: "login",
202
+ value: function () {
203
+ var _login = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(params) {
204
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
205
+ while (1) switch (_context.prev = _context.next) {
206
+ case 0:
207
+ return _context.abrupt("return", this.api.login(params));
208
+ case 1:
209
+ case "end":
210
+ return _context.stop();
211
+ }
212
+ }, _callee, this);
213
+ }));
214
+ function login(_x) {
215
+ return _login.apply(this, arguments);
216
+ }
217
+ return login;
218
+ }()
219
+ }, {
220
+ key: "loginWithOauth",
221
+ value: function () {
222
+ var _loginWithOauth = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params) {
223
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
224
+ while (1) switch (_context2.prev = _context2.next) {
225
+ case 0:
226
+ return _context2.abrupt("return", this.api.loginWithOauth(params));
227
+ case 1:
228
+ case "end":
229
+ return _context2.stop();
230
+ }
231
+ }, _callee2, this);
232
+ }));
233
+ function loginWithOauth(_x2) {
234
+ return _loginWithOauth.apply(this, arguments);
235
+ }
236
+ return loginWithOauth;
237
+ }()
238
+ }, {
239
+ key: "logout",
240
+ value: function () {
241
+ var _logout = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
242
+ var result;
243
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
244
+ while (1) switch (_context3.prev = _context3.next) {
245
+ case 0:
246
+ _context3.next = 2;
247
+ return this.api.logout();
248
+ case 2:
249
+ result = _context3.sent;
250
+ if (!this.config.localStorageAdaptor) {
251
+ _context3.next = 8;
252
+ break;
253
+ }
254
+ _context3.next = 6;
255
+ return this.config.localStorageAdaptor.removeItem('accessKey');
256
+ case 6:
257
+ _context3.next = 8;
258
+ return this.config.localStorageAdaptor.removeItem('authtoken');
259
+ case 8:
260
+ return _context3.abrupt("return", result);
261
+ case 9:
262
+ case "end":
263
+ return _context3.stop();
264
+ }
265
+ }, _callee3, this);
266
+ }));
267
+ function logout() {
268
+ return _logout.apply(this, arguments);
269
+ }
270
+ return logout;
271
+ }()
272
+ }, {
273
+ key: "refreshAuthToken",
274
+ value: function () {
275
+ var _refreshAuthToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
276
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
277
+ while (1) switch (_context4.prev = _context4.next) {
278
+ case 0:
279
+ return _context4.abrupt("return", this.api.refreshAuthToken(this.config.authtoken));
280
+ case 1:
281
+ case "end":
282
+ return _context4.stop();
283
+ }
284
+ }, _callee4, this);
285
+ }));
286
+ function refreshAuthToken() {
287
+ return _refreshAuthToken.apply(this, arguments);
288
+ }
289
+ return refreshAuthToken;
290
+ }()
291
+ }, {
292
+ key: "registerUser",
293
+ value: function () {
294
+ var _registerUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(params) {
295
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
296
+ while (1) switch (_context5.prev = _context5.next) {
297
+ case 0:
298
+ return _context5.abrupt("return", this.api.registerUser(params));
299
+ case 1:
300
+ case "end":
301
+ return _context5.stop();
302
+ }
303
+ }, _callee5, this);
304
+ }));
305
+ function registerUser(_x3) {
306
+ return _registerUser.apply(this, arguments);
307
+ }
308
+ return registerUser;
309
+ }()
310
+ }, {
311
+ key: "loadUser",
312
+ value: function () {
313
+ var _loadUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(params) {
314
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
315
+ while (1) switch (_context6.prev = _context6.next) {
316
+ case 0:
317
+ return _context6.abrupt("return", this.api.loadUser(params));
318
+ case 1:
319
+ case "end":
320
+ return _context6.stop();
321
+ }
322
+ }, _callee6, this);
323
+ }));
324
+ function loadUser(_x4) {
325
+ return _loadUser.apply(this, arguments);
326
+ }
327
+ return loadUser;
328
+ }()
329
+ }, {
330
+ key: "loadCurrentUser",
331
+ value: function () {
332
+ var _loadCurrentUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
333
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
334
+ while (1) switch (_context7.prev = _context7.next) {
335
+ case 0:
336
+ return _context7.abrupt("return", this.api.loadCurrentUser());
337
+ case 1:
338
+ case "end":
339
+ return _context7.stop();
340
+ }
341
+ }, _callee7, this);
342
+ }));
343
+ function loadCurrentUser() {
344
+ return _loadCurrentUser.apply(this, arguments);
345
+ }
346
+ return loadCurrentUser;
347
+ }()
348
+ }, {
349
+ key: "loadCurrentUserExtended",
350
+ value: function () {
351
+ var _loadCurrentUserExtended = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
352
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
353
+ while (1) switch (_context8.prev = _context8.next) {
354
+ case 0:
355
+ return _context8.abrupt("return", this.api.loadCurrentUserExtended());
356
+ case 1:
357
+ case "end":
358
+ return _context8.stop();
359
+ }
360
+ }, _callee8, this);
361
+ }));
362
+ function loadCurrentUserExtended() {
363
+ return _loadCurrentUserExtended.apply(this, arguments);
364
+ }
365
+ return loadCurrentUserExtended;
366
+ }()
367
+ }, {
368
+ key: "getCurrentUser",
369
+ value: function () {
370
+ var _getCurrentUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
371
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
372
+ while (1) switch (_context9.prev = _context9.next) {
373
+ case 0:
374
+ return _context9.abrupt("return", this.api.getCurrentUser());
375
+ case 1:
376
+ case "end":
377
+ return _context9.stop();
378
+ }
379
+ }, _callee9, this);
380
+ }));
381
+ function getCurrentUser() {
382
+ return _getCurrentUser.apply(this, arguments);
383
+ }
384
+ return getCurrentUser;
385
+ }()
386
+ }, {
387
+ key: "confirmUserEmail",
388
+ value: function () {
389
+ var _confirmUserEmail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(params) {
390
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
391
+ while (1) switch (_context10.prev = _context10.next) {
392
+ case 0:
393
+ return _context10.abrupt("return", this.api.confirmUserEmail(params));
394
+ case 1:
395
+ case "end":
396
+ return _context10.stop();
397
+ }
398
+ }, _callee10, this);
399
+ }));
400
+ function confirmUserEmail(_x5) {
401
+ return _confirmUserEmail.apply(this, arguments);
402
+ }
403
+ return confirmUserEmail;
404
+ }() //
405
+ // create and upload files
406
+ //
407
+ }, {
408
+ key: "createFile",
409
+ value: function () {
410
+ var _createFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
411
+ var data,
412
+ _args11 = arguments;
413
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
414
+ while (1) switch (_context11.prev = _context11.next) {
415
+ case 0:
416
+ data = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : {};
417
+ return _context11.abrupt("return", this.api.createFile(data));
418
+ case 2:
419
+ case "end":
420
+ return _context11.stop();
421
+ }
422
+ }, _callee11, this);
423
+ }));
424
+ function createFile() {
425
+ return _createFile.apply(this, arguments);
426
+ }
427
+ return createFile;
428
+ }()
429
+ }, {
430
+ key: "loadFile",
431
+ value: function () {
432
+ var _loadFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(id) {
433
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
434
+ while (1) switch (_context12.prev = _context12.next) {
435
+ case 0:
436
+ return _context12.abrupt("return", this.api.loadFile(id));
437
+ case 1:
438
+ case "end":
439
+ return _context12.stop();
440
+ }
441
+ }, _callee12, this);
442
+ }));
443
+ function loadFile(_x6) {
444
+ return _loadFile.apply(this, arguments);
445
+ }
446
+ return loadFile;
447
+ }()
448
+ }, {
449
+ key: "loadFiles",
450
+ value: function () {
451
+ var _loadFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(ids) {
452
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
453
+ while (1) switch (_context13.prev = _context13.next) {
454
+ case 0:
455
+ return _context13.abrupt("return", this.api.loadFiles(ids));
456
+ case 1:
457
+ case "end":
458
+ return _context13.stop();
459
+ }
460
+ }, _callee13, this);
461
+ }));
462
+ function loadFiles(_x7) {
463
+ return _loadFiles.apply(this, arguments);
464
+ }
465
+ return loadFiles;
466
+ }() //
467
+ //
468
+ //
469
+ }, {
470
+ key: "create",
471
+ value: function () {
472
+ var _create = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(params) {
473
+ var data,
474
+ _args14 = arguments;
475
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
476
+ while (1) switch (_context14.prev = _context14.next) {
477
+ case 0:
478
+ data = _args14.length > 1 && _args14[1] !== undefined ? _args14[1] : {};
479
+ return _context14.abrupt("return", this.api.create(params, data));
480
+ case 2:
481
+ case "end":
482
+ return _context14.stop();
483
+ }
484
+ }, _callee14, this);
485
+ }));
486
+ function create(_x8) {
487
+ return _create.apply(this, arguments);
488
+ }
489
+ return create;
490
+ }()
491
+ }, {
492
+ key: "load",
493
+ value: function () {
494
+ var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(type, ids, options) {
495
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
496
+ while (1) switch (_context15.prev = _context15.next) {
497
+ case 0:
498
+ return _context15.abrupt("return", this.api.load(type, ids, options));
499
+ case 1:
500
+ case "end":
501
+ return _context15.stop();
502
+ }
503
+ }, _callee15, this);
504
+ }));
505
+ function load(_x9, _x10, _x11) {
506
+ return _load.apply(this, arguments);
507
+ }
508
+ return load;
509
+ }()
510
+ }, {
511
+ key: "query",
512
+ value: function () {
513
+ var _query = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(type, params) {
514
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
515
+ while (1) switch (_context16.prev = _context16.next) {
516
+ case 0:
517
+ return _context16.abrupt("return", this.api.query(type, params));
518
+ case 1:
519
+ case "end":
520
+ return _context16.stop();
521
+ }
522
+ }, _callee16, this);
523
+ }));
524
+ function query(_x12, _x13) {
525
+ return _query.apply(this, arguments);
526
+ }
527
+ return query;
528
+ }() // WebSocket methods
529
+ }, {
530
+ key: "getWebSocketClient",
531
+ value: function getWebSocketClient() {
532
+ return this.api.getWebSocketClient();
533
+ }
534
+ }, {
535
+ key: "closeWebSocket",
536
+ value: function closeWebSocket() {
537
+ return this.api.closeWebSocket();
538
+ }
237
539
 
238
- //
239
- // Get/Post to endpoint with Roboto authtoken
240
- //
241
- async get(endpoint, params) {
242
- return this.api.get(endpoint, params);
243
- }
244
- async post(endpoint, data) {
245
- return this.api.post(endpoint, data);
246
- }
247
- }
540
+ //
541
+ //
542
+ //
543
+ }, {
544
+ key: "runTask",
545
+ value: function () {
546
+ var _runTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(params, callbacks) {
547
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
548
+ while (1) switch (_context17.prev = _context17.next) {
549
+ case 0:
550
+ return _context17.abrupt("return", this.api.runTask(params, callbacks));
551
+ case 1:
552
+ case "end":
553
+ return _context17.stop();
554
+ }
555
+ }, _callee17, this);
556
+ }));
557
+ function runTask(_x14, _x15) {
558
+ return _runTask.apply(this, arguments);
559
+ }
560
+ return runTask;
561
+ }()
562
+ }, {
563
+ key: "stopJob",
564
+ value: function () {
565
+ var _stopJob = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(params, callbacks) {
566
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
567
+ while (1) switch (_context18.prev = _context18.next) {
568
+ case 0:
569
+ return _context18.abrupt("return", this.api.stopJob(params, callbacks));
570
+ case 1:
571
+ case "end":
572
+ return _context18.stop();
573
+ }
574
+ }, _callee18, this);
575
+ }));
576
+ function stopJob(_x16, _x17) {
577
+ return _stopJob.apply(this, arguments);
578
+ }
579
+ return stopJob;
580
+ }()
581
+ }, {
582
+ key: "pollTaskProgress",
583
+ value: function () {
584
+ var _pollTaskProgress = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(params) {
585
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
586
+ while (1) switch (_context19.prev = _context19.next) {
587
+ case 0:
588
+ return _context19.abrupt("return", this.api.pollTaskProgress(params));
589
+ case 1:
590
+ case "end":
591
+ return _context19.stop();
592
+ }
593
+ }, _callee19, this);
594
+ }));
595
+ function pollTaskProgress(_x18) {
596
+ return _pollTaskProgress.apply(this, arguments);
597
+ }
598
+ return pollTaskProgress;
599
+ }() //
600
+ // Get/Post to endpoint with Roboto authtoken
601
+ //
602
+ }, {
603
+ key: "get",
604
+ value: function () {
605
+ var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(endpoint, params) {
606
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
607
+ while (1) switch (_context20.prev = _context20.next) {
608
+ case 0:
609
+ return _context20.abrupt("return", this.api.get(endpoint, params));
610
+ case 1:
611
+ case "end":
612
+ return _context20.stop();
613
+ }
614
+ }, _callee20, this);
615
+ }));
616
+ function get(_x19, _x20) {
617
+ return _get.apply(this, arguments);
618
+ }
619
+ return get;
620
+ }()
621
+ }, {
622
+ key: "post",
623
+ value: function () {
624
+ var _post = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(endpoint, data) {
625
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
626
+ while (1) switch (_context21.prev = _context21.next) {
627
+ case 0:
628
+ return _context21.abrupt("return", this.api.post(endpoint, data));
629
+ case 1:
630
+ case "end":
631
+ return _context21.stop();
632
+ }
633
+ }, _callee21, this);
634
+ }));
635
+ function post(_x21, _x22) {
636
+ return _post.apply(this, arguments);
637
+ }
638
+ return post;
639
+ }()
640
+ }]);
641
+ return Roboto;
642
+ }();
643
+ export { Roboto as default };