roboto-js 1.2.2 → 1.3.2

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.
@@ -36,10 +36,11 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
36
36
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
37
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
- function Roboto() {
40
- var proxyReq = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
39
+ function Roboto(_ref) {
40
+ var host = _ref.host,
41
+ apiKey = _ref.apiKey;
42
+ var proxyReq = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
41
43
  _classCallCheck(this, Roboto);
42
- debugger;
43
44
  if (Roboto.instance && !proxyReq) {
44
45
  // if on client, there can only be one instance
45
46
  // on server, with proxyReq, each request has its own instance
@@ -47,12 +48,13 @@ var Roboto = exports["default"] = /*#__PURE__*/function () {
47
48
  }
48
49
  var isBrowser = typeof window !== "undefined";
49
50
  this.config = {
50
- apiKey: process.env.ROBOTO_API_KEY,
51
- baseUrl: 'https://' + process.env.ROBOTO_HOST
51
+ apiKey: apiKey,
52
+ // Use passed apiKey
53
+ baseUrl: "https://".concat(host) // Use passed host
52
54
  };
53
55
 
54
56
  // DEVELOPMENT
55
- this.config.baseUrl = this._stripHttpsForDomains(this.config.baseUrl, ['localhost', 'rbt.dorfio.com']);
57
+ this.config.baseUrl = this._stripHttpsForDomains(this.config.baseUrl, ['localhost', 'rbt.dorfio.com', 'srv.dorfio.com']);
56
58
 
57
59
  // Check if a request object is provided
58
60
  if (proxyReq && proxyReq.headers) {
@@ -66,9 +68,6 @@ var Roboto = exports["default"] = /*#__PURE__*/function () {
66
68
  this.config.accesskey = accesskey; // Set the accesskey in the config
67
69
  }
68
70
  }
69
- http:
70
- //localhost:3002
71
-
72
71
  this.api = new _rbt_api["default"](this.config);
73
72
  if (isBrowser) {
74
73
  this.api.initLocalDb();
package/dist/esm/index.js CHANGED
@@ -6,8 +6,10 @@ export { RbtApi, RbtObject, RbtFile
6
6
  //Site
7
7
  };
8
8
  export default class Roboto {
9
- constructor(proxyReq = null) {
10
- debugger;
9
+ constructor({
10
+ host,
11
+ apiKey
12
+ }, proxyReq = null) {
11
13
  if (Roboto.instance && !proxyReq) {
12
14
  // if on client, there can only be one instance
13
15
  // on server, with proxyReq, each request has its own instance
@@ -15,12 +17,13 @@ export default class Roboto {
15
17
  }
16
18
  const isBrowser = typeof window !== "undefined";
17
19
  this.config = {
18
- apiKey: process.env.ROBOTO_API_KEY,
19
- baseUrl: 'https://' + process.env.ROBOTO_HOST
20
+ apiKey: apiKey,
21
+ // Use passed apiKey
22
+ baseUrl: `https://${host}` // Use passed host
20
23
  };
21
24
 
22
25
  // DEVELOPMENT
23
- this.config.baseUrl = this._stripHttpsForDomains(this.config.baseUrl, ['localhost', 'rbt.dorfio.com']);
26
+ this.config.baseUrl = this._stripHttpsForDomains(this.config.baseUrl, ['localhost', 'rbt.dorfio.com', 'srv.dorfio.com']);
24
27
 
25
28
  // Check if a request object is provided
26
29
  if (proxyReq && proxyReq.headers) {
@@ -34,9 +37,6 @@ export default class Roboto {
34
37
  this.config.accesskey = accesskey; // Set the accesskey in the config
35
38
  }
36
39
  }
37
- http:
38
- //localhost:3002
39
-
40
40
  this.api = new RbtApi(this.config);
41
41
  if (isBrowser) {
42
42
  this.api.initLocalDb();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "roboto-js",
3
- "version": "1.2.2",
3
+ "version": "1.3.2",
4
4
  "type": "module",
5
5
  "description": "",
6
6
  "main": "dist/cjs/index.cjs",
package/src/index.js CHANGED
@@ -13,11 +13,9 @@ export {
13
13
 
14
14
  export default class Roboto{
15
15
 
16
- constructor(proxyReq = null) {
16
+ constructor({ host, apiKey }, proxyReq = null) {
17
17
 
18
- debugger;
19
-
20
- if(Roboto.instance && !proxyReq){
18
+ if (Roboto.instance && !proxyReq) {
21
19
  // if on client, there can only be one instance
22
20
  // on server, with proxyReq, each request has its own instance
23
21
  return Roboto.instance;
@@ -26,13 +24,12 @@ export default class Roboto{
26
24
  const isBrowser = typeof window !== "undefined";
27
25
 
28
26
  this.config = {
29
- apiKey: process.env.ROBOTO_API_KEY,
30
- baseUrl: 'https://' + process.env.ROBOTO_HOST
27
+ apiKey: apiKey, // Use passed apiKey
28
+ baseUrl: `https://${host}` // Use passed host
31
29
  };
32
30
 
33
31
  // DEVELOPMENT
34
- this.config.baseUrl = this._stripHttpsForDomains(this.config.baseUrl, ['localhost','rbt.dorfio.com']);
35
-
32
+ this.config.baseUrl = this._stripHttpsForDomains(this.config.baseUrl, ['localhost', 'rbt.dorfio.com', 'srv.dorfio.com']);
36
33
 
37
34
  // Check if a request object is provided
38
35
  if (proxyReq && proxyReq.headers) {
@@ -46,15 +43,13 @@ export default class Roboto{
46
43
  this.config.accesskey = accesskey; // Set the accesskey in the config
47
44
  }
48
45
  }
49
- http://localhost:3002
50
46
 
51
47
  this.api = new RbtApi(this.config);
52
- if(isBrowser){
48
+ if (isBrowser) {
53
49
  this.api.initLocalDb();
54
50
  }
55
51
 
56
52
  Roboto.instance = this;
57
-
58
53
  }
59
54
 
60
55
  setAppServiceHost(host){