node-honest 0.0.1 → 0.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.
Files changed (165) hide show
  1. package/dist/index.cjs +2185 -0
  2. package/dist/index.d.cts +1539 -0
  3. package/dist/index.d.ts +1539 -16
  4. package/dist/index.js +2116 -15
  5. package/package.json +14 -11
  6. package/dist/app.d.ts +0 -1
  7. package/dist/app.js +0 -36
  8. package/dist/application/plugin-entries.d.ts +0 -13
  9. package/dist/application/plugin-entries.js +0 -38
  10. package/dist/application/startup-guide.d.ts +0 -4
  11. package/dist/application/startup-guide.js +0 -53
  12. package/dist/application-context.d.ts +0 -13
  13. package/dist/application-context.js +0 -22
  14. package/dist/application.d.ts +0 -34
  15. package/dist/application.js +0 -224
  16. package/dist/components/index.d.ts +0 -1
  17. package/dist/components/index.js +0 -1
  18. package/dist/components/layout.component.d.ts +0 -31
  19. package/dist/components/layout.component.js +0 -94
  20. package/dist/constants/index.d.ts +0 -2
  21. package/dist/constants/index.js +0 -2
  22. package/dist/constants/pipeline.constants.d.ts +0 -6
  23. package/dist/constants/pipeline.constants.js +0 -6
  24. package/dist/constants/version.constants.d.ts +0 -5
  25. package/dist/constants/version.constants.js +0 -5
  26. package/dist/decorators/controller.decorator.d.ts +0 -9
  27. package/dist/decorators/controller.decorator.js +0 -16
  28. package/dist/decorators/http-method.decorator.d.ts +0 -43
  29. package/dist/decorators/http-method.decorator.js +0 -44
  30. package/dist/decorators/index.d.ts +0 -11
  31. package/dist/decorators/index.js +0 -11
  32. package/dist/decorators/module.decorator.d.ts +0 -8
  33. package/dist/decorators/module.decorator.js +0 -12
  34. package/dist/decorators/mvc.decorator.d.ts +0 -26
  35. package/dist/decorators/mvc.decorator.js +0 -36
  36. package/dist/decorators/parameter.decorator.d.ts +0 -41
  37. package/dist/decorators/parameter.decorator.js +0 -59
  38. package/dist/decorators/service.decorator.d.ts +0 -6
  39. package/dist/decorators/service.decorator.js +0 -11
  40. package/dist/decorators/use-component.decorator.d.ts +0 -10
  41. package/dist/decorators/use-component.decorator.js +0 -19
  42. package/dist/decorators/use-filters.decorator.d.ts +0 -8
  43. package/dist/decorators/use-filters.decorator.js +0 -17
  44. package/dist/decorators/use-guards.decorator.d.ts +0 -9
  45. package/dist/decorators/use-guards.decorator.js +0 -18
  46. package/dist/decorators/use-middleware.decorator.d.ts +0 -9
  47. package/dist/decorators/use-middleware.decorator.js +0 -18
  48. package/dist/decorators/use-pipes.decorator.d.ts +0 -9
  49. package/dist/decorators/use-pipes.decorator.js +0 -18
  50. package/dist/di/container.d.ts +0 -34
  51. package/dist/di/container.js +0 -114
  52. package/dist/di/index.d.ts +0 -1
  53. package/dist/di/index.js +0 -1
  54. package/dist/errors/framework.error.d.ts +0 -19
  55. package/dist/errors/framework.error.js +0 -23
  56. package/dist/errors/index.d.ts +0 -1
  57. package/dist/errors/index.js +0 -1
  58. package/dist/handlers/error.handler.d.ts +0 -28
  59. package/dist/handlers/error.handler.js +0 -17
  60. package/dist/handlers/index.d.ts +0 -2
  61. package/dist/handlers/index.js +0 -2
  62. package/dist/handlers/not-found.handler.d.ts +0 -14
  63. package/dist/handlers/not-found.handler.js +0 -17
  64. package/dist/helpers/create-error-response.helper.d.ts +0 -25
  65. package/dist/helpers/create-error-response.helper.js +0 -90
  66. package/dist/helpers/create-http-method-decorator.helper.d.ts +0 -16
  67. package/dist/helpers/create-http-method-decorator.helper.js +0 -30
  68. package/dist/helpers/create-param-decorator.helper.d.ts +0 -16
  69. package/dist/helpers/create-param-decorator.helper.js +0 -60
  70. package/dist/helpers/index.d.ts +0 -3
  71. package/dist/helpers/index.js +0 -3
  72. package/dist/interfaces/application-context.interface.d.ts +0 -35
  73. package/dist/interfaces/application-context.interface.js +0 -1
  74. package/dist/interfaces/controller-options.interface.d.ts +0 -17
  75. package/dist/interfaces/controller-options.interface.js +0 -1
  76. package/dist/interfaces/di-container.interface.d.ts +0 -35
  77. package/dist/interfaces/di-container.interface.js +0 -1
  78. package/dist/interfaces/error-response.interface.d.ts +0 -13
  79. package/dist/interfaces/error-response.interface.js +0 -1
  80. package/dist/interfaces/filter.interface.d.ts +0 -20
  81. package/dist/interfaces/filter.interface.js +0 -1
  82. package/dist/interfaces/guard.interface.d.ts +0 -21
  83. package/dist/interfaces/guard.interface.js +0 -1
  84. package/dist/interfaces/handler-invocation.interface.d.ts +0 -10
  85. package/dist/interfaces/handler-invocation.interface.js +0 -1
  86. package/dist/interfaces/honest-options.interface.d.ts +0 -121
  87. package/dist/interfaces/honest-options.interface.js +0 -1
  88. package/dist/interfaces/http-method-options.interface.d.ts +0 -38
  89. package/dist/interfaces/http-method-options.interface.js +0 -1
  90. package/dist/interfaces/index.d.ts +0 -21
  91. package/dist/interfaces/index.js +0 -21
  92. package/dist/interfaces/logger.interface.d.ts +0 -23
  93. package/dist/interfaces/logger.interface.js +0 -1
  94. package/dist/interfaces/metadata-repository.interface.d.ts +0 -30
  95. package/dist/interfaces/metadata-repository.interface.js +0 -1
  96. package/dist/interfaces/middleware.interface.d.ts +0 -22
  97. package/dist/interfaces/middleware.interface.js +0 -1
  98. package/dist/interfaces/module-options.interface.d.ts +0 -18
  99. package/dist/interfaces/module-options.interface.js +0 -1
  100. package/dist/interfaces/parameter-metadata.interface.d.ts +0 -27
  101. package/dist/interfaces/parameter-metadata.interface.js +0 -1
  102. package/dist/interfaces/parameter-resolution.interface.d.ts +0 -14
  103. package/dist/interfaces/parameter-resolution.interface.js +0 -1
  104. package/dist/interfaces/pipe.interface.d.ts +0 -37
  105. package/dist/interfaces/pipe.interface.js +0 -1
  106. package/dist/interfaces/pipeline-context.interface.d.ts +0 -9
  107. package/dist/interfaces/pipeline-context.interface.js +0 -1
  108. package/dist/interfaces/plugin.interface.d.ts +0 -74
  109. package/dist/interfaces/plugin.interface.js +0 -1
  110. package/dist/interfaces/route-definition.interface.d.ts +0 -51
  111. package/dist/interfaces/route-definition.interface.js +0 -1
  112. package/dist/interfaces/route-info.interface.d.ts +0 -42
  113. package/dist/interfaces/route-info.interface.js +0 -1
  114. package/dist/interfaces/service-registry.interface.d.ts +0 -7
  115. package/dist/interfaces/service-registry.interface.js +0 -1
  116. package/dist/loggers/console.logger.d.ts +0 -7
  117. package/dist/loggers/console.logger.js +0 -21
  118. package/dist/loggers/index.d.ts +0 -2
  119. package/dist/loggers/index.js +0 -2
  120. package/dist/loggers/noop.logger.d.ts +0 -7
  121. package/dist/loggers/noop.logger.js +0 -8
  122. package/dist/managers/component.manager.d.ts +0 -48
  123. package/dist/managers/component.manager.js +0 -210
  124. package/dist/managers/handler.invoker.d.ts +0 -7
  125. package/dist/managers/handler.invoker.js +0 -37
  126. package/dist/managers/index.d.ts +0 -5
  127. package/dist/managers/index.js +0 -5
  128. package/dist/managers/parameter.resolver.d.ts +0 -13
  129. package/dist/managers/parameter.resolver.js +0 -58
  130. package/dist/managers/pipeline.executor.d.ts +0 -28
  131. package/dist/managers/pipeline.executor.js +0 -71
  132. package/dist/managers/route.manager.d.ts +0 -36
  133. package/dist/managers/route.manager.js +0 -149
  134. package/dist/registries/index.d.ts +0 -4
  135. package/dist/registries/index.js +0 -4
  136. package/dist/registries/metadata.registry.d.ts +0 -163
  137. package/dist/registries/metadata.registry.js +0 -250
  138. package/dist/registries/metadata.repository.d.ts +0 -30
  139. package/dist/registries/metadata.repository.js +0 -151
  140. package/dist/registries/route.registry.d.ts +0 -16
  141. package/dist/registries/route.registry.js +0 -46
  142. package/dist/registries/service.registry.d.ts +0 -8
  143. package/dist/registries/service.registry.js +0 -9
  144. package/dist/testing/create-controller-test-application.d.ts +0 -5
  145. package/dist/testing/create-controller-test-application.js +0 -11
  146. package/dist/testing/create-service-test-container.d.ts +0 -5
  147. package/dist/testing/create-service-test-container.js +0 -31
  148. package/dist/testing/create-test-application.d.ts +0 -5
  149. package/dist/testing/create-test-application.js +0 -20
  150. package/dist/testing/create-testing-module.d.ts +0 -6
  151. package/dist/testing/create-testing-module.js +0 -13
  152. package/dist/testing/fixtures/application-test-fixtures.d.ts +0 -17
  153. package/dist/testing/fixtures/application-test-fixtures.js +0 -230
  154. package/dist/testing/index.d.ts +0 -5
  155. package/dist/testing/index.js +0 -5
  156. package/dist/testing/testing.interface.d.ts +0 -96
  157. package/dist/testing/testing.interface.js +0 -1
  158. package/dist/types/constructor.type.d.ts +0 -12
  159. package/dist/types/constructor.type.js +0 -1
  160. package/dist/types/index.d.ts +0 -1
  161. package/dist/types/index.js +0 -1
  162. package/dist/utils/common.util.d.ts +0 -117
  163. package/dist/utils/common.util.js +0 -140
  164. package/dist/utils/index.d.ts +0 -1
  165. package/dist/utils/index.js +0 -1
@@ -1,6 +0,0 @@
1
- /**
2
- * Internal request-context keys used by the Honest runtime pipeline.
3
- */
4
- export const HONEST_PIPELINE_CONTROLLER_KEY = '__honest_controllerClass';
5
- export const HONEST_PIPELINE_HANDLER_KEY = '__honest_handlerName';
6
- export const HONEST_PIPELINE_BODY_CACHE_KEY = '__honest.body.cache';
@@ -1,5 +0,0 @@
1
- /**
2
- * Symbol to use when marking a route as version-neutral
3
- * Version-neutral routes are accessible both with and without version prefix
4
- */
5
- export declare const VERSION_NEUTRAL: unique symbol;
@@ -1,5 +0,0 @@
1
- /**
2
- * Symbol to use when marking a route as version-neutral
3
- * Version-neutral routes are accessible both with and without version prefix
4
- */
5
- export const VERSION_NEUTRAL = Symbol('VERSION_NEUTRAL');
@@ -1,9 +0,0 @@
1
- import type { ControllerOptions } from '../interfaces';
2
- /**
3
- * Decorator that marks a class as a controller
4
- * Controllers are responsible for handling incoming requests and returning responses
5
- * @param route - The base route for all endpoints in this controller
6
- * @param options - Configuration options for the controller
7
- * @returns A class decorator function
8
- */
9
- export declare function Controller(route?: string, options?: ControllerOptions): ClassDecorator;
@@ -1,16 +0,0 @@
1
- import { MetadataRegistry } from '../registries';
2
- /**
3
- * Decorator that marks a class as a controller
4
- * Controllers are responsible for handling incoming requests and returning responses
5
- * @param route - The base route for all endpoints in this controller
6
- * @param options - Configuration options for the controller
7
- * @returns A class decorator function
8
- */
9
- export function Controller(route = '', options = {}) {
10
- return (target) => {
11
- // Store the prefix in the registry
12
- MetadataRegistry.setControllerPath(target, route);
13
- // Store the controller options in the registry
14
- MetadataRegistry.setControllerOptions(target, options);
15
- };
16
- }
@@ -1,43 +0,0 @@
1
- /**
2
- * GET method decorator
3
- * The GET method requests a representation of the specified resource.
4
- * Requests using GET should only retrieve data and should not contain a request content.
5
- * @param path - The route path
6
- */
7
- export declare const Get: (path?: string, options?: import("..").HttpMethodOptions) => MethodDecorator;
8
- /**
9
- * POST method decorator
10
- * The POST method submits an entity to the specified resource,
11
- * often causing a change in state or side effects on the server.
12
- * @param path - The route path
13
- */
14
- export declare const Post: (path?: string, options?: import("..").HttpMethodOptions) => MethodDecorator;
15
- /**
16
- * PUT method decorator
17
- * The PUT method replaces all current representations of the target resource with the request content.
18
- * @param path - The route path
19
- */
20
- export declare const Put: (path?: string, options?: import("..").HttpMethodOptions) => MethodDecorator;
21
- /**
22
- * DELETE method decorator
23
- * The DELETE method deletes the specified resource.
24
- * @param path - The route path
25
- */
26
- export declare const Delete: (path?: string, options?: import("..").HttpMethodOptions) => MethodDecorator;
27
- /**
28
- * PATCH method decorator
29
- * The PATCH method applies partial modifications to a resource.
30
- * @param path - The route path
31
- */
32
- export declare const Patch: (path?: string, options?: import("..").HttpMethodOptions) => MethodDecorator;
33
- /**
34
- * OPTIONS method decorator
35
- * The OPTIONS method describes the communication options for the target resource.
36
- * @param path - The route path
37
- */
38
- export declare const Options: (path?: string, options?: import("..").HttpMethodOptions) => MethodDecorator;
39
- /**
40
- * ALL method decorator (matches all HTTP methods)
41
- * @param path - The route path
42
- */
43
- export declare const All: (path?: string, options?: import("..").HttpMethodOptions) => MethodDecorator;
@@ -1,44 +0,0 @@
1
- import { createHttpMethodDecorator } from '../helpers';
2
- /**
3
- * GET method decorator
4
- * The GET method requests a representation of the specified resource.
5
- * Requests using GET should only retrieve data and should not contain a request content.
6
- * @param path - The route path
7
- */
8
- export const Get = createHttpMethodDecorator('get');
9
- /**
10
- * POST method decorator
11
- * The POST method submits an entity to the specified resource,
12
- * often causing a change in state or side effects on the server.
13
- * @param path - The route path
14
- */
15
- export const Post = createHttpMethodDecorator('post');
16
- /**
17
- * PUT method decorator
18
- * The PUT method replaces all current representations of the target resource with the request content.
19
- * @param path - The route path
20
- */
21
- export const Put = createHttpMethodDecorator('put');
22
- /**
23
- * DELETE method decorator
24
- * The DELETE method deletes the specified resource.
25
- * @param path - The route path
26
- */
27
- export const Delete = createHttpMethodDecorator('delete');
28
- /**
29
- * PATCH method decorator
30
- * The PATCH method applies partial modifications to a resource.
31
- * @param path - The route path
32
- */
33
- export const Patch = createHttpMethodDecorator('patch');
34
- /**
35
- * OPTIONS method decorator
36
- * The OPTIONS method describes the communication options for the target resource.
37
- * @param path - The route path
38
- */
39
- export const Options = createHttpMethodDecorator('options');
40
- /**
41
- * ALL method decorator (matches all HTTP methods)
42
- * @param path - The route path
43
- */
44
- export const All = createHttpMethodDecorator('all');
@@ -1,11 +0,0 @@
1
- export * from './controller.decorator';
2
- export * from './http-method.decorator';
3
- export * from './module.decorator';
4
- export * from './mvc.decorator';
5
- export * from './parameter.decorator';
6
- export * from './service.decorator';
7
- export * from './use-component.decorator';
8
- export * from './use-filters.decorator';
9
- export * from './use-guards.decorator';
10
- export * from './use-middleware.decorator';
11
- export * from './use-pipes.decorator';
@@ -1,11 +0,0 @@
1
- export * from './controller.decorator';
2
- export * from './http-method.decorator';
3
- export * from './module.decorator';
4
- export * from './mvc.decorator';
5
- export * from './parameter.decorator';
6
- export * from './service.decorator';
7
- export * from './use-component.decorator';
8
- export * from './use-filters.decorator';
9
- export * from './use-guards.decorator';
10
- export * from './use-middleware.decorator';
11
- export * from './use-pipes.decorator';
@@ -1,8 +0,0 @@
1
- import type { ModuleOptions } from '../interfaces';
2
- /**
3
- * Decorator that marks a class as a module
4
- * Modules are used to organize the application structure and dependencies
5
- * @param options - Configuration options for the module
6
- * @returns A class decorator function
7
- */
8
- export declare function Module(options?: ModuleOptions): ClassDecorator;
@@ -1,12 +0,0 @@
1
- import { MetadataRegistry } from '../registries';
2
- /**
3
- * Decorator that marks a class as a module
4
- * Modules are used to organize the application structure and dependencies
5
- * @param options - Configuration options for the module
6
- * @returns A class decorator function
7
- */
8
- export function Module(options = {}) {
9
- return (target) => {
10
- MetadataRegistry.setModuleOptions(target, options);
11
- };
12
- }
@@ -1,26 +0,0 @@
1
- import type { ControllerOptions, ModuleOptions } from '../interfaces';
2
- import type { Constructor } from '../types';
3
- /**
4
- * Decorator that marks a class as a controller
5
- * Controllers are responsible for handling incoming requests and returning responses
6
- * @param route - The base route for all endpoints in this controller
7
- * @param options - Configuration options for the controller
8
- * @returns A class decorator function
9
- */
10
- export declare function View(route?: string, options?: ControllerOptions): ClassDecorator;
11
- /**
12
- * GET method decorator
13
- * The GET method requests a representation of the specified resource.
14
- * Requests using GET should only retrieve data and should not contain a request content.
15
- * @param path - The route path
16
- */
17
- export declare const Page: (path?: string, options?: import("..").HttpMethodOptions) => MethodDecorator;
18
- /**
19
- * Decorator that marks a class as a module
20
- * Modules are used to organize the application structure and dependencies
21
- * @param options - Configuration options for the module
22
- * @returns A class decorator function
23
- */
24
- export declare function MvcModule(options?: ModuleOptions & {
25
- views?: Constructor[];
26
- }): ClassDecorator;
@@ -1,36 +0,0 @@
1
- import { Controller } from './controller.decorator';
2
- import { Get } from './http-method.decorator';
3
- import { Module } from './module.decorator';
4
- /**
5
- * Decorator that marks a class as a controller
6
- * Controllers are responsible for handling incoming requests and returning responses
7
- * @param route - The base route for all endpoints in this controller
8
- * @param options - Configuration options for the controller
9
- * @returns A class decorator function
10
- */
11
- export function View(route = '', options = {
12
- prefix: null,
13
- version: null
14
- }) {
15
- return Controller(route, options);
16
- }
17
- /**
18
- * GET method decorator
19
- * The GET method requests a representation of the specified resource.
20
- * Requests using GET should only retrieve data and should not contain a request content.
21
- * @param path - The route path
22
- */
23
- export const Page = Get;
24
- /**
25
- * Decorator that marks a class as a module
26
- * Modules are used to organize the application structure and dependencies
27
- * @param options - Configuration options for the module
28
- * @returns A class decorator function
29
- */
30
- export function MvcModule(options = {}) {
31
- return Module({
32
- imports: options.imports,
33
- services: options.services,
34
- controllers: (options.views || []).concat(options.controllers || [])
35
- });
36
- }
@@ -1,41 +0,0 @@
1
- /**
2
- * Decorator that binds the request body to a parameter
3
- * @param data - Optional property name to extract from the body
4
- */
5
- export declare const Body: (data?: unknown) => (target: Object, propertyKey: string | symbol, parameterIndex: number) => void;
6
- /**
7
- * Decorator that binds a route parameter to a parameter
8
- * @param data - The parameter name in the route
9
- */
10
- export declare const Param: (data?: unknown) => (target: Object, propertyKey: string | symbol, parameterIndex: number) => void;
11
- /**
12
- * Decorator that binds a query parameter to a parameter
13
- * @param data - The query parameter name
14
- */
15
- export declare const Query: (data?: unknown) => (target: Object, propertyKey: string | symbol, parameterIndex: number) => void;
16
- /**
17
- * Decorator that binds a header value to a parameter
18
- * @param data - The header name
19
- */
20
- export declare const Header: (data?: unknown) => (target: Object, propertyKey: string | symbol, parameterIndex: number) => void;
21
- /**
22
- * Decorator that binds the request object to a parameter
23
- */
24
- export declare const Req: (data?: unknown) => (target: Object, propertyKey: string | symbol, parameterIndex: number) => void;
25
- export declare const Request: (data?: unknown) => (target: Object, propertyKey: string | symbol, parameterIndex: number) => void;
26
- /**
27
- * Decorator that binds the response object to a parameter
28
- */
29
- export declare const Res: (data?: unknown) => (target: Object, propertyKey: string | symbol, parameterIndex: number) => void;
30
- export declare const Response: (data?: unknown) => (target: Object, propertyKey: string | symbol, parameterIndex: number) => void;
31
- /**
32
- * Decorator that binds the context object to a parameter
33
- */
34
- export declare const Ctx: (data?: unknown) => (target: Object, propertyKey: string | symbol, parameterIndex: number) => void;
35
- export declare const Context: (data?: unknown) => (target: Object, propertyKey: string | symbol, parameterIndex: number) => void;
36
- /**
37
- * Decorator that binds a context variable to a parameter
38
- * @param data - The variable name to retrieve from context
39
- */
40
- export declare const Var: (data?: unknown) => (target: Object, propertyKey: string | symbol, parameterIndex: number) => void;
41
- export declare const Variable: (data?: unknown) => (target: Object, propertyKey: string | symbol, parameterIndex: number) => void;
@@ -1,59 +0,0 @@
1
- import { HONEST_PIPELINE_BODY_CACHE_KEY } from '../constants';
2
- import { createParamDecorator } from '../helpers';
3
- /**
4
- * Decorator that binds the request body to a parameter
5
- * @param data - Optional property name to extract from the body
6
- */
7
- export const Body = createParamDecorator('body', async (data, ctx) => {
8
- let body = ctx.get(HONEST_PIPELINE_BODY_CACHE_KEY);
9
- if (body === undefined) {
10
- body = await ctx.req.json();
11
- ctx.set(HONEST_PIPELINE_BODY_CACHE_KEY, body);
12
- }
13
- if (data && body && typeof body === 'object') {
14
- return body[String(data)];
15
- }
16
- return body;
17
- });
18
- /**
19
- * Decorator that binds a route parameter to a parameter
20
- * @param data - The parameter name in the route
21
- */
22
- export const Param = createParamDecorator('param', (data, ctx) => {
23
- return data ? ctx.req.param(String(data)) : ctx.req.param();
24
- });
25
- /**
26
- * Decorator that binds a query parameter to a parameter
27
- * @param data - The query parameter name
28
- */
29
- export const Query = createParamDecorator('query', (data, ctx) => {
30
- return data ? ctx.req.query(String(data)) : ctx.req.query();
31
- });
32
- /**
33
- * Decorator that binds a header value to a parameter
34
- * @param data - The header name
35
- */
36
- export const Header = createParamDecorator('header', (data, ctx) => {
37
- return data ? ctx.req.header(String(data)) : ctx.req.header();
38
- });
39
- /**
40
- * Decorator that binds the request object to a parameter
41
- */
42
- export const Req = createParamDecorator('request', (_, ctx) => ctx.req);
43
- export const Request = createParamDecorator('request', (_, ctx) => ctx.req);
44
- /**
45
- * Decorator that binds the response object to a parameter
46
- */
47
- export const Res = createParamDecorator('response', (_, ctx) => ctx.res);
48
- export const Response = createParamDecorator('response', (_, ctx) => ctx.res);
49
- /**
50
- * Decorator that binds the context object to a parameter
51
- */
52
- export const Ctx = createParamDecorator('context', (_, ctx) => ctx);
53
- export const Context = createParamDecorator('context', (_, ctx) => ctx);
54
- /**
55
- * Decorator that binds a context variable to a parameter
56
- * @param data - The variable name to retrieve from context
57
- */
58
- export const Var = createParamDecorator('variable', (data, ctx) => data === undefined ? undefined : ctx.get(String(data)));
59
- export const Variable = createParamDecorator('variable', (data, ctx) => data === undefined ? undefined : ctx.get(String(data)));
@@ -1,6 +0,0 @@
1
- /**
2
- * Decorator that marks a class as a service
3
- * Services are singleton classes that can be injected as dependencies
4
- * @returns A class decorator function
5
- */
6
- export declare function Service(): ClassDecorator;
@@ -1,11 +0,0 @@
1
- import { MetadataRegistry } from '../registries';
2
- /**
3
- * Decorator that marks a class as a service
4
- * Services are singleton classes that can be injected as dependencies
5
- * @returns A class decorator function
6
- */
7
- export function Service() {
8
- return (target) => {
9
- MetadataRegistry.addService(target);
10
- };
11
- }
@@ -1,10 +0,0 @@
1
- import type { ComponentType, ComponentTypeMap } from '../registries';
2
- import type { Constructor } from '../types';
3
- /**
4
- * Generic decorator that applies components of a specific type to a controller class or method
5
- * @template T - The type of component being applied
6
- * @param type - The component type identifier
7
- * @param components - Array of components to apply
8
- * @returns A decorator function that can be used at class or method level
9
- */
10
- export declare function UseComponent<T extends ComponentType>(type: T, ...components: ComponentTypeMap[T][]): (target: Constructor | object, propertyKey?: string | symbol) => void;
@@ -1,19 +0,0 @@
1
- import { MetadataRegistry } from '../registries';
2
- /**
3
- * Generic decorator that applies components of a specific type to a controller class or method
4
- * @template T - The type of component being applied
5
- * @param type - The component type identifier
6
- * @param components - Array of components to apply
7
- * @returns A decorator function that can be used at class or method level
8
- */
9
- export function UseComponent(type, ...components) {
10
- return (target, propertyKey) => {
11
- if (propertyKey) {
12
- const controllerClass = target.constructor;
13
- components.forEach((component) => MetadataRegistry.registerHandler(type, controllerClass, propertyKey, component));
14
- }
15
- else {
16
- components.forEach((component) => MetadataRegistry.registerController(type, target, component));
17
- }
18
- };
19
- }
@@ -1,8 +0,0 @@
1
- import type { FilterType } from '../interfaces';
2
- import type { Constructor } from '../types';
3
- /**
4
- * Decorator that applies exception filters to a controller class or method
5
- * @param filters - Array of exception filters to apply
6
- * @returns A decorator function that can be used at class or method level
7
- */
8
- export declare function UseFilters(...filters: FilterType[]): (target: Constructor | object, propertyKey?: string | symbol) => void;
@@ -1,17 +0,0 @@
1
- import { MetadataRegistry } from '../registries';
2
- /**
3
- * Decorator that applies exception filters to a controller class or method
4
- * @param filters - Array of exception filters to apply
5
- * @returns A decorator function that can be used at class or method level
6
- */
7
- export function UseFilters(...filters) {
8
- return (target, propertyKey) => {
9
- if (propertyKey) {
10
- const controllerClass = target.constructor;
11
- filters.forEach((filter) => MetadataRegistry.registerHandler('filter', controllerClass, propertyKey, filter));
12
- }
13
- else {
14
- filters.forEach((filter) => MetadataRegistry.registerController('filter', target, filter));
15
- }
16
- };
17
- }
@@ -1,9 +0,0 @@
1
- import type { GuardType } from '../interfaces';
2
- import type { Constructor } from '../types';
3
- /**
4
- * Decorator that applies guards to a controller class or method
5
- * Guards determine whether a request should be handled by the route handler
6
- * @param guards - Array of guards to apply
7
- * @returns A decorator function that can be used at class or method level
8
- */
9
- export declare function UseGuards(...guards: GuardType[]): (target: Constructor | object, propertyKey?: string | symbol) => void;
@@ -1,18 +0,0 @@
1
- import { MetadataRegistry } from '../registries';
2
- /**
3
- * Decorator that applies guards to a controller class or method
4
- * Guards determine whether a request should be handled by the route handler
5
- * @param guards - Array of guards to apply
6
- * @returns A decorator function that can be used at class or method level
7
- */
8
- export function UseGuards(...guards) {
9
- return (target, propertyKey) => {
10
- if (propertyKey) {
11
- const controllerClass = target.constructor;
12
- guards.forEach((guard) => MetadataRegistry.registerHandler('guard', controllerClass, propertyKey, guard));
13
- }
14
- else {
15
- guards.forEach((guard) => MetadataRegistry.registerController('guard', target, guard));
16
- }
17
- };
18
- }
@@ -1,9 +0,0 @@
1
- import type { MiddlewareType } from '../interfaces';
2
- import type { Constructor } from '../types';
3
- /**
4
- * Decorator that applies middleware to a controller class or method
5
- * Middleware functions run before the route handler and can modify the request/response
6
- * @param middleware - Array of middleware functions to apply
7
- * @returns A decorator function that can be used at class or method level
8
- */
9
- export declare function UseMiddleware(...middleware: MiddlewareType[]): (target: Constructor | object, propertyKey?: string | symbol) => void;
@@ -1,18 +0,0 @@
1
- import { MetadataRegistry } from '../registries';
2
- /**
3
- * Decorator that applies middleware to a controller class or method
4
- * Middleware functions run before the route handler and can modify the request/response
5
- * @param middleware - Array of middleware functions to apply
6
- * @returns A decorator function that can be used at class or method level
7
- */
8
- export function UseMiddleware(...middleware) {
9
- return (target, propertyKey) => {
10
- if (propertyKey) {
11
- const controllerClass = target.constructor;
12
- middleware.forEach((mw) => MetadataRegistry.registerHandler('middleware', controllerClass, propertyKey, mw));
13
- }
14
- else {
15
- middleware.forEach((mw) => MetadataRegistry.registerController('middleware', target, mw));
16
- }
17
- };
18
- }
@@ -1,9 +0,0 @@
1
- import type { PipeType } from '../interfaces';
2
- import type { Constructor } from '../types';
3
- /**
4
- * Decorator that applies transformation pipes to a controller class or method
5
- * Pipes transform input data before it reaches the route handler
6
- * @param pipes - Array of pipes to apply
7
- * @returns A decorator function that can be used at class or method level
8
- */
9
- export declare function UsePipes(...pipes: PipeType[]): (target: Constructor | object, propertyKey?: string | symbol) => void;
@@ -1,18 +0,0 @@
1
- import { MetadataRegistry } from '../registries';
2
- /**
3
- * Decorator that applies transformation pipes to a controller class or method
4
- * Pipes transform input data before it reaches the route handler
5
- * @param pipes - Array of pipes to apply
6
- * @returns A decorator function that can be used at class or method level
7
- */
8
- export function UsePipes(...pipes) {
9
- return (target, propertyKey) => {
10
- if (propertyKey) {
11
- const controllerClass = target.constructor;
12
- pipes.forEach((pipe) => MetadataRegistry.registerHandler('pipe', controllerClass, propertyKey, pipe));
13
- }
14
- else {
15
- pipes.forEach((pipe) => MetadataRegistry.registerController('pipe', target, pipe));
16
- }
17
- };
18
- }
@@ -1,34 +0,0 @@
1
- import type { DiContainer, ILogger, IServiceRegistry } from '../interfaces';
2
- import type { Constructor } from '../types';
3
- /**
4
- * Dependency Injection container that manages class instances and their dependencies
5
- */
6
- export declare class Container implements DiContainer {
7
- private readonly serviceRegistry;
8
- private readonly logger;
9
- private readonly debugDi;
10
- constructor(serviceRegistry?: IServiceRegistry, logger?: ILogger, debugDi?: boolean);
11
- /**
12
- * Map of class constructors to their instances
13
- */
14
- private instances;
15
- private emitLog;
16
- /**
17
- * Resolves a class instance, creating it if necessary and injecting its dependencies
18
- * @param target - The class constructor to resolve
19
- * @returns An instance of the target class
20
- */
21
- resolve<T>(target: Constructor<T>): T;
22
- /**
23
- * Internal recursive resolver with circular dependency tracking
24
- */
25
- private resolveWithTracking;
26
- /**
27
- * Registers a pre-created instance for a class
28
- * @param target - The class constructor to register
29
- * @param instance - The instance to register
30
- */
31
- register<T>(target: Constructor<T>, instance: T): void;
32
- has<T>(target: Constructor<T>): boolean;
33
- clear(): void;
34
- }