roboto-js 1.8.7 → 1.8.8

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/.last-build CHANGED
@@ -1 +1 @@
1
- 2025-11-05T08:58:03.769Z
1
+ 2025-11-12T07:28:57.602Z
@@ -102,19 +102,23 @@ var Roboto = exports["default"] = /*#__PURE__*/function () {
102
102
  this.config.baseUrl = this._stripHttpsForDomains(this.config.baseUrl, ['localhost']);
103
103
 
104
104
  // Check if a request object is provided
105
- if (proxyReq && proxyReq.headers) {
106
- var header_authtoken = proxyReq.headers.authtoken;
107
- var header_accesskey = proxyReq.headers.accesskey;
108
- var header_apikey = proxyReq.headers.apikey;
105
+ if (proxyReq) {
106
+ var _proxyReq$headers, _proxyReq$headers2, _proxyReq$headers3;
107
+ // First priority: properties set by middleware (supports cookie-based auth)
108
+ // Second priority: custom headers (backward compatibility)
109
+ var req_authtoken = proxyReq.authToken || ((_proxyReq$headers = proxyReq.headers) === null || _proxyReq$headers === void 0 ? void 0 : _proxyReq$headers.authtoken);
110
+ var req_accesskey = proxyReq.accessKey || ((_proxyReq$headers2 = proxyReq.headers) === null || _proxyReq$headers2 === void 0 ? void 0 : _proxyReq$headers2.accesskey);
111
+ var req_apikey = proxyReq.apiKey || ((_proxyReq$headers3 = proxyReq.headers) === null || _proxyReq$headers3 === void 0 ? void 0 : _proxyReq$headers3.apikey);
112
+
109
113
  // Optionally add more headers as needed
110
- if (header_authtoken) {
111
- this.config.authtoken = header_authtoken; // Set the authtoken in the config
114
+ if (req_authtoken) {
115
+ this.config.authtoken = req_authtoken; // Set the authtoken in the config
112
116
  }
113
- if (header_apikey) {
114
- this.config.apikey = header_apikey; // Set the authtoken in the config
117
+ if (req_apikey) {
118
+ this.config.apikey = req_apikey; // Set the apikey in the config
115
119
  }
116
- if (header_accesskey) {
117
- this.config.accesskey = header_accesskey; // Set the accesskey in the config
120
+ if (req_accesskey) {
121
+ this.config.accesskey = req_accesskey; // Set the accesskey in the config
118
122
  }
119
123
  }
120
124
  this.api = new _rbt_api["default"](this.config);
package/dist/esm/index.js CHANGED
@@ -75,19 +75,23 @@ var Roboto = /*#__PURE__*/function () {
75
75
  this.config.baseUrl = this._stripHttpsForDomains(this.config.baseUrl, ['localhost']);
76
76
 
77
77
  // Check if a request object is provided
78
- if (proxyReq && proxyReq.headers) {
79
- var header_authtoken = proxyReq.headers.authtoken;
80
- var header_accesskey = proxyReq.headers.accesskey;
81
- var header_apikey = proxyReq.headers.apikey;
78
+ if (proxyReq) {
79
+ var _proxyReq$headers, _proxyReq$headers2, _proxyReq$headers3;
80
+ // First priority: properties set by middleware (supports cookie-based auth)
81
+ // Second priority: custom headers (backward compatibility)
82
+ var req_authtoken = proxyReq.authToken || ((_proxyReq$headers = proxyReq.headers) === null || _proxyReq$headers === void 0 ? void 0 : _proxyReq$headers.authtoken);
83
+ var req_accesskey = proxyReq.accessKey || ((_proxyReq$headers2 = proxyReq.headers) === null || _proxyReq$headers2 === void 0 ? void 0 : _proxyReq$headers2.accesskey);
84
+ var req_apikey = proxyReq.apiKey || ((_proxyReq$headers3 = proxyReq.headers) === null || _proxyReq$headers3 === void 0 ? void 0 : _proxyReq$headers3.apikey);
85
+
82
86
  // Optionally add more headers as needed
83
- if (header_authtoken) {
84
- this.config.authtoken = header_authtoken; // Set the authtoken in the config
87
+ if (req_authtoken) {
88
+ this.config.authtoken = req_authtoken; // Set the authtoken in the config
85
89
  }
86
- if (header_apikey) {
87
- this.config.apikey = header_apikey; // Set the authtoken in the config
90
+ if (req_apikey) {
91
+ this.config.apikey = req_apikey; // Set the apikey in the config
88
92
  }
89
- if (header_accesskey) {
90
- this.config.accesskey = header_accesskey; // Set the accesskey in the config
93
+ if (req_accesskey) {
94
+ this.config.accesskey = req_accesskey; // Set the accesskey in the config
91
95
  }
92
96
  }
93
97
  this.api = new RbtApi(this.config);
@@ -66,7 +66,9 @@ var RbtObject = /*#__PURE__*/function () {
66
66
  return _createClass(RbtObject, [{
67
67
  key: "get",
68
68
  value: function get(path) {
69
- return _.get(this._data, path);
69
+ var value = _.get(this._data, path);
70
+ // Return a deep clone to prevent reference issues when modifying returned objects
71
+ return _.cloneDeep(value);
70
72
  }
71
73
  }, {
72
74
  key: "getData",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "roboto-js",
3
- "version": "1.8.7",
3
+ "version": "1.8.8",
4
4
  "type": "module",
5
5
  "description": "",
6
6
  "main": "dist/cjs/index.cjs",
package/src/index.js CHANGED
@@ -70,19 +70,22 @@ export default class Roboto{
70
70
  this.config.baseUrl = this._stripHttpsForDomains(this.config.baseUrl, ['localhost']);
71
71
 
72
72
  // Check if a request object is provided
73
- if (proxyReq && proxyReq.headers) {
74
- const header_authtoken = proxyReq.headers.authtoken;
75
- const header_accesskey = proxyReq.headers.accesskey;
76
- const header_apikey = proxyReq.headers.apikey;
73
+ if (proxyReq) {
74
+ // First priority: properties set by middleware (supports cookie-based auth)
75
+ // Second priority: custom headers (backward compatibility)
76
+ const req_authtoken = proxyReq.authToken || proxyReq.headers?.authtoken;
77
+ const req_accesskey = proxyReq.accessKey || proxyReq.headers?.accesskey;
78
+ const req_apikey = proxyReq.apiKey || proxyReq.headers?.apikey;
79
+
77
80
  // Optionally add more headers as needed
78
- if (header_authtoken) {
79
- this.config.authtoken = header_authtoken; // Set the authtoken in the config
81
+ if (req_authtoken) {
82
+ this.config.authtoken = req_authtoken; // Set the authtoken in the config
80
83
  }
81
- if (header_apikey) {
82
- this.config.apikey = header_apikey; // Set the authtoken in the config
84
+ if (req_apikey) {
85
+ this.config.apikey = req_apikey; // Set the apikey in the config
83
86
  }
84
- if (header_accesskey) {
85
- this.config.accesskey = header_accesskey; // Set the accesskey in the config
87
+ if (req_accesskey) {
88
+ this.config.accesskey = req_accesskey; // Set the accesskey in the config
86
89
  }
87
90
 
88
91
  }