koatty_router 2.0.9 → 2.1.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/.turbo/turbo-build.log +28 -19
- package/CHANGELOG.md +15 -0
- package/dist/index.d.ts +62 -30
- package/dist/index.js +1918 -1869
- package/dist/index.mjs +2157 -2108
- package/dist/package.json +6 -6
- package/package.json +9 -9
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> koatty_router@2.0
|
|
3
|
+
> koatty_router@2.1.0 build /Users/richen/Workspace/nodejs/koatty-monorepo/packages/koatty-router
|
|
4
4
|
> npm run build:js && npm run build:dts && npm run build:doc && npm run build:cp
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
> koatty_router@2.0
|
|
7
|
+
> koatty_router@2.1.0 build:js
|
|
8
8
|
> npx rollup --bundleConfigAsCjs -c .rollup.config.js
|
|
9
9
|
|
|
10
|
-
[1G[0K[1G[0K[36m
|
|
10
|
+
[1G[0K[1G[0K⠙[1G[0K[36m
|
|
11
11
|
[1m./src/index.ts[22m → [1m./dist/index.js, ./dist/index.mjs[22m...[39m
|
|
12
|
-
[32mcreated [1m./dist/index.js, ./dist/index.mjs[22m in [
|
|
12
|
+
[32mcreated [1m./dist/index.js, ./dist/index.mjs[22m in [1m12.6s[22m[39m
|
|
13
13
|
[1G[0K⠙[1G[0K[1G[0K⠙[1G[0K
|
|
14
|
-
> koatty_router@2.0
|
|
14
|
+
> koatty_router@2.1.0 build:dts
|
|
15
15
|
> bash ../../scripts/build-dts.sh
|
|
16
16
|
|
|
17
17
|
[1G[0K🔨 Building type declarations for koatty-router...
|
|
@@ -19,17 +19,15 @@
|
|
|
19
19
|
|
|
20
20
|
🔍 Checking dependencies: koatty_container, koatty_core, koatty_exception, koatty_graphql, koatty_lib, koatty_logger, koatty_proto, koatty_validation
|
|
21
21
|
✓ koatty_container type declarations ready
|
|
22
|
+
✓ koatty_core type declarations ready
|
|
22
23
|
✓ koatty_exception type declarations ready
|
|
23
24
|
✓ koatty_graphql type declarations ready
|
|
24
25
|
✓ koatty_lib type declarations ready
|
|
25
26
|
✓ koatty_logger type declarations ready
|
|
26
27
|
✓ koatty_proto type declarations ready
|
|
27
28
|
✓ koatty_validation type declarations ready
|
|
28
|
-
⏳ Waiting for: koatty_core (0s)
|
|
29
|
-
✗ koatty_core: missing .d.ts
|
|
30
|
-
✓ koatty_core type declarations ready
|
|
31
29
|
|
|
32
|
-
✅ All dependencies ready (waited
|
|
30
|
+
✅ All dependencies ready (waited 2ms)
|
|
33
31
|
📝 Running TypeScript compiler...
|
|
34
32
|
[1G[0K⠙[1G[0K[1G[0K⠙[1G[0K📦 Running API Extractor...
|
|
35
33
|
[1G[0K
|
|
@@ -40,6 +38,7 @@ Analysis will use the bundled TypeScript version 5.8.2
|
|
|
40
38
|
*** The target project appears to use TypeScript 5.9.3 which is newer than the bundled compiler engine; consider upgrading API Extractor.
|
|
41
39
|
[36mWriting: /Users/richen/Workspace/nodejs/koatty-monorepo/packages/koatty-router/temp/koatty_router.api.json[39m
|
|
42
40
|
[36mWriting package typings: /Users/richen/Workspace/nodejs/koatty-monorepo/packages/koatty-router/dist/index.d.ts[39m
|
|
41
|
+
[33mWarning: src/RouterComponent.ts:160:38 - (tsdoc-characters-after-block-tag) The token "@OnEvent" looks like a TSDoc tag but contains an invalid character "("; if it is not a tag, use a backslash to escape the "@"[39m
|
|
43
42
|
[33mWarning: src/params/mapping.ts:33:4 - (tsdoc-undefined-tag) The TSDoc tag "@export" is not defined in this configuration[39m
|
|
44
43
|
[33mWarning: src/params/mapping.ts:34:4 - (tsdoc-undefined-tag) The TSDoc tag "@interface" is not defined in this configuration[39m
|
|
45
44
|
[33mWarning: src/params/mapping.ts:47:4 - (tsdoc-undefined-tag) The TSDoc tag "@export" is not defined in this configuration[39m
|
|
@@ -114,18 +113,20 @@ Analysis will use the bundled TypeScript version 5.8.2
|
|
|
114
113
|
[33mWarning: src/router/router.ts:54:14 - (tsdoc-malformed-inline-tag) Expecting a TSDoc tag starting with "{@"[39m
|
|
115
114
|
[33mWarning: src/router/router.ts:55:62 - (tsdoc-escape-right-brace) The "}" character should be escaped using a backslash to avoid confusion with a TSDoc inline tag[39m
|
|
116
115
|
[33mWarning: src/router/router.ts:55:17 - (tsdoc-malformed-inline-tag) Expecting a TSDoc tag starting with "{@"[39m
|
|
117
|
-
[33mWarning: src/router/router.ts:
|
|
118
|
-
[33mWarning: src/router/router.ts:
|
|
119
|
-
[33mWarning: src/router/router.ts:
|
|
120
|
-
[33mWarning: src/router/router.ts:
|
|
121
|
-
[33mWarning: src/router/router.ts:
|
|
122
|
-
[33mWarning: src/router/router.ts:
|
|
123
|
-
[33mWarning: src/router/router.ts:
|
|
116
|
+
[33mWarning: src/router/router.ts:89:4 - (tsdoc-undefined-tag) The TSDoc tag "@export" is not defined in this configuration[39m
|
|
117
|
+
[33mWarning: src/router/router.ts:90:11 - (tsdoc-param-tag-with-invalid-type) The @param block should not include a JSDoc-style '{type}'[39m
|
|
118
|
+
[33mWarning: src/router/router.ts:91:11 - (tsdoc-param-tag-with-invalid-type) The @param block should not include a JSDoc-style '{type}'[39m
|
|
119
|
+
[33mWarning: src/router/router.ts:92:15 - (tsdoc-escape-right-brace) The "}" character should be escaped using a backslash to avoid confusion with a TSDoc inline tag[39m
|
|
120
|
+
[33mWarning: src/router/router.ts:92:66 - (tsdoc-escape-right-brace) The "}" character should be escaped using a backslash to avoid confusion with a TSDoc inline tag[39m
|
|
121
|
+
[33mWarning: src/router/router.ts:92:67 - (tsdoc-escape-right-brace) The "}" character should be escaped using a backslash to avoid confusion with a TSDoc inline tag[39m
|
|
122
|
+
[33mWarning: src/router/router.ts:92:13 - (tsdoc-malformed-inline-tag) Expecting a TSDoc tag starting with "{@"[39m
|
|
123
|
+
[33mWarning: src/router/router.ts:92:18 - (tsdoc-malformed-inline-tag) Expecting a TSDoc tag starting with "{@"[39m
|
|
124
|
+
[33mWarning: src/router/router.ts:92:19 - (tsdoc-malformed-inline-tag) Expecting a TSDoc tag starting with "{@"[39m
|
|
124
125
|
|
|
125
126
|
API Extractor completed successfully
|
|
126
127
|
[1G[0K⠙[1G[0K✅ Type declarations built successfully
|
|
127
128
|
[1G[0K⠙[1G[0K
|
|
128
|
-
> koatty_router@2.0
|
|
129
|
+
> koatty_router@2.1.0 build:doc
|
|
129
130
|
> npx api-documenter markdown --input temp --output docs/api
|
|
130
131
|
|
|
131
132
|
[1G[0K[1G[0K
|
|
@@ -168,10 +169,18 @@ Unsupported block tag: @interface
|
|
|
168
169
|
Unsupported block tag: @RequestBody
|
|
169
170
|
Unsupported block tag: @RequestParam
|
|
170
171
|
[1G[0K⠙[1G[0K[1G[0K⠙[1G[0K
|
|
171
|
-
> koatty_router@2.0
|
|
172
|
+
> koatty_router@2.1.0 build:cp
|
|
172
173
|
> copyfiles package.json LICENSE README.md dist/ && node scripts/postBuild
|
|
173
174
|
|
|
174
|
-
[1G[0K✓ Fixed
|
|
175
|
+
[1G[0K✓ Fixed dependencies.koatty_container: workspace:* → ^2.0.0
|
|
176
|
+
✓ Fixed dependencies.koatty_core: workspace:* → ^2.1.0
|
|
177
|
+
✓ Fixed dependencies.koatty_exception: workspace:* → ^2.1.0
|
|
178
|
+
✓ Fixed dependencies.koatty_graphql: workspace:* → ^1.1.4
|
|
179
|
+
✓ Fixed dependencies.koatty_lib: workspace:* → ^1.4.5
|
|
180
|
+
✓ Fixed dependencies.koatty_logger: workspace:* → ^2.4.0
|
|
181
|
+
✓ Fixed dependencies.koatty_proto: workspace:* → ^1.3.5
|
|
182
|
+
✓ Fixed dependencies.koatty_validation: workspace:* → ^2.0.0
|
|
183
|
+
✓ Fixed main: ./dist/... → ./index.js
|
|
175
184
|
✓ Fixed types: ./dist/... → ./index.d.ts
|
|
176
185
|
✓ Fixed exports.require: ./dist/index.js → ./index.js
|
|
177
186
|
✓ Fixed exports.import: ./dist/index.mjs → ./index.mjs
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- build
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
- koatty_container@2.0.0
|
|
13
|
+
- koatty_core@2.1.0
|
|
14
|
+
- koatty_exception@2.1.0
|
|
15
|
+
- koatty_logger@2.4.0
|
|
16
|
+
- koatty_validation@2.0.0
|
|
17
|
+
|
|
3
18
|
## 2.0.9
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* @Author: richen
|
|
3
|
-
* @Date: 2026-01-
|
|
3
|
+
* @Date: 2026-01-31 09:50:30
|
|
4
4
|
* @License: BSD (3-Clause)
|
|
5
5
|
* @Copyright (c) - <richenlin(at)gmail.com>
|
|
6
6
|
* @HomePage: https://koatty.org/
|
|
7
7
|
*/
|
|
8
8
|
import { Application } from 'koatty_container';
|
|
9
|
-
import {
|
|
10
|
-
import { IPluginCapability } from 'koatty_core';
|
|
9
|
+
import { IComponent } from 'koatty_core';
|
|
11
10
|
import { KoattyApplication } from 'koatty_core';
|
|
12
11
|
import { KoattyContext } from 'koatty_core';
|
|
13
12
|
import { KoattyNext } from 'koatty_core';
|
|
@@ -214,9 +213,12 @@ export declare type MiddlewareFunction = <T = unknown>(ctx: KoattyContext, next:
|
|
|
214
213
|
* @export
|
|
215
214
|
* @param {KoattyApplication} app
|
|
216
215
|
* @param {RouterOptions} options
|
|
217
|
-
* @returns {*} {KoattyRouter}
|
|
216
|
+
* @returns {*} {{ router: KoattyRouter, factory: RouterFactory }}
|
|
218
217
|
*/
|
|
219
|
-
export declare function NewRouter(app: KoattyApplication, opt?: RouterOptions):
|
|
218
|
+
export declare function NewRouter(app: KoattyApplication, opt?: RouterOptions): {
|
|
219
|
+
router: KoattyRouter;
|
|
220
|
+
factory: RouterFactory;
|
|
221
|
+
};
|
|
220
222
|
|
|
221
223
|
/**
|
|
222
224
|
* Routes HTTP OPTIONS requests to the specified path.
|
|
@@ -359,6 +361,42 @@ export declare enum RequestMethod {
|
|
|
359
361
|
*/
|
|
360
362
|
export declare function RequestParam(): ParameterDecorator;
|
|
361
363
|
|
|
364
|
+
/**
|
|
365
|
+
* Router Component
|
|
366
|
+
* Responsible for initializing and managing routing
|
|
367
|
+
*
|
|
368
|
+
* Implements IComponent interface (base interface)
|
|
369
|
+
*
|
|
370
|
+
* Event bindings:
|
|
371
|
+
* - loadRouter: Initialize router
|
|
372
|
+
* - appStop: Cleanup router resources
|
|
373
|
+
*/
|
|
374
|
+
export declare class RouterComponent implements IComponent {
|
|
375
|
+
events: Record<string, any>;
|
|
376
|
+
/**
|
|
377
|
+
* Initialize router and load routes
|
|
378
|
+
*
|
|
379
|
+
* This method handles the complete router initialization:
|
|
380
|
+
* 1. Create router instance(s) for configured protocol(s)
|
|
381
|
+
* 2. Bind router to app.router
|
|
382
|
+
* 3. Load controller routes into router
|
|
383
|
+
*/
|
|
384
|
+
initRouter(app: KoattyApplication): Promise<void>;
|
|
385
|
+
/**
|
|
386
|
+
* Load controller routes into router
|
|
387
|
+
*
|
|
388
|
+
* @param app - Koatty application instance
|
|
389
|
+
*/
|
|
390
|
+
run(app: KoattyApplication): Promise<void>;
|
|
391
|
+
/**
|
|
392
|
+
* Cleanup router resources on app stop
|
|
393
|
+
*
|
|
394
|
+
* NOTE: Original app.once("appStop", ...) listener in router.ts
|
|
395
|
+
* is now unified to be handled by @OnEvent(AppEvent.appStop) decorator
|
|
396
|
+
*/
|
|
397
|
+
cleanup(_app: KoattyApplication): Promise<void>;
|
|
398
|
+
}
|
|
399
|
+
|
|
362
400
|
/**
|
|
363
401
|
* Router constructor type
|
|
364
402
|
*/
|
|
@@ -614,38 +652,32 @@ export declare interface RouterOptions {
|
|
|
614
652
|
*
|
|
615
653
|
* @example
|
|
616
654
|
* ```typescript
|
|
617
|
-
* // WebSocket 配置
|
|
618
|
-
* ext: {
|
|
619
|
-
* maxFrameSize: 1024 * 1024,
|
|
620
|
-
* heartbeatInterval: 15000,
|
|
621
|
-
* maxConnections: 1000
|
|
622
|
-
* }
|
|
623
|
-
*
|
|
624
|
-
* // gRPC 配置
|
|
625
655
|
* ext: {
|
|
626
|
-
*
|
|
627
|
-
*
|
|
628
|
-
*
|
|
629
|
-
*
|
|
630
|
-
*
|
|
631
|
-
*
|
|
632
|
-
*
|
|
633
|
-
*
|
|
634
|
-
*
|
|
656
|
+
* http: {},
|
|
657
|
+
* grpc: {
|
|
658
|
+
* protoFile: "./proto/service.proto",
|
|
659
|
+
* poolSize: 10,
|
|
660
|
+
* streamConfig: { maxConcurrentStreams: 50 }
|
|
661
|
+
* },
|
|
662
|
+
* graphql: {
|
|
663
|
+
* schemaFile: "./resource/graphql/schema.graphql",
|
|
664
|
+
* // Optional: Enable HTTP/2 with SSL for GraphQL
|
|
665
|
+
* // keyFile: "./ssl/server.key",
|
|
666
|
+
* // crtFile: "./ssl/server.crt",
|
|
667
|
+
* // ssl: { mode: 'auto', allowHTTP1: true },
|
|
668
|
+
* // http2: { maxConcurrentStreams: 100 }
|
|
669
|
+
* },
|
|
670
|
+
* ws: {
|
|
671
|
+
* maxFrameSize: 1024 * 1024,
|
|
672
|
+
* heartbeatInterval: 15000,
|
|
673
|
+
* maxConnections: 1000
|
|
674
|
+
* }
|
|
635
675
|
* }
|
|
636
676
|
* ```
|
|
637
677
|
*/
|
|
638
678
|
ext?: Record<string, any>;
|
|
639
679
|
}
|
|
640
680
|
|
|
641
|
-
export declare class RouterPlugin implements IPlugin {
|
|
642
|
-
readonly provides: IPluginCapability[];
|
|
643
|
-
readonly events: {
|
|
644
|
-
beforeRouterLoad: (app: KoattyApplication) => Promise<void>;
|
|
645
|
-
};
|
|
646
|
-
uninstall(_app: KoattyApplication): Promise<void>;
|
|
647
|
-
}
|
|
648
|
-
|
|
649
681
|
/**
|
|
650
682
|
* gRPC 流配置
|
|
651
683
|
*/
|