roboto-js 1.3.17 → 1.4.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.
- package/dist/cjs/index.cjs +7 -2
- package/dist/cjs/rbt_api.cjs +7 -1
- package/dist/cjs/rbt_object.cjs +14 -1
- package/dist/esm/index.js +5 -2
- package/dist/esm/rbt_api.js +7 -1
- package/dist/esm/rbt_object.js +9 -0
- package/package.json +1 -1
- package/src/index.js +8 -2
- package/src/rbt_api.js +7 -1
- package/src/rbt_object.js +12 -0
package/dist/cjs/index.cjs
CHANGED
|
@@ -57,7 +57,7 @@ var Roboto = exports["default"] = /*#__PURE__*/function () {
|
|
|
57
57
|
};
|
|
58
58
|
|
|
59
59
|
// DEVELOPMENT
|
|
60
|
-
this.config.baseUrl = this._stripHttpsForDomains(this.config.baseUrl, ['localhost'
|
|
60
|
+
this.config.baseUrl = this._stripHttpsForDomains(this.config.baseUrl, ['localhost']);
|
|
61
61
|
|
|
62
62
|
// Check if a request object is provided
|
|
63
63
|
if (proxyReq && proxyReq.headers) {
|
|
@@ -81,7 +81,7 @@ var Roboto = exports["default"] = /*#__PURE__*/function () {
|
|
|
81
81
|
key: "setAppServiceHost",
|
|
82
82
|
value: function setAppServiceHost(host) {
|
|
83
83
|
// DEVELOPMENT
|
|
84
|
-
host = this._stripHttpsForDomains(host, ['localhost'
|
|
84
|
+
host = this._stripHttpsForDomains(host, ['localhost']);
|
|
85
85
|
this.api.setAppServiceHost(host);
|
|
86
86
|
}
|
|
87
87
|
}, {
|
|
@@ -91,6 +91,11 @@ var Roboto = exports["default"] = /*#__PURE__*/function () {
|
|
|
91
91
|
this.api.setErrorHandler(customErrorHandler);
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
|
+
}, {
|
|
95
|
+
key: "recordToInstance",
|
|
96
|
+
value: function recordToInstance(recordHash) {
|
|
97
|
+
return new _rbt_object["default"](recordHash, this.api.axios);
|
|
98
|
+
}
|
|
94
99
|
}, {
|
|
95
100
|
key: "_stripHttpsForDomains",
|
|
96
101
|
value: function _stripHttpsForDomains(baseUrl, domains) {
|
package/dist/cjs/rbt_api.cjs
CHANGED
|
@@ -1031,7 +1031,13 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
1031
1031
|
if (res) return;
|
|
1032
1032
|
}
|
|
1033
1033
|
if (_lodash["default"].isObject(err) && _lodash["default"].get(err, 'response')) {
|
|
1034
|
-
|
|
1034
|
+
if (err.response) {
|
|
1035
|
+
console.log('Error response:', {
|
|
1036
|
+
data: err.response.data,
|
|
1037
|
+
status: err.response.status,
|
|
1038
|
+
headers: err.response.headers
|
|
1039
|
+
});
|
|
1040
|
+
}
|
|
1035
1041
|
var msg = _lodash["default"].get(err, 'response.data.message', 'Error in API response');
|
|
1036
1042
|
if (msg.key) {
|
|
1037
1043
|
throw new Error(msg.key);
|
package/dist/cjs/rbt_object.cjs
CHANGED
|
@@ -24,6 +24,7 @@ var RbtObject = exports["default"] = /*#__PURE__*/function () {
|
|
|
24
24
|
_classCallCheck(this, RbtObject);
|
|
25
25
|
this._axios = axiosInstance;
|
|
26
26
|
this._internalData = record;
|
|
27
|
+
this.isRbtObject = true;
|
|
27
28
|
this.id = record.id;
|
|
28
29
|
this.id_revision = record.id_revision;
|
|
29
30
|
this.rpcMeta = {
|
|
@@ -85,6 +86,17 @@ var RbtObject = exports["default"] = /*#__PURE__*/function () {
|
|
|
85
86
|
rpcMeta: this.rpcMeta
|
|
86
87
|
});
|
|
87
88
|
}
|
|
89
|
+
}, {
|
|
90
|
+
key: "serialize",
|
|
91
|
+
value: function serialize() {
|
|
92
|
+
return JSON.stringify(this.toRecord());
|
|
93
|
+
}
|
|
94
|
+
}, {
|
|
95
|
+
key: "deserialize",
|
|
96
|
+
value: function deserialize(strRecord) {
|
|
97
|
+
var record = JSON.parse(strRecord);
|
|
98
|
+
return new RbtObject(record, this._axios);
|
|
99
|
+
}
|
|
88
100
|
}, {
|
|
89
101
|
key: "clone",
|
|
90
102
|
value: function clone() {
|
|
@@ -137,9 +149,10 @@ var RbtObject = exports["default"] = /*#__PURE__*/function () {
|
|
|
137
149
|
_context.prev = 17;
|
|
138
150
|
_context.t0 = _context["catch"](2);
|
|
139
151
|
console.log('RbtObject.save.error:', _context.t0);
|
|
152
|
+
this._error = _context.t0;
|
|
140
153
|
//console.log(e.response.data);
|
|
141
154
|
throw _context.t0;
|
|
142
|
-
case
|
|
155
|
+
case 22:
|
|
143
156
|
case "end":
|
|
144
157
|
return _context.stop();
|
|
145
158
|
}
|
package/dist/esm/index.js
CHANGED
|
@@ -26,7 +26,7 @@ export default class Roboto {
|
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
// DEVELOPMENT
|
|
29
|
-
this.config.baseUrl = this._stripHttpsForDomains(this.config.baseUrl, ['localhost'
|
|
29
|
+
this.config.baseUrl = this._stripHttpsForDomains(this.config.baseUrl, ['localhost']);
|
|
30
30
|
|
|
31
31
|
// Check if a request object is provided
|
|
32
32
|
if (proxyReq && proxyReq.headers) {
|
|
@@ -48,7 +48,7 @@ export default class Roboto {
|
|
|
48
48
|
}
|
|
49
49
|
setAppServiceHost(host) {
|
|
50
50
|
// DEVELOPMENT
|
|
51
|
-
host = this._stripHttpsForDomains(host, ['localhost'
|
|
51
|
+
host = this._stripHttpsForDomains(host, ['localhost']);
|
|
52
52
|
this.api.setAppServiceHost(host);
|
|
53
53
|
}
|
|
54
54
|
setErrorHandler(customErrorHandler) {
|
|
@@ -56,6 +56,9 @@ export default class Roboto {
|
|
|
56
56
|
this.api.setErrorHandler(customErrorHandler);
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
+
recordToInstance(recordHash) {
|
|
60
|
+
return new RbtObject(recordHash, this.api.axios);
|
|
61
|
+
}
|
|
59
62
|
_stripHttpsForDomains(baseUrl, domains) {
|
|
60
63
|
return baseUrl.replace(new RegExp(`^https://(${domains.map(domain => domain.replace(/\./g, '\\.')).join('|')})`), 'http://$1');
|
|
61
64
|
}
|
package/dist/esm/rbt_api.js
CHANGED
|
@@ -568,7 +568,13 @@ export default class RbtApi {
|
|
|
568
568
|
if (res) return;
|
|
569
569
|
}
|
|
570
570
|
if (_.isObject(err) && _.get(err, 'response')) {
|
|
571
|
-
|
|
571
|
+
if (err.response) {
|
|
572
|
+
console.log('Error response:', {
|
|
573
|
+
data: err.response.data,
|
|
574
|
+
status: err.response.status,
|
|
575
|
+
headers: err.response.headers
|
|
576
|
+
});
|
|
577
|
+
}
|
|
572
578
|
const msg = _.get(err, 'response.data.message', 'Error in API response');
|
|
573
579
|
if (msg.key) {
|
|
574
580
|
throw new Error(msg.key);
|
package/dist/esm/rbt_object.js
CHANGED
|
@@ -3,6 +3,7 @@ export default class RbtObject {
|
|
|
3
3
|
constructor(record, axiosInstance, options = {}) {
|
|
4
4
|
this._axios = axiosInstance;
|
|
5
5
|
this._internalData = record;
|
|
6
|
+
this.isRbtObject = true;
|
|
6
7
|
this.id = record.id;
|
|
7
8
|
this.id_revision = record.id_revision;
|
|
8
9
|
this.rpcMeta = {
|
|
@@ -54,6 +55,13 @@ export default class RbtObject {
|
|
|
54
55
|
rpcMeta: this.rpcMeta
|
|
55
56
|
};
|
|
56
57
|
}
|
|
58
|
+
serialize() {
|
|
59
|
+
return JSON.stringify(this.toRecord());
|
|
60
|
+
}
|
|
61
|
+
deserialize(strRecord) {
|
|
62
|
+
let record = JSON.parse(strRecord);
|
|
63
|
+
return new RbtObject(record, this._axios);
|
|
64
|
+
}
|
|
57
65
|
clone() {
|
|
58
66
|
// Create a deep copy of the current object's data
|
|
59
67
|
const clonedData = _.cloneDeep(this._internalData);
|
|
@@ -86,6 +94,7 @@ export default class RbtObject {
|
|
|
86
94
|
return this;
|
|
87
95
|
} catch (e) {
|
|
88
96
|
console.log('RbtObject.save.error:', e);
|
|
97
|
+
this._error = e;
|
|
89
98
|
//console.log(e.response.data);
|
|
90
99
|
throw e;
|
|
91
100
|
}
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -30,7 +30,7 @@ export default class Roboto{
|
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
// DEVELOPMENT
|
|
33
|
-
this.config.baseUrl = this._stripHttpsForDomains(this.config.baseUrl, ['localhost'
|
|
33
|
+
this.config.baseUrl = this._stripHttpsForDomains(this.config.baseUrl, ['localhost']);
|
|
34
34
|
|
|
35
35
|
// Check if a request object is provided
|
|
36
36
|
if (proxyReq && proxyReq.headers) {
|
|
@@ -56,7 +56,7 @@ export default class Roboto{
|
|
|
56
56
|
setAppServiceHost(host){
|
|
57
57
|
|
|
58
58
|
// DEVELOPMENT
|
|
59
|
-
host = this._stripHttpsForDomains(host, ['localhost'
|
|
59
|
+
host = this._stripHttpsForDomains(host, ['localhost']);
|
|
60
60
|
|
|
61
61
|
this.api.setAppServiceHost(host);
|
|
62
62
|
|
|
@@ -68,6 +68,12 @@ export default class Roboto{
|
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
+
recordToInstance(recordHash){
|
|
72
|
+
|
|
73
|
+
return new RbtObject(recordHash, this.api.axios);
|
|
74
|
+
|
|
75
|
+
}
|
|
76
|
+
|
|
71
77
|
_stripHttpsForDomains(baseUrl, domains) {
|
|
72
78
|
return baseUrl.replace(new RegExp(`^https://(${domains.map(domain => domain.replace(/\./g, '\\.')).join('|')})`), 'http://$1');
|
|
73
79
|
}
|
package/src/rbt_api.js
CHANGED
|
@@ -593,7 +593,13 @@ export default class RbtApi {
|
|
|
593
593
|
|
|
594
594
|
if (_.isObject(err) && _.get(err, 'response')) {
|
|
595
595
|
|
|
596
|
-
|
|
596
|
+
if (err.response) {
|
|
597
|
+
console.log('Error response:', {
|
|
598
|
+
data: err.response.data,
|
|
599
|
+
status: err.response.status,
|
|
600
|
+
headers: err.response.headers
|
|
601
|
+
});
|
|
602
|
+
}
|
|
597
603
|
|
|
598
604
|
const msg = _.get(err, 'response.data.message', 'Error in API response');
|
|
599
605
|
|
package/src/rbt_object.js
CHANGED
|
@@ -5,6 +5,7 @@ export default class RbtObject {
|
|
|
5
5
|
constructor(record, axiosInstance, options = {}) {
|
|
6
6
|
this._axios = axiosInstance;
|
|
7
7
|
this._internalData = record;
|
|
8
|
+
this.isRbtObject = true;
|
|
8
9
|
this.id = record.id;
|
|
9
10
|
this.id_revision = record.id_revision;
|
|
10
11
|
this.rpcMeta = {
|
|
@@ -66,6 +67,16 @@ export default class RbtObject {
|
|
|
66
67
|
};
|
|
67
68
|
}
|
|
68
69
|
|
|
70
|
+
|
|
71
|
+
serialize(){
|
|
72
|
+
return JSON.stringify(this.toRecord());
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
deserialize(strRecord){
|
|
76
|
+
let record = JSON.parse(strRecord);
|
|
77
|
+
return new RbtObject(record, this._axios);
|
|
78
|
+
}
|
|
79
|
+
|
|
69
80
|
clone() {
|
|
70
81
|
// Create a deep copy of the current object's data
|
|
71
82
|
const clonedData = _.cloneDeep(this._internalData);
|
|
@@ -105,6 +116,7 @@ export default class RbtObject {
|
|
|
105
116
|
|
|
106
117
|
} catch (e) {
|
|
107
118
|
console.log('RbtObject.save.error:', e);
|
|
119
|
+
this._error = e;
|
|
108
120
|
//console.log(e.response.data);
|
|
109
121
|
throw e;
|
|
110
122
|
}
|