roboto-js 1.4.44 → 1.4.45

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.
@@ -695,26 +695,28 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
695
695
  case 0:
696
696
  dataHash = _args15.length > 1 && _args15[1] !== undefined ? _args15[1] : {};
697
697
  _context15.prev = 1;
698
- _context15.next = 4;
698
+ debugger;
699
+ _context15.next = 5;
699
700
  return this.axios.post('/object_service/createObject', [type, dataHash]);
700
- case 4:
701
+ case 5:
701
702
  response = _context15.sent;
702
703
  record = response.data;
703
704
  if (dataHash) {
704
705
  record.data = dataHash;
705
706
  }
707
+ debugger;
706
708
  return _context15.abrupt("return", new _rbt_object["default"](record, this.axios, {
707
709
  isNew: true
708
710
  }));
709
- case 10:
710
- _context15.prev = 10;
711
+ case 12:
712
+ _context15.prev = 12;
711
713
  _context15.t0 = _context15["catch"](1);
712
714
  return _context15.abrupt("return", this._handleError(_context15.t0));
713
- case 13:
715
+ case 15:
714
716
  case "end":
715
717
  return _context15.stop();
716
718
  }
717
- }, _callee15, this, [[1, 10]]);
719
+ }, _callee15, this, [[1, 12]]);
718
720
  }));
719
721
  function create(_x10) {
720
722
  return _create.apply(this, arguments);
@@ -322,8 +322,14 @@ var RbtObject = exports["default"] = /*#__PURE__*/function () {
322
322
  value: function _deepUnpackJson(value) {
323
323
  if (typeof value === 'string') {
324
324
  try {
325
- var parsed = JSON.parse(value);
326
- return this._deepUnpackJson(parsed); // Recursively parse if the result is a string, object, or array
325
+ // Only parse as JSON if it's not a large number
326
+ // https://chatgpt.com/c/6745902c-edf4-800c-ab52-31bf27dde2bd
327
+ //
328
+ if (!/^\d{16,}$/.test(value)) {
329
+ var parsed = JSON.parse(value);
330
+ // Recursively parse if the result is a string, object, or array
331
+ return this._deepUnpackJson(parsed);
332
+ }
327
333
  } catch (e) {
328
334
  return value; // Return the original string if parsing fails
329
335
  }
@@ -327,11 +327,13 @@ export default class RbtApi {
327
327
  */
328
328
  async create(type, dataHash = {}) {
329
329
  try {
330
+ debugger;
330
331
  const response = await this.axios.post('/object_service/createObject', [type, dataHash]);
331
332
  const record = response.data;
332
333
  if (dataHash) {
333
334
  record.data = dataHash;
334
335
  }
336
+ debugger;
335
337
  return new RbtObject(record, this.axios, {
336
338
  isNew: true
337
339
  });
@@ -220,8 +220,14 @@ export default class RbtObject {
220
220
  _deepUnpackJson(value) {
221
221
  if (typeof value === 'string') {
222
222
  try {
223
- const parsed = JSON.parse(value);
224
- return this._deepUnpackJson(parsed); // Recursively parse if the result is a string, object, or array
223
+ // Only parse as JSON if it's not a large number
224
+ // https://chatgpt.com/c/6745902c-edf4-800c-ab52-31bf27dde2bd
225
+ //
226
+ if (!/^\d{16,}$/.test(value)) {
227
+ const parsed = JSON.parse(value);
228
+ // Recursively parse if the result is a string, object, or array
229
+ return this._deepUnpackJson(parsed);
230
+ }
225
231
  } catch (e) {
226
232
  return value; // Return the original string if parsing fails
227
233
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "roboto-js",
3
- "version": "1.4.44",
3
+ "version": "1.4.45",
4
4
  "type": "module",
5
5
  "description": "",
6
6
  "main": "dist/cjs/index.cjs",
package/src/rbt_api.js CHANGED
@@ -408,12 +408,14 @@ export default class RbtApi {
408
408
  */
409
409
  async create(type, dataHash={}) {
410
410
  try {
411
+ debugger;
411
412
  const response = await this.axios.post('/object_service/createObject', [type, dataHash]);
412
413
  const record = response.data;
413
414
 
414
415
  if(dataHash){
415
416
  record.data = dataHash;
416
417
  }
418
+ debugger;
417
419
  return new RbtObject(record, this.axios, { isNew: true });
418
420
  } catch (e) {
419
421
  return this._handleError(e);
package/src/rbt_object.js CHANGED
@@ -249,8 +249,15 @@ export default class RbtObject {
249
249
  _deepUnpackJson(value){
250
250
  if (typeof value === 'string') {
251
251
  try {
252
- const parsed = JSON.parse(value);
253
- return this._deepUnpackJson(parsed); // Recursively parse if the result is a string, object, or array
252
+
253
+ // Only parse as JSON if it's not a large number
254
+ // https://chatgpt.com/c/6745902c-edf4-800c-ab52-31bf27dde2bd
255
+ //
256
+ if (!/^\d{16,}$/.test(value)) {
257
+ const parsed = JSON.parse(value);
258
+ // Recursively parse if the result is a string, object, or array
259
+ return this._deepUnpackJson(parsed);
260
+ }
254
261
  } catch (e) {
255
262
  return value; // Return the original string if parsing fails
256
263
  }