stratal 0.0.11 → 0.0.13
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/README.md +1 -1
- package/dist/application.d.ts +6 -0
- package/dist/application.d.ts.map +1 -1
- package/dist/application.js +1 -1
- package/dist/application.js.map +1 -1
- package/dist/errors/application-error.d.ts +4 -3
- package/dist/errors/application-error.d.ts.map +1 -1
- package/dist/errors/application-error.js +12 -7
- package/dist/errors/application-error.js.map +1 -1
- package/dist/errors/error-codes.d.ts +4 -0
- package/dist/errors/error-codes.d.ts.map +1 -1
- package/dist/errors/error-codes.js +4 -0
- package/dist/errors/error-codes.js.map +1 -1
- package/dist/i18n/messages/en/errors.d.ts +2 -0
- package/dist/i18n/messages/en/errors.d.ts.map +1 -1
- package/dist/i18n/messages/en/errors.js +3 -0
- package/dist/i18n/messages/en/errors.js.map +1 -1
- package/dist/middleware/middleware-configuration.service.d.ts +8 -2
- package/dist/middleware/middleware-configuration.service.d.ts.map +1 -1
- package/dist/middleware/middleware-configuration.service.js +32 -3
- package/dist/middleware/middleware-configuration.service.js.map +1 -1
- package/dist/middleware/types.d.ts +2 -0
- package/dist/middleware/types.d.ts.map +1 -1
- package/dist/openapi/index.d.ts +1 -1
- package/dist/openapi/index.d.ts.map +1 -1
- package/dist/openapi/index.js.map +1 -1
- package/dist/openapi/openapi.module.d.ts.map +1 -1
- package/dist/openapi/openapi.module.js +0 -1
- package/dist/openapi/openapi.module.js.map +1 -1
- package/dist/openapi/services/openapi-config.service.js +1 -1
- package/dist/openapi/services/openapi-config.service.js.map +1 -1
- package/dist/openapi/services/openapi.service.d.ts.map +1 -1
- package/dist/openapi/services/openapi.service.js +16 -13
- package/dist/openapi/services/openapi.service.js.map +1 -1
- package/dist/openapi/types.d.ts +26 -3
- package/dist/openapi/types.d.ts.map +1 -1
- package/dist/router/constants.d.ts +15 -0
- package/dist/router/constants.d.ts.map +1 -1
- package/dist/router/constants.js +16 -1
- package/dist/router/constants.js.map +1 -1
- package/dist/router/decorators/controller.decorator.d.ts +8 -1
- package/dist/router/decorators/controller.decorator.d.ts.map +1 -1
- package/dist/router/decorators/controller.decorator.js +10 -0
- package/dist/router/decorators/controller.decorator.js.map +1 -1
- package/dist/router/decorators/http-method.decorator.d.ts +83 -0
- package/dist/router/decorators/http-method.decorator.d.ts.map +1 -0
- package/dist/router/decorators/http-method.decorator.js +113 -0
- package/dist/router/decorators/http-method.decorator.js.map +1 -0
- package/dist/router/decorators/index.d.ts +1 -0
- package/dist/router/decorators/index.d.ts.map +1 -1
- package/dist/router/decorators/index.js +1 -0
- package/dist/router/decorators/index.js.map +1 -1
- package/dist/router/decorators/route.decorator.d.ts +5 -2
- package/dist/router/decorators/route.decorator.d.ts.map +1 -1
- package/dist/router/decorators/route.decorator.js +4 -1
- package/dist/router/decorators/route.decorator.js.map +1 -1
- package/dist/router/hono-app.d.ts +2 -2
- package/dist/router/hono-app.d.ts.map +1 -1
- package/dist/router/hono-app.js +4 -4
- package/dist/router/hono-app.js.map +1 -1
- package/dist/router/index.d.ts +6 -3
- package/dist/router/index.d.ts.map +1 -1
- package/dist/router/index.js +3 -2
- package/dist/router/index.js.map +1 -1
- package/dist/router/router-context.d.ts +29 -3
- package/dist/router/router-context.d.ts.map +1 -1
- package/dist/router/router-context.js +34 -0
- package/dist/router/router-context.js.map +1 -1
- package/dist/router/services/route-registration.service.d.ts +38 -3
- package/dist/router/services/route-registration.service.d.ts.map +1 -1
- package/dist/router/services/route-registration.service.js +269 -20
- package/dist/router/services/route-registration.service.js.map +1 -1
- package/dist/router/types.d.ts +66 -9
- package/dist/router/types.d.ts.map +1 -1
- package/dist/websocket/decorators/gateway.decorator.d.ts +39 -0
- package/dist/websocket/decorators/gateway.decorator.d.ts.map +1 -0
- package/dist/websocket/decorators/gateway.decorator.js +55 -0
- package/dist/websocket/decorators/gateway.decorator.js.map +1 -0
- package/dist/websocket/decorators/index.d.ts +3 -0
- package/dist/websocket/decorators/index.d.ts.map +1 -0
- package/dist/websocket/decorators/index.js +3 -0
- package/dist/websocket/decorators/index.js.map +1 -0
- package/dist/websocket/decorators/ws-event.decorator.d.ts +59 -0
- package/dist/websocket/decorators/ws-event.decorator.d.ts.map +1 -0
- package/dist/websocket/decorators/ws-event.decorator.js +94 -0
- package/dist/websocket/decorators/ws-event.decorator.js.map +1 -0
- package/dist/websocket/errors/websocket-body-not-available.error.d.ts +5 -0
- package/dist/websocket/errors/websocket-body-not-available.error.d.ts.map +1 -0
- package/dist/websocket/errors/websocket-body-not-available.error.js +7 -0
- package/dist/websocket/errors/websocket-body-not-available.error.js.map +1 -0
- package/dist/websocket/errors/websocket-duplicate-event-handler.error.d.ts +5 -0
- package/dist/websocket/errors/websocket-duplicate-event-handler.error.d.ts.map +1 -0
- package/dist/websocket/errors/websocket-duplicate-event-handler.error.js +7 -0
- package/dist/websocket/errors/websocket-duplicate-event-handler.error.js.map +1 -0
- package/dist/websocket/gateway-context.d.ts +51 -0
- package/dist/websocket/gateway-context.d.ts.map +1 -0
- package/dist/websocket/gateway-context.js +66 -0
- package/dist/websocket/gateway-context.js.map +1 -0
- package/dist/websocket/index.d.ts +7 -0
- package/dist/websocket/index.d.ts.map +1 -0
- package/dist/websocket/index.js +5 -0
- package/dist/websocket/index.js.map +1 -0
- package/dist/websocket/types.d.ts +7 -0
- package/dist/websocket/types.d.ts.map +1 -0
- package/dist/websocket/types.js +2 -0
- package/dist/websocket/types.js.map +1 -0
- package/package.json +21 -15
package/dist/openapi/types.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import type { MiddlewareHandler } from 'hono/types';
|
|
1
2
|
import type { PathItemObject } from '../i18n/validation';
|
|
3
|
+
import type { RouterEnv } from '../router/types';
|
|
2
4
|
/**
|
|
3
5
|
* OpenAPI Info section configuration
|
|
4
6
|
*/
|
|
@@ -7,18 +9,39 @@ export interface OpenAPIInfo {
|
|
|
7
9
|
version: string;
|
|
8
10
|
description?: string;
|
|
9
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* Context passed to a custom OpenAPI UI renderer
|
|
14
|
+
*/
|
|
15
|
+
export interface OpenAPIUIContext {
|
|
16
|
+
specUrl: string;
|
|
17
|
+
title: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Custom UI renderer function
|
|
21
|
+
* Returns a Hono middleware handler that serves the docs UI
|
|
22
|
+
*/
|
|
23
|
+
export type OpenAPIUIRenderer = (context: OpenAPIUIContext) => MiddlewareHandler<RouterEnv>;
|
|
24
|
+
/**
|
|
25
|
+
* Options for the docs UI
|
|
26
|
+
*/
|
|
27
|
+
export interface OpenAPIUIOptions {
|
|
28
|
+
/** Path for docs UI (default: '/api/docs') */
|
|
29
|
+
path?: string;
|
|
30
|
+
/** Custom UI renderer (default: swagger UI) */
|
|
31
|
+
renderer?: OpenAPIUIRenderer;
|
|
32
|
+
}
|
|
10
33
|
/**
|
|
11
34
|
* Static module configuration (provided via forRoot)
|
|
12
35
|
*/
|
|
13
36
|
export interface OpenAPIModuleOptions {
|
|
14
37
|
/** Path for OpenAPI JSON spec (default: '/api/openapi.json') */
|
|
15
38
|
jsonPath?: string;
|
|
16
|
-
/** Path for Swagger UI docs (default: '/api/docs') */
|
|
17
|
-
docsPath?: string;
|
|
18
39
|
/** Default info section for spec */
|
|
19
40
|
info?: OpenAPIInfo;
|
|
20
41
|
/** Security schemes definition */
|
|
21
42
|
securitySchemes?: Record<string, object>;
|
|
43
|
+
/** Docs UI configuration. Set to false to disable. (default: swagger UI at /api/docs) */
|
|
44
|
+
ui?: OpenAPIUIOptions | false;
|
|
22
45
|
}
|
|
23
46
|
/**
|
|
24
47
|
* Route filter function type
|
|
@@ -39,10 +62,10 @@ export interface OpenAPIConfigOverride {
|
|
|
39
62
|
*/
|
|
40
63
|
export interface OpenAPIEffectiveConfig {
|
|
41
64
|
jsonPath: string;
|
|
42
|
-
docsPath: string;
|
|
43
65
|
info: OpenAPIInfo;
|
|
44
66
|
securitySchemes?: Record<string, object>;
|
|
45
67
|
routeFilter?: RouteFilterFn;
|
|
68
|
+
ui?: OpenAPIUIOptions | false;
|
|
46
69
|
}
|
|
47
70
|
/**
|
|
48
71
|
* OpenAPI config service interface
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/openapi/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/openapi/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAEhD;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;CACd;AAED;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,EAAE,gBAAgB,KAAK,iBAAiB,CAAC,SAAS,CAAC,CAAA;AAE3F;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,8CAA8C;IAC9C,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,iBAAiB,CAAA;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,gEAAgE;IAChE,QAAQ,CAAC,EAAE,MAAM,CAAA;IAEjB,oCAAoC;IACpC,IAAI,CAAC,EAAE,WAAW,CAAA;IAElB,kCAAkC;IAClC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAExC,yFAAyF;IACzF,EAAE,CAAC,EAAE,gBAAgB,GAAG,KAAK,CAAA;CAC9B;AAED;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,KAAK,OAAO,CAAA;AAE/E;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,4BAA4B;IAC5B,IAAI,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAA;IAE3B,sEAAsE;IACtE,WAAW,CAAC,EAAE,aAAa,CAAA;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,WAAW,CAAA;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACxC,WAAW,CAAC,EAAE,aAAa,CAAA;IAC3B,EAAE,CAAC,EAAE,gBAAgB,GAAG,KAAK,CAAA;CAC9B;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,qBAAqB,GAAG,IAAI,CAAA;IAE7C;;OAEG;IACH,kBAAkB,IAAI,sBAAsB,CAAA;CAC7C"}
|
|
@@ -16,7 +16,13 @@ export declare const ROUTE_METADATA_KEYS: {
|
|
|
16
16
|
readonly CONTROLLER_MIDDLEWARES: symbol;
|
|
17
17
|
readonly ROUTE_CONFIG: symbol;
|
|
18
18
|
readonly DECORATED_METHODS: symbol;
|
|
19
|
+
readonly HTTP_ROUTE_CONFIG: symbol;
|
|
20
|
+
readonly HTTP_DECORATED_METHODS: symbol;
|
|
19
21
|
readonly AUTH_GUARD: symbol;
|
|
22
|
+
readonly GATEWAY_MARKER: symbol;
|
|
23
|
+
readonly WS_ON_MESSAGE: symbol;
|
|
24
|
+
readonly WS_ON_CLOSE: symbol;
|
|
25
|
+
readonly WS_ON_ERROR: symbol;
|
|
20
26
|
};
|
|
21
27
|
/**
|
|
22
28
|
* Security scheme identifiers for OpenAPI
|
|
@@ -69,4 +75,13 @@ export declare const METHOD_STATUS_CODES: {
|
|
|
69
75
|
readonly patch: 200;
|
|
70
76
|
readonly destroy: 200;
|
|
71
77
|
};
|
|
78
|
+
/**
|
|
79
|
+
* Sentinel symbol to opt a controller out of versioning.
|
|
80
|
+
* When used as the version, no prefix is applied even when defaultVersion is set.
|
|
81
|
+
*/
|
|
82
|
+
export declare const VERSION_NEUTRAL: unique symbol;
|
|
83
|
+
/**
|
|
84
|
+
* Default content type for request bodies and responses
|
|
85
|
+
*/
|
|
86
|
+
export declare const DEFAULT_CONTENT_TYPE = "application/json";
|
|
72
87
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/router/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,mBAAmB;;;CAGW,CAAA;AAE3C;;;GAGG;AACH,eAAO,MAAM,mBAAmB
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/router/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,mBAAmB;;;CAGW,CAAA;AAE3C;;;GAGG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;CAatB,CAAA;AAEV;;;GAGG;AACH,eAAO,MAAM,gBAAgB;;;;CAInB,CAAA;AAEV;;;GAGG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;CAOf,CAAA;AAEV;;;GAGG;AACH,eAAO,MAAM,mBAAmB;;;;;;;CAOtB,CAAA;AAEV;;;GAGG;AACH,eAAO,MAAM,eAAe,eAAwC,CAAA;AAEpE;;GAEG;AACH,eAAO,MAAM,oBAAoB,qBAAqB,CAAA"}
|
package/dist/router/constants.js
CHANGED
|
@@ -16,7 +16,13 @@ export const ROUTE_METADATA_KEYS = {
|
|
|
16
16
|
CONTROLLER_MIDDLEWARES: Symbol.for('stratal:controller:middlewares'),
|
|
17
17
|
ROUTE_CONFIG: Symbol.for('stratal:route:config'),
|
|
18
18
|
DECORATED_METHODS: Symbol.for('stratal:decorated:methods'),
|
|
19
|
-
|
|
19
|
+
HTTP_ROUTE_CONFIG: Symbol.for('stratal:http-route:config'),
|
|
20
|
+
HTTP_DECORATED_METHODS: Symbol.for('stratal:http-decorated:methods'),
|
|
21
|
+
AUTH_GUARD: Symbol.for('stratal:auth:guard'),
|
|
22
|
+
GATEWAY_MARKER: Symbol.for('stratal:gateway:marker'),
|
|
23
|
+
WS_ON_MESSAGE: Symbol.for('stratal:ws:on-message'),
|
|
24
|
+
WS_ON_CLOSE: Symbol.for('stratal:ws:on-close'),
|
|
25
|
+
WS_ON_ERROR: Symbol.for('stratal:ws:on-error'),
|
|
20
26
|
};
|
|
21
27
|
/**
|
|
22
28
|
* Security scheme identifiers for OpenAPI
|
|
@@ -51,4 +57,13 @@ export const METHOD_STATUS_CODES = {
|
|
|
51
57
|
patch: 200,
|
|
52
58
|
destroy: 200
|
|
53
59
|
};
|
|
60
|
+
/**
|
|
61
|
+
* Sentinel symbol to opt a controller out of versioning.
|
|
62
|
+
* When used as the version, no prefix is applied even when defaultVersion is set.
|
|
63
|
+
*/
|
|
64
|
+
export const VERSION_NEUTRAL = Symbol.for('stratal:version:neutral');
|
|
65
|
+
/**
|
|
66
|
+
* Default content type for request bodies and responses
|
|
67
|
+
*/
|
|
68
|
+
export const DEFAULT_CONTENT_TYPE = 'application/json';
|
|
54
69
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/router/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,iBAAiB,EAAE,kBAAkB;IACrC,MAAM,EAAE,QAAQ;CACyB,CAAA;AAE3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';
|
|
3
3
|
/**
|
|
4
4
|
* Base controller decorator for route registration
|
|
5
5
|
*
|
|
@@ -36,4 +36,11 @@ export declare function getControllerRoute(target: object): string | undefined;
|
|
|
36
36
|
* @returns Controller options or undefined if not set
|
|
37
37
|
*/
|
|
38
38
|
export declare function getControllerOptions(target: object): ControllerOptions | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* Get the version from controller class metadata
|
|
41
|
+
*
|
|
42
|
+
* @param target - Controller class or instance
|
|
43
|
+
* @returns Version string, array, VERSION_NEUTRAL symbol, or undefined if not set
|
|
44
|
+
*/
|
|
45
|
+
export declare function getControllerVersion(target: object): ControllerOptions['version'];
|
|
39
46
|
//# sourceMappingURL=controller.decorator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller.decorator.d.ts","sourceRoot":"","sources":["../../../src/router/decorators/controller.decorator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAA;AAE9C,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"controller.decorator.d.ts","sourceRoot":"","sources":["../../../src/router/decorators/controller.decorator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAA;AAE9C,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAIjD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,iBAAiB,IAClD,CAAC,SAAS,WAAW,EAAE,QAAQ,CAAC,OAclD;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAKrE;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS,CAGlF;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,iBAAiB,CAAC,SAAS,CAAC,CAGjF"}
|
|
@@ -57,4 +57,14 @@ export function getControllerOptions(target) {
|
|
|
57
57
|
const metadataTarget = typeof target === 'function' ? target : target.constructor;
|
|
58
58
|
return Reflect.getMetadata(ROUTE_METADATA_KEYS.CONTROLLER_OPTIONS, metadataTarget);
|
|
59
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Get the version from controller class metadata
|
|
62
|
+
*
|
|
63
|
+
* @param target - Controller class or instance
|
|
64
|
+
* @returns Version string, array, VERSION_NEUTRAL symbol, or undefined if not set
|
|
65
|
+
*/
|
|
66
|
+
export function getControllerVersion(target) {
|
|
67
|
+
const options = getControllerOptions(target);
|
|
68
|
+
return options?.version;
|
|
69
|
+
}
|
|
60
70
|
//# sourceMappingURL=controller.decorator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller.decorator.js","sourceRoot":"","sources":["../../../src/router/decorators/controller.decorator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAE/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA;AAGlD,MAAM,oBAAoB,GAAG,mBAAmB,CAAC,gBAAgB,CAAA;AAEjE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,UAAU,CAAC,KAAa,EAAE,OAA2B;IACnE,OAAO,UAAiC,MAAS;QAC/C,2DAA2D;QAC3D,SAAS,EAAE,CAAC,MAAM,CAAC,CAAA;QAEnB,oCAAoC;QACpC,OAAO,CAAC,cAAc,CAAC,oBAAoB,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;QAE3D,qCAAqC;QACrC,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,CAAC,cAAc,CAAC,mBAAmB,CAAC,kBAAkB,EAAE,OAAO,EAAE,MAAM,CAAC,CAAA;QACjF,CAAC;QAED,OAAO,MAAM,CAAA;IACf,CAAC,CAAA;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAc;IAC/C,mEAAmE;IACnE,6EAA6E;IAC7E,MAAM,cAAc,GAAG,OAAO,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAE,MAAkC,CAAC,WAAW,CAAA;IAC9G,OAAO,OAAO,CAAC,WAAW,CAAC,oBAAoB,EAAE,cAAc,CAAuB,CAAA;AACxF,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAc;IACjD,MAAM,cAAc,GAAG,OAAO,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAE,MAAkC,CAAC,WAAW,CAAA;IAC9G,OAAO,OAAO,CAAC,WAAW,CAAC,mBAAmB,CAAC,kBAAkB,EAAE,cAAc,CAAkC,CAAA;AACrH,CAAC"}
|
|
1
|
+
{"version":3,"file":"controller.decorator.js","sourceRoot":"","sources":["../../../src/router/decorators/controller.decorator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAE/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA;AAGlD,MAAM,oBAAoB,GAAG,mBAAmB,CAAC,gBAAgB,CAAA;AAEjE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,UAAU,CAAC,KAAa,EAAE,OAA2B;IACnE,OAAO,UAAiC,MAAS;QAC/C,2DAA2D;QAC3D,SAAS,EAAE,CAAC,MAAM,CAAC,CAAA;QAEnB,oCAAoC;QACpC,OAAO,CAAC,cAAc,CAAC,oBAAoB,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;QAE3D,qCAAqC;QACrC,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,CAAC,cAAc,CAAC,mBAAmB,CAAC,kBAAkB,EAAE,OAAO,EAAE,MAAM,CAAC,CAAA;QACjF,CAAC;QAED,OAAO,MAAM,CAAA;IACf,CAAC,CAAA;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAc;IAC/C,mEAAmE;IACnE,6EAA6E;IAC7E,MAAM,cAAc,GAAG,OAAO,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAE,MAAkC,CAAC,WAAW,CAAA;IAC9G,OAAO,OAAO,CAAC,WAAW,CAAC,oBAAoB,EAAE,cAAc,CAAuB,CAAA;AACxF,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAc;IACjD,MAAM,cAAc,GAAG,OAAO,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAE,MAAkC,CAAC,WAAW,CAAA;IAC9G,OAAO,OAAO,CAAC,WAAW,CAAC,mBAAmB,CAAC,kBAAkB,EAAE,cAAc,CAAkC,CAAA;AACrH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAc;IACjD,MAAM,OAAO,GAAG,oBAAoB,CAAC,MAAM,CAAC,CAAA;IAC5C,OAAO,OAAO,EAAE,OAAO,CAAA;AACzB,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { HttpRouteMetadata, RouteConfig } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Registers a GET route on the controller method.
|
|
4
|
+
*
|
|
5
|
+
* @param path - Route path relative to the controller base path
|
|
6
|
+
* @param config - Optional route configuration (response schema, body, params, etc.)
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* @Controller('/api/v1/users')
|
|
11
|
+
* class UsersController {
|
|
12
|
+
* @Get('/', { response: z.array(userSchema), summary: 'List users' })
|
|
13
|
+
* async list(ctx: RouterContext) { ... }
|
|
14
|
+
*
|
|
15
|
+
* @Get('/:id', { params: z.object({ id: z.string().uuid() }), response: userSchema })
|
|
16
|
+
* async getUser(ctx: RouterContext) { ... }
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare const Get: (path: string, config?: RouteConfig) => (target: object, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
21
|
+
/**
|
|
22
|
+
* Registers a POST route on the controller method.
|
|
23
|
+
*
|
|
24
|
+
* @param path - Route path relative to the controller base path
|
|
25
|
+
* @param config - Optional route configuration (response schema, body, params, etc.)
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```typescript
|
|
29
|
+
* @Controller('/api/v1/users')
|
|
30
|
+
* class UsersController {
|
|
31
|
+
* @Post('/', { body: createUserSchema, response: userSchema, statusCode: 201 })
|
|
32
|
+
* async createUser(ctx: RouterContext) { ... }
|
|
33
|
+
* }
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare const Post: (path: string, config?: RouteConfig) => (target: object, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
37
|
+
/**
|
|
38
|
+
* Registers a PUT route on the controller method.
|
|
39
|
+
*
|
|
40
|
+
* @param path - Route path relative to the controller base path
|
|
41
|
+
* @param config - Optional route configuration
|
|
42
|
+
*/
|
|
43
|
+
export declare const Put: (path: string, config?: RouteConfig) => (target: object, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
44
|
+
/**
|
|
45
|
+
* Registers a PATCH route on the controller method.
|
|
46
|
+
*
|
|
47
|
+
* @param path - Route path relative to the controller base path
|
|
48
|
+
* @param config - Optional route configuration
|
|
49
|
+
*/
|
|
50
|
+
export declare const Patch: (path: string, config?: RouteConfig) => (target: object, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
51
|
+
/**
|
|
52
|
+
* Registers a DELETE route on the controller method.
|
|
53
|
+
*
|
|
54
|
+
* @param path - Route path relative to the controller base path
|
|
55
|
+
* @param config - Optional route configuration
|
|
56
|
+
*/
|
|
57
|
+
export declare const Delete: (path: string, config?: RouteConfig) => (target: object, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
58
|
+
/**
|
|
59
|
+
* Registers an ALL (any HTTP method) route on the controller method.
|
|
60
|
+
* Routes using @All are automatically hidden from OpenAPI documentation
|
|
61
|
+
* since OpenAPI does not support a catch-all HTTP method.
|
|
62
|
+
*
|
|
63
|
+
* @param path - Route path relative to the controller base path
|
|
64
|
+
* @param config - Optional route configuration
|
|
65
|
+
*/
|
|
66
|
+
export declare const All: (path: string, config?: RouteConfig) => (target: object, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
67
|
+
/**
|
|
68
|
+
* Get the HTTP route metadata from a controller method decorated with
|
|
69
|
+
* @Get, @Post, @Put, @Patch, @Delete, or @All.
|
|
70
|
+
*
|
|
71
|
+
* @param target - Controller prototype
|
|
72
|
+
* @param methodName - Name of the method
|
|
73
|
+
* @returns HTTP route metadata or undefined if not decorated
|
|
74
|
+
*/
|
|
75
|
+
export declare function getHttpRouteMetadata(target: object, methodName: string): HttpRouteMetadata | undefined;
|
|
76
|
+
/**
|
|
77
|
+
* Get all methods decorated with HTTP method decorators from a controller class.
|
|
78
|
+
*
|
|
79
|
+
* @param ControllerClass - Controller class
|
|
80
|
+
* @returns Array of method names that have HTTP route metadata
|
|
81
|
+
*/
|
|
82
|
+
export declare function getHttpDecoratedMethods(ControllerClass: new (...args: unknown[]) => object): string[];
|
|
83
|
+
//# sourceMappingURL=http-method.decorator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-method.decorator.d.ts","sourceRoot":"","sources":["../../../src/router/decorators/http-method.decorator.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAc,iBAAiB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAwC1E;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,GAAG,SAhDS,MAAM,WAAW,WAAW,MAE/C,QAAQ,MAAM,EACd,aAAa,MAAM,EACnB,YAAY,kBAAkB,uBA4Ce,CAAA;AAEnD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,IAAI,SAjEQ,MAAM,WAAW,WAAW,MAE/C,QAAQ,MAAM,EACd,aAAa,MAAM,EACnB,YAAY,kBAAkB,uBA6DiB,CAAA;AAErD;;;;;GAKG;AACH,eAAO,MAAM,GAAG,SAzES,MAAM,WAAW,WAAW,MAE/C,QAAQ,MAAM,EACd,aAAa,MAAM,EACnB,YAAY,kBAAkB,uBAqEe,CAAA;AAEnD;;;;;GAKG;AACH,eAAO,MAAM,KAAK,SAjFO,MAAM,WAAW,WAAW,MAE/C,QAAQ,MAAM,EACd,aAAa,MAAM,EACnB,YAAY,kBAAkB,uBA6EmB,CAAA;AAEvD;;;;;GAKG;AACH,eAAO,MAAM,MAAM,SAzFM,MAAM,WAAW,WAAW,MAE/C,QAAQ,MAAM,EACd,aAAa,MAAM,EACnB,YAAY,kBAAkB,uBAqFqB,CAAA;AAEzD;;;;;;;GAOG;AACH,eAAO,MAAM,GAAG,SAnGS,MAAM,WAAW,WAAW,MAE/C,QAAQ,MAAM,EACd,aAAa,MAAM,EACnB,YAAY,kBAAkB,uBA+Fe,CAAA;AAEnD;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS,CAEtG;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,eAAe,EAAE,KAAK,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,MAAM,GAAG,MAAM,EAAE,CAGrG"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { z } from '../../i18n/validation';
|
|
2
|
+
import { ROUTE_METADATA_KEYS } from '../constants';
|
|
3
|
+
/**
|
|
4
|
+
* Creates an HTTP method decorator factory for the given HTTP method.
|
|
5
|
+
*
|
|
6
|
+
* The returned decorator stores {@link HttpRouteMetadata} on the method and
|
|
7
|
+
* tracks the method name under {@link ROUTE_METADATA_KEYS.HTTP_DECORATED_METHODS}
|
|
8
|
+
* on the controller prototype so they can be discovered at registration time.
|
|
9
|
+
*/
|
|
10
|
+
function createHttpMethodDecorator(method) {
|
|
11
|
+
return function (path, config) {
|
|
12
|
+
return function (target, propertyKey, descriptor) {
|
|
13
|
+
const metadata = {
|
|
14
|
+
method,
|
|
15
|
+
path,
|
|
16
|
+
config: config ?? { response: z.any() },
|
|
17
|
+
};
|
|
18
|
+
Reflect.defineMetadata(ROUTE_METADATA_KEYS.HTTP_ROUTE_CONFIG, metadata, target, propertyKey);
|
|
19
|
+
// Track this method as HTTP-decorated on the prototype
|
|
20
|
+
const existing = Reflect.getOwnMetadata(ROUTE_METADATA_KEYS.HTTP_DECORATED_METHODS, target) ?? [];
|
|
21
|
+
existing.push(propertyKey);
|
|
22
|
+
Reflect.defineMetadata(ROUTE_METADATA_KEYS.HTTP_DECORATED_METHODS, existing, target);
|
|
23
|
+
return descriptor;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Registers a GET route on the controller method.
|
|
29
|
+
*
|
|
30
|
+
* @param path - Route path relative to the controller base path
|
|
31
|
+
* @param config - Optional route configuration (response schema, body, params, etc.)
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```typescript
|
|
35
|
+
* @Controller('/api/v1/users')
|
|
36
|
+
* class UsersController {
|
|
37
|
+
* @Get('/', { response: z.array(userSchema), summary: 'List users' })
|
|
38
|
+
* async list(ctx: RouterContext) { ... }
|
|
39
|
+
*
|
|
40
|
+
* @Get('/:id', { params: z.object({ id: z.string().uuid() }), response: userSchema })
|
|
41
|
+
* async getUser(ctx: RouterContext) { ... }
|
|
42
|
+
* }
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export const Get = createHttpMethodDecorator('get');
|
|
46
|
+
/**
|
|
47
|
+
* Registers a POST route on the controller method.
|
|
48
|
+
*
|
|
49
|
+
* @param path - Route path relative to the controller base path
|
|
50
|
+
* @param config - Optional route configuration (response schema, body, params, etc.)
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```typescript
|
|
54
|
+
* @Controller('/api/v1/users')
|
|
55
|
+
* class UsersController {
|
|
56
|
+
* @Post('/', { body: createUserSchema, response: userSchema, statusCode: 201 })
|
|
57
|
+
* async createUser(ctx: RouterContext) { ... }
|
|
58
|
+
* }
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
export const Post = createHttpMethodDecorator('post');
|
|
62
|
+
/**
|
|
63
|
+
* Registers a PUT route on the controller method.
|
|
64
|
+
*
|
|
65
|
+
* @param path - Route path relative to the controller base path
|
|
66
|
+
* @param config - Optional route configuration
|
|
67
|
+
*/
|
|
68
|
+
export const Put = createHttpMethodDecorator('put');
|
|
69
|
+
/**
|
|
70
|
+
* Registers a PATCH route on the controller method.
|
|
71
|
+
*
|
|
72
|
+
* @param path - Route path relative to the controller base path
|
|
73
|
+
* @param config - Optional route configuration
|
|
74
|
+
*/
|
|
75
|
+
export const Patch = createHttpMethodDecorator('patch');
|
|
76
|
+
/**
|
|
77
|
+
* Registers a DELETE route on the controller method.
|
|
78
|
+
*
|
|
79
|
+
* @param path - Route path relative to the controller base path
|
|
80
|
+
* @param config - Optional route configuration
|
|
81
|
+
*/
|
|
82
|
+
export const Delete = createHttpMethodDecorator('delete');
|
|
83
|
+
/**
|
|
84
|
+
* Registers an ALL (any HTTP method) route on the controller method.
|
|
85
|
+
* Routes using @All are automatically hidden from OpenAPI documentation
|
|
86
|
+
* since OpenAPI does not support a catch-all HTTP method.
|
|
87
|
+
*
|
|
88
|
+
* @param path - Route path relative to the controller base path
|
|
89
|
+
* @param config - Optional route configuration
|
|
90
|
+
*/
|
|
91
|
+
export const All = createHttpMethodDecorator('all');
|
|
92
|
+
/**
|
|
93
|
+
* Get the HTTP route metadata from a controller method decorated with
|
|
94
|
+
* @Get, @Post, @Put, @Patch, @Delete, or @All.
|
|
95
|
+
*
|
|
96
|
+
* @param target - Controller prototype
|
|
97
|
+
* @param methodName - Name of the method
|
|
98
|
+
* @returns HTTP route metadata or undefined if not decorated
|
|
99
|
+
*/
|
|
100
|
+
export function getHttpRouteMetadata(target, methodName) {
|
|
101
|
+
return Reflect.getMetadata(ROUTE_METADATA_KEYS.HTTP_ROUTE_CONFIG, target, methodName);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Get all methods decorated with HTTP method decorators from a controller class.
|
|
105
|
+
*
|
|
106
|
+
* @param ControllerClass - Controller class
|
|
107
|
+
* @returns Array of method names that have HTTP route metadata
|
|
108
|
+
*/
|
|
109
|
+
export function getHttpDecoratedMethods(ControllerClass) {
|
|
110
|
+
const prototype = ControllerClass.prototype;
|
|
111
|
+
return Reflect.getOwnMetadata(ROUTE_METADATA_KEYS.HTTP_DECORATED_METHODS, prototype) ?? [];
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=http-method.decorator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-method.decorator.js","sourceRoot":"","sources":["../../../src/router/decorators/http-method.decorator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,uBAAuB,CAAA;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA;AAGlD;;;;;;GAMG;AACH,SAAS,yBAAyB,CAAC,MAAkB;IACnD,OAAO,UAAU,IAAY,EAAE,MAAoB;QACjD,OAAO,UACL,MAAc,EACd,WAAmB,EACnB,UAA8B;YAE9B,MAAM,QAAQ,GAAsB;gBAClC,MAAM;gBACN,IAAI;gBACJ,MAAM,EAAE,MAAM,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,GAAG,EAAE,EAAE;aACxC,CAAA;YAED,OAAO,CAAC,cAAc,CACpB,mBAAmB,CAAC,iBAAiB,EACrC,QAAQ,EACR,MAAM,EACN,WAAW,CACZ,CAAA;YA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,IAAI,EAAE,CAAA;AACtH,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { Controller, getControllerOptions, getControllerRoute } from './controller.decorator';
|
|
2
|
+
export { All, Delete, Get, getHttpDecoratedMethods, getHttpRouteMetadata, Patch, Post, Put } from './http-method.decorator';
|
|
2
3
|
export { getDecoratedMethods, getRouteConfig, Route } from './route.decorator';
|
|
3
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/router/decorators/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAAE,oBAAoB,EAAE,kBAAkB,EACrD,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/router/decorators/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAAE,oBAAoB,EAAE,kBAAkB,EACrD,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAA;AAC3H,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { Controller, getControllerOptions, getControllerRoute } from './controller.decorator';
|
|
2
|
+
export { All, Delete, Get, getHttpDecoratedMethods, getHttpRouteMetadata, Patch, Post, Put } from './http-method.decorator';
|
|
2
3
|
export { getDecoratedMethods, getRouteConfig, Route } from './route.decorator';
|
|
3
4
|
// Guards are now exported from core/guards module
|
|
4
5
|
// Use: import { UseGuards, AuthGuard } from 'stratal/guards'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/router/decorators/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAAE,oBAAoB,EAAE,kBAAkB,EACrD,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAE9E,kDAAkD;AAClD,6DAA6D"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/router/decorators/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAAE,oBAAoB,EAAE,kBAAkB,EACrD,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAA;AAC3H,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAE9E,kDAAkD;AAClD,6DAA6D"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { RouteConfig } from '../types';
|
|
2
2
|
/**
|
|
3
|
-
* Decorator to add OpenAPI metadata to a controller method
|
|
3
|
+
* Decorator to add OpenAPI metadata to a controller method using convention-based routing.
|
|
4
|
+
*
|
|
5
|
+
* **Cannot be mixed with HTTP method decorators** (`@Get`, `@Post`, `@Put`, `@Patch`,
|
|
6
|
+
* `@Delete`, `@All`) in the same controller. Use one pattern or the other.
|
|
4
7
|
*
|
|
5
8
|
* Stores route configuration (schemas, response, tags, security) in metadata.
|
|
6
9
|
* HTTP method, path, and success status code are auto-derived from the method name:
|
|
@@ -68,7 +71,7 @@ import type { RouteConfig } from '../types';
|
|
|
68
71
|
* }
|
|
69
72
|
* ```
|
|
70
73
|
*/
|
|
71
|
-
export declare function Route(config: RouteConfig): (target: object, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
74
|
+
export declare function Route(config: Omit<RouteConfig, 'statusCode'>): (target: object, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
72
75
|
/**
|
|
73
76
|
* Get the route configuration from a controller method
|
|
74
77
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.decorator.d.ts","sourceRoot":"","sources":["../../../src/router/decorators/route.decorator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAE3C
|
|
1
|
+
{"version":3,"file":"route.decorator.d.ts","sourceRoot":"","sources":["../../../src/router/decorators/route.decorator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAE3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuEG;AACH,wBAAgB,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,WAAW,EAAE,YAAY,CAAC,IAEzD,QAAQ,MAAM,EACd,aAAa,MAAM,EACnB,YAAY,kBAAkB,wBAYjC;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAE1F;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,eAAe,EAAE,KAAK,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,MAAM,GAAG,MAAM,EAAE,CASjG"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { ROUTE_METADATA_KEYS } from '../constants';
|
|
2
2
|
/**
|
|
3
|
-
* Decorator to add OpenAPI metadata to a controller method
|
|
3
|
+
* Decorator to add OpenAPI metadata to a controller method using convention-based routing.
|
|
4
|
+
*
|
|
5
|
+
* **Cannot be mixed with HTTP method decorators** (`@Get`, `@Post`, `@Put`, `@Patch`,
|
|
6
|
+
* `@Delete`, `@All`) in the same controller. Use one pattern or the other.
|
|
4
7
|
*
|
|
5
8
|
* Stores route configuration (schemas, response, tags, security) in metadata.
|
|
6
9
|
* HTTP method, path, and success status code are auto-derived from the method name:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.decorator.js","sourceRoot":"","sources":["../../../src/router/decorators/route.decorator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA;AAGlD
|
|
1
|
+
{"version":3,"file":"route.decorator.js","sourceRoot":"","sources":["../../../src/router/decorators/route.decorator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA;AAGlD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuEG;AACH,MAAM,UAAU,KAAK,CAAC,MAAuC;IAC3D,OAAO,UACL,MAAc,EACd,WAAmB,EACnB,UAA8B;QAE9B,4CAA4C;QAC5C,OAAO,CAAC,cAAc,CACpB,mBAAmB,CAAC,YAAY,EAChC,MAAM,EACN,MAAM,EACN,WAAW,CACZ,CAAA;QAED,OAAO,UAAU,CAAA;IACnB,CAAC,CAAA;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,MAAc,EAAE,UAAkB;IAC/D,OAAO,OAAO,CAAC,WAAW,CAAC,mBAAmB,CAAC,YAAY,EAAE,MAAM,EAAE,UAAU,CAA4B,CAAA;AAC7G,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,eAAmD;IACrF,MAAM,SAAS,GAAG,eAAe,CAAC,SAAoC,CAAA;IACtE,MAAM,WAAW,GAAG,MAAM,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC,MAAM,CAC9D,IAAI,CAAC,EAAE,CAAC,IAAI,KAAK,aAAa,IAAI,OAAO,SAAS,CAAC,IAAI,CAAC,KAAK,UAAU,CACxE,CAAA;IAED,OAAO,WAAW,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CACrC,OAAO,CAAC,WAAW,CAAC,mBAAmB,CAAC,YAAY,EAAE,SAAS,EAAE,UAAU,CAAC,CAC7E,CAAA;AACH,CAAC"}
|
|
@@ -4,7 +4,7 @@ import type { LoggerService } from '../logger';
|
|
|
4
4
|
import { type MiddlewareConfigEntry } from '../middleware';
|
|
5
5
|
import type { Constructor } from '../types';
|
|
6
6
|
import type { IController } from './controller';
|
|
7
|
-
import type { RouterEnv } from './types';
|
|
7
|
+
import type { RouterEnv, VersioningOptions } from './types';
|
|
8
8
|
/**
|
|
9
9
|
* HonoApp — extends OpenAPIHono with Stratal-specific setup
|
|
10
10
|
*
|
|
@@ -30,7 +30,7 @@ export declare class HonoApp extends OpenAPIHono<RouterEnv> {
|
|
|
30
30
|
* Configure module middleware, OpenAPI endpoints, controller routes, and 404 handler.
|
|
31
31
|
* Called once by Application.initialize().
|
|
32
32
|
*/
|
|
33
|
-
configure(middlewareConfigs: MiddlewareConfigEntry[], controllers: Constructor<IController>[]): void
|
|
33
|
+
configure(middlewareConfigs: MiddlewareConfigEntry[], controllers: Constructor<IController>[], versioningOptions?: VersioningOptions | null): Promise<void>;
|
|
34
34
|
private setupRequestScope;
|
|
35
35
|
private setupGlobalMiddleware;
|
|
36
36
|
private applyMiddlewareClasses;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hono-app.d.ts","sourceRoot":"","sources":["../../src/router/hono-app.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAGhD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAC9C,OAAO,EAEL,KAAK,qBAAqB,EAC3B,MAAM,eAAe,CAAA;AAEtB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAE3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAQ/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"hono-app.d.ts","sourceRoot":"","sources":["../../src/router/hono-app.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAGhD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAC9C,OAAO,EAEL,KAAK,qBAAqB,EAC3B,MAAM,eAAe,CAAA;AAEtB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAE3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAQ/C,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAO3D;;;;;;;;;GASG;AACH,qBAAa,OAAQ,SAAQ,WAAW,CAAC,SAAS,CAAC;IACjD,OAAO,CAAC,UAAU,CAAQ;IAC1B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAW;IACtC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAe;IAEvC;;;;OAIG;IACH,OAAO,CAAC,SAAS,CAAkB;gBAGjC,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,aAAa;IAwCvB;;;OAGG;IACG,SAAS,CACb,iBAAiB,EAAE,qBAAqB,EAAE,EAC1C,WAAW,EAAE,WAAW,CAAC,WAAW,CAAC,EAAE,EACvC,iBAAiB,CAAC,EAAE,iBAAiB,GAAG,IAAI,GAC3C,OAAO,CAAC,IAAI,CAAC;IAqBhB,OAAO,CAAC,iBAAiB;IAazB,OAAO,CAAC,qBAAqB;IAU7B,OAAO,CAAC,sBAAsB;CAiB/B"}
|
package/dist/router/hono-app.js
CHANGED
|
@@ -69,18 +69,18 @@ export class HonoApp extends OpenAPIHono {
|
|
|
69
69
|
* Configure module middleware, OpenAPI endpoints, controller routes, and 404 handler.
|
|
70
70
|
* Called once by Application.initialize().
|
|
71
71
|
*/
|
|
72
|
-
configure(middlewareConfigs, controllers) {
|
|
72
|
+
async configure(middlewareConfigs, controllers, versioningOptions) {
|
|
73
73
|
if (this.configured)
|
|
74
74
|
throw new HonoAppAlreadyConfiguredError();
|
|
75
75
|
// Module middleware
|
|
76
|
-
const middlewareConfigService = new MiddlewareConfigurationService(this._logger);
|
|
76
|
+
const middlewareConfigService = new MiddlewareConfigurationService(this._logger, versioningOptions ?? null);
|
|
77
77
|
middlewareConfigService.applyMiddlewares(this, middlewareConfigs, controllers, this._container);
|
|
78
78
|
// OpenAPI endpoints
|
|
79
79
|
const openAPIService = this._container.resolve(OPENAPI_TOKENS.OpenAPIService);
|
|
80
80
|
openAPIService.setupEndpoints(this, controllers);
|
|
81
81
|
// Controller routes
|
|
82
|
-
const routeRegistrationService = new RouteRegistrationService(this._logger);
|
|
83
|
-
routeRegistrationService.configure(this, controllers);
|
|
82
|
+
const routeRegistrationService = new RouteRegistrationService(this._logger, versioningOptions ?? null);
|
|
83
|
+
await routeRegistrationService.configure(this, controllers);
|
|
84
84
|
// 404 handler (must be last)
|
|
85
85
|
this.notFound((c) => { throw new RouteNotFoundError(c.req.path, c.req.method); });
|
|
86
86
|
this.configured = true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hono-app.js","sourceRoot":"","sources":["../../src/router/hono-app.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,aAAa,EAA2B,MAAM,WAAW,CAAA;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAEhD,OAAO,EACL,8BAA8B,GAE/B,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,cAAc,EAAuB,MAAM,YAAY,CAAA;AAEhE,OAAO,EAAE,mBAAmB,EAA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C,CAAA;YAClD,CAAC;YAED,MAAM,OAAO,EAAE,CAAA;QACjB,CAAC,CAAC,CAAA;QACF,OAAO,IAAI,CAAA;IACb,CAAC;CACF"}
|
package/dist/router/index.d.ts
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
export type { IController } from './controller';
|
|
2
2
|
export type { Middleware } from './middleware.interface';
|
|
3
|
-
export type { ControllerOptions, RouteConfig, RouterEnv, RouteResponse, RouterVariables, SecurityScheme } from './types';
|
|
4
|
-
export { HTTP_METHODS, ROUTE_METADATA_KEYS, ROUTER_CONTEXT_KEYS, SECURITY_SCHEMES } from './constants';
|
|
3
|
+
export type { ControllerOptions, HttpRouteMetadata, RouteBody, RouteBodyObject, RouteConfig, RouterEnv, RouteResponse, RouteResponseObject, RouterVariables, SecurityScheme, VersioningOptions } from './types';
|
|
4
|
+
export { HTTP_METHODS, ROUTE_METADATA_KEYS, ROUTER_CONTEXT_KEYS, SECURITY_SCHEMES, VERSION_NEUTRAL } from './constants';
|
|
5
5
|
export { RouterContext } from './router-context';
|
|
6
|
+
export type { SSEMessage, SSEStreamingApi } from 'hono/streaming';
|
|
7
|
+
export type { StreamingApi } from 'hono/utils/stream';
|
|
6
8
|
export { HonoApp } from './hono-app';
|
|
7
9
|
export { RouteRegistrationService } from './services';
|
|
8
10
|
export { ROUTER_TOKENS } from './router.tokens';
|
|
9
|
-
export { Controller, getControllerOptions, getControllerRoute } from './decorators/controller.decorator';
|
|
11
|
+
export { Controller, getControllerOptions, getControllerRoute, getControllerVersion } from './decorators/controller.decorator';
|
|
12
|
+
export { All, Delete, Get, getHttpDecoratedMethods, getHttpRouteMetadata, Patch, Post, Put } from './decorators/http-method.decorator';
|
|
10
13
|
export { getDecoratedMethods, getRouteConfig, Route } from './decorators/route.decorator';
|
|
11
14
|
export * from './schemas';
|
|
12
15
|
export { ControllerRegistrationError, HonoAppAlreadyConfiguredError, OpenAPIRouteRegistrationError, OpenAPIValidationError, RouteNotFoundError } from './errors';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/router/index.ts"],"names":[],"mappings":"AAIA,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC/C,YAAY,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AACxD,YAAY,EAAE,iBAAiB,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/router/index.ts"],"names":[],"mappings":"AAIA,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC/C,YAAY,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AACxD,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,SAAS,EAAE,eAAe,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,EAAE,mBAAmB,EAAE,eAAe,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAG/M,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAGvH,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAGhD,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AACjE,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAGrD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAGpC,OAAO,EACL,wBAAwB,EACzB,MAAM,YAAY,CAAA;AAGnB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAG/C,OAAO,EACL,UAAU,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,oBAAoB,EAC3E,MAAM,mCAAmC,CAAA;AAC1C,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,oCAAoC,CAAA;AACtI,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAA;AAGzF,cAAc,WAAW,CAAA;AAGzB,OAAO,EACL,2BAA2B,EAAE,6BAA6B,EAAE,6BAA6B,EAAE,sBAAsB,EAAE,kBAAkB,EACtI,MAAM,UAAU,CAAA"}
|
package/dist/router/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// eslint-disable-next-line @typescript-eslint/triple-slash-reference
|
|
2
2
|
/// <reference path="./hono-middleware-augment.d.ts" />
|
|
3
3
|
// Router constants
|
|
4
|
-
export { HTTP_METHODS, ROUTE_METADATA_KEYS, ROUTER_CONTEXT_KEYS, SECURITY_SCHEMES } from './constants';
|
|
4
|
+
export { HTTP_METHODS, ROUTE_METADATA_KEYS, ROUTER_CONTEXT_KEYS, SECURITY_SCHEMES, VERSION_NEUTRAL } from './constants';
|
|
5
5
|
// Router context
|
|
6
6
|
export { RouterContext } from './router-context';
|
|
7
7
|
// HonoApp
|
|
@@ -11,7 +11,8 @@ export { RouteRegistrationService } from './services';
|
|
|
11
11
|
// Router tokens
|
|
12
12
|
export { ROUTER_TOKENS } from './router.tokens';
|
|
13
13
|
// Decorators
|
|
14
|
-
export { Controller, getControllerOptions, getControllerRoute } from './decorators/controller.decorator';
|
|
14
|
+
export { Controller, getControllerOptions, getControllerRoute, getControllerVersion } from './decorators/controller.decorator';
|
|
15
|
+
export { All, Delete, Get, getHttpDecoratedMethods, getHttpRouteMetadata, Patch, Post, Put } from './decorators/http-method.decorator';
|
|
15
16
|
export { getDecoratedMethods, getRouteConfig, Route } from './decorators/route.decorator';
|
|
16
17
|
// Schemas
|
|
17
18
|
export * from './schemas';
|
package/dist/router/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/router/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,uDAAuD;AAOvD,mBAAmB;AACnB,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/router/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,uDAAuD;AAOvD,mBAAmB;AACnB,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAEvH,iBAAiB;AACjB,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAMhD,UAAU;AACV,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAEpC,kBAAkB;AAClB,OAAO,EACL,wBAAwB,EACzB,MAAM,YAAY,CAAA;AAEnB,gBAAgB;AAChB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE/C,aAAa;AACb,OAAO,EACL,UAAU,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,oBAAoB,EAC3E,MAAM,mCAAmC,CAAA;AAC1C,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,oCAAoC,CAAA;AACtI,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAA;AAEzF,UAAU;AACV,cAAc,WAAW,CAAA;AAEzB,SAAS;AACT,OAAO,EACL,2BAA2B,EAAE,6BAA6B,EAAE,6BAA6B,EAAE,sBAAsB,EAAE,kBAAkB,EACtI,MAAM,UAAU,CAAA"}
|