koatty_router 2.1.5 → 2.1.6

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.
@@ -1,10 +1,10 @@
1
1
 
2
2
  
3
- > koatty_router@2.1.5 build /Users/richen/Workspace/nodejs/koatty-monorepo/packages/koatty-router
3
+ > koatty_router@2.1.6 build /Users/richen/Workspace/nodejs/koatty-monorepo/packages/koatty-router
4
4
  > pnpm run build:js && pnpm run build:dts && pnpm run build:doc && pnpm run build:cp
5
5
 
6
6
 
7
- > koatty_router@2.1.5 build:js /Users/richen/Workspace/nodejs/koatty-monorepo/packages/koatty-router
7
+ > koatty_router@2.1.6 build:js /Users/richen/Workspace/nodejs/koatty-monorepo/packages/koatty-router
8
8
  > tsup
9
9
 
10
10
  CLI Building entry: src/index.ts
@@ -15,14 +15,14 @@
15
15
  CLI Cleaning output folder
16
16
  CJS Build start
17
17
  ESM Build start
18
- CJS dist/index.js 147.14 KB
19
- CJS dist/index.js.map 374.07 KB
20
- CJS ⚡️ Build success in 961ms
21
- ESM dist/index.mjs 141.13 KB
22
- ESM dist/index.mjs.map 373.76 KB
23
- ESM ⚡️ Build success in 964ms
24
-
25
- > koatty_router@2.1.5 build:dts /Users/richen/Workspace/nodejs/koatty-monorepo/packages/koatty-router
18
+ CJS dist/index.js 148.11 KB
19
+ CJS dist/index.js.map 376.39 KB
20
+ CJS ⚡️ Build success in 978ms
21
+ ESM dist/index.mjs 142.07 KB
22
+ ESM dist/index.mjs.map 376.08 KB
23
+ ESM ⚡️ Build success in 993ms
24
+
25
+ > koatty_router@2.1.6 build:dts /Users/richen/Workspace/nodejs/koatty-monorepo/packages/koatty-router
26
26
  > bash ../../scripts/build-dts.sh
27
27
 
28
28
  🔨 Building type declarations for koatty-router...
@@ -172,7 +172,7 @@ Analysis will use the bundled TypeScript version 5.8.2
172
172
  API Extractor completed successfully
173
173
  ⠙✅ Type declarations built successfully
174
174
 
175
- > koatty_router@2.1.5 build:doc /Users/richen/Workspace/nodejs/koatty-monorepo/packages/koatty-router
175
+ > koatty_router@2.1.6 build:doc /Users/richen/Workspace/nodejs/koatty-monorepo/packages/koatty-router
176
176
  > api-documenter markdown --input temp --output docs/api
177
177
 
178
178
 
@@ -215,7 +215,7 @@ Unsupported block tag: @interface
215
215
  Unsupported block tag: @RequestBody
216
216
  Unsupported block tag: @RequestParam
217
217
 
218
- > koatty_router@2.1.5 build:cp /Users/richen/Workspace/nodejs/koatty-monorepo/packages/koatty-router
218
+ > koatty_router@2.1.6 build:cp /Users/richen/Workspace/nodejs/koatty-monorepo/packages/koatty-router
219
219
  > node ../../scripts/postBuild.js
220
220
 
221
221
  📦 postBuild: koatty-router
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.1.6
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+ - koatty_container@2.0.6
9
+ - koatty_core@2.1.6
10
+ - koatty_exception@2.1.6
11
+ - koatty_validation@2.0.6
12
+
3
13
  ## 2.1.5
4
14
 
5
15
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * @Author: richen
3
- * @Date: 2026-02-10 17:13:28
3
+ * @Date: 2026-02-11 11:43:06
4
4
  * @License: BSD (3-Clause)
5
5
  * @Copyright (c) - <richenlin(at)gmail.com>
6
6
  * @HomePage: https://koatty.org/
package/dist/index.js CHANGED
@@ -54,7 +54,7 @@ var onFinished__default = /*#__PURE__*/_interopDefault(onFinished);
54
54
 
55
55
  /*!
56
56
  * @Author: richen
57
- * @Date: 2026-02-10 09:12:21
57
+ * @Date: 2026-02-11 03:41:57
58
58
  * @License: BSD (3-Clause)
59
59
  * @Copyright (c) - <richenlin(at)gmail.com>
60
60
  * @HomePage: https://koatty.org/
@@ -1224,12 +1224,36 @@ __name(getContentLength, "getContentLength");
1224
1224
  function payload(options) {
1225
1225
  const opts = cacheManager.getMergedOptions(options);
1226
1226
  return (ctx, next) => {
1227
+ if (!Object.prototype.hasOwnProperty.call(ctx, "requestHeader")) {
1228
+ Helper5.Helper.define(ctx, "requestHeader", (name) => {
1229
+ return name ? ctx.get(name) : ctx.headers;
1230
+ });
1231
+ }
1232
+ if (!Object.prototype.hasOwnProperty.call(ctx, "requestQuery")) {
1233
+ Helper5.Helper.define(ctx, "requestQuery", (name) => {
1234
+ const queryParams = ctx.query ?? {};
1235
+ return name ? queryParams[name] : queryParams;
1236
+ });
1237
+ }
1238
+ if (!Object.prototype.hasOwnProperty.call(ctx, "requestPathVariable")) {
1239
+ Helper5.Helper.define(ctx, "requestPathVariable", (name) => {
1240
+ const pathParams = ctx.params ?? {};
1241
+ return name ? pathParams[name] : pathParams;
1242
+ });
1243
+ }
1227
1244
  if (!Object.prototype.hasOwnProperty.call(ctx, "requestParam")) {
1228
1245
  Helper5.Helper.define(ctx, "requestParam", () => queryParser(ctx));
1229
1246
  }
1230
1247
  if (!Object.prototype.hasOwnProperty.call(ctx, "requestBody")) {
1231
1248
  Helper5.Helper.define(ctx, "requestBody", () => bodyParser(ctx, opts));
1232
1249
  }
1250
+ if (!Object.prototype.hasOwnProperty.call(ctx, "requestFile")) {
1251
+ Helper5.Helper.define(ctx, "requestFile", async (name) => {
1252
+ const body = await bodyParser(ctx, opts);
1253
+ const files = body.file ?? {};
1254
+ return name ? files[name] : files;
1255
+ });
1256
+ }
1233
1257
  return next();
1234
1258
  };
1235
1259
  }