@naturalcycles/backend-lib 8.0.0 → 8.0.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.
package/dist/index.d.ts CHANGED
@@ -8,7 +8,6 @@ export * from './sentry/sentry.shared.service';
8
8
  export * from './server/asyncLocalStorageMiddleware';
9
9
  export * from './server/basicAuthMiddleware';
10
10
  export * from './server/bodyParserTimeoutMiddleware';
11
- export * from './server/catchWrapper';
12
11
  export * from './server/createDefaultApp';
13
12
  export * from './server/createDefaultApp.model';
14
13
  export * from './server/deployInfo.util';
package/dist/index.js CHANGED
@@ -13,7 +13,6 @@ tslib_1.__exportStar(require("./sentry/sentry.shared.service"), exports);
13
13
  tslib_1.__exportStar(require("./server/asyncLocalStorageMiddleware"), exports);
14
14
  tslib_1.__exportStar(require("./server/basicAuthMiddleware"), exports);
15
15
  tslib_1.__exportStar(require("./server/bodyParserTimeoutMiddleware"), exports);
16
- tslib_1.__exportStar(require("./server/catchWrapper"), exports);
17
16
  tslib_1.__exportStar(require("./server/createDefaultApp"), exports);
18
17
  tslib_1.__exportStar(require("./server/createDefaultApp.model"), exports);
19
18
  tslib_1.__exportStar(require("./server/deployInfo.util"), exports);
@@ -63,7 +63,8 @@ class ValidateRequest {
63
63
  });
64
64
  }
65
65
  // mutate req to replace the property with the value, converted by Joi
66
- if (!opt.keepOriginal) {
66
+ if (!opt.keepOriginal && reqProperty !== 'query') {
67
+ // query is read-only in Express 5
67
68
  req[reqProperty] = value;
68
69
  }
69
70
  return value;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturalcycles/backend-lib",
3
- "version": "8.0.0",
3
+ "version": "8.0.2",
4
4
  "scripts": {
5
5
  "prepare": "husky",
6
6
  "build": "dev-lib build",
@@ -8,7 +8,7 @@
8
8
  "lint": "dev-lib lint",
9
9
  "bt": "dev-lib bt",
10
10
  "lbt": "dev-lib lbt",
11
- "dev": "APP_ENV=dev node -r ts-node/register --watch ./src/test/server/server.ts",
11
+ "dev": "APP_ENV=dev tsx watch src/test/server/server.ts",
12
12
  "docs-serve": "NODE_OPTIONS=--openssl-legacy-provider vuepress dev docs",
13
13
  "docs-build": "NODE_OPTIONS=--openssl-legacy-provider vuepress build docs",
14
14
  "deploy-gae": "yarn tsx ./src/bin/deploy-gae.ts",
package/src/index.ts CHANGED
@@ -8,7 +8,6 @@ export * from './sentry/sentry.shared.service'
8
8
  export * from './server/asyncLocalStorageMiddleware'
9
9
  export * from './server/basicAuthMiddleware'
10
10
  export * from './server/bodyParserTimeoutMiddleware'
11
- export * from './server/catchWrapper'
12
11
  export * from './server/createDefaultApp'
13
12
  export * from './server/createDefaultApp.model'
14
13
  export * from './server/deployInfo.util'
@@ -112,7 +112,8 @@ class ValidateRequest {
112
112
  }
113
113
 
114
114
  // mutate req to replace the property with the value, converted by Joi
115
- if (!opt.keepOriginal) {
115
+ if (!opt.keepOriginal && reqProperty !== 'query') {
116
+ // query is read-only in Express 5
116
117
  req[reqProperty] = value
117
118
  }
118
119
 
@@ -1,2 +0,0 @@
1
- import { BackendRequestHandler } from './server.model';
2
- export declare const catchWrapper: (fn: BackendRequestHandler) => BackendRequestHandler;
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.catchWrapper = void 0;
4
- // https://strongloop.com/strongblog/async-error-handling-expressjs-es7-promises-generators/
5
- // https://stackoverflow.com/a/43564267/4919972
6
- const catchWrapper = (fn) => async (req, res, next) => {
7
- try {
8
- await fn(req, res, next);
9
- }
10
- catch (err) {
11
- next(err);
12
- }
13
- };
14
- exports.catchWrapper = catchWrapper;
@@ -1,13 +0,0 @@
1
- import { BackendRequestHandler } from './server.model'
2
-
3
- // https://strongloop.com/strongblog/async-error-handling-expressjs-es7-promises-generators/
4
- // https://stackoverflow.com/a/43564267/4919972
5
- export const catchWrapper =
6
- (fn: BackendRequestHandler): BackendRequestHandler =>
7
- async (req, res, next) => {
8
- try {
9
- await fn(req, res, next)
10
- } catch (err) {
11
- next(err)
12
- }
13
- }