@sdflc/backend-helpers 1.0.64 → 1.0.65

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.
@@ -50,18 +50,19 @@ class BaseController {
50
50
  res.status(result.getHttpStatus()).json(result.toJS());
51
51
  }
52
52
  else if (result) {
53
- res.json(result);
53
+ res.status(200).json(result);
54
54
  }
55
55
  else {
56
56
  res.status(204).json(new api_helpers_1.OpResult());
57
57
  }
58
58
  if (((_a = req.context) === null || _a === void 0 ? void 0 : _a.isExternalDb) === false && ((_b = req.context) === null || _b === void 0 ? void 0 : _b.db)) {
59
59
  this.logger.log('Release DB connection');
60
- req.context.db.destroy();
60
+ yield req.context.db.destroy();
61
61
  }
62
62
  yield this.onResponse(req, res, next);
63
63
  }
64
64
  catch (ex) {
65
+ this.logger.log(`An exception has occured when processing REST API request on the entry point '${req.method} ${req.originalUrl}' from ${req.ip}`);
65
66
  next(ex);
66
67
  }
67
68
  });
package/build/BaseCore.js CHANGED
@@ -143,7 +143,7 @@ class BaseCore {
143
143
  }
144
144
  runAction(opt) {
145
145
  return __awaiter(this, void 0, void 0, function* () {
146
- const { args, validate, doAuth, action, hasTransaction, doingWhat, onException } = opt || {};
146
+ const { args, validate, doAuth, action, hasTransaction, doingWhat, onException, shouldLogArgs } = opt || {};
147
147
  // If we process action with the same requestId as requestId passed to the constructor it means
148
148
  // we are processing the same request from FE and can skip some of the operations like transactions and etc
149
149
  const sameRequest = !!this.config.context.requestId && (args === null || args === void 0 ? void 0 : args.requestId) === this.config.context.requestId;
@@ -151,7 +151,12 @@ class BaseCore {
151
151
  // this.measureTool.threadBlockTime(doingWhat, ({ name, durationMs }: any) => {
152
152
  // this.logger.debug(`The ${name} blocked thread for the time of ${durationMs} ms`);
153
153
  // });
154
- this.logger.debug(`The ${doingWhat} started:`, args);
154
+ if (shouldLogArgs == null || shouldLogArgs === true) {
155
+ this.logger.debug(`The ${doingWhat} started:`, args);
156
+ }
157
+ else {
158
+ this.logger.debug(`The ${doingWhat} started`);
159
+ }
155
160
  this.measureTool.start();
156
161
  let step = doingWhat || '';
157
162
  const setStep = (stepName) => {
@@ -8,4 +8,5 @@ export interface CoreActionInterface {
8
8
  hasTransaction: boolean;
9
9
  doingWhat?: string;
10
10
  onException?(params: any, opt?: BaseCoreActionsInterface): Promise<any | undefined | null>;
11
+ shouldLogArgs?: boolean;
11
12
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sdflc/backend-helpers",
3
- "version": "1.0.64",
3
+ "version": "1.0.65",
4
4
  "description": "Set of helper functions and classes to simplify building backend apps within @sdflc ecosystem",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",