@autofleet/shtinker 1.1.7-beta.8 → 1.1.7-beta.9
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/index.js +7 -1
- package/package.json +1 -1
- package/src/index.ts +7 -1
package/dist/index.js
CHANGED
|
@@ -34,7 +34,7 @@ const audit_api_1 = __importDefault(require("./audit-api"));
|
|
|
34
34
|
const logger_1 = __importDefault(require("./logger"));
|
|
35
35
|
let auditLogger;
|
|
36
36
|
const enableAuditing = (options) => {
|
|
37
|
-
if (
|
|
37
|
+
if (process.env.DISABLE_AUDIT_LOGS !== 'true') {
|
|
38
38
|
auditLogger = new audit_logger_1.default(options);
|
|
39
39
|
(0, audit_api_1.default)(options);
|
|
40
40
|
auditLogger.registerHooks();
|
|
@@ -43,6 +43,9 @@ const enableAuditing = (options) => {
|
|
|
43
43
|
exports.enableAuditing = enableAuditing;
|
|
44
44
|
const setAuditContext = (entityType, action) => (req, res, next) => __awaiter(void 0, void 0, void 0, function* () {
|
|
45
45
|
try {
|
|
46
|
+
if (process.env.DISABLE_AUDIT_LOGS === 'true') {
|
|
47
|
+
return next();
|
|
48
|
+
}
|
|
46
49
|
const currentTrace = (0, zehut_1.getCurrentPayload)();
|
|
47
50
|
if (currentTrace && currentTrace.context && currentTrace.context.get) {
|
|
48
51
|
const user = currentTrace.context.get(const_1.USER_CONTEXT_KEY);
|
|
@@ -65,6 +68,9 @@ const setAuditContext = (entityType, action) => (req, res, next) => __awaiter(vo
|
|
|
65
68
|
exports.setAuditContext = setAuditContext;
|
|
66
69
|
const setRabbitAuditContext = (entityType, action) => (endpoint) => __awaiter(void 0, void 0, void 0, function* () {
|
|
67
70
|
var _a;
|
|
71
|
+
if (process.env.DISABLE_AUDIT_LOGS === 'true') {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
68
74
|
const currentTrace = (0, zehut_1.getCurrentPayload)();
|
|
69
75
|
if ((_a = currentTrace === null || currentTrace === void 0 ? void 0 : currentTrace.context) === null || _a === void 0 ? void 0 : _a.get) {
|
|
70
76
|
const user = currentTrace.context.get(const_1.USER_CONTEXT_KEY);
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -8,7 +8,7 @@ import logger from './logger';
|
|
|
8
8
|
let auditLogger: AuditLogger;
|
|
9
9
|
|
|
10
10
|
export const enableAuditing = (options: AuditLoggerOptions) => {
|
|
11
|
-
if (
|
|
11
|
+
if (process.env.DISABLE_AUDIT_LOGS !== 'true') {
|
|
12
12
|
auditLogger = new AuditLogger(options);
|
|
13
13
|
addAuditApi(options as any);
|
|
14
14
|
auditLogger.registerHooks();
|
|
@@ -20,6 +20,9 @@ export const setAuditContext = (
|
|
|
20
20
|
action: string,
|
|
21
21
|
) => async (req: any, res: any, next: any): Promise<any> => {
|
|
22
22
|
try {
|
|
23
|
+
if (process.env.DISABLE_AUDIT_LOGS === 'true') {
|
|
24
|
+
return next();
|
|
25
|
+
}
|
|
23
26
|
const currentTrace = getCurrentTrace();
|
|
24
27
|
if (currentTrace && currentTrace.context && currentTrace.context.get) {
|
|
25
28
|
const user = currentTrace.context.get(USER_CONTEXT_KEY);
|
|
@@ -43,6 +46,9 @@ export const setRabbitAuditContext = (
|
|
|
43
46
|
entityType: string,
|
|
44
47
|
action: string,
|
|
45
48
|
) => async (endpoint: string): Promise<any> => {
|
|
49
|
+
if (process.env.DISABLE_AUDIT_LOGS === 'true') {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
46
52
|
const currentTrace = getCurrentTrace();
|
|
47
53
|
if (currentTrace?.context?.get) {
|
|
48
54
|
const user = currentTrace.context.get(USER_CONTEXT_KEY);
|