fng-audit 0.12.0-beta.220 → 0.12.0-beta.221
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/dist/server/fng-audit.js +25 -18
- package/package.json +2 -2
package/dist/server/fng-audit.js
CHANGED
|
@@ -292,13 +292,15 @@ function auditAdHocEvent(user, description, details) {
|
|
|
292
292
|
copyDets = cloneDeep(details);
|
|
293
293
|
cleanKeys(copyDets); // Make sure mongoose doesn't barf on composite keys by putting quotes round them
|
|
294
294
|
auditRec = { user: user, op: description, dets: copyDets };
|
|
295
|
+
if (!(typeof auditOptions.addPropFunc === 'function')) return [3 /*break*/, 2];
|
|
295
296
|
return [4 /*yield*/, auditOptions.addPropFunc(auditRec, null, null, null, {})];
|
|
296
297
|
case 1:
|
|
297
298
|
xtra = _a.sent();
|
|
298
299
|
if (xtra) {
|
|
299
300
|
auditRec.xtra = xtra;
|
|
300
301
|
}
|
|
301
|
-
|
|
302
|
+
_a.label = 2;
|
|
303
|
+
case 2: return [2 /*return*/, exports.Audit.create(auditRec)];
|
|
302
304
|
}
|
|
303
305
|
});
|
|
304
306
|
});
|
|
@@ -361,9 +363,9 @@ function auditFromObject(doc, orig, updated, options, next) {
|
|
|
361
363
|
.sort("-ver")
|
|
362
364
|
.exec()
|
|
363
365
|
.then(function (prevAudit) { return __awaiter(_this, void 0, void 0, function () {
|
|
364
|
-
var auditRec, invariantAuditRec,
|
|
365
|
-
return __generator(this, function (
|
|
366
|
-
switch (
|
|
366
|
+
var auditRec, invariantAuditRec, xtra;
|
|
367
|
+
return __generator(this, function (_a) {
|
|
368
|
+
switch (_a.label) {
|
|
367
369
|
case 0:
|
|
368
370
|
auditRec = {
|
|
369
371
|
c: c_1,
|
|
@@ -377,13 +379,15 @@ function auditFromObject(doc, orig, updated, options, next) {
|
|
|
377
379
|
if (op_1) {
|
|
378
380
|
auditRec.op = op_1;
|
|
379
381
|
}
|
|
380
|
-
if (!auditOptions.addPropFunc) return [3 /*break*/, 2];
|
|
382
|
+
if (!(typeof auditOptions.addPropFunc === 'function')) return [3 /*break*/, 2];
|
|
381
383
|
invariantAuditRec = __assign({}, auditRec);
|
|
382
|
-
_a = auditRec;
|
|
383
384
|
return [4 /*yield*/, auditOptions.addPropFunc(invariantAuditRec, doc, orig, updated, options)];
|
|
384
385
|
case 1:
|
|
385
|
-
|
|
386
|
-
|
|
386
|
+
xtra = _a.sent();
|
|
387
|
+
if (xtra) {
|
|
388
|
+
auditRec.xtra = xtra;
|
|
389
|
+
}
|
|
390
|
+
_a.label = 2;
|
|
387
391
|
case 2:
|
|
388
392
|
exports.Audit.create(auditRec)
|
|
389
393
|
.then(function () {
|
|
@@ -537,23 +541,26 @@ function plugin(schema, options) {
|
|
|
537
541
|
case 0:
|
|
538
542
|
if (!(this._noAudit || !exports.Audit)) return [3 /*break*/, 1];
|
|
539
543
|
next();
|
|
540
|
-
return [3 /*break*/,
|
|
544
|
+
return [3 /*break*/, 7];
|
|
541
545
|
case 1:
|
|
542
|
-
if (!this.isNew) return [3 /*break*/,
|
|
546
|
+
if (!this.isNew) return [3 /*break*/, 6];
|
|
543
547
|
user = getPseudoField('user', this) || getPseudoField('_usr', this);
|
|
544
|
-
if (!user) return [3 /*break*/,
|
|
548
|
+
if (!user) return [3 /*break*/, 4];
|
|
545
549
|
auditRec = {
|
|
546
550
|
c: this.constructor.modelName,
|
|
547
551
|
cId: this._id,
|
|
548
552
|
op: 'create',
|
|
549
553
|
user: user
|
|
550
554
|
};
|
|
555
|
+
if (!(typeof auditOptions.addPropFunc === "function")) return [3 /*break*/, 3];
|
|
551
556
|
return [4 /*yield*/, auditOptions.addPropFunc(auditRec, this, null, null, {})];
|
|
552
557
|
case 2:
|
|
553
558
|
xtra = _a.sent();
|
|
554
559
|
if (xtra) {
|
|
555
560
|
auditRec.xtra = xtra;
|
|
556
561
|
}
|
|
562
|
+
_a.label = 3;
|
|
563
|
+
case 3:
|
|
557
564
|
exports.Audit.create(auditRec)
|
|
558
565
|
.then(function () {
|
|
559
566
|
// nothing to do
|
|
@@ -564,12 +571,12 @@ function plugin(schema, options) {
|
|
|
564
571
|
.finally(function () {
|
|
565
572
|
next();
|
|
566
573
|
});
|
|
567
|
-
return [3 /*break*/,
|
|
568
|
-
case
|
|
574
|
+
return [3 /*break*/, 5];
|
|
575
|
+
case 4:
|
|
569
576
|
next();
|
|
570
|
-
_a.label =
|
|
571
|
-
case
|
|
572
|
-
case
|
|
577
|
+
_a.label = 5;
|
|
578
|
+
case 5: return [3 /*break*/, 7];
|
|
579
|
+
case 6:
|
|
573
580
|
that_1 = this;
|
|
574
581
|
try {
|
|
575
582
|
getHiddenFields(that_1.constructor.collection.collectionName, options);
|
|
@@ -590,8 +597,8 @@ function plugin(schema, options) {
|
|
|
590
597
|
}
|
|
591
598
|
next();
|
|
592
599
|
}
|
|
593
|
-
_a.label =
|
|
594
|
-
case
|
|
600
|
+
_a.label = 7;
|
|
601
|
+
case 7: return [2 /*return*/];
|
|
595
602
|
}
|
|
596
603
|
});
|
|
597
604
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fng-audit",
|
|
3
|
-
"version": "0.12.0-beta.
|
|
3
|
+
"version": "0.12.0-beta.221",
|
|
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.1",
|
|
27
27
|
"angular": "^1.8.3",
|
|
28
28
|
"chai": "4.3.7",
|
|
29
|
-
"forms-angular": "0.12.0-beta.
|
|
29
|
+
"forms-angular": "0.12.0-beta.221",
|
|
30
30
|
"grunt": "^1.5.3",
|
|
31
31
|
"grunt-angular-templates": "^1.2.0",
|
|
32
32
|
"grunt-contrib-concat": "2.1.0",
|