@sera4/essentia 1.1.31 → 1.1.33
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 +1 -1
- package/package.tar.gz +0 -0
- package/paper-trail/helpers.js +7 -7
- package/paper-trail/index.js +12 -0
- package/queue/subscriber.js +1 -0
- package/utils/index.js +3 -0
package/package.json
CHANGED
package/package.tar.gz
CHANGED
|
Binary file
|
package/paper-trail/helpers.js
CHANGED
|
@@ -67,25 +67,25 @@ const calcDelta = (current, next, exclude, strict, DEBUG = false) => {
|
|
|
67
67
|
};
|
|
68
68
|
|
|
69
69
|
const diffToString = val => {
|
|
70
|
-
if (typeof val === 'undefined' || val === null)
|
|
70
|
+
if (typeof val === 'undefined' || val === null)
|
|
71
71
|
return '';
|
|
72
72
|
|
|
73
73
|
if (val === true)
|
|
74
74
|
return '1';
|
|
75
75
|
|
|
76
|
-
if (val === false)
|
|
76
|
+
if (val === false)
|
|
77
77
|
return '0';
|
|
78
78
|
|
|
79
|
-
if (typeof val === 'string')
|
|
79
|
+
if (typeof val === 'string')
|
|
80
80
|
return val;
|
|
81
81
|
|
|
82
|
-
if (!Number.isNaN(Number(val)))
|
|
82
|
+
if (!Number.isNaN(Number(val)))
|
|
83
83
|
return `${String(val)}`;
|
|
84
84
|
|
|
85
|
-
if ((typeof val === 'undefined' ? 'undefined' : typeof val) === 'object')
|
|
85
|
+
if ((typeof val === 'undefined' ? 'undefined' : typeof val) === 'object')
|
|
86
86
|
return `${JSON.stringify(val)}`;
|
|
87
87
|
|
|
88
|
-
if (Array.isArray(val))
|
|
88
|
+
if (Array.isArray(val))
|
|
89
89
|
return `${JSON.stringify(val)}`;
|
|
90
90
|
|
|
91
91
|
return '';
|
|
@@ -95,5 +95,5 @@ export default {
|
|
|
95
95
|
capitalizeFirstLetter,
|
|
96
96
|
toUnderscored,
|
|
97
97
|
calcDelta,
|
|
98
|
-
diffToString
|
|
98
|
+
diffToString
|
|
99
99
|
};
|
package/paper-trail/index.js
CHANGED
|
@@ -4,6 +4,8 @@ import helpers from './helpers.js';
|
|
|
4
4
|
import paginator from "../paginator/sql-pagination.js";
|
|
5
5
|
import { utils } from "../utils/index.js"
|
|
6
6
|
|
|
7
|
+
const censorText = "**********"
|
|
8
|
+
|
|
7
9
|
let failHard = false;
|
|
8
10
|
let als;
|
|
9
11
|
let Sequelize = null;
|
|
@@ -31,6 +33,7 @@ paperTrail.init = (sequelize, sequelizePackage, optionsArg) => {
|
|
|
31
33
|
],
|
|
32
34
|
// additional fields to exclude on a global basis
|
|
33
35
|
excludeExtras: [],
|
|
36
|
+
censor: ["mfa_temp_secret", "mfa_secret"],
|
|
34
37
|
revisionAttribute: 'revision',
|
|
35
38
|
revisionModel: 'Revision',
|
|
36
39
|
revisionChangeModel: 'RevisionChange',
|
|
@@ -660,6 +663,15 @@ paperTrail.init = (sequelize, sequelizePackage, optionsArg) => {
|
|
|
660
663
|
values.document_id = values.document_id || values.document_uuid;
|
|
661
664
|
delete values.document_uuid;
|
|
662
665
|
|
|
666
|
+
_.forEach(defaultOptions.censor, a => {
|
|
667
|
+
if (!utils.isBlank(values.document.newValues[a])){
|
|
668
|
+
values.document.newValues[a] = censorText;
|
|
669
|
+
}
|
|
670
|
+
if (!utils.isBlank(values.document.oldValues[a])){
|
|
671
|
+
values.document.oldValues[a] = censorText;
|
|
672
|
+
}
|
|
673
|
+
})
|
|
674
|
+
|
|
663
675
|
return _.omitBy(values, function(value, key) {
|
|
664
676
|
return (excludedFields.includes(key) || (value === null));
|
|
665
677
|
});
|
package/queue/subscriber.js
CHANGED
|
@@ -70,6 +70,7 @@ export class Subscriber {
|
|
|
70
70
|
} catch (e) {
|
|
71
71
|
logger.error("Failed to parse incomming message:", e);
|
|
72
72
|
error = e;
|
|
73
|
+
payload = { error, original_content: content.toString() };
|
|
73
74
|
}
|
|
74
75
|
payload.metadata = fields;
|
|
75
76
|
logger.debug(`Got message from exchange '${fields.exchange}' with key '${fields.routingKey}'`);
|