@autofleet/shtinker 1.1.7-beta.0 → 1.1.7-beta.2

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.
@@ -18,7 +18,9 @@ const logger_1 = __importDefault(require("./logger"));
18
18
  const getAuditContext = () => {
19
19
  var _a;
20
20
  const currentTrace = (0, zehut_1.getCurrentPayload)();
21
+ logger_1.default.info('getAuditContext currentTrace', { currentTrace });
21
22
  const auditContext = (_a = currentTrace === null || currentTrace === void 0 ? void 0 : currentTrace.context) === null || _a === void 0 ? void 0 : _a.get(const_1.AUDIT_LOG_CONTEXT_KEY);
23
+ logger_1.default.info('getAuditContext auditContext', { auditContext });
22
24
  return auditContext;
23
25
  };
24
26
  const isEmpty = (field) => {
package/dist/index.js CHANGED
@@ -41,6 +41,10 @@ const enableAuditing = (options) => {
41
41
  exports.enableAuditing = enableAuditing;
42
42
  const setAuditContext = (entityType, action) => (req, res, next) => __awaiter(void 0, void 0, void 0, function* () {
43
43
  try {
44
+ const ENVS_TO_DISABLE_AUDIT_LOGIC = ['production-jp', 'loadtesting', '22dd162d-2c7e-4cf3-a97a-0d8ca6b8a661'];
45
+ if (ENVS_TO_DISABLE_AUDIT_LOGIC.includes(process.env.ENV_NAME)) {
46
+ return next();
47
+ }
44
48
  const currentTrace = (0, zehut_1.getCurrentPayload)();
45
49
  if (currentTrace && currentTrace.context && currentTrace.context.get) {
46
50
  const user = currentTrace.context.get(const_1.USER_CONTEXT_KEY);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autofleet/shtinker",
3
- "version": "1.1.7-beta.0",
3
+ "version": "1.1.7-beta.2",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -8,7 +8,9 @@ import logger from './logger';
8
8
 
9
9
  const getAuditContext = () => {
10
10
  const currentTrace = getCurrentTrace();
11
+ logger.info('getAuditContext currentTrace', { currentTrace });
11
12
  const auditContext = currentTrace?.context?.get(AUDIT_LOG_CONTEXT_KEY);
13
+ logger.info('getAuditContext auditContext', { auditContext });
12
14
  return auditContext;
13
15
  };
14
16
 
package/src/index.ts CHANGED
@@ -18,6 +18,11 @@ export const setAuditContext = (
18
18
  action: string,
19
19
  ) => async (req: any, res: any, next: any): Promise<any> => {
20
20
  try {
21
+ const ENVS_TO_DISABLE_AUDIT_LOGIC = ['production-jp', 'loadtesting', '22dd162d-2c7e-4cf3-a97a-0d8ca6b8a661'];
22
+ if (ENVS_TO_DISABLE_AUDIT_LOGIC.includes(process.env.ENV_NAME)) {
23
+ return next();
24
+ }
25
+
21
26
  const currentTrace = getCurrentTrace();
22
27
  if (currentTrace && currentTrace.context && currentTrace.context.get) {
23
28
  const user = currentTrace.context.get(USER_CONTEXT_KEY);