@azrico/webobject 1.5.12 → 1.5.14
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.
|
@@ -126,6 +126,13 @@ export declare class WebObject extends SimpleObject {
|
|
|
126
126
|
* default order of parameters : search,readonly,fetchID
|
|
127
127
|
*/
|
|
128
128
|
static get_list(...p: any[]): Promise<Array<WebObject | any>>;
|
|
129
|
+
/**
|
|
130
|
+
* uses `get_list` and then saves the result to `gcache`
|
|
131
|
+
* then uses the `equals` function to return matched results
|
|
132
|
+
* @param search
|
|
133
|
+
* @returns
|
|
134
|
+
*/
|
|
135
|
+
static get_list_cache(search?: any): Promise<Array<WebObject | any>>;
|
|
129
136
|
/**
|
|
130
137
|
* Get a list of web objects and convert them to basic objects
|
|
131
138
|
* can be passed to client components
|
|
@@ -1331,7 +1331,6 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
1331
1331
|
fetchID,
|
|
1332
1332
|
res,
|
|
1333
1333
|
params,
|
|
1334
|
-
usepath,
|
|
1335
1334
|
_args24 = arguments;
|
|
1336
1335
|
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
1337
1336
|
while (1) switch (_context24.prev = _context24.next) {
|
|
@@ -1351,38 +1350,38 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
1351
1350
|
params = {};
|
|
1352
1351
|
params.__context = readonly ? "view" : "edit";
|
|
1353
1352
|
_context24.t0 = _typeof(search);
|
|
1354
|
-
_context24.next = _context24.t0 === "string" ? 11 : _context24.t0 === "number" ? 11 : _context24.t0 === "object" ?
|
|
1353
|
+
_context24.next = _context24.t0 === "string" ? 11 : _context24.t0 === "number" ? 11 : _context24.t0 === "object" ? 16 : 16;
|
|
1355
1354
|
break;
|
|
1356
1355
|
case 11:
|
|
1357
1356
|
search = String(search);
|
|
1357
|
+
// const usepath =
|
|
1358
|
+
// (await WebObjectPathHelper.get_path(this, "get")) +
|
|
1359
|
+
// "/" +
|
|
1360
|
+
// search;
|
|
1361
|
+
// res = await gfunc.run_action("get", usepath, params, {
|
|
1362
|
+
// fetchID: fetchID,
|
|
1363
|
+
// });
|
|
1358
1364
|
_context24.next = 14;
|
|
1359
|
-
return
|
|
1365
|
+
return this.get_list({
|
|
1366
|
+
__searchid: search
|
|
1367
|
+
}, readonly, fetchID);
|
|
1360
1368
|
case 14:
|
|
1361
|
-
_context24.t1 = _context24.sent;
|
|
1362
|
-
_context24.t2 = _context24.t1 + "/";
|
|
1363
|
-
_context24.t3 = search;
|
|
1364
|
-
usepath = _context24.t2 + _context24.t3;
|
|
1365
|
-
_context24.next = 20;
|
|
1366
|
-
return _global.gfunc.run_action("get", usepath, params, {
|
|
1367
|
-
fetchID: fetchID
|
|
1368
|
-
});
|
|
1369
|
-
case 20:
|
|
1370
1369
|
res = _context24.sent;
|
|
1371
|
-
return _context24.abrupt("break",
|
|
1372
|
-
case
|
|
1373
|
-
_context24.next =
|
|
1370
|
+
return _context24.abrupt("break", 20);
|
|
1371
|
+
case 16:
|
|
1372
|
+
_context24.next = 18;
|
|
1374
1373
|
return this.get_list(search, readonly, fetchID);
|
|
1375
|
-
case
|
|
1374
|
+
case 18:
|
|
1376
1375
|
res = _context24.sent;
|
|
1377
|
-
return _context24.abrupt("break",
|
|
1378
|
-
case
|
|
1376
|
+
return _context24.abrupt("break", 20);
|
|
1377
|
+
case 20:
|
|
1379
1378
|
if (res) res = (0, _object.array_first)(res);
|
|
1380
1379
|
if (!(0, _object.object_isEmpty)(res)) {
|
|
1381
1380
|
res = this.ensure(this, res);
|
|
1382
1381
|
WebObject.setReadonly(res, readonly);
|
|
1383
1382
|
}
|
|
1384
1383
|
return _context24.abrupt("return", res);
|
|
1385
|
-
case
|
|
1384
|
+
case 23:
|
|
1386
1385
|
case "end":
|
|
1387
1386
|
return _context24.stop();
|
|
1388
1387
|
}
|
|
@@ -1449,6 +1448,59 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
1449
1448
|
}
|
|
1450
1449
|
return get_list;
|
|
1451
1450
|
}()
|
|
1451
|
+
/**
|
|
1452
|
+
* uses `get_list` and then saves the result to `gcache`
|
|
1453
|
+
* then uses the `equals` function to return matched results
|
|
1454
|
+
* @param search
|
|
1455
|
+
* @returns
|
|
1456
|
+
*/
|
|
1457
|
+
)
|
|
1458
|
+
}, {
|
|
1459
|
+
key: "get_list_cache",
|
|
1460
|
+
value: (function () {
|
|
1461
|
+
var _get_list_cache = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(search) {
|
|
1462
|
+
var _this3 = this;
|
|
1463
|
+
var all_data;
|
|
1464
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
1465
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
1466
|
+
case 0:
|
|
1467
|
+
_context27.next = 2;
|
|
1468
|
+
return _global.gcache.get_temp_cache(this.get_webpath(), /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
|
|
1469
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
1470
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
1471
|
+
case 0:
|
|
1472
|
+
_context26.next = 2;
|
|
1473
|
+
return _this3.get_list();
|
|
1474
|
+
case 2:
|
|
1475
|
+
return _context26.abrupt("return", _context26.sent);
|
|
1476
|
+
case 3:
|
|
1477
|
+
case "end":
|
|
1478
|
+
return _context26.stop();
|
|
1479
|
+
}
|
|
1480
|
+
}, _callee26);
|
|
1481
|
+
})));
|
|
1482
|
+
case 2:
|
|
1483
|
+
all_data = _context27.sent;
|
|
1484
|
+
if (search) {
|
|
1485
|
+
_context27.next = 5;
|
|
1486
|
+
break;
|
|
1487
|
+
}
|
|
1488
|
+
return _context27.abrupt("return", all_data);
|
|
1489
|
+
case 5:
|
|
1490
|
+
return _context27.abrupt("return", all_data.filter(function (s) {
|
|
1491
|
+
return _this3.equals(s, search);
|
|
1492
|
+
}));
|
|
1493
|
+
case 6:
|
|
1494
|
+
case "end":
|
|
1495
|
+
return _context27.stop();
|
|
1496
|
+
}
|
|
1497
|
+
}, _callee27, this);
|
|
1498
|
+
}));
|
|
1499
|
+
function get_list_cache(_x9) {
|
|
1500
|
+
return _get_list_cache.apply(this, arguments);
|
|
1501
|
+
}
|
|
1502
|
+
return get_list_cache;
|
|
1503
|
+
}()
|
|
1452
1504
|
/**
|
|
1453
1505
|
* Get a list of web objects and convert them to basic objects
|
|
1454
1506
|
* can be passed to client components
|
|
@@ -1458,43 +1510,43 @@ var WebObject = exports.WebObject = /*#__PURE__*/function (_SimpleObject) {
|
|
|
1458
1510
|
}, {
|
|
1459
1511
|
key: "get_basicList",
|
|
1460
1512
|
value: (function () {
|
|
1461
|
-
var _get_basicList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1513
|
+
var _get_basicList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
|
|
1462
1514
|
var itemlist,
|
|
1463
|
-
|
|
1464
|
-
return _regeneratorRuntime().wrap(function
|
|
1465
|
-
while (1) switch (
|
|
1515
|
+
_args29 = arguments;
|
|
1516
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
1517
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
1466
1518
|
case 0:
|
|
1467
|
-
|
|
1468
|
-
return this.get_list.apply(this,
|
|
1519
|
+
_context29.next = 2;
|
|
1520
|
+
return this.get_list.apply(this, _args29);
|
|
1469
1521
|
case 2:
|
|
1470
|
-
itemlist =
|
|
1471
|
-
|
|
1522
|
+
itemlist = _context29.sent;
|
|
1523
|
+
_context29.next = 5;
|
|
1472
1524
|
return Promise.all(itemlist.map( /*#__PURE__*/function () {
|
|
1473
|
-
var
|
|
1474
|
-
return _regeneratorRuntime().wrap(function
|
|
1475
|
-
while (1) switch (
|
|
1525
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(r) {
|
|
1526
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
1527
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
1476
1528
|
case 0:
|
|
1477
|
-
|
|
1529
|
+
_context28.next = 2;
|
|
1478
1530
|
return r.get_basicObject();
|
|
1479
1531
|
case 2:
|
|
1480
|
-
return
|
|
1532
|
+
return _context28.abrupt("return", _context28.sent);
|
|
1481
1533
|
case 3:
|
|
1482
1534
|
case "end":
|
|
1483
|
-
return
|
|
1535
|
+
return _context28.stop();
|
|
1484
1536
|
}
|
|
1485
|
-
},
|
|
1537
|
+
}, _callee28);
|
|
1486
1538
|
}));
|
|
1487
|
-
return function (
|
|
1488
|
-
return
|
|
1539
|
+
return function (_x10) {
|
|
1540
|
+
return _ref3.apply(this, arguments);
|
|
1489
1541
|
};
|
|
1490
1542
|
}()));
|
|
1491
1543
|
case 5:
|
|
1492
|
-
return
|
|
1544
|
+
return _context29.abrupt("return", _context29.sent);
|
|
1493
1545
|
case 6:
|
|
1494
1546
|
case "end":
|
|
1495
|
-
return
|
|
1547
|
+
return _context29.stop();
|
|
1496
1548
|
}
|
|
1497
|
-
},
|
|
1549
|
+
}, _callee29, this);
|
|
1498
1550
|
}));
|
|
1499
1551
|
function get_basicList() {
|
|
1500
1552
|
return _get_basicList.apply(this, arguments);
|