@modern-js/plugin-express 2.11.0 → 2.13.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # @modern-js/plugin-express
2
2
 
3
+ ## 2.13.0
4
+
5
+ ### Patch Changes
6
+
7
+ - @modern-js/bff-core@2.13.0
8
+ - @modern-js/bff-runtime@2.13.0
9
+ - @modern-js/types@2.13.0
10
+ - @modern-js/utils@2.13.0
11
+
12
+ ## 2.12.0
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies [c2ca6c8]
17
+ - Updated dependencies [6d86e34]
18
+ - @modern-js/utils@2.12.0
19
+ - @modern-js/bff-core@2.12.0
20
+ - @modern-js/bff-runtime@2.12.0
21
+ - @modern-js/types@2.12.0
22
+
3
23
  ## 2.11.0
4
24
 
5
25
  ### Patch Changes
@@ -120,8 +120,8 @@ var plugin_default = () => ({
120
120
  app = (0, import_express.default)();
121
121
  initApp(app);
122
122
  if (config) {
123
- const { middleware: middleware1 } = config;
124
- initMiddlewares(middleware1, app);
123
+ const { middleware } = config;
124
+ initMiddlewares(middleware, app);
125
125
  }
126
126
  useRun(app);
127
127
  (0, import_registerRoutes.default)(app, apiHandlerInfos);
package/dist/cjs/utils.js CHANGED
@@ -84,17 +84,17 @@ const createRouteHandler = (handler) => {
84
84
  throw error;
85
85
  }
86
86
  } else if ((0, import_bff_runtime.isSchemaHandler)(handler)) {
87
- const result1 = await handler(input);
88
- if (result1.type !== "HandleSuccess") {
89
- if (result1.type === "InputValidationError") {
87
+ const result = await handler(input);
88
+ if (result.type !== "HandleSuccess") {
89
+ if (result.type === "InputValidationError") {
90
90
  res.status(400);
91
91
  } else {
92
92
  res.status(500);
93
93
  }
94
- return res.json(result1.message);
94
+ return res.json(result.message);
95
95
  } else {
96
96
  res.status(200);
97
- return res.json(result1.value);
97
+ return res.json(result.value);
98
98
  }
99
99
  } else if ((0, import_bff_core.isInputParamsDeciderHandler)(handler)) {
100
100
  try {
@@ -110,17 +110,17 @@ const createRouteHandler = (handler) => {
110
110
  return next(e);
111
111
  }
112
112
  } else {
113
- const args1 = Object.values(input.params).concat(input);
113
+ const args = Object.values(input.params).concat(input);
114
114
  try {
115
- const body1 = await handler(...args1);
115
+ const body = await handler(...args);
116
116
  if (res.headersSent) {
117
117
  return await Promise.resolve();
118
118
  }
119
- if (typeof body1 !== "undefined") {
120
- return res.json(body1);
119
+ if (typeof body !== "undefined") {
120
+ return res.json(body);
121
121
  }
122
- } catch (e1) {
123
- return next(e1);
122
+ } catch (e) {
123
+ return next(e);
124
124
  }
125
125
  }
126
126
  };
@@ -88,8 +88,8 @@ var plugin_default = () => ({
88
88
  app = express();
89
89
  initApp(app);
90
90
  if (config) {
91
- const { middleware: middleware1 } = config;
92
- initMiddlewares(middleware1, app);
91
+ const { middleware } = config;
92
+ initMiddlewares(middleware, app);
93
93
  }
94
94
  useRun(app);
95
95
  registerRoutes(app, apiHandlerInfos);
@@ -51,17 +51,17 @@ const createRouteHandler = (handler) => {
51
51
  throw error;
52
52
  }
53
53
  } else if (isSchemaHandler(handler)) {
54
- const result1 = await handler(input);
55
- if (result1.type !== "HandleSuccess") {
56
- if (result1.type === "InputValidationError") {
54
+ const result = await handler(input);
55
+ if (result.type !== "HandleSuccess") {
56
+ if (result.type === "InputValidationError") {
57
57
  res.status(400);
58
58
  } else {
59
59
  res.status(500);
60
60
  }
61
- return res.json(result1.message);
61
+ return res.json(result.message);
62
62
  } else {
63
63
  res.status(200);
64
- return res.json(result1.value);
64
+ return res.json(result.value);
65
65
  }
66
66
  } else if (isInputParamsDeciderHandler(handler)) {
67
67
  try {
@@ -77,17 +77,17 @@ const createRouteHandler = (handler) => {
77
77
  return next(e);
78
78
  }
79
79
  } else {
80
- const args1 = Object.values(input.params).concat(input);
80
+ const args = Object.values(input.params).concat(input);
81
81
  try {
82
- const body1 = await handler(...args1);
82
+ const body = await handler(...args);
83
83
  if (res.headersSent) {
84
84
  return await Promise.resolve();
85
85
  }
86
- if (typeof body1 !== "undefined") {
87
- return res.json(body1);
86
+ if (typeof body !== "undefined") {
87
+ return res.json(body);
88
88
  }
89
- } catch (e1) {
90
- return next(e1);
89
+ } catch (e) {
90
+ return next(e);
91
91
  }
92
92
  }
93
93
  };
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "2.11.0",
14
+ "version": "2.13.0",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/types/cli/index.d.ts",
17
17
  "main": "./dist/cjs/cli/index.js",
@@ -42,10 +42,10 @@
42
42
  "formidable": "^1.2.2",
43
43
  "reflect-metadata": "^0.1.13",
44
44
  "type-is": "^1.6.18",
45
- "@modern-js/bff-core": "2.11.0",
46
- "@modern-js/bff-runtime": "2.11.0",
47
- "@modern-js/types": "2.11.0",
48
- "@modern-js/utils": "2.11.0"
45
+ "@modern-js/bff-runtime": "2.13.0",
46
+ "@modern-js/types": "2.13.0",
47
+ "@modern-js/bff-core": "2.13.0",
48
+ "@modern-js/utils": "2.13.0"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@types/cookie-parser": "^1.4.2",
@@ -61,11 +61,11 @@
61
61
  "supertest": "^6.1.6",
62
62
  "typescript": "^4",
63
63
  "zod": "^3.17.3",
64
- "@modern-js/core": "2.11.0",
65
- "@modern-js/app-tools": "2.11.0",
66
- "@modern-js/server-core": "2.11.0",
67
- "@scripts/build": "2.11.0",
68
- "@scripts/jest-config": "2.11.0"
64
+ "@modern-js/core": "2.13.0",
65
+ "@modern-js/app-tools": "2.13.0",
66
+ "@modern-js/server-core": "2.13.0",
67
+ "@scripts/build": "2.13.0",
68
+ "@scripts/jest-config": "2.13.0"
69
69
  },
70
70
  "peerDependencies": {
71
71
  "express": "^4.17.1"