roboto-js 1.2.2 → 1.3.1

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,12 @@ 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 _ref$proxyReq = _ref.proxyReq,
41
+ proxyReq = _ref$proxyReq === void 0 ? null : _ref$proxyReq,
42
+ host = _ref.host,
43
+ apiKey = _ref.apiKey;
41
44
  _classCallCheck(this, Roboto);
42
- debugger;
43
45
  if (Roboto.instance && !proxyReq) {
44
46
  // if on client, there can only be one instance
45
47
  // on server, with proxyReq, each request has its own instance
@@ -47,8 +49,9 @@ var Roboto = exports["default"] = /*#__PURE__*/function () {
47
49
  }
48
50
  var isBrowser = typeof window !== "undefined";
49
51
  this.config = {
50
- apiKey: process.env.ROBOTO_API_KEY,
51
- baseUrl: 'https://' + process.env.ROBOTO_HOST
52
+ apiKey: apiKey,
53
+ // Use passed apiKey
54
+ baseUrl: "https://".concat(host) // Use passed host
52
55
  };
53
56
 
54
57
  // DEVELOPMENT
@@ -66,9 +69,6 @@ var Roboto = exports["default"] = /*#__PURE__*/function () {
66
69
  this.config.accesskey = accesskey; // Set the accesskey in the config
67
70
  }
68
71
  }
69
- http:
70
- //localhost:3002
71
-
72
72
  this.api = new _rbt_api["default"](this.config);
73
73
  if (isBrowser) {
74
74
  this.api.initLocalDb();
package/dist/esm/index.js CHANGED
@@ -6,8 +6,11 @@ export { RbtApi, RbtObject, RbtFile
6
6
  //Site
7
7
  };
8
8
  export default class Roboto {
9
- constructor(proxyReq = null) {
10
- debugger;
9
+ constructor({
10
+ proxyReq = null,
11
+ host,
12
+ apiKey
13
+ }) {
11
14
  if (Roboto.instance && !proxyReq) {
12
15
  // if on client, there can only be one instance
13
16
  // on server, with proxyReq, each request has its own instance
@@ -15,8 +18,9 @@ export default class Roboto {
15
18
  }
16
19
  const isBrowser = typeof window !== "undefined";
17
20
  this.config = {
18
- apiKey: process.env.ROBOTO_API_KEY,
19
- baseUrl: 'https://' + process.env.ROBOTO_HOST
21
+ apiKey: apiKey,
22
+ // Use passed apiKey
23
+ baseUrl: `https://${host}` // Use passed host
20
24
  };
21
25
 
22
26
  // DEVELOPMENT
@@ -34,9 +38,6 @@ export default class Roboto {
34
38
  this.config.accesskey = accesskey; // Set the accesskey in the config
35
39
  }
36
40
  }
37
- http:
38
- //localhost:3002
39
-
40
41
  this.api = new RbtApi(this.config);
41
42
  if (isBrowser) {
42
43
  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.1",
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) {
17
-
18
- debugger;
19
-
20
- if(Roboto.instance && !proxyReq){
16
+ constructor({ proxyReq = null, host, apiKey }) {
17
+
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']);
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){