@hono-di/core 0.0.6
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/core.cjs +1554 -0
- package/dist/core.cjs.map +1 -0
- package/dist/core.d.cts +339 -0
- package/dist/core.d.ts +339 -0
- package/dist/core.js +1519 -0
- package/dist/core.js.map +1 -0
- package/dist/decorators.cjs +345 -0
- package/dist/decorators.cjs.map +1 -0
- package/dist/decorators.d.cts +70 -0
- package/dist/decorators.d.ts +70 -0
- package/dist/decorators.js +302 -0
- package/dist/decorators.js.map +1 -0
- package/dist/index.cjs +1850 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +32 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.js +1772 -0
- package/dist/index.js.map +1 -0
- package/dist/interfaces-4oTuNIHA.d.cts +139 -0
- package/dist/interfaces-4oTuNIHA.d.ts +139 -0
- package/package.json +39 -0
package/dist/core.d.cts
ADDED
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
import { q as IApplication, I as InjectionToken, T as Type, S as Scope, b as ExecutionContext, H as HttpArgumentsHost, E as ExceptionFilter, P as PipeTransform, a as Interceptor, C as CanActivate, k as ForwardReference, m as MiddlewareConsumer, n as MiddlewareConfigProxy, o as RouteInfo, c as ArgumentMetadata, A as ArgumentsHost } from './interfaces-4oTuNIHA.cjs';
|
|
2
|
+
export { B as BeforeApplicationShutdown, d as CallHandler, i as ClassProvider, D as DynamicModule, j as ExistingProvider, F as FactoryProvider, l as HonoDiMiddleware, p as HonoDiModule, M as ModuleOptions, e as OnApplicationBootstrap, g as OnApplicationShutdown, f as OnModuleDestroy, O as OnModuleInit, h as Provider, R as RequestMethod, V as ValueProvider } from './interfaces-4oTuNIHA.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
|
+
import 'rxjs';
|
|
7
|
+
|
|
8
|
+
declare class HonoDiFactory {
|
|
9
|
+
private static logger;
|
|
10
|
+
static create(rootModule: any, appOrOptions?: Hono | {
|
|
11
|
+
app?: Hono;
|
|
12
|
+
autoInit?: boolean;
|
|
13
|
+
}): Promise<IApplication>;
|
|
14
|
+
private static instantiateProviders;
|
|
15
|
+
private static callLifecycleHook;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
declare class ContextId {
|
|
19
|
+
private static idCounter;
|
|
20
|
+
readonly id: number;
|
|
21
|
+
constructor();
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
declare class InstanceWrapper<T = any> {
|
|
25
|
+
readonly id: string;
|
|
26
|
+
readonly token: InjectionToken;
|
|
27
|
+
readonly name?: string;
|
|
28
|
+
metatype?: Type<T> | Function;
|
|
29
|
+
scope: Scope;
|
|
30
|
+
host?: Module;
|
|
31
|
+
inject?: InjectionToken[];
|
|
32
|
+
isOptional?: boolean[];
|
|
33
|
+
properties?: {
|
|
34
|
+
key: string | symbol;
|
|
35
|
+
token: InjectionToken;
|
|
36
|
+
isOptional?: boolean;
|
|
37
|
+
}[];
|
|
38
|
+
instance?: T;
|
|
39
|
+
private readonly instancesPerContext;
|
|
40
|
+
isResolved: boolean;
|
|
41
|
+
isPending: boolean;
|
|
42
|
+
isAlias: boolean;
|
|
43
|
+
useFactory?: Function;
|
|
44
|
+
useValue?: any;
|
|
45
|
+
useExisting?: any;
|
|
46
|
+
constructor(metadata: Partial<InstanceWrapper<T>> & {
|
|
47
|
+
token: InjectionToken;
|
|
48
|
+
});
|
|
49
|
+
getInstanceByContextId(contextId: ContextId): T | undefined;
|
|
50
|
+
setInstanceByContextId(contextId: ContextId, instance: T): void;
|
|
51
|
+
addCtorMetadata(index: number, token: InjectionToken): void;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
declare class Module {
|
|
55
|
+
readonly metatype: Type<any>;
|
|
56
|
+
readonly token: string;
|
|
57
|
+
private readonly _providers;
|
|
58
|
+
private readonly _imports;
|
|
59
|
+
private readonly _exports;
|
|
60
|
+
private readonly _controllers;
|
|
61
|
+
constructor(metatype: Type<any>, token: string);
|
|
62
|
+
get providers(): Map<InjectionToken, InstanceWrapper<any>>;
|
|
63
|
+
get imports(): Set<Module>;
|
|
64
|
+
get exports(): Set<InjectionToken>;
|
|
65
|
+
get controllers(): Map<InjectionToken, InstanceWrapper<any>>;
|
|
66
|
+
addProvider(provider: InstanceWrapper): void;
|
|
67
|
+
addController(controller: InstanceWrapper): void;
|
|
68
|
+
addImport(module: Module): void;
|
|
69
|
+
addExport(token: InjectionToken): void;
|
|
70
|
+
hasProvider(token: InjectionToken): boolean;
|
|
71
|
+
getProvider(token: InjectionToken): InstanceWrapper | undefined;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
declare class Container {
|
|
75
|
+
private readonly modules;
|
|
76
|
+
private readonly globalModules;
|
|
77
|
+
addModule(moduleMeta: Type<any>, token: string): Module;
|
|
78
|
+
addGlobalModule(module: Module): void;
|
|
79
|
+
getGlobalModules(): Set<Module>;
|
|
80
|
+
getModuleByToken(token: string): Module | undefined;
|
|
81
|
+
getModules(): Map<string, Module>;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
declare class Injector {
|
|
85
|
+
private readonly container?;
|
|
86
|
+
constructor(container?: Container | undefined);
|
|
87
|
+
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
|
|
88
|
+
contextId?: ContextId, inquire?: InstanceWrapper[], parentInquire?: InstanceWrapper[]): Promise<any[]>;
|
|
89
|
+
resolveSingleParam<T>(token: InjectionToken, targetModule: Module, contextId: ContextId, inquire: InstanceWrapper[], isOptional?: boolean): Promise<T | undefined>;
|
|
90
|
+
private lookupProvider;
|
|
91
|
+
loadInstance<T>(wrapper: InstanceWrapper<T>, contextId: ContextId, inquire?: InstanceWrapper[]): Promise<T>;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
declare class HonoDiScanner {
|
|
95
|
+
private readonly container;
|
|
96
|
+
constructor(container: Container);
|
|
97
|
+
private readonly logger;
|
|
98
|
+
scan(module: Type<any>): Promise<void>;
|
|
99
|
+
private scanModule;
|
|
100
|
+
private insertProvider;
|
|
101
|
+
private insertController;
|
|
102
|
+
scanDependencies(wrapper: InstanceWrapper): void;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
declare abstract class ModuleRef {
|
|
106
|
+
abstract get<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | string | symbol, options?: {
|
|
107
|
+
strict: boolean;
|
|
108
|
+
}): TResult;
|
|
109
|
+
abstract resolve<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | string | symbol, contextId?: ContextId, options?: {
|
|
110
|
+
strict: boolean;
|
|
111
|
+
}): Promise<TResult>;
|
|
112
|
+
}
|
|
113
|
+
declare class ModuleRefImpl extends ModuleRef {
|
|
114
|
+
private readonly container;
|
|
115
|
+
private readonly injector;
|
|
116
|
+
private readonly moduleRef;
|
|
117
|
+
constructor(container: Container, injector: Injector, moduleRef: Module);
|
|
118
|
+
get<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | string | symbol, options?: {
|
|
119
|
+
strict: boolean;
|
|
120
|
+
}): TResult;
|
|
121
|
+
resolve<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | string | symbol, contextId?: ContextId, options?: {
|
|
122
|
+
strict: boolean;
|
|
123
|
+
}): Promise<TResult>;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
declare class ExecutionContextHost implements ExecutionContext {
|
|
127
|
+
private readonly args;
|
|
128
|
+
private readonly constructorRef;
|
|
129
|
+
private readonly handler;
|
|
130
|
+
private readonly context;
|
|
131
|
+
private readonly next?;
|
|
132
|
+
constructor(args: any[], constructorRef: Type<any>, handler: Function);
|
|
133
|
+
getClass<T = any>(): Type<T>;
|
|
134
|
+
getHandler(): Function;
|
|
135
|
+
getArgs<T extends Array<any> = any[]>(): T;
|
|
136
|
+
getType<TContext extends string = 'http'>(): TContext;
|
|
137
|
+
switchToHttp(): HttpArgumentsHost;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
declare class HonoDiApplication implements IApplication {
|
|
141
|
+
private readonly app;
|
|
142
|
+
private readonly container;
|
|
143
|
+
private readonly injector;
|
|
144
|
+
private globalFilters;
|
|
145
|
+
private globalPipes;
|
|
146
|
+
private globalGuards;
|
|
147
|
+
private globalInterceptors;
|
|
148
|
+
constructor(app: Hono, container: Container, injector: Injector);
|
|
149
|
+
useGlobalFilters(...filters: ExceptionFilter[]): this;
|
|
150
|
+
useGlobalPipes(...pipes: PipeTransform[]): this;
|
|
151
|
+
useGlobalInterceptors(...interceptors: Interceptor[]): this;
|
|
152
|
+
useGlobalGuards(...guards: CanActivate[]): this;
|
|
153
|
+
private globalPrefix;
|
|
154
|
+
setGlobalPrefix(prefix: string): this;
|
|
155
|
+
getGlobalPrefix(): string;
|
|
156
|
+
private readonly logger;
|
|
157
|
+
private isInitialized;
|
|
158
|
+
init(): Promise<this>;
|
|
159
|
+
listen(port: number | string, callback?: () => void): Promise<any>;
|
|
160
|
+
private callLifecycleHook;
|
|
161
|
+
private registerControllersFromContainer;
|
|
162
|
+
private registerControllerRoutes;
|
|
163
|
+
private handleException;
|
|
164
|
+
private resolveContextItems;
|
|
165
|
+
private resolveArgs;
|
|
166
|
+
private runGuards;
|
|
167
|
+
private initializeMiddleware;
|
|
168
|
+
private isRouteMatch;
|
|
169
|
+
private isRouteExcluded;
|
|
170
|
+
private combinePaths;
|
|
171
|
+
getHttpAdapter(): any;
|
|
172
|
+
get<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | string | symbol, options?: {
|
|
173
|
+
strict?: boolean;
|
|
174
|
+
}): TResult;
|
|
175
|
+
close(): Promise<void>;
|
|
176
|
+
getGlobalFilters(): ExceptionFilter<any>[];
|
|
177
|
+
getGlobalPipes(): PipeTransform<any, any>[];
|
|
178
|
+
getGlobalGuards(): CanActivate[];
|
|
179
|
+
getGlobalInterceptors(): Interceptor<any, any>[];
|
|
180
|
+
getContainer(): Container;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
declare function forwardRef(fn: () => Type<any>): ForwardReference;
|
|
184
|
+
|
|
185
|
+
declare class MiddlewareBuilder implements MiddlewareConsumer {
|
|
186
|
+
private readonly module?;
|
|
187
|
+
private readonly configs;
|
|
188
|
+
constructor(module?: Module | undefined);
|
|
189
|
+
apply(...middleware: (Type<any> | Function)[]): MiddlewareConfigProxy;
|
|
190
|
+
addConfig(middleware: any[], routes: (string | Type<any> | RouteInfo)[], excludes?: (string | RouteInfo)[]): void;
|
|
191
|
+
getConfigs(): MiddlewareConfig[];
|
|
192
|
+
}
|
|
193
|
+
interface MiddlewareConfig {
|
|
194
|
+
middleware: any[];
|
|
195
|
+
routes: (string | Type<any> | RouteInfo)[];
|
|
196
|
+
excludes: (string | RouteInfo)[];
|
|
197
|
+
module?: Module;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
declare class Reflector {
|
|
201
|
+
get<TResult = any, TKey = any>(metadataKey: TKey, target: Type<any> | Function): TResult;
|
|
202
|
+
getAllAndOverride<TResult = any, TKey = any>(metadataKey: TKey, targets: (Type<any> | Function)[]): TResult;
|
|
203
|
+
getAllAndMerge<TResult = any[], TKey = any>(metadataKey: TKey, targets: (Type<any> | Function)[]): TResult;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
declare class HttpException extends Error {
|
|
207
|
+
private readonly response;
|
|
208
|
+
private readonly status;
|
|
209
|
+
constructor(response: string | object, status: number);
|
|
210
|
+
getResponse(): string | object;
|
|
211
|
+
getStatus(): number;
|
|
212
|
+
static createBody(message: object | string | any, error: string, statusCode: number): any;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
declare class BadRequestException extends HttpException {
|
|
216
|
+
constructor(message?: string | object | any, error?: string);
|
|
217
|
+
}
|
|
218
|
+
declare class UnauthorizedException extends HttpException {
|
|
219
|
+
constructor(message?: string | object | any, error?: string);
|
|
220
|
+
}
|
|
221
|
+
declare class NotFoundException extends HttpException {
|
|
222
|
+
constructor(message?: string | object | any, error?: string);
|
|
223
|
+
}
|
|
224
|
+
declare class ForbiddenException extends HttpException {
|
|
225
|
+
constructor(message?: string | object | any, error?: string);
|
|
226
|
+
}
|
|
227
|
+
declare class NotAcceptableException extends HttpException {
|
|
228
|
+
constructor(message?: string | object | any, error?: string);
|
|
229
|
+
}
|
|
230
|
+
declare class RequestTimeoutException extends HttpException {
|
|
231
|
+
constructor(message?: string | object | any, error?: string);
|
|
232
|
+
}
|
|
233
|
+
declare class ConflictException extends HttpException {
|
|
234
|
+
constructor(message?: string | object | any, error?: string);
|
|
235
|
+
}
|
|
236
|
+
declare class GoneException extends HttpException {
|
|
237
|
+
constructor(message?: string | object | any, error?: string);
|
|
238
|
+
}
|
|
239
|
+
declare class PayloadTooLargeException extends HttpException {
|
|
240
|
+
constructor(message?: string | object | any, error?: string);
|
|
241
|
+
}
|
|
242
|
+
declare class UnsupportedMediaTypeException extends HttpException {
|
|
243
|
+
constructor(message?: string | object | any, error?: string);
|
|
244
|
+
}
|
|
245
|
+
declare class UnprocessableEntityException extends HttpException {
|
|
246
|
+
constructor(message?: string | object | any, error?: string);
|
|
247
|
+
}
|
|
248
|
+
declare class InternalServerErrorException extends HttpException {
|
|
249
|
+
constructor(message?: string | object | any, error?: string);
|
|
250
|
+
}
|
|
251
|
+
declare class NotImplementedException extends HttpException {
|
|
252
|
+
constructor(message?: string | object | any, error?: string);
|
|
253
|
+
}
|
|
254
|
+
declare class BadGatewayException extends HttpException {
|
|
255
|
+
constructor(message?: string | object | any, error?: string);
|
|
256
|
+
}
|
|
257
|
+
declare class ServiceUnavailableException extends HttpException {
|
|
258
|
+
constructor(message?: string | object | any, error?: string);
|
|
259
|
+
}
|
|
260
|
+
declare class GatewayTimeoutException extends HttpException {
|
|
261
|
+
constructor(message?: string | object | any, error?: string);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
declare class ParseIntPipe implements PipeTransform<string, number> {
|
|
265
|
+
transform(value: string, metadata: ArgumentMetadata): number;
|
|
266
|
+
}
|
|
267
|
+
declare class ParseFloatPipe implements PipeTransform<string, number> {
|
|
268
|
+
transform(value: string, metadata: ArgumentMetadata): number;
|
|
269
|
+
}
|
|
270
|
+
declare class ParseBoolPipe implements PipeTransform<string | boolean, boolean> {
|
|
271
|
+
transform(value: string | boolean, metadata: ArgumentMetadata): boolean;
|
|
272
|
+
}
|
|
273
|
+
declare class ValidationPipe implements PipeTransform<any> {
|
|
274
|
+
transform(value: any, metadata: ArgumentMetadata): any;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
declare class AppError extends Error {
|
|
278
|
+
statusCode: number;
|
|
279
|
+
message: string;
|
|
280
|
+
isOperational: boolean;
|
|
281
|
+
constructor(statusCode: number, message: string, isOperational?: boolean);
|
|
282
|
+
}
|
|
283
|
+
declare class NotFoundError extends AppError {
|
|
284
|
+
constructor(message?: string);
|
|
285
|
+
}
|
|
286
|
+
declare class BadRequestError extends AppError {
|
|
287
|
+
constructor(message?: string);
|
|
288
|
+
}
|
|
289
|
+
declare class UnauthorizedError extends AppError {
|
|
290
|
+
constructor(message?: string);
|
|
291
|
+
}
|
|
292
|
+
declare class ForbiddenError extends AppError {
|
|
293
|
+
constructor(message?: string);
|
|
294
|
+
}
|
|
295
|
+
declare class ConflictError extends AppError {
|
|
296
|
+
constructor(message?: string);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
interface ILogger {
|
|
300
|
+
info(message: string, ...meta: any[]): void;
|
|
301
|
+
error(message: string, ...meta: any[]): void;
|
|
302
|
+
warn(message: string, ...meta: any[]): void;
|
|
303
|
+
debug(message: string, ...meta: any[]): void;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
declare class BaseExceptionFilter implements ExceptionFilter {
|
|
307
|
+
catch(exception: unknown, host: ArgumentsHost): (Response & hono.TypedResponse<string, hono_utils_http_status.ContentfulStatusCode, "json">) | (Response & hono.TypedResponse<{
|
|
308
|
+
statusCode: number;
|
|
309
|
+
message: string;
|
|
310
|
+
}, hono_utils_http_status.ContentfulStatusCode, "json">);
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
declare const METADATA_KEYS: {
|
|
314
|
+
MODULE: symbol;
|
|
315
|
+
GLOBAL: symbol;
|
|
316
|
+
CONTROLLER: symbol;
|
|
317
|
+
FLUSH_ROLES: symbol;
|
|
318
|
+
OPTS: symbol;
|
|
319
|
+
PARAMS: symbol;
|
|
320
|
+
ROUTES: symbol;
|
|
321
|
+
FILTER_CATCH: symbol;
|
|
322
|
+
FILTER_EXCEPTION: symbol;
|
|
323
|
+
USE_FILTERS: symbol;
|
|
324
|
+
USE_PIPES: symbol;
|
|
325
|
+
USE_GUARDS: symbol;
|
|
326
|
+
USE_INTERCEPTORS: symbol;
|
|
327
|
+
ROUTE_ARGS_METADATA: symbol;
|
|
328
|
+
INJECTIONS: symbol;
|
|
329
|
+
OPTIONAL: symbol;
|
|
330
|
+
SCOPE: symbol;
|
|
331
|
+
METHOD_INJECTIONS: symbol;
|
|
332
|
+
METHOD_OPTIONAL: symbol;
|
|
333
|
+
PROPERTY_DEPS: symbol;
|
|
334
|
+
HTTP_CODE: symbol;
|
|
335
|
+
HEADERS: symbol;
|
|
336
|
+
REDIRECT: symbol;
|
|
337
|
+
};
|
|
338
|
+
|
|
339
|
+
export { AppError, ArgumentMetadata, ArgumentsHost, BadGatewayException, BadRequestError, BadRequestException, BaseExceptionFilter, CanActivate, ConflictError, ConflictException, Container, ExceptionFilter, ExecutionContext, ExecutionContextHost, ForbiddenError, ForbiddenException, ForwardReference, GatewayTimeoutException, GoneException, HonoDiApplication, HonoDiFactory, HonoDiScanner, HttpArgumentsHost, HttpException, IApplication, type ILogger, InjectionToken, Interceptor, InternalServerErrorException, METADATA_KEYS, MiddlewareBuilder, type MiddlewareConfig, MiddlewareConfigProxy, MiddlewareConsumer, ModuleRef, ModuleRefImpl, NotAcceptableException, NotFoundError, NotFoundException, NotImplementedException, ParseBoolPipe, ParseFloatPipe, ParseIntPipe, PayloadTooLargeException, PipeTransform, Reflector, RequestTimeoutException, RouteInfo, ServiceUnavailableException, Type, UnauthorizedError, UnauthorizedException, UnprocessableEntityException, UnsupportedMediaTypeException, ValidationPipe, forwardRef };
|
package/dist/core.d.ts
ADDED
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
import { q as IApplication, I as InjectionToken, T as Type, S as Scope, b as ExecutionContext, H as HttpArgumentsHost, E as ExceptionFilter, P as PipeTransform, a as Interceptor, C as CanActivate, k as ForwardReference, m as MiddlewareConsumer, n as MiddlewareConfigProxy, o as RouteInfo, c as ArgumentMetadata, A as ArgumentsHost } from './interfaces-4oTuNIHA.js';
|
|
2
|
+
export { B as BeforeApplicationShutdown, d as CallHandler, i as ClassProvider, D as DynamicModule, j as ExistingProvider, F as FactoryProvider, l as HonoDiMiddleware, p as HonoDiModule, M as ModuleOptions, e as OnApplicationBootstrap, g as OnApplicationShutdown, f as OnModuleDestroy, O as OnModuleInit, h as Provider, R as RequestMethod, V as ValueProvider } from './interfaces-4oTuNIHA.js';
|
|
3
|
+
import * as hono from 'hono';
|
|
4
|
+
import { Hono } from 'hono';
|
|
5
|
+
import * as hono_utils_http_status from 'hono/utils/http-status';
|
|
6
|
+
import 'rxjs';
|
|
7
|
+
|
|
8
|
+
declare class HonoDiFactory {
|
|
9
|
+
private static logger;
|
|
10
|
+
static create(rootModule: any, appOrOptions?: Hono | {
|
|
11
|
+
app?: Hono;
|
|
12
|
+
autoInit?: boolean;
|
|
13
|
+
}): Promise<IApplication>;
|
|
14
|
+
private static instantiateProviders;
|
|
15
|
+
private static callLifecycleHook;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
declare class ContextId {
|
|
19
|
+
private static idCounter;
|
|
20
|
+
readonly id: number;
|
|
21
|
+
constructor();
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
declare class InstanceWrapper<T = any> {
|
|
25
|
+
readonly id: string;
|
|
26
|
+
readonly token: InjectionToken;
|
|
27
|
+
readonly name?: string;
|
|
28
|
+
metatype?: Type<T> | Function;
|
|
29
|
+
scope: Scope;
|
|
30
|
+
host?: Module;
|
|
31
|
+
inject?: InjectionToken[];
|
|
32
|
+
isOptional?: boolean[];
|
|
33
|
+
properties?: {
|
|
34
|
+
key: string | symbol;
|
|
35
|
+
token: InjectionToken;
|
|
36
|
+
isOptional?: boolean;
|
|
37
|
+
}[];
|
|
38
|
+
instance?: T;
|
|
39
|
+
private readonly instancesPerContext;
|
|
40
|
+
isResolved: boolean;
|
|
41
|
+
isPending: boolean;
|
|
42
|
+
isAlias: boolean;
|
|
43
|
+
useFactory?: Function;
|
|
44
|
+
useValue?: any;
|
|
45
|
+
useExisting?: any;
|
|
46
|
+
constructor(metadata: Partial<InstanceWrapper<T>> & {
|
|
47
|
+
token: InjectionToken;
|
|
48
|
+
});
|
|
49
|
+
getInstanceByContextId(contextId: ContextId): T | undefined;
|
|
50
|
+
setInstanceByContextId(contextId: ContextId, instance: T): void;
|
|
51
|
+
addCtorMetadata(index: number, token: InjectionToken): void;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
declare class Module {
|
|
55
|
+
readonly metatype: Type<any>;
|
|
56
|
+
readonly token: string;
|
|
57
|
+
private readonly _providers;
|
|
58
|
+
private readonly _imports;
|
|
59
|
+
private readonly _exports;
|
|
60
|
+
private readonly _controllers;
|
|
61
|
+
constructor(metatype: Type<any>, token: string);
|
|
62
|
+
get providers(): Map<InjectionToken, InstanceWrapper<any>>;
|
|
63
|
+
get imports(): Set<Module>;
|
|
64
|
+
get exports(): Set<InjectionToken>;
|
|
65
|
+
get controllers(): Map<InjectionToken, InstanceWrapper<any>>;
|
|
66
|
+
addProvider(provider: InstanceWrapper): void;
|
|
67
|
+
addController(controller: InstanceWrapper): void;
|
|
68
|
+
addImport(module: Module): void;
|
|
69
|
+
addExport(token: InjectionToken): void;
|
|
70
|
+
hasProvider(token: InjectionToken): boolean;
|
|
71
|
+
getProvider(token: InjectionToken): InstanceWrapper | undefined;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
declare class Container {
|
|
75
|
+
private readonly modules;
|
|
76
|
+
private readonly globalModules;
|
|
77
|
+
addModule(moduleMeta: Type<any>, token: string): Module;
|
|
78
|
+
addGlobalModule(module: Module): void;
|
|
79
|
+
getGlobalModules(): Set<Module>;
|
|
80
|
+
getModuleByToken(token: string): Module | undefined;
|
|
81
|
+
getModules(): Map<string, Module>;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
declare class Injector {
|
|
85
|
+
private readonly container?;
|
|
86
|
+
constructor(container?: Container | undefined);
|
|
87
|
+
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
|
|
88
|
+
contextId?: ContextId, inquire?: InstanceWrapper[], parentInquire?: InstanceWrapper[]): Promise<any[]>;
|
|
89
|
+
resolveSingleParam<T>(token: InjectionToken, targetModule: Module, contextId: ContextId, inquire: InstanceWrapper[], isOptional?: boolean): Promise<T | undefined>;
|
|
90
|
+
private lookupProvider;
|
|
91
|
+
loadInstance<T>(wrapper: InstanceWrapper<T>, contextId: ContextId, inquire?: InstanceWrapper[]): Promise<T>;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
declare class HonoDiScanner {
|
|
95
|
+
private readonly container;
|
|
96
|
+
constructor(container: Container);
|
|
97
|
+
private readonly logger;
|
|
98
|
+
scan(module: Type<any>): Promise<void>;
|
|
99
|
+
private scanModule;
|
|
100
|
+
private insertProvider;
|
|
101
|
+
private insertController;
|
|
102
|
+
scanDependencies(wrapper: InstanceWrapper): void;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
declare abstract class ModuleRef {
|
|
106
|
+
abstract get<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | string | symbol, options?: {
|
|
107
|
+
strict: boolean;
|
|
108
|
+
}): TResult;
|
|
109
|
+
abstract resolve<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | string | symbol, contextId?: ContextId, options?: {
|
|
110
|
+
strict: boolean;
|
|
111
|
+
}): Promise<TResult>;
|
|
112
|
+
}
|
|
113
|
+
declare class ModuleRefImpl extends ModuleRef {
|
|
114
|
+
private readonly container;
|
|
115
|
+
private readonly injector;
|
|
116
|
+
private readonly moduleRef;
|
|
117
|
+
constructor(container: Container, injector: Injector, moduleRef: Module);
|
|
118
|
+
get<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | string | symbol, options?: {
|
|
119
|
+
strict: boolean;
|
|
120
|
+
}): TResult;
|
|
121
|
+
resolve<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | string | symbol, contextId?: ContextId, options?: {
|
|
122
|
+
strict: boolean;
|
|
123
|
+
}): Promise<TResult>;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
declare class ExecutionContextHost implements ExecutionContext {
|
|
127
|
+
private readonly args;
|
|
128
|
+
private readonly constructorRef;
|
|
129
|
+
private readonly handler;
|
|
130
|
+
private readonly context;
|
|
131
|
+
private readonly next?;
|
|
132
|
+
constructor(args: any[], constructorRef: Type<any>, handler: Function);
|
|
133
|
+
getClass<T = any>(): Type<T>;
|
|
134
|
+
getHandler(): Function;
|
|
135
|
+
getArgs<T extends Array<any> = any[]>(): T;
|
|
136
|
+
getType<TContext extends string = 'http'>(): TContext;
|
|
137
|
+
switchToHttp(): HttpArgumentsHost;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
declare class HonoDiApplication implements IApplication {
|
|
141
|
+
private readonly app;
|
|
142
|
+
private readonly container;
|
|
143
|
+
private readonly injector;
|
|
144
|
+
private globalFilters;
|
|
145
|
+
private globalPipes;
|
|
146
|
+
private globalGuards;
|
|
147
|
+
private globalInterceptors;
|
|
148
|
+
constructor(app: Hono, container: Container, injector: Injector);
|
|
149
|
+
useGlobalFilters(...filters: ExceptionFilter[]): this;
|
|
150
|
+
useGlobalPipes(...pipes: PipeTransform[]): this;
|
|
151
|
+
useGlobalInterceptors(...interceptors: Interceptor[]): this;
|
|
152
|
+
useGlobalGuards(...guards: CanActivate[]): this;
|
|
153
|
+
private globalPrefix;
|
|
154
|
+
setGlobalPrefix(prefix: string): this;
|
|
155
|
+
getGlobalPrefix(): string;
|
|
156
|
+
private readonly logger;
|
|
157
|
+
private isInitialized;
|
|
158
|
+
init(): Promise<this>;
|
|
159
|
+
listen(port: number | string, callback?: () => void): Promise<any>;
|
|
160
|
+
private callLifecycleHook;
|
|
161
|
+
private registerControllersFromContainer;
|
|
162
|
+
private registerControllerRoutes;
|
|
163
|
+
private handleException;
|
|
164
|
+
private resolveContextItems;
|
|
165
|
+
private resolveArgs;
|
|
166
|
+
private runGuards;
|
|
167
|
+
private initializeMiddleware;
|
|
168
|
+
private isRouteMatch;
|
|
169
|
+
private isRouteExcluded;
|
|
170
|
+
private combinePaths;
|
|
171
|
+
getHttpAdapter(): any;
|
|
172
|
+
get<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | string | symbol, options?: {
|
|
173
|
+
strict?: boolean;
|
|
174
|
+
}): TResult;
|
|
175
|
+
close(): Promise<void>;
|
|
176
|
+
getGlobalFilters(): ExceptionFilter<any>[];
|
|
177
|
+
getGlobalPipes(): PipeTransform<any, any>[];
|
|
178
|
+
getGlobalGuards(): CanActivate[];
|
|
179
|
+
getGlobalInterceptors(): Interceptor<any, any>[];
|
|
180
|
+
getContainer(): Container;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
declare function forwardRef(fn: () => Type<any>): ForwardReference;
|
|
184
|
+
|
|
185
|
+
declare class MiddlewareBuilder implements MiddlewareConsumer {
|
|
186
|
+
private readonly module?;
|
|
187
|
+
private readonly configs;
|
|
188
|
+
constructor(module?: Module | undefined);
|
|
189
|
+
apply(...middleware: (Type<any> | Function)[]): MiddlewareConfigProxy;
|
|
190
|
+
addConfig(middleware: any[], routes: (string | Type<any> | RouteInfo)[], excludes?: (string | RouteInfo)[]): void;
|
|
191
|
+
getConfigs(): MiddlewareConfig[];
|
|
192
|
+
}
|
|
193
|
+
interface MiddlewareConfig {
|
|
194
|
+
middleware: any[];
|
|
195
|
+
routes: (string | Type<any> | RouteInfo)[];
|
|
196
|
+
excludes: (string | RouteInfo)[];
|
|
197
|
+
module?: Module;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
declare class Reflector {
|
|
201
|
+
get<TResult = any, TKey = any>(metadataKey: TKey, target: Type<any> | Function): TResult;
|
|
202
|
+
getAllAndOverride<TResult = any, TKey = any>(metadataKey: TKey, targets: (Type<any> | Function)[]): TResult;
|
|
203
|
+
getAllAndMerge<TResult = any[], TKey = any>(metadataKey: TKey, targets: (Type<any> | Function)[]): TResult;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
declare class HttpException extends Error {
|
|
207
|
+
private readonly response;
|
|
208
|
+
private readonly status;
|
|
209
|
+
constructor(response: string | object, status: number);
|
|
210
|
+
getResponse(): string | object;
|
|
211
|
+
getStatus(): number;
|
|
212
|
+
static createBody(message: object | string | any, error: string, statusCode: number): any;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
declare class BadRequestException extends HttpException {
|
|
216
|
+
constructor(message?: string | object | any, error?: string);
|
|
217
|
+
}
|
|
218
|
+
declare class UnauthorizedException extends HttpException {
|
|
219
|
+
constructor(message?: string | object | any, error?: string);
|
|
220
|
+
}
|
|
221
|
+
declare class NotFoundException extends HttpException {
|
|
222
|
+
constructor(message?: string | object | any, error?: string);
|
|
223
|
+
}
|
|
224
|
+
declare class ForbiddenException extends HttpException {
|
|
225
|
+
constructor(message?: string | object | any, error?: string);
|
|
226
|
+
}
|
|
227
|
+
declare class NotAcceptableException extends HttpException {
|
|
228
|
+
constructor(message?: string | object | any, error?: string);
|
|
229
|
+
}
|
|
230
|
+
declare class RequestTimeoutException extends HttpException {
|
|
231
|
+
constructor(message?: string | object | any, error?: string);
|
|
232
|
+
}
|
|
233
|
+
declare class ConflictException extends HttpException {
|
|
234
|
+
constructor(message?: string | object | any, error?: string);
|
|
235
|
+
}
|
|
236
|
+
declare class GoneException extends HttpException {
|
|
237
|
+
constructor(message?: string | object | any, error?: string);
|
|
238
|
+
}
|
|
239
|
+
declare class PayloadTooLargeException extends HttpException {
|
|
240
|
+
constructor(message?: string | object | any, error?: string);
|
|
241
|
+
}
|
|
242
|
+
declare class UnsupportedMediaTypeException extends HttpException {
|
|
243
|
+
constructor(message?: string | object | any, error?: string);
|
|
244
|
+
}
|
|
245
|
+
declare class UnprocessableEntityException extends HttpException {
|
|
246
|
+
constructor(message?: string | object | any, error?: string);
|
|
247
|
+
}
|
|
248
|
+
declare class InternalServerErrorException extends HttpException {
|
|
249
|
+
constructor(message?: string | object | any, error?: string);
|
|
250
|
+
}
|
|
251
|
+
declare class NotImplementedException extends HttpException {
|
|
252
|
+
constructor(message?: string | object | any, error?: string);
|
|
253
|
+
}
|
|
254
|
+
declare class BadGatewayException extends HttpException {
|
|
255
|
+
constructor(message?: string | object | any, error?: string);
|
|
256
|
+
}
|
|
257
|
+
declare class ServiceUnavailableException extends HttpException {
|
|
258
|
+
constructor(message?: string | object | any, error?: string);
|
|
259
|
+
}
|
|
260
|
+
declare class GatewayTimeoutException extends HttpException {
|
|
261
|
+
constructor(message?: string | object | any, error?: string);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
declare class ParseIntPipe implements PipeTransform<string, number> {
|
|
265
|
+
transform(value: string, metadata: ArgumentMetadata): number;
|
|
266
|
+
}
|
|
267
|
+
declare class ParseFloatPipe implements PipeTransform<string, number> {
|
|
268
|
+
transform(value: string, metadata: ArgumentMetadata): number;
|
|
269
|
+
}
|
|
270
|
+
declare class ParseBoolPipe implements PipeTransform<string | boolean, boolean> {
|
|
271
|
+
transform(value: string | boolean, metadata: ArgumentMetadata): boolean;
|
|
272
|
+
}
|
|
273
|
+
declare class ValidationPipe implements PipeTransform<any> {
|
|
274
|
+
transform(value: any, metadata: ArgumentMetadata): any;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
declare class AppError extends Error {
|
|
278
|
+
statusCode: number;
|
|
279
|
+
message: string;
|
|
280
|
+
isOperational: boolean;
|
|
281
|
+
constructor(statusCode: number, message: string, isOperational?: boolean);
|
|
282
|
+
}
|
|
283
|
+
declare class NotFoundError extends AppError {
|
|
284
|
+
constructor(message?: string);
|
|
285
|
+
}
|
|
286
|
+
declare class BadRequestError extends AppError {
|
|
287
|
+
constructor(message?: string);
|
|
288
|
+
}
|
|
289
|
+
declare class UnauthorizedError extends AppError {
|
|
290
|
+
constructor(message?: string);
|
|
291
|
+
}
|
|
292
|
+
declare class ForbiddenError extends AppError {
|
|
293
|
+
constructor(message?: string);
|
|
294
|
+
}
|
|
295
|
+
declare class ConflictError extends AppError {
|
|
296
|
+
constructor(message?: string);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
interface ILogger {
|
|
300
|
+
info(message: string, ...meta: any[]): void;
|
|
301
|
+
error(message: string, ...meta: any[]): void;
|
|
302
|
+
warn(message: string, ...meta: any[]): void;
|
|
303
|
+
debug(message: string, ...meta: any[]): void;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
declare class BaseExceptionFilter implements ExceptionFilter {
|
|
307
|
+
catch(exception: unknown, host: ArgumentsHost): (Response & hono.TypedResponse<string, hono_utils_http_status.ContentfulStatusCode, "json">) | (Response & hono.TypedResponse<{
|
|
308
|
+
statusCode: number;
|
|
309
|
+
message: string;
|
|
310
|
+
}, hono_utils_http_status.ContentfulStatusCode, "json">);
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
declare const METADATA_KEYS: {
|
|
314
|
+
MODULE: symbol;
|
|
315
|
+
GLOBAL: symbol;
|
|
316
|
+
CONTROLLER: symbol;
|
|
317
|
+
FLUSH_ROLES: symbol;
|
|
318
|
+
OPTS: symbol;
|
|
319
|
+
PARAMS: symbol;
|
|
320
|
+
ROUTES: symbol;
|
|
321
|
+
FILTER_CATCH: symbol;
|
|
322
|
+
FILTER_EXCEPTION: symbol;
|
|
323
|
+
USE_FILTERS: symbol;
|
|
324
|
+
USE_PIPES: symbol;
|
|
325
|
+
USE_GUARDS: symbol;
|
|
326
|
+
USE_INTERCEPTORS: symbol;
|
|
327
|
+
ROUTE_ARGS_METADATA: symbol;
|
|
328
|
+
INJECTIONS: symbol;
|
|
329
|
+
OPTIONAL: symbol;
|
|
330
|
+
SCOPE: symbol;
|
|
331
|
+
METHOD_INJECTIONS: symbol;
|
|
332
|
+
METHOD_OPTIONAL: symbol;
|
|
333
|
+
PROPERTY_DEPS: symbol;
|
|
334
|
+
HTTP_CODE: symbol;
|
|
335
|
+
HEADERS: symbol;
|
|
336
|
+
REDIRECT: symbol;
|
|
337
|
+
};
|
|
338
|
+
|
|
339
|
+
export { AppError, ArgumentMetadata, ArgumentsHost, BadGatewayException, BadRequestError, BadRequestException, BaseExceptionFilter, CanActivate, ConflictError, ConflictException, Container, ExceptionFilter, ExecutionContext, ExecutionContextHost, ForbiddenError, ForbiddenException, ForwardReference, GatewayTimeoutException, GoneException, HonoDiApplication, HonoDiFactory, HonoDiScanner, HttpArgumentsHost, HttpException, IApplication, type ILogger, InjectionToken, Interceptor, InternalServerErrorException, METADATA_KEYS, MiddlewareBuilder, type MiddlewareConfig, MiddlewareConfigProxy, MiddlewareConsumer, ModuleRef, ModuleRefImpl, NotAcceptableException, NotFoundError, NotFoundException, NotImplementedException, ParseBoolPipe, ParseFloatPipe, ParseIntPipe, PayloadTooLargeException, PipeTransform, Reflector, RequestTimeoutException, RouteInfo, ServiceUnavailableException, Type, UnauthorizedError, UnauthorizedException, UnprocessableEntityException, UnsupportedMediaTypeException, ValidationPipe, forwardRef };
|