@onehat/data 1.6.9 → 1.6.10
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/package.json
CHANGED
package/src/Entity.js
CHANGED
|
@@ -1077,7 +1077,7 @@ class Entity extends EventEmitter {
|
|
|
1077
1077
|
}
|
|
1078
1078
|
|
|
1079
1079
|
/**
|
|
1080
|
-
*
|
|
1080
|
+
* Marks a deleted entity as undeleted.
|
|
1081
1081
|
* Only works when autoSave is off for the containing repository
|
|
1082
1082
|
* @fires delete
|
|
1083
1083
|
*/
|
|
@@ -1478,6 +1478,44 @@ export default class Repository extends EventEmitter {
|
|
|
1478
1478
|
await this.delete(this.getPhantom());
|
|
1479
1479
|
}
|
|
1480
1480
|
|
|
1481
|
+
/**
|
|
1482
|
+
* Deletes a single Entity by its index (zero-indexed) on the current page
|
|
1483
|
+
* @param {integer} ix - Index
|
|
1484
|
+
* @return {object} entity - Entity
|
|
1485
|
+
*/
|
|
1486
|
+
undeleteByIx = async (ix) => {
|
|
1487
|
+
await this.undelete(this.getByIx(ix));
|
|
1488
|
+
}
|
|
1489
|
+
|
|
1490
|
+
/**
|
|
1491
|
+
* Deletes multiple Entities by their range of indices
|
|
1492
|
+
* (zero-indexed) on the current page
|
|
1493
|
+
* @param {integer} startIx - Index
|
|
1494
|
+
* @param {integer} endIx - Index (inclusive)
|
|
1495
|
+
* @return {array} entities - Array of Entities
|
|
1496
|
+
*/
|
|
1497
|
+
undeleteByRange = async (startIx, endIx) => {
|
|
1498
|
+
await this.undelete(this.getByRange(startIx, endIx));
|
|
1499
|
+
}
|
|
1500
|
+
|
|
1501
|
+
/**
|
|
1502
|
+
* Remove multiple Entities by supplied filter function
|
|
1503
|
+
* @param {function} fn - Filter function to apply to all entities
|
|
1504
|
+
* @return {Entity[]} Entities that passed through filter
|
|
1505
|
+
*/
|
|
1506
|
+
undeleteBy = async (filter) => {
|
|
1507
|
+
await this.undelete(this.getBy(filter));
|
|
1508
|
+
}
|
|
1509
|
+
|
|
1510
|
+
/**
|
|
1511
|
+
* Remove a single Entity by its id
|
|
1512
|
+
* @param {integer} id - id of record to retrieve
|
|
1513
|
+
* @return {Entity} The Entity with matching id
|
|
1514
|
+
*/
|
|
1515
|
+
undeleteById = async (id) => {
|
|
1516
|
+
await this.undelete(this.getById(id));
|
|
1517
|
+
}
|
|
1518
|
+
|
|
1481
1519
|
|
|
1482
1520
|
|
|
1483
1521
|
|