node-honest 0.0.7 → 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 (163) 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 +12 -9
  6. package/dist/application/plugin-entries.d.ts +0 -13
  7. package/dist/application/plugin-entries.js +0 -38
  8. package/dist/application/startup-guide.d.ts +0 -4
  9. package/dist/application/startup-guide.js +0 -53
  10. package/dist/application-context.d.ts +0 -13
  11. package/dist/application-context.js +0 -22
  12. package/dist/application.d.ts +0 -34
  13. package/dist/application.js +0 -224
  14. package/dist/components/index.d.ts +0 -1
  15. package/dist/components/index.js +0 -1
  16. package/dist/components/layout.component.d.ts +0 -31
  17. package/dist/components/layout.component.js +0 -94
  18. package/dist/constants/index.d.ts +0 -2
  19. package/dist/constants/index.js +0 -2
  20. package/dist/constants/pipeline.constants.d.ts +0 -6
  21. package/dist/constants/pipeline.constants.js +0 -6
  22. package/dist/constants/version.constants.d.ts +0 -5
  23. package/dist/constants/version.constants.js +0 -5
  24. package/dist/decorators/controller.decorator.d.ts +0 -9
  25. package/dist/decorators/controller.decorator.js +0 -16
  26. package/dist/decorators/http-method.decorator.d.ts +0 -43
  27. package/dist/decorators/http-method.decorator.js +0 -44
  28. package/dist/decorators/index.d.ts +0 -11
  29. package/dist/decorators/index.js +0 -11
  30. package/dist/decorators/module.decorator.d.ts +0 -8
  31. package/dist/decorators/module.decorator.js +0 -12
  32. package/dist/decorators/mvc.decorator.d.ts +0 -26
  33. package/dist/decorators/mvc.decorator.js +0 -36
  34. package/dist/decorators/parameter.decorator.d.ts +0 -41
  35. package/dist/decorators/parameter.decorator.js +0 -59
  36. package/dist/decorators/service.decorator.d.ts +0 -6
  37. package/dist/decorators/service.decorator.js +0 -11
  38. package/dist/decorators/use-component.decorator.d.ts +0 -10
  39. package/dist/decorators/use-component.decorator.js +0 -19
  40. package/dist/decorators/use-filters.decorator.d.ts +0 -8
  41. package/dist/decorators/use-filters.decorator.js +0 -17
  42. package/dist/decorators/use-guards.decorator.d.ts +0 -9
  43. package/dist/decorators/use-guards.decorator.js +0 -18
  44. package/dist/decorators/use-middleware.decorator.d.ts +0 -9
  45. package/dist/decorators/use-middleware.decorator.js +0 -18
  46. package/dist/decorators/use-pipes.decorator.d.ts +0 -9
  47. package/dist/decorators/use-pipes.decorator.js +0 -18
  48. package/dist/di/container.d.ts +0 -34
  49. package/dist/di/container.js +0 -114
  50. package/dist/di/index.d.ts +0 -1
  51. package/dist/di/index.js +0 -1
  52. package/dist/errors/framework.error.d.ts +0 -19
  53. package/dist/errors/framework.error.js +0 -23
  54. package/dist/errors/index.d.ts +0 -1
  55. package/dist/errors/index.js +0 -1
  56. package/dist/handlers/error.handler.d.ts +0 -28
  57. package/dist/handlers/error.handler.js +0 -17
  58. package/dist/handlers/index.d.ts +0 -2
  59. package/dist/handlers/index.js +0 -2
  60. package/dist/handlers/not-found.handler.d.ts +0 -14
  61. package/dist/handlers/not-found.handler.js +0 -17
  62. package/dist/helpers/create-error-response.helper.d.ts +0 -25
  63. package/dist/helpers/create-error-response.helper.js +0 -90
  64. package/dist/helpers/create-http-method-decorator.helper.d.ts +0 -16
  65. package/dist/helpers/create-http-method-decorator.helper.js +0 -30
  66. package/dist/helpers/create-param-decorator.helper.d.ts +0 -16
  67. package/dist/helpers/create-param-decorator.helper.js +0 -60
  68. package/dist/helpers/index.d.ts +0 -3
  69. package/dist/helpers/index.js +0 -3
  70. package/dist/interfaces/application-context.interface.d.ts +0 -35
  71. package/dist/interfaces/application-context.interface.js +0 -1
  72. package/dist/interfaces/controller-options.interface.d.ts +0 -17
  73. package/dist/interfaces/controller-options.interface.js +0 -1
  74. package/dist/interfaces/di-container.interface.d.ts +0 -35
  75. package/dist/interfaces/di-container.interface.js +0 -1
  76. package/dist/interfaces/error-response.interface.d.ts +0 -13
  77. package/dist/interfaces/error-response.interface.js +0 -1
  78. package/dist/interfaces/filter.interface.d.ts +0 -20
  79. package/dist/interfaces/filter.interface.js +0 -1
  80. package/dist/interfaces/guard.interface.d.ts +0 -21
  81. package/dist/interfaces/guard.interface.js +0 -1
  82. package/dist/interfaces/handler-invocation.interface.d.ts +0 -10
  83. package/dist/interfaces/handler-invocation.interface.js +0 -1
  84. package/dist/interfaces/honest-options.interface.d.ts +0 -121
  85. package/dist/interfaces/honest-options.interface.js +0 -1
  86. package/dist/interfaces/http-method-options.interface.d.ts +0 -38
  87. package/dist/interfaces/http-method-options.interface.js +0 -1
  88. package/dist/interfaces/index.d.ts +0 -21
  89. package/dist/interfaces/index.js +0 -21
  90. package/dist/interfaces/logger.interface.d.ts +0 -23
  91. package/dist/interfaces/logger.interface.js +0 -1
  92. package/dist/interfaces/metadata-repository.interface.d.ts +0 -30
  93. package/dist/interfaces/metadata-repository.interface.js +0 -1
  94. package/dist/interfaces/middleware.interface.d.ts +0 -22
  95. package/dist/interfaces/middleware.interface.js +0 -1
  96. package/dist/interfaces/module-options.interface.d.ts +0 -18
  97. package/dist/interfaces/module-options.interface.js +0 -1
  98. package/dist/interfaces/parameter-metadata.interface.d.ts +0 -27
  99. package/dist/interfaces/parameter-metadata.interface.js +0 -1
  100. package/dist/interfaces/parameter-resolution.interface.d.ts +0 -14
  101. package/dist/interfaces/parameter-resolution.interface.js +0 -1
  102. package/dist/interfaces/pipe.interface.d.ts +0 -37
  103. package/dist/interfaces/pipe.interface.js +0 -1
  104. package/dist/interfaces/pipeline-context.interface.d.ts +0 -9
  105. package/dist/interfaces/pipeline-context.interface.js +0 -1
  106. package/dist/interfaces/plugin.interface.d.ts +0 -74
  107. package/dist/interfaces/plugin.interface.js +0 -1
  108. package/dist/interfaces/route-definition.interface.d.ts +0 -51
  109. package/dist/interfaces/route-definition.interface.js +0 -1
  110. package/dist/interfaces/route-info.interface.d.ts +0 -42
  111. package/dist/interfaces/route-info.interface.js +0 -1
  112. package/dist/interfaces/service-registry.interface.d.ts +0 -7
  113. package/dist/interfaces/service-registry.interface.js +0 -1
  114. package/dist/loggers/console.logger.d.ts +0 -7
  115. package/dist/loggers/console.logger.js +0 -21
  116. package/dist/loggers/index.d.ts +0 -2
  117. package/dist/loggers/index.js +0 -2
  118. package/dist/loggers/noop.logger.d.ts +0 -7
  119. package/dist/loggers/noop.logger.js +0 -8
  120. package/dist/managers/component.manager.d.ts +0 -48
  121. package/dist/managers/component.manager.js +0 -209
  122. package/dist/managers/handler.invoker.d.ts +0 -7
  123. package/dist/managers/handler.invoker.js +0 -37
  124. package/dist/managers/index.d.ts +0 -5
  125. package/dist/managers/index.js +0 -5
  126. package/dist/managers/parameter.resolver.d.ts +0 -13
  127. package/dist/managers/parameter.resolver.js +0 -57
  128. package/dist/managers/pipeline.executor.d.ts +0 -28
  129. package/dist/managers/pipeline.executor.js +0 -68
  130. package/dist/managers/route.manager.d.ts +0 -36
  131. package/dist/managers/route.manager.js +0 -147
  132. package/dist/registries/index.d.ts +0 -4
  133. package/dist/registries/index.js +0 -4
  134. package/dist/registries/metadata.registry.d.ts +0 -163
  135. package/dist/registries/metadata.registry.js +0 -250
  136. package/dist/registries/metadata.repository.d.ts +0 -30
  137. package/dist/registries/metadata.repository.js +0 -151
  138. package/dist/registries/route.registry.d.ts +0 -16
  139. package/dist/registries/route.registry.js +0 -46
  140. package/dist/registries/service.registry.d.ts +0 -8
  141. package/dist/registries/service.registry.js +0 -9
  142. package/dist/testing/create-controller-test-application.d.ts +0 -5
  143. package/dist/testing/create-controller-test-application.js +0 -11
  144. package/dist/testing/create-service-test-container.d.ts +0 -5
  145. package/dist/testing/create-service-test-container.js +0 -31
  146. package/dist/testing/create-test-application.d.ts +0 -5
  147. package/dist/testing/create-test-application.js +0 -20
  148. package/dist/testing/create-testing-module.d.ts +0 -6
  149. package/dist/testing/create-testing-module.js +0 -13
  150. package/dist/testing/fixtures/application-test-fixtures.d.ts +0 -17
  151. package/dist/testing/fixtures/application-test-fixtures.js +0 -230
  152. package/dist/testing/index.d.ts +0 -5
  153. package/dist/testing/index.js +0 -5
  154. package/dist/testing/testing.interface.d.ts +0 -96
  155. package/dist/testing/testing.interface.js +0 -1
  156. package/dist/types/constructor.type.d.ts +0 -12
  157. package/dist/types/constructor.type.js +0 -1
  158. package/dist/types/index.d.ts +0 -1
  159. package/dist/types/index.js +0 -1
  160. package/dist/utils/common.util.d.ts +0 -117
  161. package/dist/utils/common.util.js +0 -140
  162. package/dist/utils/index.d.ts +0 -1
  163. package/dist/utils/index.js +0 -1
@@ -1,121 +0,0 @@
1
- import type { Context } from 'hono';
2
- import type { VERSION_NEUTRAL } from '../constants';
3
- import type { FilterType, GuardType, ILogger, MiddlewareType, PipeType, PluginEntry } from '../interfaces';
4
- import type { DiContainer } from './di-container.interface';
5
- /**
6
- * Options for configuring the Honest application
7
- */
8
- export interface HonestOptions {
9
- /**
10
- * Emit actionable startup guidance when initialization fails.
11
- * - `true` enables concise hints
12
- * - object form enables verbose hints with additional context
13
- */
14
- startupGuide?: boolean | {
15
- verbose?: boolean;
16
- };
17
- /**
18
- * Enable debug logging for startup diagnostics.
19
- * - `true` enables all debug logs
20
- * - object form enables specific categories
21
- */
22
- debug?: boolean | {
23
- routes?: boolean;
24
- plugins?: boolean;
25
- pipeline?: boolean;
26
- di?: boolean;
27
- startup?: boolean;
28
- };
29
- /**
30
- * Optional logger for structured framework events.
31
- */
32
- logger?: ILogger;
33
- /**
34
- * Optional strict-mode checks for startup validation.
35
- */
36
- strict?: {
37
- /**
38
- * When enabled, startup fails if no routes were registered.
39
- */
40
- requireRoutes?: boolean;
41
- };
42
- /**
43
- * Optional warnings for unstable/deprecated behavior.
44
- */
45
- deprecations?: {
46
- /**
47
- * Print pre-v1 instability warning during startup.
48
- */
49
- printPreV1Warning?: boolean;
50
- };
51
- /**
52
- * Container instance for dependency injection
53
- */
54
- container?: DiContainer;
55
- /**
56
- * Hono-specific options
57
- */
58
- hono?: {
59
- /**
60
- * Whether to use strict matching for routes
61
- */
62
- strict?: boolean;
63
- /**
64
- * Custom router to use
65
- */
66
- router?: any;
67
- /**
68
- * Function to extract path from request
69
- */
70
- getPath?: (request: Request, options?: any) => string;
71
- };
72
- /**
73
- * Global routing options
74
- */
75
- routing?: {
76
- /**
77
- * Global API prefix to apply to all routes (e.g. /api)
78
- */
79
- prefix?: string;
80
- /**
81
- * Global API version to apply to all routes (e.g. 1 becomes /v1)
82
- * Set to VERSION_NEUTRAL to make routes accessible both with and without version prefix
83
- * Set to an array of numbers to make routes available at multiple versions
84
- */
85
- version?: number | typeof VERSION_NEUTRAL | number[];
86
- };
87
- /**
88
- * Global components to apply to all routes
89
- */
90
- components?: {
91
- /**
92
- * Global middleware to apply to all routes
93
- */
94
- middleware?: MiddlewareType[];
95
- /**
96
- * Global guards to apply to all routes
97
- */
98
- guards?: GuardType[];
99
- /**
100
- * Global pipes to apply to all routes
101
- */
102
- pipes?: PipeType[];
103
- /**
104
- * Global exception filters to apply to all routes
105
- */
106
- filters?: FilterType[];
107
- };
108
- /**
109
- * Plugins for extending the application functionality.
110
- * Each entry can be a plain plugin or an object with plugin and optional pre/post processors.
111
- */
112
- plugins?: PluginEntry[];
113
- /**
114
- * Default exception handler to use when no filter matches
115
- */
116
- onError?: (error: unknown, context: Context) => Response | Promise<Response>;
117
- /**
118
- * Default not found handler for routes that don't match any pattern
119
- */
120
- notFound?: (context: Context) => Response | Promise<Response>;
121
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,38 +0,0 @@
1
- import type { VERSION_NEUTRAL } from '../constants';
2
- /**
3
- * Options for HTTP method decorators (@Get, @Post, @Put, @Delete, etc.)
4
- *
5
- * @example
6
- * ```typescript
7
- * @Get('users', { prefix: 'api', version: 2 })
8
- * getUsers() {
9
- * // ...
10
- * }
11
- * ```
12
- */
13
- export interface HttpMethodOptions {
14
- /**
15
- * Optional prefix for this specific route, overrides controller and global prefix.
16
- * Set to null to explicitly remove any prefix for this route.
17
- *
18
- * @example
19
- * ```typescript
20
- * @Get('users', { prefix: 'api' }) // -> /api/users
21
- * @Get('users', { prefix: null }) // -> /users (no prefix)
22
- * @Get('users', { prefix: 'v2/api' }) // -> /v2/api/users
23
- * ```
24
- */
25
- prefix?: string | null;
26
- /**
27
- * API version for this specific route, overrides controller and global version.
28
- *
29
- * @example
30
- * ```typescript
31
- * @Get('users', { version: 1 }) // -> /v1/users
32
- * @Get('users', { version: null }) // -> /users (no version)
33
- * @Get('users', { version: VERSION_NEUTRAL }) // -> Both /users and /v1/users
34
- * @Get('users', { version: [1, 2] }) // -> Both /v1/users and /v2/users
35
- * ```
36
- */
37
- version?: number | null | typeof VERSION_NEUTRAL | number[];
38
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,21 +0,0 @@
1
- export * from './application-context.interface';
2
- export * from './controller-options.interface';
3
- export * from './di-container.interface';
4
- export * from './logger.interface';
5
- export * from './error-response.interface';
6
- export * from './filter.interface';
7
- export * from './guard.interface';
8
- export * from './handler-invocation.interface';
9
- export * from './honest-options.interface';
10
- export * from './http-method-options.interface';
11
- export * from './metadata-repository.interface';
12
- export * from './middleware.interface';
13
- export * from './module-options.interface';
14
- export * from './parameter-metadata.interface';
15
- export * from './parameter-resolution.interface';
16
- export * from './pipeline-context.interface';
17
- export * from './pipe.interface';
18
- export * from './plugin.interface';
19
- export * from './route-definition.interface';
20
- export * from './route-info.interface';
21
- export * from './service-registry.interface';
@@ -1,21 +0,0 @@
1
- export * from './application-context.interface';
2
- export * from './controller-options.interface';
3
- export * from './di-container.interface';
4
- export * from './logger.interface';
5
- export * from './error-response.interface';
6
- export * from './filter.interface';
7
- export * from './guard.interface';
8
- export * from './handler-invocation.interface';
9
- export * from './honest-options.interface';
10
- export * from './http-method-options.interface';
11
- export * from './metadata-repository.interface';
12
- export * from './middleware.interface';
13
- export * from './module-options.interface';
14
- export * from './parameter-metadata.interface';
15
- export * from './parameter-resolution.interface';
16
- export * from './pipeline-context.interface';
17
- export * from './pipe.interface';
18
- export * from './plugin.interface';
19
- export * from './route-definition.interface';
20
- export * from './route-info.interface';
21
- export * from './service-registry.interface';
@@ -1,23 +0,0 @@
1
- /**
2
- * Log level.
3
- */
4
- export type LogLevel = 'debug' | 'info' | 'warn' | 'error';
5
- /**
6
- * Log category used to filter or route events.
7
- */
8
- export type LogCategory = 'startup' | 'routes' | 'plugins' | 'deprecations' | 'pipeline' | 'di' | 'errors';
9
- /**
10
- * Structured log event emitted by Honest runtime components.
11
- */
12
- export interface LogEvent {
13
- level: LogLevel;
14
- category: LogCategory;
15
- message: string;
16
- details?: Record<string, unknown>;
17
- }
18
- /**
19
- * Logger contract.
20
- */
21
- export interface ILogger {
22
- emit(event: LogEvent): void;
23
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,30 +0,0 @@
1
- import type { ControllerOptions } from './controller-options.interface';
2
- import type { FilterType } from './filter.interface';
3
- import type { GuardType } from './guard.interface';
4
- import type { MiddlewareType } from './middleware.interface';
5
- import type { ModuleOptions } from './module-options.interface';
6
- import type { ParameterMetadata } from './parameter-metadata.interface';
7
- import type { PipeType } from './pipe.interface';
8
- import type { RouteDefinition } from './route-definition.interface';
9
- import type { Constructor } from '../types';
10
- export type MetadataComponentType = 'middleware' | 'guard' | 'pipe' | 'filter';
11
- export interface MetadataComponentTypeMap {
12
- middleware: MiddlewareType;
13
- guard: GuardType;
14
- pipe: PipeType;
15
- filter: FilterType;
16
- }
17
- /**
18
- * Runtime metadata access contract used by framework managers.
19
- */
20
- export interface IMetadataRepository {
21
- hasController(controller: Constructor): boolean;
22
- getControllerPath(controller: Constructor): string;
23
- getControllerOptions(controller: Constructor): ControllerOptions;
24
- getRoutes(controller: Constructor): RouteDefinition[];
25
- getParameters(controller: Constructor): Map<string | symbol, ParameterMetadata[]>;
26
- getContextIndices(controller: Constructor): Map<string | symbol, number>;
27
- getModuleOptions(module: Constructor): ModuleOptions | undefined;
28
- getControllerComponents<T extends MetadataComponentType>(type: T, controller: Constructor): MetadataComponentTypeMap[T][];
29
- getHandlerComponents<T extends MetadataComponentType>(type: T, controller: Constructor, handlerName: string | symbol): MetadataComponentTypeMap[T][];
30
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,22 +0,0 @@
1
- import type { Context, Next } from 'hono';
2
- import type { Constructor } from '../types';
3
- /**
4
- * Interface for HTTP middleware components
5
- * Middleware can process requests before they reach the route handler
6
- * and modify both the request and response
7
- */
8
- export interface IMiddleware {
9
- /**
10
- * Processes an HTTP request/response
11
- * @param c - The Hono context containing request and response information
12
- * @param next - Function to call the next middleware in the chain
13
- * @returns A Promise that resolves to a Response or void
14
- * @throws {Error} If middleware processing fails
15
- */
16
- use(c: Context, next: Next): Promise<Response | void>;
17
- }
18
- /**
19
- * Type for middleware implementations
20
- * Can be either a class implementing IMiddleware or an instance of IMiddleware
21
- */
22
- export type MiddlewareType = Constructor<IMiddleware> | IMiddleware;
@@ -1 +0,0 @@
1
- export {};
@@ -1,18 +0,0 @@
1
- import type { Constructor } from '../types';
2
- /**
3
- * Options for configuring a module
4
- */
5
- export interface ModuleOptions {
6
- /**
7
- * List of controller classes
8
- */
9
- controllers?: Constructor[];
10
- /**
11
- * List of service classes
12
- */
13
- services?: Constructor[];
14
- /**
15
- * List of imported modules
16
- */
17
- imports?: Constructor[];
18
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,27 +0,0 @@
1
- import type { Constructor } from '../types';
2
- import type { Context } from 'hono';
3
- /**
4
- * Metadata for route parameters
5
- */
6
- export interface ParameterMetadata {
7
- /**
8
- * Parameter index
9
- */
10
- index: number;
11
- /**
12
- * Parameter name (body, param, query, etc.)
13
- */
14
- name: string;
15
- /**
16
- * Additional parameter data (e.g., param name)
17
- */
18
- data?: unknown;
19
- /**
20
- * Optional factory function to transform the data
21
- */
22
- factory: (data: unknown, ctx: Context) => unknown | Promise<unknown>;
23
- /**
24
- * The class type of the parameter
25
- */
26
- metatype?: Constructor<unknown>;
27
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,14 +0,0 @@
1
- import type { Context } from 'hono';
2
- import type { IPipe } from './pipe.interface';
3
- import type { ParameterMetadata } from './parameter-metadata.interface';
4
- /**
5
- * Input contract for route-parameter resolution.
6
- */
7
- export interface ParameterResolutionInput {
8
- controllerName: string;
9
- handlerName: string | symbol;
10
- handlerArity: number;
11
- handlerParams: ReadonlyArray<ParameterMetadata>;
12
- handlerPipes: ReadonlyArray<IPipe>;
13
- context: Context;
14
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,37 +0,0 @@
1
- import type { Constructor } from '../types';
2
- /**
3
- * Metadata about an argument being processed by a pipe
4
- */
5
- export interface ArgumentMetadata {
6
- /**
7
- * The type of argument (body, query, param, header, request, response, context, variable, or custom)
8
- */
9
- type: 'body' | 'query' | 'param' | 'header' | 'request' | 'response' | 'context' | 'variable' | string;
10
- /**
11
- * The class type of the argument
12
- */
13
- metatype?: Constructor<unknown>;
14
- /**
15
- * Additional data about the argument
16
- */
17
- data?: string;
18
- }
19
- /**
20
- * Interface for transformation pipes
21
- * Pipes transform input data before it reaches the route handler
22
- */
23
- export interface IPipe {
24
- /**
25
- * Transforms the input value according to the pipe's logic
26
- * @param value - The value to transform
27
- * @param metadata - Metadata about the argument being transformed
28
- * @returns The transformed value, which can be synchronous or asynchronous
29
- * @throws {Error} If the transformation fails or validation fails
30
- */
31
- transform(value: unknown, metadata: ArgumentMetadata): Promise<unknown> | unknown;
32
- }
33
- /**
34
- * Type for pipe implementations
35
- * Can be either a class implementing IPipe or an instance of IPipe
36
- */
37
- export type PipeType = Constructor<IPipe> | IPipe;
@@ -1 +0,0 @@
1
- export {};
@@ -1,9 +0,0 @@
1
- import type { Constructor } from '../types';
2
- /**
3
- * Request-scoped keys used by the framework pipeline.
4
- */
5
- export interface PipelineContextValues {
6
- controllerClass?: Constructor;
7
- handlerName?: string;
8
- bodyCache?: unknown;
9
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,74 +0,0 @@
1
- import type { Hono } from 'hono';
2
- import type { Application } from '../application';
3
- import type { IApplicationContext } from './application-context.interface';
4
- import type { ILogger } from './logger.interface';
5
- import type { Constructor } from '../types';
6
- /**
7
- * Processor callback for plugin pre/post hooks.
8
- * Receives app, hono, and the application context (registry) for sharing pipeline data.
9
- */
10
- export type PluginProcessor = (app: Application, hono: Hono, ctx: IApplicationContext) => void | Promise<void>;
11
- /**
12
- * Optional metadata for plugin diagnostics.
13
- */
14
- export interface PluginMeta {
15
- /**
16
- * Stable plugin name used for diagnostics.
17
- */
18
- name?: string;
19
- }
20
- /**
21
- * Object form of a plugin entry with optional pre/post processors.
22
- * Processors run before (pre) or after (post) the plugin's lifecycle hooks.
23
- */
24
- export interface PluginEntryObject {
25
- plugin: IPlugin | Constructor<IPlugin>;
26
- /**
27
- * Optional stable plugin name for diagnostics.
28
- * Takes precedence over plugin.meta.name.
29
- */
30
- name?: string;
31
- preProcessors?: PluginProcessor[];
32
- postProcessors?: PluginProcessor[];
33
- }
34
- /**
35
- * Interface for Honest framework plugins
36
- * Plugins can extend the framework's functionality by hooking into
37
- * different stages of the application lifecycle
38
- */
39
- export interface IPlugin {
40
- /**
41
- * Optional metadata for plugin diagnostics.
42
- */
43
- meta?: PluginMeta;
44
- /**
45
- * Application logger, injected by the framework before lifecycle hooks run.
46
- * Use this to emit structured log events from within plugin code.
47
- */
48
- logger?: ILogger;
49
- /**
50
- * Hook that runs before module registration begins.
51
- * Use this to set up plugin functionality that modules might depend on.
52
- * @param app - The Honest application instance
53
- * @param hono - The underlying Hono application instance
54
- */
55
- beforeModulesRegistered?: (app: Application, hono: Hono) => void | Promise<void>;
56
- /**
57
- * Hook that runs after all modules have been registered.
58
- * Use this to perform cleanup or setup that requires all modules to be ready.
59
- * @param app - The Honest application instance
60
- * @param hono - The underlying Hono application instance
61
- */
62
- afterModulesRegistered?: (app: Application, hono: Hono) => void | Promise<void>;
63
- }
64
- /**
65
- * Type for plugin implementations
66
- * Can be either a class implementing IPlugin or an instance of IPlugin
67
- */
68
- export type PluginType = Constructor<IPlugin> | IPlugin;
69
- /**
70
- * Plugin entry: either a plain plugin or an object wrapping a plugin with optional processors.
71
- * Use the object form to attach preProcessors (run before lifecycle hooks) and postProcessors
72
- * (run after). Processors receive (app, hono, ctx) where ctx is the application context.
73
- */
74
- export type PluginEntry = PluginType | PluginEntryObject;
@@ -1 +0,0 @@
1
- export {};
@@ -1,51 +0,0 @@
1
- import type { VERSION_NEUTRAL } from '../constants';
2
- /**
3
- * Internal metadata for defining a route. This interface is used by the framework
4
- * to store route information collected from decorators.
5
- *
6
- * @example
7
- * ```typescript
8
- * // Internal representation of:
9
- * @Controller('users')
10
- * class UsersController {
11
- * @Get(':id')
12
- * getUser(@Param('id') id: string) {}
13
- * }
14
- * ```
15
- */
16
- export interface RouteDefinition {
17
- /**
18
- * Route path relative to the controller's base path.
19
- * Supports path parameters using colon syntax.
20
- *
21
- * @example ':id' | 'users/:userId/posts/:postId' | ''
22
- */
23
- path: string;
24
- /**
25
- * HTTP method for the route (GET, POST, PUT, DELETE, etc.)
26
- */
27
- method: string;
28
- /**
29
- * Name of the method in the controller class that handles this route
30
- */
31
- handlerName: string | symbol;
32
- /**
33
- * Route-specific API version, overrides controller and global version.
34
- *
35
- * @example
36
- * ```typescript
37
- * version: 1 // -> /v1/...
38
- * version: null // -> /... (no version)
39
- * version: VERSION_NEUTRAL // -> Both /... and /v1/...
40
- * version: [1, 2] // -> Both /v1/... and /v2/...
41
- * ```
42
- */
43
- version?: number | null | typeof VERSION_NEUTRAL | number[];
44
- /**
45
- * Route-specific prefix that overrides controller and global prefix.
46
- * Set to null to explicitly remove any prefix.
47
- *
48
- * @example 'api' | 'v2/api' | null
49
- */
50
- prefix?: string | null;
51
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,42 +0,0 @@
1
- import type { ParameterMetadata } from './parameter-metadata.interface';
2
- /**
3
- * Route information for registered routes
4
- */
5
- export interface RouteInfo {
6
- /**
7
- * Controller name
8
- */
9
- controller: string | symbol;
10
- /**
11
- * Handler method name
12
- */
13
- handler: string | symbol;
14
- /**
15
- * HTTP method
16
- */
17
- method: string;
18
- /**
19
- * Effective prefix
20
- */
21
- prefix: string;
22
- /**
23
- * Effective version
24
- */
25
- version?: string;
26
- /**
27
- * Controller route path
28
- */
29
- route: string;
30
- /**
31
- * Method path
32
- */
33
- path: string;
34
- /**
35
- * Complete path (prefix + version + route + path)
36
- */
37
- fullPath: string;
38
- /**
39
- * Parameter metadata for the handler
40
- */
41
- parameters: ParameterMetadata[];
42
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,7 +0,0 @@
1
- import type { Constructor } from '../types';
2
- /**
3
- * Contract for checking whether classes are registered as injectable services.
4
- */
5
- export interface IServiceRegistry {
6
- isService(service: Constructor): boolean;
7
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,7 +0,0 @@
1
- import type { LogEvent, ILogger } from '../interfaces';
2
- /**
3
- * Default logger that writes structured events to console.
4
- */
5
- export declare class ConsoleLogger implements ILogger {
6
- emit(event: LogEvent): void;
7
- }
@@ -1,21 +0,0 @@
1
- /**
2
- * Default logger that writes structured events to console.
3
- */
4
- export class ConsoleLogger {
5
- emit(event) {
6
- const prefix = `[HonestJS:${event.category}]`;
7
- const payload = event.details ? [prefix, event.message, event.details] : [prefix, event.message];
8
- switch (event.level) {
9
- case 'debug':
10
- case 'info':
11
- console.info(...payload);
12
- break;
13
- case 'warn':
14
- console.warn(...payload);
15
- break;
16
- case 'error':
17
- console.error(...payload);
18
- break;
19
- }
20
- }
21
- }
@@ -1,2 +0,0 @@
1
- export * from './console.logger';
2
- export * from './noop.logger';
@@ -1,2 +0,0 @@
1
- export * from './console.logger';
2
- export * from './noop.logger';
@@ -1,7 +0,0 @@
1
- import type { LogEvent, ILogger } from '../interfaces';
2
- /**
3
- * Logger implementation that intentionally does nothing.
4
- */
5
- export declare class NoopLogger implements ILogger {
6
- emit(_event: LogEvent): void;
7
- }