@autofleet/shtinker 1.1.6-beta.3 → 1.1.6-beta.5

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.
@@ -21,7 +21,7 @@ const getAuditContext = () => {
21
21
  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);
22
22
  return auditContext;
23
23
  };
24
- const getChangedFields = (instance, options) => {
24
+ const getChangedFields = (instance, options, loggerLocal) => {
25
25
  // When bulk updating in sequelize using the "returning" option, the instance.changed() stops working.
26
26
  // It's a known issut with sequelize.
27
27
  if (options.returning) {
@@ -46,10 +46,10 @@ class AuditLogger {
46
46
  const auditContext = getAuditContext();
47
47
  this.logger.info('auditContext:', { auditContext });
48
48
  if (auditContext) {
49
- const changedProperties = getChangedFields(instance, options);
49
+ const changedProperties = getChangedFields(instance, options, this.logger);
50
50
  this.logger.info('changedProperties:', { changedProperties });
51
- // const changedPropertiesWithoutEmptyFields = changedProperties.filter((property) => instance.previous(property) != null || instance.get(property) != null);
52
- // this.logger.info('changedPropertiesWithoutEmptyFields:', { changedPropertiesWithoutEmptyFields });
51
+ const changedPropertiesWithoutEmptyFields = changedProperties.filter((property) => instance.previous(property) != null || instance.get(property) != null);
52
+ this.logger.info('changedPropertiesWithoutEmptyFields:', { changedPropertiesWithoutEmptyFields });
53
53
  const payload = {
54
54
  entityType: modelName,
55
55
  entityId: instance.id,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autofleet/shtinker",
3
- "version": "1.1.6-beta.3",
3
+ "version": "1.1.6-beta.5",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -12,7 +12,7 @@ const getAuditContext = () => {
12
12
  return auditContext;
13
13
  };
14
14
 
15
- const getChangedFields = (instance, options) => {
15
+ const getChangedFields = (instance, options, loggerLocal) => {
16
16
  // When bulk updating in sequelize using the "returning" option, the instance.changed() stops working.
17
17
  // It's a known issut with sequelize.
18
18
  if (options.returning) {
@@ -45,10 +45,10 @@ class AuditLogger {
45
45
  const auditContext = getAuditContext();
46
46
  this.logger.info('auditContext:', { auditContext });
47
47
  if (auditContext) {
48
- const changedProperties = getChangedFields(instance, options);
48
+ const changedProperties = getChangedFields(instance, options, this.logger);
49
49
  this.logger.info('changedProperties:', { changedProperties });
50
- // const changedPropertiesWithoutEmptyFields = changedProperties.filter((property) => instance.previous(property) != null || instance.get(property) != null);
51
- // this.logger.info('changedPropertiesWithoutEmptyFields:', { changedPropertiesWithoutEmptyFields });
50
+ const changedPropertiesWithoutEmptyFields = changedProperties.filter((property) => instance.previous(property) != null || instance.get(property) != null);
51
+ this.logger.info('changedPropertiesWithoutEmptyFields:', { changedPropertiesWithoutEmptyFields });
52
52
  const payload: AuditLogPayload = {
53
53
  entityType: modelName,
54
54
  entityId: instance.id,