@estgbue/mezgeb 0.0.45 → 0.0.47

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.
@@ -61,16 +61,16 @@ let ClientLoggerInterceptor = class ClientLoggerInterceptor {
61
61
  }));
62
62
  }
63
63
  handleRequestAuditInitiation(context, next, requestId) {
64
- var _a, _b, _c, _d, _e;
64
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
65
65
  const req = context.switchToHttp().getRequest();
66
- const { ip, ips, method, originalUrl, headers, body, params, user } = req;
66
+ const { ip, ips, method, originalUrl, headers, body, params, auditUser, user } = req;
67
67
  const ds = this.connection;
68
- const userPayload = (ds.user = Object.assign({ id: user === null || user === void 0 ? void 0 : user.id, name: `${user === null || user === void 0 ? void 0 : user.firstName} ${user === null || user === void 0 ? void 0 : user.lastName}`, organizationId: (_a = user === null || user === void 0 ? void 0 : user.organization) === null || _a === void 0 ? void 0 : _a.id, organizationName: (_b = user === null || user === void 0 ? void 0 : user.organization) === null || _b === void 0 ? void 0 : _b.name }, user));
68
+ const userPayload = (ds.user = Object.assign({ id: (_a = auditUser === null || auditUser === void 0 ? void 0 : auditUser.id) !== null && _a !== void 0 ? _a : user === null || user === void 0 ? void 0 : user.id, name: `${(_b = auditUser === null || auditUser === void 0 ? void 0 : auditUser.firstName) !== null && _b !== void 0 ? _b : user === null || user === void 0 ? void 0 : user.firstName} ${(_c = auditUser === null || auditUser === void 0 ? void 0 : auditUser.lastName) !== null && _c !== void 0 ? _c : user === null || user === void 0 ? void 0 : user.lastName}`, organizationId: (_e = (_d = auditUser === null || auditUser === void 0 ? void 0 : auditUser.organization) === null || _d === void 0 ? void 0 : _d.id) !== null && _e !== void 0 ? _e : (_f = user === null || user === void 0 ? void 0 : user.organization) === null || _f === void 0 ? void 0 : _f.id, organizationName: (_h = (_g = auditUser === null || auditUser === void 0 ? void 0 : auditUser.organization) === null || _g === void 0 ? void 0 : _g.name) !== null && _h !== void 0 ? _h : (_j = user === null || user === void 0 ? void 0 : user.organization) === null || _j === void 0 ? void 0 : _j.name }, (auditUser !== null && auditUser !== void 0 ? auditUser : user)));
69
69
  const log = {
70
70
  id: requestId,
71
71
  requestMethod: method,
72
- application: (_d = (_c = process.env.APPLICATION_NAME) !== null && _c !== void 0 ? _c : process.env.APP_NAME) !== null && _d !== void 0 ? _d : 'DEFAULT',
73
- module: (_e = originalUrl.split('/')[2]) !== null && _e !== void 0 ? _e : 'DEFAULT',
72
+ application: (_l = (_k = process.env.APPLICATION_NAME) !== null && _k !== void 0 ? _k : process.env.APP_NAME) !== null && _l !== void 0 ? _l : 'DEFAULT',
73
+ module: (_m = originalUrl.split('/')[2]) !== null && _m !== void 0 ? _m : 'DEFAULT',
74
74
  requestBody: originalUrl.includes('/auth') ? {} : body,
75
75
  requestHeader: this.mapHeaders(headers),
76
76
  statusCode: 201,
@@ -1,4 +1,4 @@
1
1
  import { Repository, FindOptionsWhere, ObjectLiteral } from "typeorm";
2
- export declare const safeSave: <T extends ObjectLiteral>(repo: Repository<T>, conditions: FindOptionsWhere<T>, patch: Partial<T>) => Promise<T>;
3
- export declare const safeRemove: <T extends ObjectLiteral>(repo: Repository<T>, conditions: FindOptionsWhere<T>) => Promise<T>;
2
+ export declare const safeSave: <T extends ObjectLiteral>(repo: Repository<T>, conditions: FindOptionsWhere<T>, patch: Partial<T>) => Promise<T | undefined>;
3
+ export declare const safeRemove: <T extends ObjectLiteral>(repo: Repository<T>, conditions: FindOptionsWhere<T>) => Promise<T | undefined>;
4
4
  //# sourceMappingURL=client-save-update.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client-save-update.d.ts","sourceRoot":"","sources":["../../../libs/mezgeb/src/mezgeb/client/client-save-update.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,aAAa,EACd,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,QAAQ,GAAU,CAAC,SAAS,aAAa,EACpD,MAAM,UAAU,CAAC,CAAC,CAAC,EACnB,YAAY,gBAAgB,CAAC,CAAC,CAAC,EAC/B,OAAO,OAAO,CAAC,CAAC,CAAC,KAChB,OAAO,CAAC,CAAC,CAMX,CAAA;AAED,eAAO,MAAM,UAAU,GAAU,CAAC,SAAS,aAAa,EACtD,MAAM,UAAU,CAAC,CAAC,CAAC,EACnB,YAAY,gBAAgB,CAAC,CAAC,CAAC,KAC9B,OAAO,CAAC,CAAC,CAIX,CAAA"}
1
+ {"version":3,"file":"client-save-update.d.ts","sourceRoot":"","sources":["../../../libs/mezgeb/src/mezgeb/client/client-save-update.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,aAAa,EACd,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,QAAQ,GAAU,CAAC,SAAS,aAAa,EACpD,MAAM,UAAU,CAAC,CAAC,CAAC,EACnB,YAAY,gBAAgB,CAAC,CAAC,CAAC,EAC/B,OAAO,OAAO,CAAC,CAAC,CAAC,KAChB,OAAO,CAAC,CAAC,GAAC,SAAS,CASrB,CAAA;AAED,eAAO,MAAM,UAAU,GAAU,CAAC,SAAS,aAAa,EACtD,MAAM,UAAU,CAAC,CAAC,CAAC,EACnB,YAAY,gBAAgB,CAAC,CAAC,CAAC,KAC9B,OAAO,CAAC,CAAC,GAAC,SAAS,CAQrB,CAAA"}
@@ -11,13 +11,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.safeRemove = exports.safeSave = void 0;
13
13
  const safeSave = (repo, conditions, patch) => __awaiter(void 0, void 0, void 0, function* () {
14
- const entity = yield repo.findOneByOrFail(conditions);
14
+ const entity = yield repo.findOneBy(conditions);
15
+ if (!entity) {
16
+ return;
17
+ }
15
18
  Object.assign(entity, patch);
16
19
  return repo.save(entity);
17
20
  });
18
21
  exports.safeSave = safeSave;
19
22
  const safeRemove = (repo, conditions) => __awaiter(void 0, void 0, void 0, function* () {
20
- const entity = yield repo.findOneByOrFail(conditions);
23
+ const entity = yield repo.findOneBy(conditions);
24
+ if (!entity) {
25
+ return;
26
+ }
21
27
  return repo.remove(entity);
22
28
  });
23
29
  exports.safeRemove = safeRemove;
@@ -57,7 +57,7 @@ let AuditLogCommandService = class AuditLogCommandService {
57
57
  ...Object.keys(after || {}),
58
58
  ]);
59
59
  for (const key of keys) {
60
- if (key === 'updatedAt')
60
+ if (key === 'updatedAt' || key === 'amharicUpdatedAt')
61
61
  continue;
62
62
  const fromValue = before === null || before === void 0 ? void 0 : before[key];
63
63
  const toValue = after === null || after === void 0 ? void 0 : after[key];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@estgbue/mezgeb",
3
- "version": "0.0.45",
3
+ "version": "0.0.47",
4
4
  "main": "./src/index",
5
5
  "exports": {
6
6
  ".": "./dist/index.js"