fng-audit 0.12.0-beta.296 → 0.12.0-beta.298

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.
@@ -55,6 +55,7 @@ exports.getAuditTrail = getAuditTrail;
55
55
  exports.getVersion = getVersion;
56
56
  exports.getSnapshot = getSnapshot;
57
57
  exports.auditAdHocEvent = auditAdHocEvent;
58
+ exports.getUpdatesSince = getUpdatesSince;
58
59
  exports.plugin = plugin;
59
60
  var jsondiffpatch = require("jsondiffpatch");
60
61
  var async = require("async");
@@ -542,6 +543,16 @@ function getHiddenFields(collectionName, options) {
542
543
  options.hidden = (_b = (_a = formsAngular === null || formsAngular === void 0 ? void 0 : formsAngular.getResourceFromCollection(collectionName)) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.hide;
543
544
  }
544
545
  }
546
+ function getUpdatesSince(modelName, id, since) {
547
+ var crit = { c: modelName, cId: id, ver: { $exists: true } };
548
+ if (since) {
549
+ crit._id = { $gt: new Mongoose.Types.ObjectId(Math.floor(since.getTime() / 1000).toString(16) + "0000000000000000") };
550
+ return exports.Audit.find(crit).lean();
551
+ }
552
+ else {
553
+ return exports.Audit.find(crit).sort({ _id: -1 }).limit(1).lean();
554
+ }
555
+ }
545
556
  function plugin(schema, options) {
546
557
  options = options || {};
547
558
  options.strip = options.strip || [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fng-audit",
3
- "version": "0.12.0-beta.296",
3
+ "version": "0.12.0-beta.298",
4
4
  "description": "Client part of forms-angular audit plugin",
5
5
  "homepage": "https://www.forms-angular.org/#/plugins",
6
6
  "files": [
@@ -26,7 +26,7 @@
26
26
  "@types/mocha": "10.0.7",
27
27
  "angular": "^1.8.3",
28
28
  "chai": "=4.3.10",
29
- "forms-angular": "0.12.0-beta.296",
29
+ "forms-angular": "0.12.0-beta.298",
30
30
  "grunt": "^1.6.1",
31
31
  "grunt-angular-templates": "^1.2.0",
32
32
  "grunt-contrib-concat": "2.1.0",