roboto-js 1.4.25 → 1.4.27
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/rbt_api.cjs +2 -2
- package/dist/cjs/rbt_object.cjs +68 -8
- package/dist/esm/rbt_api.js +2 -2
- package/dist/esm/rbt_object.js +70 -9
- package/package.json +1 -1
- package/src/rbt_api.js +2 -2
- package/src/rbt_object.js +85 -22
package/dist/cjs/rbt_api.cjs
CHANGED
|
@@ -1032,8 +1032,8 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
|
|
|
1032
1032
|
onProgress(response);
|
|
1033
1033
|
}
|
|
1034
1034
|
|
|
1035
|
-
// Continue polling if the status is 'RUNNING'
|
|
1036
|
-
if (['RUNNING'].includes(response.status)) {
|
|
1035
|
+
// Continue polling if the status is 'RUNNING' or STOPPING
|
|
1036
|
+
if (['RUNNING', 'STOPPING'].includes(response.status)) {
|
|
1037
1037
|
setTimeout(checkProgress, 2000); // Poll every 2 seconds
|
|
1038
1038
|
}
|
|
1039
1039
|
case 8:
|
package/dist/cjs/rbt_object.cjs
CHANGED
|
@@ -77,20 +77,24 @@ var RbtObject = exports["default"] = /*#__PURE__*/function () {
|
|
|
77
77
|
key: "set",
|
|
78
78
|
value: function set(path, value) {
|
|
79
79
|
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
80
|
-
var currentValue = _lodash["default"].get(this._data, path);
|
|
80
|
+
var currentValue = _lodash["default"].get(this._data, path); // Fetch current value at deep path
|
|
81
81
|
|
|
82
82
|
// Check if merge is required
|
|
83
83
|
if (options.merge) {
|
|
84
84
|
// Merge the value if merge option is true
|
|
85
|
-
var mergedValue = _lodash["default"].
|
|
85
|
+
var mergedValue = _lodash["default"].mergeWith({}, currentValue, value, function (objValue, srcValue) {
|
|
86
|
+
if (_lodash["default"].isArray(objValue)) {
|
|
87
|
+
return srcValue; // Customize merging behavior for arrays or other specific types
|
|
88
|
+
}
|
|
89
|
+
});
|
|
86
90
|
if (!_lodash["default"].isEqual(currentValue, mergedValue)) {
|
|
87
|
-
_lodash["default"].set(this._data, path, mergedValue);
|
|
91
|
+
_lodash["default"].set(this._data, path, mergedValue); // Set the merged value at the deep path
|
|
88
92
|
this._addChange(path);
|
|
89
93
|
}
|
|
90
94
|
} else {
|
|
91
95
|
// Set the value directly if no merge option or merge option is false
|
|
92
96
|
if (!_lodash["default"].isEqual(currentValue, value)) {
|
|
93
|
-
_lodash["default"].set(this._data, path, value);
|
|
97
|
+
_lodash["default"].set(this._data, path, value); // Set the value directly at the deep path
|
|
94
98
|
this._addChange(path);
|
|
95
99
|
}
|
|
96
100
|
}
|
|
@@ -99,16 +103,72 @@ var RbtObject = exports["default"] = /*#__PURE__*/function () {
|
|
|
99
103
|
key: "setData",
|
|
100
104
|
value: function setData(newData) {
|
|
101
105
|
var _this2 = this;
|
|
106
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
102
107
|
if (_typeof(newData) !== 'object' || newData === null) {
|
|
103
108
|
throw new Error('setData expects an object');
|
|
104
109
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
110
|
+
var _options$merge = options.merge,
|
|
111
|
+
merge = _options$merge === void 0 ? false : _options$merge;
|
|
112
|
+
Object.keys(newData).forEach(function (path) {
|
|
113
|
+
var currentValue = _lodash["default"].get(_this2._data, path);
|
|
114
|
+
var newValue = newData[path];
|
|
115
|
+
if (merge && _lodash["default"].isObject(currentValue) && _lodash["default"].isObject(newValue)) {
|
|
116
|
+
// Perform a deep merge on the values at the path
|
|
117
|
+
var mergedValue = _lodash["default"].mergeWith({}, currentValue, newValue, function (objValue, srcValue) {
|
|
118
|
+
if (_lodash["default"].isArray(objValue)) {
|
|
119
|
+
return srcValue; // Customize merging behavior for arrays or other specific types
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
if (!_lodash["default"].isEqual(currentValue, mergedValue)) {
|
|
123
|
+
_lodash["default"].set(_this2._data, path, mergedValue);
|
|
124
|
+
_this2._addChange(path);
|
|
125
|
+
}
|
|
126
|
+
} else if (!_lodash["default"].isEqual(currentValue, newValue)) {
|
|
127
|
+
// Directly set the new value at the path
|
|
128
|
+
_lodash["default"].setWith(_this2._data, path, newValue, function (nsValue, key, nsObject, nsPath) {
|
|
129
|
+
if (key === nsPath.split('.').pop() && !_lodash["default"].has(nsObject, key)) {
|
|
130
|
+
// Create any missing parts of the path as plain objects
|
|
131
|
+
return nsObject[key] = {};
|
|
132
|
+
}
|
|
133
|
+
return nsValue;
|
|
134
|
+
});
|
|
135
|
+
_this2._addChange(path);
|
|
109
136
|
}
|
|
110
137
|
});
|
|
111
138
|
}
|
|
139
|
+
|
|
140
|
+
// set(path, value, options = {}) {
|
|
141
|
+
// const currentValue = _.get(this._data, path);
|
|
142
|
+
//
|
|
143
|
+
// // Check if merge is required
|
|
144
|
+
// if (options.merge) {
|
|
145
|
+
// // Merge the value if merge option is true
|
|
146
|
+
// const mergedValue = _.merge({}, currentValue, value);
|
|
147
|
+
// if (!_.isEqual(currentValue, mergedValue)) {
|
|
148
|
+
// _.set(this._data, path, mergedValue);
|
|
149
|
+
// this._addChange(path);
|
|
150
|
+
// }
|
|
151
|
+
// } else {
|
|
152
|
+
// // Set the value directly if no merge option or merge option is false
|
|
153
|
+
// if (!_.isEqual(currentValue, value)) {
|
|
154
|
+
// _.set(this._data, path, value);
|
|
155
|
+
// this._addChange(path);
|
|
156
|
+
// }
|
|
157
|
+
// }
|
|
158
|
+
// }
|
|
159
|
+
//
|
|
160
|
+
// setData(newData) {
|
|
161
|
+
// if (typeof newData !== 'object' || newData === null) {
|
|
162
|
+
// throw new Error('setData expects an object');
|
|
163
|
+
// }
|
|
164
|
+
//
|
|
165
|
+
// Object.keys(newData).forEach(key => {
|
|
166
|
+
// if (!_.isEqual(_.get(this._data, key), newData[key])) {
|
|
167
|
+
// _.set(this._data, key, newData[key]);
|
|
168
|
+
// this._addChange(key);
|
|
169
|
+
// }
|
|
170
|
+
// });
|
|
171
|
+
// }
|
|
112
172
|
}, {
|
|
113
173
|
key: "toRecord",
|
|
114
174
|
value: function toRecord() {
|
package/dist/esm/rbt_api.js
CHANGED
|
@@ -539,8 +539,8 @@ export default class RbtApi {
|
|
|
539
539
|
onProgress(response);
|
|
540
540
|
}
|
|
541
541
|
|
|
542
|
-
// Continue polling if the status is 'RUNNING'
|
|
543
|
-
if (['RUNNING'].includes(response.status)) {
|
|
542
|
+
// Continue polling if the status is 'RUNNING' or STOPPING
|
|
543
|
+
if (['RUNNING', 'STOPPING'].includes(response.status)) {
|
|
544
544
|
setTimeout(checkProgress, 2000); // Poll every 2 seconds
|
|
545
545
|
}
|
|
546
546
|
};
|
package/dist/esm/rbt_object.js
CHANGED
|
@@ -47,35 +47,96 @@ export default class RbtObject {
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
set(path, value, options = {}) {
|
|
50
|
-
const currentValue = _.get(this._data, path);
|
|
50
|
+
const currentValue = _.get(this._data, path); // Fetch current value at deep path
|
|
51
51
|
|
|
52
52
|
// Check if merge is required
|
|
53
53
|
if (options.merge) {
|
|
54
54
|
// Merge the value if merge option is true
|
|
55
|
-
const mergedValue = _.
|
|
55
|
+
const mergedValue = _.mergeWith({}, currentValue, value, (objValue, srcValue) => {
|
|
56
|
+
if (_.isArray(objValue)) {
|
|
57
|
+
return srcValue; // Customize merging behavior for arrays or other specific types
|
|
58
|
+
}
|
|
59
|
+
});
|
|
56
60
|
if (!_.isEqual(currentValue, mergedValue)) {
|
|
57
|
-
_.set(this._data, path, mergedValue);
|
|
61
|
+
_.set(this._data, path, mergedValue); // Set the merged value at the deep path
|
|
58
62
|
this._addChange(path);
|
|
59
63
|
}
|
|
60
64
|
} else {
|
|
61
65
|
// Set the value directly if no merge option or merge option is false
|
|
62
66
|
if (!_.isEqual(currentValue, value)) {
|
|
63
|
-
_.set(this._data, path, value);
|
|
67
|
+
_.set(this._data, path, value); // Set the value directly at the deep path
|
|
64
68
|
this._addChange(path);
|
|
65
69
|
}
|
|
66
70
|
}
|
|
67
71
|
}
|
|
68
|
-
setData(newData) {
|
|
72
|
+
setData(newData, options = {}) {
|
|
69
73
|
if (typeof newData !== 'object' || newData === null) {
|
|
70
74
|
throw new Error('setData expects an object');
|
|
71
75
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
+
const {
|
|
77
|
+
merge = false
|
|
78
|
+
} = options;
|
|
79
|
+
Object.keys(newData).forEach(path => {
|
|
80
|
+
const currentValue = _.get(this._data, path);
|
|
81
|
+
const newValue = newData[path];
|
|
82
|
+
if (merge && _.isObject(currentValue) && _.isObject(newValue)) {
|
|
83
|
+
// Perform a deep merge on the values at the path
|
|
84
|
+
const mergedValue = _.mergeWith({}, currentValue, newValue, (objValue, srcValue) => {
|
|
85
|
+
if (_.isArray(objValue)) {
|
|
86
|
+
return srcValue; // Customize merging behavior for arrays or other specific types
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
if (!_.isEqual(currentValue, mergedValue)) {
|
|
90
|
+
_.set(this._data, path, mergedValue);
|
|
91
|
+
this._addChange(path);
|
|
92
|
+
}
|
|
93
|
+
} else if (!_.isEqual(currentValue, newValue)) {
|
|
94
|
+
// Directly set the new value at the path
|
|
95
|
+
_.setWith(this._data, path, newValue, (nsValue, key, nsObject, nsPath) => {
|
|
96
|
+
if (key === nsPath.split('.').pop() && !_.has(nsObject, key)) {
|
|
97
|
+
// Create any missing parts of the path as plain objects
|
|
98
|
+
return nsObject[key] = {};
|
|
99
|
+
}
|
|
100
|
+
return nsValue;
|
|
101
|
+
});
|
|
102
|
+
this._addChange(path);
|
|
76
103
|
}
|
|
77
104
|
});
|
|
78
105
|
}
|
|
106
|
+
|
|
107
|
+
// set(path, value, options = {}) {
|
|
108
|
+
// const currentValue = _.get(this._data, path);
|
|
109
|
+
//
|
|
110
|
+
// // Check if merge is required
|
|
111
|
+
// if (options.merge) {
|
|
112
|
+
// // Merge the value if merge option is true
|
|
113
|
+
// const mergedValue = _.merge({}, currentValue, value);
|
|
114
|
+
// if (!_.isEqual(currentValue, mergedValue)) {
|
|
115
|
+
// _.set(this._data, path, mergedValue);
|
|
116
|
+
// this._addChange(path);
|
|
117
|
+
// }
|
|
118
|
+
// } else {
|
|
119
|
+
// // Set the value directly if no merge option or merge option is false
|
|
120
|
+
// if (!_.isEqual(currentValue, value)) {
|
|
121
|
+
// _.set(this._data, path, value);
|
|
122
|
+
// this._addChange(path);
|
|
123
|
+
// }
|
|
124
|
+
// }
|
|
125
|
+
// }
|
|
126
|
+
//
|
|
127
|
+
// setData(newData) {
|
|
128
|
+
// if (typeof newData !== 'object' || newData === null) {
|
|
129
|
+
// throw new Error('setData expects an object');
|
|
130
|
+
// }
|
|
131
|
+
//
|
|
132
|
+
// Object.keys(newData).forEach(key => {
|
|
133
|
+
// if (!_.isEqual(_.get(this._data, key), newData[key])) {
|
|
134
|
+
// _.set(this._data, key, newData[key]);
|
|
135
|
+
// this._addChange(key);
|
|
136
|
+
// }
|
|
137
|
+
// });
|
|
138
|
+
// }
|
|
139
|
+
|
|
79
140
|
toRecord() {
|
|
80
141
|
return {
|
|
81
142
|
...this._internalData,
|
package/package.json
CHANGED
package/src/rbt_api.js
CHANGED
|
@@ -579,8 +579,8 @@ export default class RbtApi {
|
|
|
579
579
|
onProgress(response);
|
|
580
580
|
}
|
|
581
581
|
|
|
582
|
-
// Continue polling if the status is 'RUNNING'
|
|
583
|
-
if (['RUNNING'].includes(response.status)) {
|
|
582
|
+
// Continue polling if the status is 'RUNNING' or STOPPING
|
|
583
|
+
if (['RUNNING','STOPPING'].includes(response.status)) {
|
|
584
584
|
setTimeout(checkProgress, 2000); // Poll every 2 seconds
|
|
585
585
|
}
|
|
586
586
|
};
|
package/src/rbt_object.js
CHANGED
|
@@ -53,38 +53,101 @@ export default class RbtObject {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
set(path, value, options = {}) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
56
|
+
const currentValue = _.get(this._data, path); // Fetch current value at deep path
|
|
57
|
+
|
|
58
|
+
// Check if merge is required
|
|
59
|
+
if (options.merge) {
|
|
60
|
+
// Merge the value if merge option is true
|
|
61
|
+
const mergedValue = _.mergeWith({}, currentValue, value, (objValue, srcValue) => {
|
|
62
|
+
if (_.isArray(objValue)) {
|
|
63
|
+
return srcValue; // Customize merging behavior for arrays or other specific types
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
if (!_.isEqual(currentValue, mergedValue)) {
|
|
67
|
+
_.set(this._data, path, mergedValue); // Set the merged value at the deep path
|
|
68
|
+
this._addChange(path);
|
|
69
|
+
}
|
|
70
|
+
} else {
|
|
71
|
+
// Set the value directly if no merge option or merge option is false
|
|
72
|
+
if (!_.isEqual(currentValue, value)) {
|
|
73
|
+
_.set(this._data, path, value); // Set the value directly at the deep path
|
|
74
|
+
this._addChange(path);
|
|
75
|
+
}
|
|
71
76
|
}
|
|
72
|
-
}
|
|
73
77
|
}
|
|
74
|
-
|
|
75
|
-
setData(newData) {
|
|
78
|
+
|
|
79
|
+
setData(newData, options = {}) {
|
|
76
80
|
if (typeof newData !== 'object' || newData === null) {
|
|
77
81
|
throw new Error('setData expects an object');
|
|
78
82
|
}
|
|
79
83
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
+
const { merge = false } = options;
|
|
85
|
+
|
|
86
|
+
Object.keys(newData).forEach(path => {
|
|
87
|
+
const currentValue = _.get(this._data, path);
|
|
88
|
+
const newValue = newData[path];
|
|
89
|
+
|
|
90
|
+
if (merge && _.isObject(currentValue) && _.isObject(newValue)) {
|
|
91
|
+
// Perform a deep merge on the values at the path
|
|
92
|
+
const mergedValue = _.mergeWith({}, currentValue, newValue, (objValue, srcValue) => {
|
|
93
|
+
if (_.isArray(objValue)) {
|
|
94
|
+
return srcValue; // Customize merging behavior for arrays or other specific types
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
if (!_.isEqual(currentValue, mergedValue)) {
|
|
99
|
+
_.set(this._data, path, mergedValue);
|
|
100
|
+
this._addChange(path);
|
|
101
|
+
}
|
|
102
|
+
} else if (!_.isEqual(currentValue, newValue)) {
|
|
103
|
+
// Directly set the new value at the path
|
|
104
|
+
_.setWith(this._data, path, newValue, (nsValue, key, nsObject, nsPath) => {
|
|
105
|
+
if (key === nsPath.split('.').pop() && !_.has(nsObject, key)) {
|
|
106
|
+
// Create any missing parts of the path as plain objects
|
|
107
|
+
return nsObject[key] = {};
|
|
108
|
+
}
|
|
109
|
+
return nsValue;
|
|
110
|
+
});
|
|
111
|
+
this._addChange(path);
|
|
84
112
|
}
|
|
85
113
|
});
|
|
86
114
|
}
|
|
87
115
|
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
// set(path, value, options = {}) {
|
|
119
|
+
// const currentValue = _.get(this._data, path);
|
|
120
|
+
//
|
|
121
|
+
// // Check if merge is required
|
|
122
|
+
// if (options.merge) {
|
|
123
|
+
// // Merge the value if merge option is true
|
|
124
|
+
// const mergedValue = _.merge({}, currentValue, value);
|
|
125
|
+
// if (!_.isEqual(currentValue, mergedValue)) {
|
|
126
|
+
// _.set(this._data, path, mergedValue);
|
|
127
|
+
// this._addChange(path);
|
|
128
|
+
// }
|
|
129
|
+
// } else {
|
|
130
|
+
// // Set the value directly if no merge option or merge option is false
|
|
131
|
+
// if (!_.isEqual(currentValue, value)) {
|
|
132
|
+
// _.set(this._data, path, value);
|
|
133
|
+
// this._addChange(path);
|
|
134
|
+
// }
|
|
135
|
+
// }
|
|
136
|
+
// }
|
|
137
|
+
//
|
|
138
|
+
// setData(newData) {
|
|
139
|
+
// if (typeof newData !== 'object' || newData === null) {
|
|
140
|
+
// throw new Error('setData expects an object');
|
|
141
|
+
// }
|
|
142
|
+
//
|
|
143
|
+
// Object.keys(newData).forEach(key => {
|
|
144
|
+
// if (!_.isEqual(_.get(this._data, key), newData[key])) {
|
|
145
|
+
// _.set(this._data, key, newData[key]);
|
|
146
|
+
// this._addChange(key);
|
|
147
|
+
// }
|
|
148
|
+
// });
|
|
149
|
+
// }
|
|
150
|
+
|
|
88
151
|
toRecord() {
|
|
89
152
|
return {
|
|
90
153
|
...this._internalData,
|