@hono-di/core 0.0.9 → 0.0.15
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/dist/decorators-ClTJ_N9c.d.cts +304 -0
- package/dist/decorators-ClTJ_N9c.d.ts +304 -0
- package/dist/decorators.d.cts +1 -68
- package/dist/decorators.d.ts +1 -68
- package/dist/index.cjs +774 -101
- package/dist/index.d.cts +520 -7
- package/dist/index.d.ts +520 -7
- package/dist/index.js +773 -100
- package/package.json +1 -1
- package/dist/core.cjs +0 -1790
- package/dist/core.d.cts +0 -339
- package/dist/core.d.ts +0 -339
- package/dist/core.js +0 -1755
- package/dist/interfaces-4oTuNIHA.d.cts +0 -139
- package/dist/interfaces-4oTuNIHA.d.ts +0 -139
package/dist/index.d.cts
CHANGED
|
@@ -1,10 +1,407 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
import 'hono';
|
|
1
|
+
import { I as IApplication, a as InjectionToken, T as Type, S as Scope, E as ExceptionFilter, P as PipeTransform, b as Interceptor, C as CanActivate, F as ForwardReference, c as ExecutionContext, H as HttpArgumentsHost, M as MiddlewareConsumer, d as MiddlewareConfigProxy, R as RouteInfo, A as ArgumentMetadata, e as ArgumentsHost } from './decorators-ClTJ_N9c.cjs';
|
|
2
|
+
export { r as All, ab as BeforeApplicationShutdown, Y as Body, a7 as CallHandler, s as Catch, ae as ClassProvider, am as CleanupHandler, l as Controller, X as Ctx, a1 as CustomDecorator, D as Delete, ai as DynamicModule, ah as ExistingProvider, ag as FactoryProvider, L as FileParam, Q as Files, m as Get, G as Global, q as Head, a3 as Header, $ as Headers, aj as HonoDiMiddleware, ak as HonoDiModule, W as HostParam, a2 as HttpCode, t as Inject, k as Injectable, h as InjectableOptions, V as Ip, j as Module, g as ModuleOptions, N as Next, a9 as OnApplicationBootstrap, ac as OnApplicationShutdown, aa as OnModuleDestroy, a8 as OnModuleInit, u as Optional, O as Options, _ as Param, p as Patch, n as Post, ad as Provider, o as Put, Z as Query, a4 as Redirect, B as Request, f as RequestMethod, J as Response, i as RouteDefinition, al as RouteMetadataCache, y as RouteParamtypes, K as Session, a0 as SetMetadata, U as UseFilters, v as UseGuards, w as UseInterceptors, x as UsePipes, af as ValueProvider, a5 as applyDecorators, z as assignMetadata, a6 as createParamDecorator } from './decorators-ClTJ_N9c.cjs';
|
|
3
|
+
import * as hono from 'hono';
|
|
4
|
+
import { Hono } from 'hono';
|
|
5
|
+
import * as hono_utils_http_status from 'hono/utils/http-status';
|
|
6
6
|
import 'rxjs';
|
|
7
|
-
|
|
7
|
+
|
|
8
|
+
declare const METADATA_KEYS: {
|
|
9
|
+
MODULE: symbol;
|
|
10
|
+
GLOBAL: symbol;
|
|
11
|
+
CONTROLLER: symbol;
|
|
12
|
+
FLUSH_ROLES: symbol;
|
|
13
|
+
OPTS: symbol;
|
|
14
|
+
PARAMS: symbol;
|
|
15
|
+
ROUTES: symbol;
|
|
16
|
+
FILTER_CATCH: symbol;
|
|
17
|
+
FILTER_EXCEPTION: symbol;
|
|
18
|
+
USE_FILTERS: symbol;
|
|
19
|
+
USE_PIPES: symbol;
|
|
20
|
+
USE_GUARDS: symbol;
|
|
21
|
+
USE_INTERCEPTORS: symbol;
|
|
22
|
+
ROUTE_ARGS_METADATA: symbol;
|
|
23
|
+
INJECTIONS: symbol;
|
|
24
|
+
OPTIONAL: symbol;
|
|
25
|
+
SCOPE: symbol;
|
|
26
|
+
METHOD_INJECTIONS: symbol;
|
|
27
|
+
METHOD_OPTIONAL: symbol;
|
|
28
|
+
PROPERTY_DEPS: symbol;
|
|
29
|
+
HTTP_CODE: symbol;
|
|
30
|
+
HEADERS: symbol;
|
|
31
|
+
REDIRECT: symbol;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Factory class for creating Hono DI applications
|
|
36
|
+
*
|
|
37
|
+
* @remarks
|
|
38
|
+
* This is the main entry point for bootstrapping a Hono DI application.
|
|
39
|
+
* It handles module scanning, dependency resolution, and application initialization.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* Basic usage:
|
|
43
|
+
* ```typescript
|
|
44
|
+
* @Module({
|
|
45
|
+
* controllers: [AppController],
|
|
46
|
+
* providers: [AppService]
|
|
47
|
+
* })
|
|
48
|
+
* class AppModule {}
|
|
49
|
+
*
|
|
50
|
+
* const app = await HonoDiFactory.create(AppModule);
|
|
51
|
+
* ```
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* With custom Hono instance:
|
|
55
|
+
* ```typescript
|
|
56
|
+
* const hono = new Hono();
|
|
57
|
+
* const app = await HonoDiFactory.create(AppModule, hono);
|
|
58
|
+
* ```
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* With manual initialization:
|
|
62
|
+
* ```typescript
|
|
63
|
+
* const app = await HonoDiFactory.create(AppModule, { autoInit: false });
|
|
64
|
+
* app.setGlobalPrefix('api/v1');
|
|
65
|
+
* await app.init();
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* @public
|
|
69
|
+
*/
|
|
70
|
+
declare class HonoDiFactory {
|
|
71
|
+
private static logger;
|
|
72
|
+
/**
|
|
73
|
+
* Creates and bootstraps a Hono DI application
|
|
74
|
+
*
|
|
75
|
+
* @param rootModule - The root module class decorated with @Module
|
|
76
|
+
* @param appOrOptions - Optional Hono instance or configuration options
|
|
77
|
+
* @param appOrOptions.app - Custom Hono instance to use
|
|
78
|
+
* @param appOrOptions.autoInit - Whether to automatically initialize the app (default: true)
|
|
79
|
+
*
|
|
80
|
+
* @returns Promise resolving to the initialized application instance
|
|
81
|
+
*
|
|
82
|
+
* @throws {Error} If module scanning fails
|
|
83
|
+
* @throws {Error} If circular dependencies are detected
|
|
84
|
+
* @throws {Error} If required dependencies cannot be resolved
|
|
85
|
+
*
|
|
86
|
+
* @remarks
|
|
87
|
+
* The creation process includes:
|
|
88
|
+
* 1. Module scanning and dependency graph building
|
|
89
|
+
* 2. Scope bubbling optimization (REQUEST-scoped propagation)
|
|
90
|
+
* 3. Singleton provider instantiation
|
|
91
|
+
* 4. Lifecycle hook execution (OnModuleInit, OnApplicationBootstrap)
|
|
92
|
+
* 5. Route registration and middleware setup
|
|
93
|
+
*
|
|
94
|
+
* @public
|
|
95
|
+
*/
|
|
96
|
+
static create(rootModule: any, appOrOptions?: Hono | {
|
|
97
|
+
app?: Hono;
|
|
98
|
+
autoInit?: boolean;
|
|
99
|
+
}): Promise<IApplication>;
|
|
100
|
+
private static applyScopeBubbling;
|
|
101
|
+
private static instantiateProviders;
|
|
102
|
+
private static callLifecycleHook;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
declare class ContextId {
|
|
106
|
+
readonly id: string;
|
|
107
|
+
constructor();
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
declare class InstanceWrapper<T = any> {
|
|
111
|
+
readonly id: string;
|
|
112
|
+
readonly token: InjectionToken;
|
|
113
|
+
readonly name?: string;
|
|
114
|
+
metatype?: Type<T> | Function;
|
|
115
|
+
scope: Scope;
|
|
116
|
+
host?: Module;
|
|
117
|
+
inject?: InjectionToken[];
|
|
118
|
+
isOptional?: boolean[];
|
|
119
|
+
properties?: {
|
|
120
|
+
key: string | symbol;
|
|
121
|
+
token: InjectionToken;
|
|
122
|
+
isOptional?: boolean;
|
|
123
|
+
}[];
|
|
124
|
+
instance?: T;
|
|
125
|
+
private readonly instancesPerContext;
|
|
126
|
+
isResolved: boolean;
|
|
127
|
+
isPending: boolean;
|
|
128
|
+
isAlias: boolean;
|
|
129
|
+
useFactory?: Function;
|
|
130
|
+
useValue?: any;
|
|
131
|
+
useExisting?: any;
|
|
132
|
+
constructor(metadata: Partial<InstanceWrapper<T>> & {
|
|
133
|
+
token: InjectionToken;
|
|
134
|
+
});
|
|
135
|
+
getInstanceByContextId(contextId: ContextId): T | undefined;
|
|
136
|
+
setInstanceByContextId(contextId: ContextId, instance: T): void;
|
|
137
|
+
addCtorMetadata(index: number, token: InjectionToken): void;
|
|
138
|
+
cleanup(contextId?: ContextId): void;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
declare class Module {
|
|
142
|
+
readonly metatype: Type<any>;
|
|
143
|
+
readonly token: string;
|
|
144
|
+
private readonly _providers;
|
|
145
|
+
private readonly _imports;
|
|
146
|
+
private readonly _exports;
|
|
147
|
+
private readonly _controllers;
|
|
148
|
+
constructor(metatype: Type<any>, token: string);
|
|
149
|
+
get providers(): Map<InjectionToken, InstanceWrapper<any>>;
|
|
150
|
+
get imports(): Set<Module>;
|
|
151
|
+
get exports(): Set<InjectionToken>;
|
|
152
|
+
get controllers(): Map<InjectionToken, InstanceWrapper<any>>;
|
|
153
|
+
addProvider(provider: InstanceWrapper): void;
|
|
154
|
+
addController(controller: InstanceWrapper): void;
|
|
155
|
+
addImport(module: Module): void;
|
|
156
|
+
addExport(token: InjectionToken): void;
|
|
157
|
+
hasProvider(token: InjectionToken): boolean;
|
|
158
|
+
getProvider(token: InjectionToken): InstanceWrapper | undefined;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
declare class Container {
|
|
162
|
+
private readonly modules;
|
|
163
|
+
private readonly globalModules;
|
|
164
|
+
addModule(moduleMeta: Type<any>, token: string): Module;
|
|
165
|
+
addGlobalModule(module: Module): void;
|
|
166
|
+
getGlobalModules(): Set<Module>;
|
|
167
|
+
getModuleByToken(token: string): Module | undefined;
|
|
168
|
+
getModules(): Map<string, Module>;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
declare class Injector {
|
|
172
|
+
private readonly container?;
|
|
173
|
+
constructor(container?: Container | undefined);
|
|
174
|
+
resolveConstructorParams<T>(wrapper: InstanceWrapper<T>, module: Module, inject: InjectionToken[], callback: (args: any[]) => void, // not used directly in this async flow but kept for structure if needed
|
|
175
|
+
contextId?: ContextId, inquire?: InstanceWrapper[], parentInquire?: InstanceWrapper[]): Promise<any[]>;
|
|
176
|
+
resolveSingleParam<T>(token: InjectionToken, targetModule: Module, contextId: ContextId, inquire: InstanceWrapper[], isOptional?: boolean): Promise<T | undefined>;
|
|
177
|
+
private lookupProvider;
|
|
178
|
+
loadInstance<T>(wrapper: InstanceWrapper<T>, contextId: ContextId, inquire?: InstanceWrapper[]): Promise<T>;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
declare class Scanner {
|
|
182
|
+
private readonly container;
|
|
183
|
+
constructor(container: Container);
|
|
184
|
+
private readonly logger;
|
|
185
|
+
scan(module: Type<any>): Promise<void>;
|
|
186
|
+
private scanModule;
|
|
187
|
+
private insertProvider;
|
|
188
|
+
private insertController;
|
|
189
|
+
scanDependencies(wrapper: InstanceWrapper): void;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
declare abstract class ModuleRef {
|
|
193
|
+
abstract get<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | string | symbol, options?: {
|
|
194
|
+
strict: boolean;
|
|
195
|
+
}): TResult;
|
|
196
|
+
abstract resolve<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | string | symbol, contextId?: ContextId, options?: {
|
|
197
|
+
strict: boolean;
|
|
198
|
+
}): Promise<TResult>;
|
|
199
|
+
abstract create<TInput = any>(type: Type<TInput>, contextId?: ContextId): Promise<TInput>;
|
|
200
|
+
}
|
|
201
|
+
declare class ModuleRefImpl extends ModuleRef {
|
|
202
|
+
private readonly container;
|
|
203
|
+
private readonly injector;
|
|
204
|
+
private readonly moduleRef;
|
|
205
|
+
constructor(container: Container, injector: Injector, moduleRef: Module);
|
|
206
|
+
get<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | string | symbol, options?: {
|
|
207
|
+
strict: boolean;
|
|
208
|
+
}): TResult;
|
|
209
|
+
resolve<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | string | symbol, contextId?: ContextId, options?: {
|
|
210
|
+
strict: boolean;
|
|
211
|
+
}): Promise<TResult>;
|
|
212
|
+
create<TInput = any>(type: Type<TInput>, contextId?: ContextId): Promise<TInput>;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* The main application class for Hono DI
|
|
217
|
+
*
|
|
218
|
+
* @remarks
|
|
219
|
+
* This class manages the application lifecycle, route registration, middleware,
|
|
220
|
+
* and dependency injection container. It wraps a Hono instance and adds DI capabilities.
|
|
221
|
+
*
|
|
222
|
+
* @example
|
|
223
|
+
* ```typescript
|
|
224
|
+
* const app = await HonoDiFactory.create(AppModule);
|
|
225
|
+
* app.useGlobalGuards(new AuthGuard());
|
|
226
|
+
* app.setGlobalPrefix('api');
|
|
227
|
+
* await app.listen({ port: 3000 });
|
|
228
|
+
* ```
|
|
229
|
+
*
|
|
230
|
+
* @public
|
|
231
|
+
*/
|
|
232
|
+
declare class Application implements IApplication {
|
|
233
|
+
private readonly app;
|
|
234
|
+
private readonly container;
|
|
235
|
+
private readonly injector;
|
|
236
|
+
private globalFilters;
|
|
237
|
+
private globalPipes;
|
|
238
|
+
private globalGuards;
|
|
239
|
+
private globalInterceptors;
|
|
240
|
+
private readonly scanner;
|
|
241
|
+
private readonly contextManager;
|
|
242
|
+
private readonly lifecycleManager;
|
|
243
|
+
private readonly argumentResolver;
|
|
244
|
+
private readonly exceptionHandler;
|
|
245
|
+
private readonly middlewareHandler;
|
|
246
|
+
private readonly UNSAFE_PROPERTIES;
|
|
247
|
+
private readonly routeCache;
|
|
248
|
+
constructor(app: Hono, container: Container, injector: Injector);
|
|
249
|
+
/**
|
|
250
|
+
* Registers global exception filters
|
|
251
|
+
*
|
|
252
|
+
* @param filters - Exception filter instances or classes
|
|
253
|
+
* @returns This application instance for chaining
|
|
254
|
+
*
|
|
255
|
+
* @example
|
|
256
|
+
* ```typescript
|
|
257
|
+
* app.useGlobalFilters(new HttpExceptionFilter());
|
|
258
|
+
* ```
|
|
259
|
+
*
|
|
260
|
+
* @public
|
|
261
|
+
*/
|
|
262
|
+
useGlobalFilters(...filters: ExceptionFilter[]): this;
|
|
263
|
+
/**
|
|
264
|
+
* Registers global pipes for request transformation/validation
|
|
265
|
+
*
|
|
266
|
+
* @param pipes - Pipe instances or classes
|
|
267
|
+
* @returns This application instance for chaining
|
|
268
|
+
*
|
|
269
|
+
* @example
|
|
270
|
+
* ```typescript
|
|
271
|
+
* app.useGlobalPipes(new ValidationPipe());
|
|
272
|
+
* ```
|
|
273
|
+
*
|
|
274
|
+
* @public
|
|
275
|
+
*/
|
|
276
|
+
useGlobalPipes(...pipes: PipeTransform[]): this;
|
|
277
|
+
/**
|
|
278
|
+
* Registers global interceptors for request/response manipulation
|
|
279
|
+
*
|
|
280
|
+
* @param interceptors - Interceptor instances or classes
|
|
281
|
+
* @returns This application instance for chaining
|
|
282
|
+
*
|
|
283
|
+
* @example
|
|
284
|
+
* ```typescript
|
|
285
|
+
* app.useGlobalInterceptors(new LoggingInterceptor());
|
|
286
|
+
* ```
|
|
287
|
+
*
|
|
288
|
+
* @public
|
|
289
|
+
*/
|
|
290
|
+
useGlobalInterceptors(...interceptors: Interceptor[]): this;
|
|
291
|
+
/**
|
|
292
|
+
* Registers global guards for route protection
|
|
293
|
+
*
|
|
294
|
+
* @param guards - Guard instances or classes
|
|
295
|
+
* @returns This application instance for chaining
|
|
296
|
+
*
|
|
297
|
+
* @example
|
|
298
|
+
* ```typescript
|
|
299
|
+
* app.useGlobalGuards(new AuthGuard());
|
|
300
|
+
* ```
|
|
301
|
+
*
|
|
302
|
+
* @public
|
|
303
|
+
*/
|
|
304
|
+
useGlobalGuards(...guards: CanActivate[]): this;
|
|
305
|
+
private globalPrefix;
|
|
306
|
+
/**
|
|
307
|
+
* Sets a global prefix for all routes
|
|
308
|
+
*
|
|
309
|
+
* @param prefix - URL prefix (e.g., 'api' or 'api/v1')
|
|
310
|
+
* @returns This application instance for chaining
|
|
311
|
+
*
|
|
312
|
+
* @remarks
|
|
313
|
+
* Must be called before init() if using autoInit: true.
|
|
314
|
+
* Use autoInit: false in HonoDiFactory.create() to set prefix before initialization.
|
|
315
|
+
*
|
|
316
|
+
* @example
|
|
317
|
+
* ```typescript
|
|
318
|
+
* app.setGlobalPrefix('api/v1');
|
|
319
|
+
* // All routes will be prefixed with /api/v1
|
|
320
|
+
* ```
|
|
321
|
+
*
|
|
322
|
+
* @public
|
|
323
|
+
*/
|
|
324
|
+
setGlobalPrefix(prefix: string): this;
|
|
325
|
+
getGlobalPrefix(): string;
|
|
326
|
+
private readonly logger;
|
|
327
|
+
private isInitialized;
|
|
328
|
+
/**
|
|
329
|
+
* Initializes the application by registering all routes and middleware
|
|
330
|
+
*
|
|
331
|
+
* @returns Promise resolving to this application instance
|
|
332
|
+
*
|
|
333
|
+
* @remarks
|
|
334
|
+
* Called automatically unless autoInit: false is specified in HonoDiFactory.create().
|
|
335
|
+
* Handles:
|
|
336
|
+
* - Middleware registration
|
|
337
|
+
* - Controller and route registration
|
|
338
|
+
* - Lifecycle hook execution (OnApplicationBootstrap)
|
|
339
|
+
*
|
|
340
|
+
* @public
|
|
341
|
+
*/
|
|
342
|
+
init(): Promise<this>;
|
|
343
|
+
listen(port: number | string, callback?: () => void): Promise<any>;
|
|
344
|
+
private callLifecycleHook;
|
|
345
|
+
private registerControllersFromContainer;
|
|
346
|
+
private registerControllerRoutes;
|
|
347
|
+
private resolveContextItems;
|
|
348
|
+
private resolveArgs;
|
|
349
|
+
private runGuards;
|
|
350
|
+
private resolveArgsFromCache;
|
|
351
|
+
private initializeMiddleware;
|
|
352
|
+
private isRouteMatch;
|
|
353
|
+
private isRouteExcluded;
|
|
354
|
+
private combinePaths;
|
|
355
|
+
getHttpAdapter(): any;
|
|
356
|
+
get<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | string | symbol, options?: {
|
|
357
|
+
strict?: boolean;
|
|
358
|
+
}): TResult;
|
|
359
|
+
close(): Promise<void>;
|
|
360
|
+
private cleanupContext;
|
|
361
|
+
getGlobalFilters(): ExceptionFilter<any>[];
|
|
362
|
+
getGlobalPipes(): PipeTransform<any, any>[];
|
|
363
|
+
getGlobalGuards(): CanActivate[];
|
|
364
|
+
getGlobalInterceptors(): Interceptor<any, any>[];
|
|
365
|
+
getContainer(): Container;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
declare function forwardRef(fn: () => Type<any>): ForwardReference;
|
|
369
|
+
|
|
370
|
+
declare class ExecutionContextHost implements ExecutionContext {
|
|
371
|
+
private readonly args;
|
|
372
|
+
private readonly constructorRef;
|
|
373
|
+
private readonly handler;
|
|
374
|
+
private readonly context;
|
|
375
|
+
private readonly next?;
|
|
376
|
+
constructor(args: any[], constructorRef: Type<any>, handler: Function);
|
|
377
|
+
getClass<T = any>(): Type<T>;
|
|
378
|
+
getHandler(): Function;
|
|
379
|
+
getArgs<T extends Array<any> = any[]>(): T;
|
|
380
|
+
getType<TContext extends string = 'http'>(): TContext;
|
|
381
|
+
switchToHttp(): HttpArgumentsHost;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
declare class MiddlewareBuilder implements MiddlewareConsumer {
|
|
385
|
+
private readonly module?;
|
|
386
|
+
private readonly configs;
|
|
387
|
+
constructor(module?: Module | undefined);
|
|
388
|
+
apply(...middleware: (Type<any> | Function)[]): MiddlewareConfigProxy;
|
|
389
|
+
addConfig(middleware: any[], routes: (string | Type<any> | RouteInfo)[], excludes?: (string | RouteInfo)[]): void;
|
|
390
|
+
getConfigs(): MiddlewareConfig[];
|
|
391
|
+
}
|
|
392
|
+
interface MiddlewareConfig {
|
|
393
|
+
middleware: any[];
|
|
394
|
+
routes: (string | Type<any> | RouteInfo)[];
|
|
395
|
+
excludes: (string | RouteInfo)[];
|
|
396
|
+
module?: Module;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
interface ILogger {
|
|
400
|
+
info(message: string, ...meta: any[]): void;
|
|
401
|
+
error(message: string, ...meta: any[]): void;
|
|
402
|
+
warn(message: string, ...meta: any[]): void;
|
|
403
|
+
debug(message: string, ...meta: any[]): void;
|
|
404
|
+
}
|
|
8
405
|
|
|
9
406
|
declare class Logger implements ILogger {
|
|
10
407
|
private static lastTimestamp?;
|
|
@@ -27,6 +424,122 @@ declare class Logger implements ILogger {
|
|
|
27
424
|
private static getColorByLevel;
|
|
28
425
|
}
|
|
29
426
|
|
|
427
|
+
declare class Reflector {
|
|
428
|
+
get<TResult = any, TKey = any>(metadataKey: TKey, target: Type<any> | Function): TResult;
|
|
429
|
+
getAllAndOverride<TResult = any, TKey = any>(metadataKey: TKey, targets: (Type<any> | Function)[]): TResult;
|
|
430
|
+
getAllAndMerge<TResult = any[], TKey = any>(metadataKey: TKey, targets: (Type<any> | Function)[]): TResult;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
declare class HttpException extends Error {
|
|
434
|
+
private readonly response;
|
|
435
|
+
private readonly status;
|
|
436
|
+
constructor(response: string | object, status: number);
|
|
437
|
+
getResponse(): string | object;
|
|
438
|
+
getStatus(): number;
|
|
439
|
+
static createBody(message: object | string | any, error: string, statusCode: number): any;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
declare class BadRequestException extends HttpException {
|
|
443
|
+
constructor(message?: string | object | any, error?: string);
|
|
444
|
+
}
|
|
445
|
+
declare class UnauthorizedException extends HttpException {
|
|
446
|
+
constructor(message?: string | object | any, error?: string);
|
|
447
|
+
}
|
|
448
|
+
declare class NotFoundException extends HttpException {
|
|
449
|
+
constructor(message?: string | object | any, error?: string);
|
|
450
|
+
}
|
|
451
|
+
declare class ForbiddenException extends HttpException {
|
|
452
|
+
constructor(message?: string | object | any, error?: string);
|
|
453
|
+
}
|
|
454
|
+
declare class NotAcceptableException extends HttpException {
|
|
455
|
+
constructor(message?: string | object | any, error?: string);
|
|
456
|
+
}
|
|
457
|
+
declare class RequestTimeoutException extends HttpException {
|
|
458
|
+
constructor(message?: string | object | any, error?: string);
|
|
459
|
+
}
|
|
460
|
+
declare class ConflictException extends HttpException {
|
|
461
|
+
constructor(message?: string | object | any, error?: string);
|
|
462
|
+
}
|
|
463
|
+
declare class GoneException extends HttpException {
|
|
464
|
+
constructor(message?: string | object | any, error?: string);
|
|
465
|
+
}
|
|
466
|
+
declare class PayloadTooLargeException extends HttpException {
|
|
467
|
+
constructor(message?: string | object | any, error?: string);
|
|
468
|
+
}
|
|
469
|
+
declare class UnsupportedMediaTypeException extends HttpException {
|
|
470
|
+
constructor(message?: string | object | any, error?: string);
|
|
471
|
+
}
|
|
472
|
+
declare class UnprocessableEntityException extends HttpException {
|
|
473
|
+
constructor(message?: string | object | any, error?: string);
|
|
474
|
+
}
|
|
475
|
+
declare class InternalServerErrorException extends HttpException {
|
|
476
|
+
constructor(message?: string | object | any, error?: string);
|
|
477
|
+
}
|
|
478
|
+
declare class NotImplementedException extends HttpException {
|
|
479
|
+
constructor(message?: string | object | any, error?: string);
|
|
480
|
+
}
|
|
481
|
+
declare class BadGatewayException extends HttpException {
|
|
482
|
+
constructor(message?: string | object | any, error?: string);
|
|
483
|
+
}
|
|
484
|
+
declare class ServiceUnavailableException extends HttpException {
|
|
485
|
+
constructor(message?: string | object | any, error?: string);
|
|
486
|
+
}
|
|
487
|
+
declare class GatewayTimeoutException extends HttpException {
|
|
488
|
+
constructor(message?: string | object | any, error?: string);
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
declare class ParseIntPipe implements PipeTransform<string, number> {
|
|
492
|
+
transform(value: string, metadata: ArgumentMetadata): number;
|
|
493
|
+
}
|
|
494
|
+
declare class ParseFloatPipe implements PipeTransform<string, number> {
|
|
495
|
+
transform(value: string, metadata: ArgumentMetadata): number;
|
|
496
|
+
}
|
|
497
|
+
declare class ParseBoolPipe implements PipeTransform<string | boolean, boolean> {
|
|
498
|
+
transform(value: string | boolean, metadata: ArgumentMetadata): boolean;
|
|
499
|
+
}
|
|
500
|
+
declare class ValidationPipe implements PipeTransform<any> {
|
|
501
|
+
transform(value: any, metadata: ArgumentMetadata): any;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
declare class AppError extends Error {
|
|
505
|
+
statusCode: number;
|
|
506
|
+
message: string;
|
|
507
|
+
isOperational: boolean;
|
|
508
|
+
constructor(statusCode: number, message: string, isOperational?: boolean);
|
|
509
|
+
}
|
|
510
|
+
declare class NotFoundError extends AppError {
|
|
511
|
+
constructor(message?: string);
|
|
512
|
+
}
|
|
513
|
+
declare class BadRequestError extends AppError {
|
|
514
|
+
constructor(message?: string);
|
|
515
|
+
}
|
|
516
|
+
declare class UnauthorizedError extends AppError {
|
|
517
|
+
constructor(message?: string);
|
|
518
|
+
}
|
|
519
|
+
declare class ForbiddenError extends AppError {
|
|
520
|
+
constructor(message?: string);
|
|
521
|
+
}
|
|
522
|
+
declare class ConflictError extends AppError {
|
|
523
|
+
constructor(message?: string);
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
declare class BaseExceptionFilter implements ExceptionFilter {
|
|
527
|
+
catch(exception: unknown, host: ArgumentsHost): (Response & hono.TypedResponse<string, hono_utils_http_status.ContentfulStatusCode, "json">) | (Response & hono.TypedResponse<{
|
|
528
|
+
statusCode: number;
|
|
529
|
+
message: string;
|
|
530
|
+
cause: string;
|
|
531
|
+
}, hono_utils_http_status.ContentfulStatusCode, "json">) | (Response & hono.TypedResponse<{
|
|
532
|
+
statusCode: number;
|
|
533
|
+
message: string;
|
|
534
|
+
error: string;
|
|
535
|
+
}, hono_utils_http_status.ContentfulStatusCode, "json">);
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
/**
|
|
539
|
+
* @module @hono-di/core
|
|
540
|
+
* Main entry point for Hono DI framework
|
|
541
|
+
*/
|
|
542
|
+
|
|
30
543
|
declare const HonoDi: typeof HonoDiFactory;
|
|
31
544
|
|
|
32
|
-
export { HonoDi, HonoDiFactory, ILogger, Logger };
|
|
545
|
+
export { AppError, Application, ArgumentMetadata, ArgumentsHost, BadGatewayException, BadRequestError, BadRequestException, BaseExceptionFilter, CanActivate, ConflictError, ConflictException, Container, ExceptionFilter, ExecutionContext, ExecutionContextHost, ForbiddenError, ForbiddenException, ForwardReference, GatewayTimeoutException, GoneException, HonoDi, HonoDiFactory, HttpArgumentsHost, HttpException, IApplication, type ILogger, InjectionToken, Interceptor, InternalServerErrorException, Logger, METADATA_KEYS, MiddlewareBuilder, type MiddlewareConfig, MiddlewareConfigProxy, MiddlewareConsumer, ModuleRef, ModuleRefImpl, NotAcceptableException, NotFoundError, NotFoundException, NotImplementedException, ParseBoolPipe, ParseFloatPipe, ParseIntPipe, PayloadTooLargeException, PipeTransform, Reflector, RequestTimeoutException, RouteInfo, Scanner, Scope, ServiceUnavailableException, Type, UnauthorizedError, UnauthorizedException, UnprocessableEntityException, UnsupportedMediaTypeException, ValidationPipe, forwardRef };
|