roboto-js 1.1.8 → 1.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -33,8 +33,8 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
33
33
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
34
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); } }
35
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; }
36
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
37
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
36
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
37
+ 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); }
38
38
  var Roboto = exports["default"] = /*#__PURE__*/function () {
39
39
  function Roboto() {
40
40
  var proxyReq = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
@@ -50,6 +50,11 @@ var Roboto = exports["default"] = /*#__PURE__*/function () {
50
50
  baseUrl: 'https://' + (isBrowser ? process.env.NEXT_PUBLIC_ROBOTO_HOST : process.env.ROBOTO_HOST)
51
51
  };
52
52
 
53
+ // DEVELOPMENT
54
+ if (this.config.baseUrl.indexOf('rbt.dorfio') !== -1) {
55
+ this.config.baseUrl = 'http://rbt.dorfio.com';
56
+ }
57
+
53
58
  // Check if a request object is provided
54
59
  if (proxyReq && proxyReq.headers) {
55
60
  var authtoken = proxyReq.headers.authtoken;
@@ -58,11 +63,12 @@ var Roboto = exports["default"] = /*#__PURE__*/function () {
58
63
  if (authtoken) {
59
64
  this.config.authtoken = authtoken; // Set the authtoken in the config
60
65
  }
61
-
62
66
  if (accesskey) {
63
67
  this.config.accesskey = accesskey; // Set the accesskey in the config
64
68
  }
65
69
  }
70
+ http:
71
+ //localhost:3002
66
72
 
67
73
  this.api = new _rbt_api["default"](this.config);
68
74
  if (isBrowser) {
@@ -71,6 +77,11 @@ var Roboto = exports["default"] = /*#__PURE__*/function () {
71
77
  Roboto.instance = this;
72
78
  }
73
79
  _createClass(Roboto, [{
80
+ key: "setAppServiceHost",
81
+ value: function setAppServiceHost(host) {
82
+ this.api.setAppServiceHost(host);
83
+ }
84
+ }, {
74
85
  key: "setErrorHandler",
75
86
  value: function setErrorHandler(customErrorHandler) {
76
87
  if (this.api) {
@@ -22,8 +22,8 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
22
22
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
23
23
  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); } }
24
24
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
25
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
26
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
25
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
26
+ 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); }
27
27
  var RbtApi = exports["default"] = /*#__PURE__*/function () {
28
28
  function RbtApi(_ref) {
29
29
  var apiKey = _ref.apiKey,
@@ -43,6 +43,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
43
43
  this.localDb = null;
44
44
  this.iac_session = null;
45
45
  this.authtoken = authTokenToUse;
46
+ this.appServiceHost = null;
46
47
  }
47
48
  _createClass(RbtApi, [{
48
49
  key: "initLocalDb",
@@ -74,6 +75,13 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
74
75
  }
75
76
  return initLocalDb;
76
77
  }()
78
+ }, {
79
+ key: "setAppServiceHost",
80
+ value: function setAppServiceHost(host) {
81
+ this.appServiceHost = host;
82
+ this.axios.defaults.baseURL = host;
83
+ }
84
+
77
85
  /**
78
86
  * Logs in a user and stores the authToken.
79
87
  *
@@ -84,7 +92,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
84
92
  */
85
93
  }, {
86
94
  key: "login",
87
- value: function () {
95
+ value: (function () {
88
96
  var _login = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params) {
89
97
  var hash_password, response;
90
98
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
@@ -128,7 +136,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
128
136
  return _login.apply(this, arguments);
129
137
  }
130
138
  return login;
131
- }()
139
+ }())
132
140
  }, {
133
141
  key: "logout",
134
142
  value: function () {
@@ -337,7 +345,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
337
345
  */
338
346
  }, {
339
347
  key: "registerUser",
340
- value: function () {
348
+ value: (function () {
341
349
  var _registerUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
342
350
  var dataHash,
343
351
  response,
@@ -377,9 +385,10 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
377
385
  * @returns {Promise<RbtFile>} - The newly created file as an RbtFile.
378
386
  *
379
387
  */
388
+ )
380
389
  }, {
381
390
  key: "createFile",
382
- value: function () {
391
+ value: (function () {
383
392
  var _createFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(dataHash) {
384
393
  var response, record;
385
394
  return _regeneratorRuntime().wrap(function _callee9$(_context9) {
@@ -417,9 +426,10 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
417
426
  * @param {Object} dataHash - The data for the new object.
418
427
  * @returns {Promise<RbtObject>} - The newly created object as an RbtObject.
419
428
  */
429
+ )
420
430
  }, {
421
431
  key: "create",
422
- value: function () {
432
+ value: (function () {
423
433
  var _create = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(type) {
424
434
  var dataHash,
425
435
  response,
@@ -484,9 +494,10 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
484
494
  *
485
495
  * Note: A default orderBy is applied if none is provided, ordering items by 'timeCreated' in descending order.
486
496
  */
497
+ )
487
498
  }, {
488
499
  key: "query",
489
- value: function () {
500
+ value: (function () {
490
501
  var _query = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(type) {
491
502
  var _this = this;
492
503
  var params,
@@ -558,9 +569,10 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
558
569
  *
559
570
  * @returns {Promise<RbtObject|RbtObject[]>} - The loaded object(s) as RbtObject(s).
560
571
  */
572
+ )
561
573
  }, {
562
574
  key: "load",
563
- value: function () {
575
+ value: (function () {
564
576
  var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(type, ids) {
565
577
  var params,
566
578
  mergedParams,
@@ -619,9 +631,10 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
619
631
  * status: string // Can be 'RUNNING', 'DONE', or 'ERROR'
620
632
  * }
621
633
  */
634
+ )
622
635
  }, {
623
636
  key: "runTask",
624
- value: function () {
637
+ value: (function () {
625
638
  var _runTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
626
639
  var params,
627
640
  callbacks,
@@ -715,9 +728,10 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
715
728
  * and reports back via the provided callback function. The polling stops when
716
729
  * the task is completed or an error occurs.
717
730
  */
731
+ )
718
732
  }, {
719
733
  key: "pollTaskProgress",
720
- value: function () {
734
+ value: (function () {
721
735
  var _pollTaskProgress = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(jobId, callbacks) {
722
736
  var _this2 = this;
723
737
  var onProgress, onError, onFinish, checkProgress;
@@ -797,9 +811,10 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
797
811
  * @param {Object} [params={}] - Optional parameters to be sent with the request.
798
812
  * @returns {Promise<Object>} - The response data from the API.
799
813
  */
814
+ )
800
815
  }, {
801
816
  key: "get",
802
- value: function () {
817
+ value: (function () {
803
818
  var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(endpoint) {
804
819
  var params,
805
820
  headers,
@@ -855,9 +870,10 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
855
870
  * @param {Object} [data={}] - Data to be sent in the body of the POST request.
856
871
  * @returns {Promise<Object>} - The response data from the API.
857
872
  */
873
+ )
858
874
  }, {
859
875
  key: "post",
860
- value: function () {
876
+ value: (function () {
861
877
  var _post = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(endpoint) {
862
878
  var data,
863
879
  headers,
@@ -899,7 +915,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
899
915
  return _post.apply(this, arguments);
900
916
  }
901
917
  return post;
902
- }()
918
+ }())
903
919
  }, {
904
920
  key: "setErrorHandler",
905
921
  value: function setErrorHandler(customErrorHandler) {
@@ -16,26 +16,25 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
16
16
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
17
17
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
18
18
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
19
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
20
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
21
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
19
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
22
20
  function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
23
21
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
24
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
22
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
25
23
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
24
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
25
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
26
26
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
27
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
28
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
27
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
28
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
29
29
  // Make sure to use a browser-compatible version if in the browser
30
30
  var RbtFile = exports["default"] = /*#__PURE__*/function (_EventEmitter) {
31
31
  _inherits(RbtFile, _EventEmitter);
32
- var _super = _createSuper(RbtFile);
33
32
  // 1MB, for example
34
33
 
35
34
  function RbtFile(record, axiosInstance, localDb) {
36
35
  var _this;
37
36
  _classCallCheck(this, RbtFile);
38
- _this = _super.call(this); // Call the constructor of EventEmitter
37
+ _this = _callSuper(this, RbtFile); // Call the constructor of EventEmitter
39
38
  _this.id = record.id;
40
39
  _this._axios = axiosInstance;
41
40
  _this._internalData = record;
@@ -16,8 +16,8 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
16
16
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
17
17
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
18
18
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
19
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
20
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
19
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
20
+ 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); }
21
21
  var RbtObject = exports["default"] = /*#__PURE__*/function () {
22
22
  function RbtObject(record, axiosInstance) {
23
23
  var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
@@ -16,8 +16,8 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
16
16
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
17
17
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
18
18
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
19
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
20
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
19
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
20
+ 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); }
21
21
  var RbtUser = exports["default"] = /*#__PURE__*/function () {
22
22
  function RbtUser(record, axiosInstance) {
23
23
  var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
package/dist/esm/index.js CHANGED
@@ -33,8 +33,8 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
33
33
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
34
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); } }
35
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; }
36
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
37
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
36
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
37
+ 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); }
38
38
  var Roboto = exports["default"] = /*#__PURE__*/function () {
39
39
  function Roboto() {
40
40
  var proxyReq = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
@@ -50,6 +50,11 @@ var Roboto = exports["default"] = /*#__PURE__*/function () {
50
50
  baseUrl: 'https://' + (isBrowser ? process.env.NEXT_PUBLIC_ROBOTO_HOST : process.env.ROBOTO_HOST)
51
51
  };
52
52
 
53
+ // DEVELOPMENT
54
+ if (this.config.baseUrl.indexOf('rbt.dorfio') !== -1) {
55
+ this.config.baseUrl = 'http://rbt.dorfio.com';
56
+ }
57
+
53
58
  // Check if a request object is provided
54
59
  if (proxyReq && proxyReq.headers) {
55
60
  var authtoken = proxyReq.headers.authtoken;
@@ -58,11 +63,12 @@ var Roboto = exports["default"] = /*#__PURE__*/function () {
58
63
  if (authtoken) {
59
64
  this.config.authtoken = authtoken; // Set the authtoken in the config
60
65
  }
61
-
62
66
  if (accesskey) {
63
67
  this.config.accesskey = accesskey; // Set the accesskey in the config
64
68
  }
65
69
  }
70
+ http:
71
+ //localhost:3002
66
72
 
67
73
  this.api = new _rbt_api["default"](this.config);
68
74
  if (isBrowser) {
@@ -71,6 +77,11 @@ var Roboto = exports["default"] = /*#__PURE__*/function () {
71
77
  Roboto.instance = this;
72
78
  }
73
79
  _createClass(Roboto, [{
80
+ key: "setAppServiceHost",
81
+ value: function setAppServiceHost(host) {
82
+ this.api.setAppServiceHost(host);
83
+ }
84
+ }, {
74
85
  key: "setErrorHandler",
75
86
  value: function setErrorHandler(customErrorHandler) {
76
87
  if (this.api) {
@@ -22,8 +22,8 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
22
22
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
23
23
  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); } }
24
24
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
25
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
26
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
25
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
26
+ 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); }
27
27
  var RbtApi = exports["default"] = /*#__PURE__*/function () {
28
28
  function RbtApi(_ref) {
29
29
  var apiKey = _ref.apiKey,
@@ -43,6 +43,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
43
43
  this.localDb = null;
44
44
  this.iac_session = null;
45
45
  this.authtoken = authTokenToUse;
46
+ this.appServiceHost = null;
46
47
  }
47
48
  _createClass(RbtApi, [{
48
49
  key: "initLocalDb",
@@ -74,6 +75,13 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
74
75
  }
75
76
  return initLocalDb;
76
77
  }()
78
+ }, {
79
+ key: "setAppServiceHost",
80
+ value: function setAppServiceHost(host) {
81
+ this.appServiceHost = host;
82
+ this.axios.defaults.baseURL = host;
83
+ }
84
+
77
85
  /**
78
86
  * Logs in a user and stores the authToken.
79
87
  *
@@ -84,7 +92,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
84
92
  */
85
93
  }, {
86
94
  key: "login",
87
- value: function () {
95
+ value: (function () {
88
96
  var _login = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params) {
89
97
  var hash_password, response;
90
98
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
@@ -128,7 +136,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
128
136
  return _login.apply(this, arguments);
129
137
  }
130
138
  return login;
131
- }()
139
+ }())
132
140
  }, {
133
141
  key: "logout",
134
142
  value: function () {
@@ -337,7 +345,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
337
345
  */
338
346
  }, {
339
347
  key: "registerUser",
340
- value: function () {
348
+ value: (function () {
341
349
  var _registerUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
342
350
  var dataHash,
343
351
  response,
@@ -377,9 +385,10 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
377
385
  * @returns {Promise<RbtFile>} - The newly created file as an RbtFile.
378
386
  *
379
387
  */
388
+ )
380
389
  }, {
381
390
  key: "createFile",
382
- value: function () {
391
+ value: (function () {
383
392
  var _createFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(dataHash) {
384
393
  var response, record;
385
394
  return _regeneratorRuntime().wrap(function _callee9$(_context9) {
@@ -417,9 +426,10 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
417
426
  * @param {Object} dataHash - The data for the new object.
418
427
  * @returns {Promise<RbtObject>} - The newly created object as an RbtObject.
419
428
  */
429
+ )
420
430
  }, {
421
431
  key: "create",
422
- value: function () {
432
+ value: (function () {
423
433
  var _create = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(type) {
424
434
  var dataHash,
425
435
  response,
@@ -484,9 +494,10 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
484
494
  *
485
495
  * Note: A default orderBy is applied if none is provided, ordering items by 'timeCreated' in descending order.
486
496
  */
497
+ )
487
498
  }, {
488
499
  key: "query",
489
- value: function () {
500
+ value: (function () {
490
501
  var _query = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(type) {
491
502
  var _this = this;
492
503
  var params,
@@ -558,9 +569,10 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
558
569
  *
559
570
  * @returns {Promise<RbtObject|RbtObject[]>} - The loaded object(s) as RbtObject(s).
560
571
  */
572
+ )
561
573
  }, {
562
574
  key: "load",
563
- value: function () {
575
+ value: (function () {
564
576
  var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(type, ids) {
565
577
  var params,
566
578
  mergedParams,
@@ -619,9 +631,10 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
619
631
  * status: string // Can be 'RUNNING', 'DONE', or 'ERROR'
620
632
  * }
621
633
  */
634
+ )
622
635
  }, {
623
636
  key: "runTask",
624
- value: function () {
637
+ value: (function () {
625
638
  var _runTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
626
639
  var params,
627
640
  callbacks,
@@ -715,9 +728,10 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
715
728
  * and reports back via the provided callback function. The polling stops when
716
729
  * the task is completed or an error occurs.
717
730
  */
731
+ )
718
732
  }, {
719
733
  key: "pollTaskProgress",
720
- value: function () {
734
+ value: (function () {
721
735
  var _pollTaskProgress = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(jobId, callbacks) {
722
736
  var _this2 = this;
723
737
  var onProgress, onError, onFinish, checkProgress;
@@ -797,9 +811,10 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
797
811
  * @param {Object} [params={}] - Optional parameters to be sent with the request.
798
812
  * @returns {Promise<Object>} - The response data from the API.
799
813
  */
814
+ )
800
815
  }, {
801
816
  key: "get",
802
- value: function () {
817
+ value: (function () {
803
818
  var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(endpoint) {
804
819
  var params,
805
820
  headers,
@@ -855,9 +870,10 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
855
870
  * @param {Object} [data={}] - Data to be sent in the body of the POST request.
856
871
  * @returns {Promise<Object>} - The response data from the API.
857
872
  */
873
+ )
858
874
  }, {
859
875
  key: "post",
860
- value: function () {
876
+ value: (function () {
861
877
  var _post = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(endpoint) {
862
878
  var data,
863
879
  headers,
@@ -899,7 +915,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
899
915
  return _post.apply(this, arguments);
900
916
  }
901
917
  return post;
902
- }()
918
+ }())
903
919
  }, {
904
920
  key: "setErrorHandler",
905
921
  value: function setErrorHandler(customErrorHandler) {
@@ -16,26 +16,25 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
16
16
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
17
17
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
18
18
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
19
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
20
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
21
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
19
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
22
20
  function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
23
21
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
24
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
22
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
25
23
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
24
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
25
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
26
26
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
27
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
28
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
27
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
28
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
29
29
  // Make sure to use a browser-compatible version if in the browser
30
30
  var RbtFile = exports["default"] = /*#__PURE__*/function (_EventEmitter) {
31
31
  _inherits(RbtFile, _EventEmitter);
32
- var _super = _createSuper(RbtFile);
33
32
  // 1MB, for example
34
33
 
35
34
  function RbtFile(record, axiosInstance, localDb) {
36
35
  var _this;
37
36
  _classCallCheck(this, RbtFile);
38
- _this = _super.call(this); // Call the constructor of EventEmitter
37
+ _this = _callSuper(this, RbtFile); // Call the constructor of EventEmitter
39
38
  _this.id = record.id;
40
39
  _this._axios = axiosInstance;
41
40
  _this._internalData = record;
@@ -16,8 +16,8 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
16
16
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
17
17
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
18
18
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
19
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
20
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
19
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
20
+ 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); }
21
21
  var RbtObject = exports["default"] = /*#__PURE__*/function () {
22
22
  function RbtObject(record, axiosInstance) {
23
23
  var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
@@ -16,8 +16,8 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
16
16
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
17
17
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
18
18
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
19
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
20
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
19
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
20
+ 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); }
21
21
  var RbtUser = exports["default"] = /*#__PURE__*/function () {
22
22
  function RbtUser(record, axiosInstance) {
23
23
  var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "roboto-js",
3
- "version": "1.1.8",
3
+ "version": "1.1.9",
4
4
  "type": "module",
5
5
  "description": "",
6
6
  "main": "dist/cjs/index.cjs",
package/src/index.js CHANGED
@@ -25,9 +25,14 @@ export default class Roboto{
25
25
 
26
26
  this.config = {
27
27
  apiKey: isBrowser ? process.env.NEXT_PUBLIC_ROBOTO_API_KEY : process.env.ROBOTO_API_KEY,
28
- baseUrl: 'https://' + (isBrowser ? process.env.NEXT_PUBLIC_ROBOTO_HOST : process.env.ROBOTO_HOST),
28
+ baseUrl: 'https://' + (isBrowser ? process.env.NEXT_PUBLIC_ROBOTO_HOST : process.env.ROBOTO_HOST)
29
29
  };
30
30
 
31
+ // DEVELOPMENT
32
+ if(this.config.baseUrl.indexOf('rbt.dorfio')!==-1){
33
+ this.config.baseUrl = 'http://rbt.dorfio.com';
34
+ }
35
+
31
36
  // Check if a request object is provided
32
37
  if (proxyReq && proxyReq.headers) {
33
38
  const authtoken = proxyReq.headers.authtoken;
@@ -40,7 +45,7 @@ export default class Roboto{
40
45
  this.config.accesskey = accesskey; // Set the accesskey in the config
41
46
  }
42
47
  }
43
-
48
+ http://localhost:3002
44
49
 
45
50
  this.api = new RbtApi(this.config);
46
51
  if(isBrowser){
@@ -51,6 +56,12 @@ export default class Roboto{
51
56
 
52
57
  }
53
58
 
59
+ setAppServiceHost(host){
60
+
61
+ this.api.setAppServiceHost(host);
62
+
63
+ }
64
+
54
65
  setErrorHandler(customErrorHandler) {
55
66
  if (this.api) {
56
67
  this.api.setErrorHandler(customErrorHandler);
package/src/rbt_api.js CHANGED
@@ -23,6 +23,8 @@ export default class RbtApi {
23
23
  this.localDb = null;
24
24
  this.iac_session = null;
25
25
  this.authtoken = authTokenToUse;
26
+ this.appServiceHost = null;
27
+
26
28
 
27
29
  }
28
30
 
@@ -38,6 +40,13 @@ export default class RbtApi {
38
40
 
39
41
  }
40
42
 
43
+ setAppServiceHost(host){
44
+
45
+ this.appServiceHost = host;
46
+ this.axios.defaults.baseURL = host;
47
+
48
+ }
49
+
41
50
  /**
42
51
  * Logs in a user and stores the authToken.
43
52
  *
@@ -51,6 +60,8 @@ export default class RbtApi {
51
60
 
52
61
  // create a md5 hash of the password using crypto-js
53
62
  const hash_password = CryptoJS.MD5(params.password).toString(CryptoJS.enc.Hex);
63
+
64
+
54
65
  const response = await this.axios.post('/user_service/loginUser', [{
55
66
  email: params.email,
56
67
  password: hash_password