@azrico/webobject 1.4.189 → 1.4.191
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.
|
@@ -470,6 +470,8 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
470
470
|
/**
|
|
471
471
|
* converts this object to an basic object
|
|
472
472
|
* that can be passed into client components from server components
|
|
473
|
+
*
|
|
474
|
+
* uses `get_fullDeltaObject`
|
|
473
475
|
* @param p
|
|
474
476
|
* @returns
|
|
475
477
|
*/
|
|
@@ -477,7 +479,7 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
477
479
|
key: "get_basicObject",
|
|
478
480
|
value: (function () {
|
|
479
481
|
var _get_basicObject = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
480
|
-
var fulldelta,
|
|
482
|
+
var fulldelta, key, element;
|
|
481
483
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
482
484
|
while (1) switch (_context8.prev = _context8.next) {
|
|
483
485
|
case 0:
|
|
@@ -485,20 +487,19 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
485
487
|
return this.get_fullDeltaObject();
|
|
486
488
|
case 2:
|
|
487
489
|
fulldelta = _context8.sent;
|
|
488
|
-
idFields = ["id", "parentid"];
|
|
489
|
-
idFields.forEach(function (r) {
|
|
490
|
-
if (r in fulldelta) {
|
|
491
|
-
fulldelta[r] = String(fulldelta[r]);
|
|
492
|
-
}
|
|
493
|
-
});
|
|
494
490
|
for (key in fulldelta) {
|
|
495
491
|
element = fulldelta[key];
|
|
496
|
-
|
|
497
|
-
|
|
492
|
+
/* --------------------------- check for id fields -------------------------- */
|
|
493
|
+
if (element != null && _typeof(element) === "object") {
|
|
494
|
+
if ((key === "id" || key.endsWith("_id")) && typeof element.toString === "function") {
|
|
495
|
+
fulldelta[key] = String(element);
|
|
496
|
+
} else {
|
|
497
|
+
fulldelta[key] = JSON.parse(JSON.stringify(element));
|
|
498
|
+
}
|
|
498
499
|
}
|
|
499
500
|
}
|
|
500
501
|
return _context8.abrupt("return", fulldelta);
|
|
501
|
-
case
|
|
502
|
+
case 5:
|
|
502
503
|
case "end":
|
|
503
504
|
return _context8.stop();
|
|
504
505
|
}
|
|
@@ -1271,6 +1272,7 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
1271
1272
|
fetchID,
|
|
1272
1273
|
res,
|
|
1273
1274
|
params,
|
|
1275
|
+
usepath,
|
|
1274
1276
|
_args23 = arguments;
|
|
1275
1277
|
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
1276
1278
|
while (1) switch (_context23.prev = _context23.next) {
|
|
@@ -1290,31 +1292,38 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
1290
1292
|
params = {};
|
|
1291
1293
|
params.context = readonly ? "view" : "edit";
|
|
1292
1294
|
_context23.t0 = _typeof(search);
|
|
1293
|
-
_context23.next = _context23.t0 === "string" ? 11 : _context23.t0 === "number" ? 11 : _context23.t0 === "object" ?
|
|
1295
|
+
_context23.next = _context23.t0 === "string" ? 11 : _context23.t0 === "number" ? 11 : _context23.t0 === "object" ? 22 : 22;
|
|
1294
1296
|
break;
|
|
1295
1297
|
case 11:
|
|
1296
1298
|
search = String(search);
|
|
1297
1299
|
_context23.next = 14;
|
|
1298
|
-
return
|
|
1300
|
+
return _WebObjectPathHelper["default"].get_path(this, "get");
|
|
1301
|
+
case 14:
|
|
1302
|
+
_context23.t1 = _context23.sent;
|
|
1303
|
+
_context23.t2 = _context23.t1 + "/";
|
|
1304
|
+
_context23.t3 = search;
|
|
1305
|
+
usepath = _context23.t2 + _context23.t3;
|
|
1306
|
+
_context23.next = 20;
|
|
1307
|
+
return _global.gfunc.run_action("get", usepath, params, {
|
|
1299
1308
|
fetchID: fetchID
|
|
1300
1309
|
});
|
|
1301
|
-
case
|
|
1310
|
+
case 20:
|
|
1302
1311
|
res = _context23.sent;
|
|
1303
|
-
return _context23.abrupt("break",
|
|
1304
|
-
case
|
|
1305
|
-
_context23.next =
|
|
1312
|
+
return _context23.abrupt("break", 26);
|
|
1313
|
+
case 22:
|
|
1314
|
+
_context23.next = 24;
|
|
1306
1315
|
return this.get_list(search, readonly, fetchID);
|
|
1307
|
-
case
|
|
1316
|
+
case 24:
|
|
1308
1317
|
res = _context23.sent;
|
|
1309
|
-
return _context23.abrupt("break",
|
|
1310
|
-
case
|
|
1318
|
+
return _context23.abrupt("break", 26);
|
|
1319
|
+
case 26:
|
|
1311
1320
|
if (res) res = (0, _object.array_first)(res);
|
|
1312
1321
|
if (!(0, _object.object_isEmpty)(res)) {
|
|
1313
1322
|
res = this.ensure(this, res);
|
|
1314
1323
|
WebObject.setReadonly(res, readonly);
|
|
1315
1324
|
}
|
|
1316
1325
|
return _context23.abrupt("return", res);
|
|
1317
|
-
case
|
|
1326
|
+
case 29:
|
|
1318
1327
|
case "end":
|
|
1319
1328
|
return _context23.stop();
|
|
1320
1329
|
}
|
|
@@ -69,6 +69,7 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
|
|
|
69
69
|
_defineProperty(_this, "__saveResultObject", void 0);
|
|
70
70
|
_defineProperty(_this, "__saveResultIsSuccess", true);
|
|
71
71
|
_defineProperty(_this, "__saveResultType", void 0);
|
|
72
|
+
//id in the database
|
|
72
73
|
_defineProperty(_this, "_id", "");
|
|
73
74
|
//sequence key (usually managed by the database)
|
|
74
75
|
_defineProperty(_this, "_index_key", "");
|
|
@@ -827,7 +828,7 @@ var SimpleObject = exports.SimpleObject = /*#__PURE__*/function (_MapableObject)
|
|
|
827
828
|
////for (const key in this.__delta) {
|
|
828
829
|
//// return true;
|
|
829
830
|
////}
|
|
830
|
-
////return false;
|
|
831
|
+
////return false;
|
|
831
832
|
}
|
|
832
833
|
/* --------------------- check the properties one by one -------------------- */
|
|
833
834
|
var orig = this.getOriginal();
|