@riktajs/core 0.10.1 → 0.10.3
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/index.cjs +3591 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +770 -0
- package/dist/index.d.ts +770 -2
- package/dist/index.js +3415 -2
- package/dist/index.js.map +1 -0
- package/package.json +63 -56
- package/dist/core/application.d.ts +0 -6
- package/dist/core/application.js +0 -248
- package/dist/core/config/abstract-config-provider.d.ts +0 -14
- package/dist/core/config/abstract-config-provider.js +0 -53
- package/dist/core/config/env-loader.d.ts +0 -3
- package/dist/core/config/env-loader.js +0 -26
- package/dist/core/config/index.d.ts +0 -2
- package/dist/core/config/index.js +0 -2
- package/dist/core/constants.d.ts +0 -30
- package/dist/core/constants.js +0 -31
- package/dist/core/container/abstract-class.utils.d.ts +0 -10
- package/dist/core/container/abstract-class.utils.js +0 -44
- package/dist/core/container/container.d.ts +0 -32
- package/dist/core/container/container.js +0 -292
- package/dist/core/container/implements.decorator.d.ts +0 -6
- package/dist/core/container/implements.decorator.js +0 -39
- package/dist/core/container/index.d.ts +0 -5
- package/dist/core/container/index.js +0 -5
- package/dist/core/container/injection-token.d.ts +0 -29
- package/dist/core/container/injection-token.js +0 -11
- package/dist/core/container/request-scope.d.ts +0 -16
- package/dist/core/container/request-scope.js +0 -49
- package/dist/core/decorators/apply-decorators.d.ts +0 -8
- package/dist/core/decorators/apply-decorators.js +0 -36
- package/dist/core/decorators/autowired.decorator.d.ts +0 -11
- package/dist/core/decorators/autowired.decorator.js +0 -78
- package/dist/core/decorators/config-property.decorator.d.ts +0 -9
- package/dist/core/decorators/config-property.decorator.js +0 -59
- package/dist/core/decorators/controller.decorator.d.ts +0 -5
- package/dist/core/decorators/controller.decorator.js +0 -18
- package/dist/core/decorators/create-param-decorator.d.ts +0 -11
- package/dist/core/decorators/create-param-decorator.js +0 -21
- package/dist/core/decorators/index.d.ts +0 -9
- package/dist/core/decorators/index.js +0 -9
- package/dist/core/decorators/injectable.decorator.d.ts +0 -3
- package/dist/core/decorators/injectable.decorator.js +0 -11
- package/dist/core/decorators/param.decorator.d.ts +0 -59
- package/dist/core/decorators/param.decorator.js +0 -38
- package/dist/core/decorators/provider.decorator.d.ts +0 -12
- package/dist/core/decorators/provider.decorator.js +0 -56
- package/dist/core/decorators/route.decorator.d.ts +0 -9
- package/dist/core/decorators/route.decorator.js +0 -30
- package/dist/core/discovery.d.ts +0 -3
- package/dist/core/discovery.js +0 -111
- package/dist/core/exceptions/catch.decorator.d.ts +0 -8
- package/dist/core/exceptions/catch.decorator.js +0 -13
- package/dist/core/exceptions/config.exceptions.d.ts +0 -9
- package/dist/core/exceptions/config.exceptions.js +0 -34
- package/dist/core/exceptions/discovery.exception.d.ts +0 -18
- package/dist/core/exceptions/discovery.exception.js +0 -39
- package/dist/core/exceptions/exception-filter.d.ts +0 -38
- package/dist/core/exceptions/exception-filter.js +0 -103
- package/dist/core/exceptions/exceptions.d.ts +0 -55
- package/dist/core/exceptions/exceptions.js +0 -91
- package/dist/core/exceptions/http-exception.d.ts +0 -24
- package/dist/core/exceptions/http-exception.js +0 -62
- package/dist/core/exceptions/index.d.ts +0 -7
- package/dist/core/exceptions/index.js +0 -7
- package/dist/core/exceptions/validation.exception.d.ts +0 -17
- package/dist/core/exceptions/validation.exception.js +0 -33
- package/dist/core/guards/can-activate.interface.d.ts +0 -4
- package/dist/core/guards/can-activate.interface.js +0 -1
- package/dist/core/guards/execution-context.d.ts +0 -28
- package/dist/core/guards/execution-context.js +0 -35
- package/dist/core/guards/index.d.ts +0 -3
- package/dist/core/guards/index.js +0 -2
- package/dist/core/guards/use-guards.decorator.d.ts +0 -6
- package/dist/core/guards/use-guards.decorator.js +0 -22
- package/dist/core/index.d.ts +0 -19
- package/dist/core/index.js +0 -17
- package/dist/core/interceptors/index.d.ts +0 -2
- package/dist/core/interceptors/index.js +0 -1
- package/dist/core/interceptors/interceptor.interface.d.ts +0 -7
- package/dist/core/interceptors/interceptor.interface.js +0 -1
- package/dist/core/interceptors/use-interceptors.decorator.d.ts +0 -6
- package/dist/core/interceptors/use-interceptors.decorator.js +0 -19
- package/dist/core/lifecycle/event-bus.d.ts +0 -57
- package/dist/core/lifecycle/event-bus.js +0 -108
- package/dist/core/lifecycle/index.d.ts +0 -3
- package/dist/core/lifecycle/index.js +0 -3
- package/dist/core/lifecycle/interfaces.d.ts +0 -15
- package/dist/core/lifecycle/interfaces.js +0 -1
- package/dist/core/lifecycle/on.decorator.d.ts +0 -11
- package/dist/core/lifecycle/on.decorator.js +0 -13
- package/dist/core/metadata.d.ts +0 -20
- package/dist/core/metadata.js +0 -64
- package/dist/core/middleware/index.d.ts +0 -3
- package/dist/core/middleware/index.js +0 -2
- package/dist/core/middleware/middleware.decorator.d.ts +0 -2
- package/dist/core/middleware/middleware.decorator.js +0 -7
- package/dist/core/middleware/rikta-middleware.interface.d.ts +0 -5
- package/dist/core/middleware/rikta-middleware.interface.js +0 -1
- package/dist/core/middleware/use-middleware.decorator.d.ts +0 -6
- package/dist/core/middleware/use-middleware.decorator.js +0 -22
- package/dist/core/profiler/index.d.ts +0 -2
- package/dist/core/profiler/index.js +0 -1
- package/dist/core/profiler/performance-profiler.d.ts +0 -42
- package/dist/core/profiler/performance-profiler.js +0 -95
- package/dist/core/registry.d.ts +0 -41
- package/dist/core/registry.js +0 -109
- package/dist/core/router/router.d.ts +0 -32
- package/dist/core/router/router.js +0 -300
- package/dist/core/types.d.ts +0 -62
- package/dist/core/types.js +0 -1
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,770 @@
|
|
|
1
|
+
import { FastifyInstance, FastifyRequest, FastifyReply, FastifyError } from 'fastify';
|
|
2
|
+
export { FastifyInstance, FastifyReply, FastifyRequest } from 'fastify';
|
|
3
|
+
import * as zod from 'zod';
|
|
4
|
+
import { ZodType, ZodError, z, ZodSchema } from 'zod';
|
|
5
|
+
export { ZodError, infer as ZodInfer, input as ZodInput, ZodIssue, output as ZodOutput, z } from 'zod';
|
|
6
|
+
|
|
7
|
+
declare class InjectionToken<T = unknown> {
|
|
8
|
+
readonly description: string;
|
|
9
|
+
readonly options?: {
|
|
10
|
+
factory?: () => T;
|
|
11
|
+
} | undefined;
|
|
12
|
+
constructor(description: string, options?: {
|
|
13
|
+
factory?: () => T;
|
|
14
|
+
} | undefined);
|
|
15
|
+
toString(): string;
|
|
16
|
+
}
|
|
17
|
+
type Token<T = unknown> = (new (...args: unknown[]) => T) | InjectionToken<T> | string | symbol;
|
|
18
|
+
interface ClassProvider<T = unknown> {
|
|
19
|
+
provide: Token<T>;
|
|
20
|
+
useClass: new (...args: unknown[]) => T;
|
|
21
|
+
}
|
|
22
|
+
interface ValueProvider<T = unknown> {
|
|
23
|
+
provide: Token<T>;
|
|
24
|
+
useValue: T;
|
|
25
|
+
}
|
|
26
|
+
interface FactoryProvider<T = unknown> {
|
|
27
|
+
provide: Token<T>;
|
|
28
|
+
useFactory: (...args: unknown[]) => T | Promise<T>;
|
|
29
|
+
inject?: Token[];
|
|
30
|
+
}
|
|
31
|
+
interface ExistingProvider<T = unknown> {
|
|
32
|
+
provide: Token<T>;
|
|
33
|
+
useExisting: Token<T>;
|
|
34
|
+
}
|
|
35
|
+
type ProviderDefinition<T = unknown> = ClassProvider<T> | ValueProvider<T> | FactoryProvider<T> | ExistingProvider<T> | (new (...args: unknown[]) => T);
|
|
36
|
+
|
|
37
|
+
declare class Container {
|
|
38
|
+
private static instance;
|
|
39
|
+
private singletons;
|
|
40
|
+
private providers;
|
|
41
|
+
private resolutionStack;
|
|
42
|
+
private constructor();
|
|
43
|
+
static getInstance(): Container;
|
|
44
|
+
static reset(): void;
|
|
45
|
+
register<T>(target: Constructor$1<T>, options?: InjectableOptions): void;
|
|
46
|
+
registerProvider<T>(provider: ProviderDefinition<T>): void;
|
|
47
|
+
registerValue<T>(token: Token<T>, value: T): void;
|
|
48
|
+
registerFactory<T>(token: Token<T>, factory: () => T, inject?: Token[]): void;
|
|
49
|
+
has(token: Token): boolean;
|
|
50
|
+
resolve<T>(token: Token<T>): T;
|
|
51
|
+
resolveOptional<T>(token: Token<T>): T | undefined;
|
|
52
|
+
private resolveToken;
|
|
53
|
+
private resolveAbstractClass;
|
|
54
|
+
private resolveProvider;
|
|
55
|
+
private resolveClass;
|
|
56
|
+
private injectProperties;
|
|
57
|
+
private resolveWithName;
|
|
58
|
+
private resolveWithNameOptional;
|
|
59
|
+
registerInstance<T>(target: Constructor$1<T>, instance: T): void;
|
|
60
|
+
getProviders(): Token[];
|
|
61
|
+
clearSingletons(): void;
|
|
62
|
+
private isPrimitive;
|
|
63
|
+
private getTokenName;
|
|
64
|
+
}
|
|
65
|
+
declare const container: Container;
|
|
66
|
+
|
|
67
|
+
declare class Router {
|
|
68
|
+
private readonly server;
|
|
69
|
+
private readonly container;
|
|
70
|
+
private readonly globalPrefix;
|
|
71
|
+
private readonly guardCache;
|
|
72
|
+
private readonly middlewareCache;
|
|
73
|
+
private readonly interceptorCache;
|
|
74
|
+
constructor(server: FastifyInstance, container: Container, globalPrefix?: string);
|
|
75
|
+
clearGuardCache(): void;
|
|
76
|
+
clearMiddlewareCache(): void;
|
|
77
|
+
clearInterceptorCache(): void;
|
|
78
|
+
clearAllCaches(): void;
|
|
79
|
+
getGuardCacheSize(): number;
|
|
80
|
+
getMiddlewareCacheSize(): number;
|
|
81
|
+
getInterceptorCacheSize(): number;
|
|
82
|
+
registerController(controllerClass: Constructor$1, silent?: boolean): void;
|
|
83
|
+
private registerRoute;
|
|
84
|
+
private compileParamResolvers;
|
|
85
|
+
private createParamExtractor;
|
|
86
|
+
private resolveAllParams;
|
|
87
|
+
private resolveGuardInstances;
|
|
88
|
+
private executeGuardsOptimized;
|
|
89
|
+
private resolveMiddlewareInstances;
|
|
90
|
+
private executeMiddlewareChain;
|
|
91
|
+
private resolveInterceptorInstances;
|
|
92
|
+
private executeInterceptorChain;
|
|
93
|
+
private buildPath;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
interface EventPayload {
|
|
97
|
+
'app:discovery': {
|
|
98
|
+
files: string[];
|
|
99
|
+
};
|
|
100
|
+
'app:providers': {
|
|
101
|
+
count: number;
|
|
102
|
+
};
|
|
103
|
+
'provider:init': {
|
|
104
|
+
provider: Constructor$1;
|
|
105
|
+
name: string;
|
|
106
|
+
priority: number;
|
|
107
|
+
};
|
|
108
|
+
'app:routes': {
|
|
109
|
+
count: number;
|
|
110
|
+
};
|
|
111
|
+
'app:bootstrap': {
|
|
112
|
+
providerCount: number;
|
|
113
|
+
};
|
|
114
|
+
'app:listen': {
|
|
115
|
+
address: string;
|
|
116
|
+
port: number;
|
|
117
|
+
};
|
|
118
|
+
'app:shutdown': {
|
|
119
|
+
signal?: string;
|
|
120
|
+
};
|
|
121
|
+
'provider:destroy': {
|
|
122
|
+
provider: Constructor$1;
|
|
123
|
+
name: string;
|
|
124
|
+
};
|
|
125
|
+
'app:destroy': {
|
|
126
|
+
uptime: number;
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
type LifecycleEvent = keyof EventPayload;
|
|
130
|
+
type Listener<E extends LifecycleEvent> = (payload: EventPayload[E]) => void | Promise<void>;
|
|
131
|
+
declare class EventBus {
|
|
132
|
+
private listeners;
|
|
133
|
+
private onceListeners;
|
|
134
|
+
private ownerUnsubscribers;
|
|
135
|
+
on<E extends LifecycleEvent>(event: E, listener: Listener<E>, owner?: string): () => void;
|
|
136
|
+
on<T = unknown>(event: string, listener: (payload: T) => void | Promise<void>, owner?: string): () => void;
|
|
137
|
+
once<E extends LifecycleEvent>(event: E, listener: Listener<E>, owner?: string): void;
|
|
138
|
+
once<T = unknown>(event: string, listener: (payload: T) => void | Promise<void>, owner?: string): void;
|
|
139
|
+
emit<E extends LifecycleEvent>(event: E, payload: EventPayload[E]): Promise<void>;
|
|
140
|
+
emit<T = unknown>(event: string, payload: T): Promise<void>;
|
|
141
|
+
waitFor<E extends LifecycleEvent>(event: E): Promise<EventPayload[E]>;
|
|
142
|
+
waitFor<T = unknown>(event: string): Promise<T>;
|
|
143
|
+
off(event: string): void;
|
|
144
|
+
removeByOwner(owner: string): void;
|
|
145
|
+
clear(): void;
|
|
146
|
+
listenerCount(event: string): number;
|
|
147
|
+
totalListenerCount(): number;
|
|
148
|
+
listenerCountByOwner(owner: string): number;
|
|
149
|
+
getOwners(): string[];
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
type Constructor$1<T = any> = new (...args: any[]) => T;
|
|
153
|
+
type AbstractConstructor<T = any> = abstract new (...args: any[]) => T;
|
|
154
|
+
type AnyConstructor<T = any> = Constructor$1<T> | AbstractConstructor<T>;
|
|
155
|
+
type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'OPTIONS' | 'HEAD';
|
|
156
|
+
interface RouteContext {
|
|
157
|
+
request: FastifyRequest;
|
|
158
|
+
reply: FastifyReply;
|
|
159
|
+
params: Record<string, string>;
|
|
160
|
+
query: Record<string, unknown>;
|
|
161
|
+
body: unknown;
|
|
162
|
+
}
|
|
163
|
+
interface RouteDefinition {
|
|
164
|
+
method: HttpMethod;
|
|
165
|
+
path: string;
|
|
166
|
+
handlerName: string | symbol;
|
|
167
|
+
statusCode?: number;
|
|
168
|
+
}
|
|
169
|
+
interface ControllerMetadata {
|
|
170
|
+
prefix: string;
|
|
171
|
+
routes: RouteDefinition[];
|
|
172
|
+
}
|
|
173
|
+
type ProviderScope = 'singleton' | 'transient' | 'request';
|
|
174
|
+
interface InjectableOptions {
|
|
175
|
+
scope?: ProviderScope;
|
|
176
|
+
priority?: number;
|
|
177
|
+
}
|
|
178
|
+
interface ExceptionFilterConfig {
|
|
179
|
+
includeStack?: boolean;
|
|
180
|
+
logErrors?: boolean;
|
|
181
|
+
}
|
|
182
|
+
interface RiktaConfig {
|
|
183
|
+
port?: number;
|
|
184
|
+
host?: string;
|
|
185
|
+
logger?: boolean | object;
|
|
186
|
+
silent?: boolean;
|
|
187
|
+
prefix?: string;
|
|
188
|
+
autowired?: string[] | false;
|
|
189
|
+
strictDiscovery?: boolean;
|
|
190
|
+
onDiscoveryError?: (filePath: string, error: Error) => void;
|
|
191
|
+
controllers?: Constructor$1[];
|
|
192
|
+
providers?: Constructor$1[];
|
|
193
|
+
exceptionFilter?: ExceptionFilterConfig;
|
|
194
|
+
exceptionFilters?: Constructor$1[];
|
|
195
|
+
}
|
|
196
|
+
type MiddlewareFunction = (request: FastifyRequest, reply: FastifyReply, next: () => Promise<void>) => Promise<void> | void;
|
|
197
|
+
interface Guard {
|
|
198
|
+
canActivate(context: RouteContext): boolean | Promise<boolean>;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
interface RiktaApplication {
|
|
202
|
+
readonly server: FastifyInstance;
|
|
203
|
+
listen(): Promise<string>;
|
|
204
|
+
close(): Promise<void>;
|
|
205
|
+
getUrl(): string;
|
|
206
|
+
getContainer(): Container;
|
|
207
|
+
getRouter(): Router;
|
|
208
|
+
getEventBus(): EventBus;
|
|
209
|
+
clearRouterCaches(): void;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
declare const CONTROLLER_METADATA: unique symbol;
|
|
213
|
+
declare const ROUTES_METADATA: unique symbol;
|
|
214
|
+
declare const INJECTABLE_METADATA: unique symbol;
|
|
215
|
+
declare const PARAM_METADATA: unique symbol;
|
|
216
|
+
declare const GUARDS_METADATA: unique symbol;
|
|
217
|
+
declare const INTERCEPTORS_METADATA: unique symbol;
|
|
218
|
+
declare const MIDDLEWARE_METADATA: unique symbol;
|
|
219
|
+
declare const HTTP_CODE_METADATA: unique symbol;
|
|
220
|
+
declare const HEADERS_METADATA: unique symbol;
|
|
221
|
+
declare const INJECT_METADATA: unique symbol;
|
|
222
|
+
declare const ZOD_SCHEMA_METADATA: unique symbol;
|
|
223
|
+
declare const AUTOWIRED_METADATA: unique symbol;
|
|
224
|
+
declare const PROVIDER_METADATA: unique symbol;
|
|
225
|
+
declare const CONFIG_PROVIDER_METADATA: unique symbol;
|
|
226
|
+
declare const CONFIG_PROPERTY_METADATA: unique symbol;
|
|
227
|
+
declare enum ParamType {
|
|
228
|
+
BODY = "body",
|
|
229
|
+
QUERY = "query",
|
|
230
|
+
PARAM = "param",
|
|
231
|
+
HEADERS = "headers",
|
|
232
|
+
REQUEST = "request",
|
|
233
|
+
REPLY = "reply",
|
|
234
|
+
CONTEXT = "context"
|
|
235
|
+
}
|
|
236
|
+
declare const DEFAULT_CONFIG: {
|
|
237
|
+
readonly port: 3000;
|
|
238
|
+
readonly host: "0.0.0.0";
|
|
239
|
+
readonly logger: true;
|
|
240
|
+
readonly prefix: "";
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
declare const IMPLEMENTS_METADATA: unique symbol;
|
|
244
|
+
declare const PRIMARY_METADATA: unique symbol;
|
|
245
|
+
declare function isAbstractClass(target: unknown): target is Constructor$1;
|
|
246
|
+
declare function extendsFrom(derived: Constructor$1, base: Constructor$1): boolean;
|
|
247
|
+
declare function getImplementedAbstract(target: Constructor$1): Constructor$1 | undefined;
|
|
248
|
+
declare function isPrimaryImplementation(target: Constructor$1): boolean;
|
|
249
|
+
declare function setImplementsMetadata(target: Constructor$1, abstractClass: Constructor$1): void;
|
|
250
|
+
declare function setPrimaryMetadata(target: Constructor$1): void;
|
|
251
|
+
declare function markAsAbstract(target: Constructor$1): void;
|
|
252
|
+
|
|
253
|
+
declare function Implements<T extends AnyConstructor>(abstractClass: T): ClassDecorator;
|
|
254
|
+
declare function Primary(): ClassDecorator;
|
|
255
|
+
declare function Named(name: string): ClassDecorator;
|
|
256
|
+
declare function AbstractClass(): ClassDecorator;
|
|
257
|
+
|
|
258
|
+
declare class RequestScopeStorage {
|
|
259
|
+
private static instance;
|
|
260
|
+
private readonly asyncLocalStorage;
|
|
261
|
+
private constructor();
|
|
262
|
+
static getInstance(): RequestScopeStorage;
|
|
263
|
+
static reset(): void;
|
|
264
|
+
run<T>(fn: () => T): T;
|
|
265
|
+
runAsync<T>(fn: () => Promise<T>): Promise<T>;
|
|
266
|
+
isInRequestScope(): boolean;
|
|
267
|
+
get<T>(token: Token<T>): T | undefined;
|
|
268
|
+
set<T>(token: Token<T>, instance: T): void;
|
|
269
|
+
has(token: Token): boolean;
|
|
270
|
+
getStore(): Map<Token, unknown> | undefined;
|
|
271
|
+
}
|
|
272
|
+
declare const requestScopeStorage: RequestScopeStorage;
|
|
273
|
+
|
|
274
|
+
interface ConfigProviderRegistration {
|
|
275
|
+
token: string;
|
|
276
|
+
providerClass: Constructor$1;
|
|
277
|
+
}
|
|
278
|
+
interface AbstractImplementation {
|
|
279
|
+
implementation: Constructor$1;
|
|
280
|
+
isPrimary: boolean;
|
|
281
|
+
name?: string;
|
|
282
|
+
}
|
|
283
|
+
declare class Registry {
|
|
284
|
+
private static instance;
|
|
285
|
+
private controllers;
|
|
286
|
+
private providers;
|
|
287
|
+
private customProviders;
|
|
288
|
+
private configProviderMap;
|
|
289
|
+
private abstractImplementations;
|
|
290
|
+
private constructor();
|
|
291
|
+
static getInstance(): Registry;
|
|
292
|
+
static reset(): void;
|
|
293
|
+
registerController(target: Constructor$1): void;
|
|
294
|
+
registerProvider(target: Constructor$1): void;
|
|
295
|
+
getControllers(): Constructor$1[];
|
|
296
|
+
getProviders(): Constructor$1[];
|
|
297
|
+
hasController(target: Constructor$1): boolean;
|
|
298
|
+
hasProvider(target: Constructor$1): boolean;
|
|
299
|
+
registerCustomProvider(target: Constructor$1): void;
|
|
300
|
+
getCustomProviders(): Constructor$1[];
|
|
301
|
+
hasCustomProvider(target: Constructor$1): boolean;
|
|
302
|
+
registerConfigProvider(token: string, providerClass: Constructor$1): void;
|
|
303
|
+
getConfigProviderRegistrations(): ConfigProviderRegistration[];
|
|
304
|
+
clearConfigProviders(): void;
|
|
305
|
+
registerAbstractImplementation(abstractClass: Constructor$1, implementation: Constructor$1, name?: string): void;
|
|
306
|
+
setImplementationName(abstractClass: Constructor$1, implementation: Constructor$1, name: string): void;
|
|
307
|
+
setPrimaryImplementation(abstractClass: Constructor$1, implementation: Constructor$1): void;
|
|
308
|
+
getImplementations(abstractClass: Constructor$1): AbstractImplementation[];
|
|
309
|
+
hasImplementation(abstractClass: Constructor$1): boolean;
|
|
310
|
+
clearAbstractImplementations(): void;
|
|
311
|
+
}
|
|
312
|
+
declare const registry: Registry;
|
|
313
|
+
|
|
314
|
+
declare class DiscoveryException extends Error {
|
|
315
|
+
readonly filePath: string;
|
|
316
|
+
readonly originalError: Error;
|
|
317
|
+
readonly failedImports: DiscoveryFailure[];
|
|
318
|
+
constructor(filePath: string, originalError: Error);
|
|
319
|
+
constructor(failures: DiscoveryFailure[]);
|
|
320
|
+
getReport(): string;
|
|
321
|
+
}
|
|
322
|
+
interface DiscoveryFailure {
|
|
323
|
+
filePath: string;
|
|
324
|
+
error: Error;
|
|
325
|
+
}
|
|
326
|
+
interface DiscoveryOptions {
|
|
327
|
+
patterns?: string[];
|
|
328
|
+
cwd?: string;
|
|
329
|
+
strict?: boolean;
|
|
330
|
+
onImportError?: (filePath: string, error: Error) => void;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
declare function discoverModules(optionsOrPatterns?: DiscoveryOptions | string[], cwd?: string): Promise<string[]>;
|
|
334
|
+
declare function getCallerDirectory(): string;
|
|
335
|
+
|
|
336
|
+
declare const ON_EVENT_METADATA: unique symbol;
|
|
337
|
+
interface OnEventMetadata {
|
|
338
|
+
event: string;
|
|
339
|
+
methodName: string;
|
|
340
|
+
priority: number;
|
|
341
|
+
}
|
|
342
|
+
declare function On(event: LifecycleEvent | string, options?: {
|
|
343
|
+
priority?: number;
|
|
344
|
+
}): MethodDecorator;
|
|
345
|
+
|
|
346
|
+
interface OnProviderInit {
|
|
347
|
+
onProviderInit(): Promise<void> | void;
|
|
348
|
+
}
|
|
349
|
+
interface OnProviderDestroy {
|
|
350
|
+
onProviderDestroy(): Promise<void> | void;
|
|
351
|
+
}
|
|
352
|
+
interface OnApplicationBootstrap {
|
|
353
|
+
onApplicationBootstrap(): Promise<void> | void;
|
|
354
|
+
}
|
|
355
|
+
interface OnApplicationListen {
|
|
356
|
+
onApplicationListen(address: string): Promise<void> | void;
|
|
357
|
+
}
|
|
358
|
+
interface OnApplicationShutdown {
|
|
359
|
+
onApplicationShutdown(signal?: string): Promise<void> | void;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
declare class RiktaFactory {
|
|
363
|
+
static create(config?: RiktaConfig): Promise<RiktaApplication>;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
declare function Injectable(options?: InjectableOptions): ClassDecorator;
|
|
367
|
+
|
|
368
|
+
interface ControllerOptions {
|
|
369
|
+
prefix?: string;
|
|
370
|
+
}
|
|
371
|
+
declare function Controller(prefixOrOptions?: string | ControllerOptions): ClassDecorator;
|
|
372
|
+
|
|
373
|
+
declare const Get: (path?: string) => MethodDecorator;
|
|
374
|
+
declare const Post: (path?: string) => MethodDecorator;
|
|
375
|
+
declare const Put: (path?: string) => MethodDecorator;
|
|
376
|
+
declare const Patch: (path?: string) => MethodDecorator;
|
|
377
|
+
declare const Delete: (path?: string) => MethodDecorator;
|
|
378
|
+
declare const Options: (path?: string) => MethodDecorator;
|
|
379
|
+
declare const Head: (path?: string) => MethodDecorator;
|
|
380
|
+
declare function HttpCode(statusCode: number): MethodDecorator;
|
|
381
|
+
|
|
382
|
+
interface ParamMetadata {
|
|
383
|
+
index: number;
|
|
384
|
+
type: ParamType;
|
|
385
|
+
key?: string;
|
|
386
|
+
zodSchema?: ZodType<unknown>;
|
|
387
|
+
}
|
|
388
|
+
declare const Body: {
|
|
389
|
+
(): ParameterDecorator;
|
|
390
|
+
(key: string): ParameterDecorator;
|
|
391
|
+
<T>(schema: ZodType<T>): ParameterDecorator;
|
|
392
|
+
};
|
|
393
|
+
declare const Query: {
|
|
394
|
+
(): ParameterDecorator;
|
|
395
|
+
(key: string): ParameterDecorator;
|
|
396
|
+
<T>(schema: ZodType<T>): ParameterDecorator;
|
|
397
|
+
};
|
|
398
|
+
declare const Param: {
|
|
399
|
+
(): ParameterDecorator;
|
|
400
|
+
(key: string): ParameterDecorator;
|
|
401
|
+
<T>(schema: ZodType<T>): ParameterDecorator;
|
|
402
|
+
};
|
|
403
|
+
declare const Headers: {
|
|
404
|
+
(): ParameterDecorator;
|
|
405
|
+
(key: string): ParameterDecorator;
|
|
406
|
+
<T>(schema: ZodType<T>): ParameterDecorator;
|
|
407
|
+
};
|
|
408
|
+
declare const Req: {
|
|
409
|
+
(): ParameterDecorator;
|
|
410
|
+
(key: string): ParameterDecorator;
|
|
411
|
+
<T>(schema: ZodType<T>): ParameterDecorator;
|
|
412
|
+
};
|
|
413
|
+
declare const Request: {
|
|
414
|
+
(): ParameterDecorator;
|
|
415
|
+
(key: string): ParameterDecorator;
|
|
416
|
+
<T>(schema: ZodType<T>): ParameterDecorator;
|
|
417
|
+
};
|
|
418
|
+
declare const Res: {
|
|
419
|
+
(): ParameterDecorator;
|
|
420
|
+
(key: string): ParameterDecorator;
|
|
421
|
+
<T>(schema: ZodType<T>): ParameterDecorator;
|
|
422
|
+
};
|
|
423
|
+
declare const Reply: {
|
|
424
|
+
(): ParameterDecorator;
|
|
425
|
+
(key: string): ParameterDecorator;
|
|
426
|
+
<T>(schema: ZodType<T>): ParameterDecorator;
|
|
427
|
+
};
|
|
428
|
+
declare const Ctx: {
|
|
429
|
+
(): ParameterDecorator;
|
|
430
|
+
(key: string): ParameterDecorator;
|
|
431
|
+
<T>(schema: ZodType<T>): ParameterDecorator;
|
|
432
|
+
};
|
|
433
|
+
declare const Context: {
|
|
434
|
+
(): ParameterDecorator;
|
|
435
|
+
(key: string): ParameterDecorator;
|
|
436
|
+
<T>(schema: ZodType<T>): ParameterDecorator;
|
|
437
|
+
};
|
|
438
|
+
|
|
439
|
+
interface AutowiredMetadata {
|
|
440
|
+
token: Token;
|
|
441
|
+
index?: number;
|
|
442
|
+
propertyKey?: string;
|
|
443
|
+
optional?: boolean;
|
|
444
|
+
name?: string;
|
|
445
|
+
}
|
|
446
|
+
declare function Autowired(token?: Token, name?: string): ParameterDecorator & PropertyDecorator;
|
|
447
|
+
declare function Optional(): ParameterDecorator & PropertyDecorator;
|
|
448
|
+
|
|
449
|
+
interface ProviderMetadata {
|
|
450
|
+
token: Token;
|
|
451
|
+
}
|
|
452
|
+
interface ConfigProviderMetadata {
|
|
453
|
+
token: string;
|
|
454
|
+
}
|
|
455
|
+
declare function Provider(token?: Token): ClassDecorator;
|
|
456
|
+
declare function getConfigProviderMetadata(target: Constructor$1): ConfigProviderMetadata | undefined;
|
|
457
|
+
declare function isConfigProvider(target: Constructor$1): boolean;
|
|
458
|
+
|
|
459
|
+
interface ConfigPropertyMapping {
|
|
460
|
+
propertyKey: string;
|
|
461
|
+
envKey: string;
|
|
462
|
+
}
|
|
463
|
+
declare function ConfigProperty(envKey?: string): PropertyDecorator;
|
|
464
|
+
declare function getConfigPropertyMappings(target: Function): ConfigPropertyMapping[];
|
|
465
|
+
declare function hasConfigProperties(target: Function): boolean;
|
|
466
|
+
declare function clearPropertyNameCache(): void;
|
|
467
|
+
|
|
468
|
+
interface HttpArgumentsHost {
|
|
469
|
+
getRequest<T = FastifyRequest>(): T;
|
|
470
|
+
getResponse<T = FastifyReply>(): T;
|
|
471
|
+
}
|
|
472
|
+
interface ExecutionContext {
|
|
473
|
+
switchToHttp(): HttpArgumentsHost;
|
|
474
|
+
getRequest<T = FastifyRequest>(): T;
|
|
475
|
+
getReply<T = FastifyReply>(): T;
|
|
476
|
+
getClass(): Constructor$1;
|
|
477
|
+
getHandler(): string | symbol;
|
|
478
|
+
getMetadata<T = unknown>(key: string | symbol): T | undefined;
|
|
479
|
+
}
|
|
480
|
+
declare class ExecutionContextImpl implements ExecutionContext {
|
|
481
|
+
private readonly request;
|
|
482
|
+
private readonly reply;
|
|
483
|
+
private readonly controllerClass;
|
|
484
|
+
private readonly handlerName;
|
|
485
|
+
private readonly httpHost;
|
|
486
|
+
constructor(request: FastifyRequest, reply: FastifyReply, controllerClass: Constructor$1, handlerName: string | symbol);
|
|
487
|
+
switchToHttp(): HttpArgumentsHost;
|
|
488
|
+
getRequest<T = FastifyRequest>(): T;
|
|
489
|
+
getReply<T = FastifyReply>(): T;
|
|
490
|
+
getClass(): Constructor$1;
|
|
491
|
+
getHandler(): string | symbol;
|
|
492
|
+
getMetadata<T = unknown>(key: string | symbol): T | undefined;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
declare const CUSTOM_PARAM_METADATA: unique symbol;
|
|
496
|
+
interface CustomParamMetadata<T = unknown> {
|
|
497
|
+
index: number;
|
|
498
|
+
factory: CustomParamFactory<T, unknown>;
|
|
499
|
+
data?: T;
|
|
500
|
+
}
|
|
501
|
+
type CustomParamFactory<TData = unknown, TResult = unknown> = (data: TData, ctx: ExecutionContext) => TResult | Promise<TResult>;
|
|
502
|
+
declare function createParamDecorator<TData = unknown, TResult = unknown>(factory: CustomParamFactory<TData, TResult>): (data?: TData) => ParameterDecorator;
|
|
503
|
+
declare function getCustomParamMetadata<T = unknown>(target: Function, propertyKey: string | symbol): CustomParamMetadata<T>[];
|
|
504
|
+
|
|
505
|
+
type ClassDecorator$1 = <TFunction extends Function>(target: TFunction) => TFunction | void;
|
|
506
|
+
type MethodDecorator$1 = <T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T> | void;
|
|
507
|
+
type PropertyDecorator$1 = (target: Object, propertyKey: string | symbol) => void;
|
|
508
|
+
type AnyDecorator = ClassDecorator$1 | MethodDecorator$1 | PropertyDecorator$1;
|
|
509
|
+
declare function applyDecorators(...decorators: AnyDecorator[]): MethodDecorator$1 & ClassDecorator$1 & PropertyDecorator$1;
|
|
510
|
+
declare function SetMetadata<T = unknown>(key: string | symbol, value: T): MethodDecorator$1 & ClassDecorator$1;
|
|
511
|
+
|
|
512
|
+
declare class HttpException extends Error {
|
|
513
|
+
readonly statusCode: number;
|
|
514
|
+
readonly response: HttpExceptionResponse;
|
|
515
|
+
readonly timestamp: string;
|
|
516
|
+
constructor(response: string | HttpExceptionBody, statusCode?: number);
|
|
517
|
+
getResponse(): HttpExceptionResponse;
|
|
518
|
+
getStatus(): number;
|
|
519
|
+
private getDefaultError;
|
|
520
|
+
}
|
|
521
|
+
interface HttpExceptionBody {
|
|
522
|
+
message: string;
|
|
523
|
+
error?: string;
|
|
524
|
+
details?: unknown;
|
|
525
|
+
code?: string;
|
|
526
|
+
}
|
|
527
|
+
interface HttpExceptionResponse {
|
|
528
|
+
statusCode: number;
|
|
529
|
+
message: string;
|
|
530
|
+
error: string;
|
|
531
|
+
timestamp: string;
|
|
532
|
+
details?: unknown;
|
|
533
|
+
code?: string;
|
|
534
|
+
path?: string;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
interface ValidationErrorDetails {
|
|
538
|
+
path: (string | number)[];
|
|
539
|
+
message: string;
|
|
540
|
+
code: string;
|
|
541
|
+
expected?: string;
|
|
542
|
+
received?: string;
|
|
543
|
+
}
|
|
544
|
+
declare class ValidationException extends HttpException {
|
|
545
|
+
readonly zodError: ZodError;
|
|
546
|
+
readonly errors: ValidationErrorDetails[];
|
|
547
|
+
constructor(zodError: ZodError, message?: string);
|
|
548
|
+
getValidationErrors(): ValidationErrorDetails[];
|
|
549
|
+
getFlattenedErrors(): zod.ZodFlattenedError<unknown, string>;
|
|
550
|
+
getFormattedErrors(): zod.ZodFormattedError<unknown, string>;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
declare class BadRequestException extends HttpException {
|
|
554
|
+
constructor(response?: string | HttpExceptionBody);
|
|
555
|
+
}
|
|
556
|
+
declare class UnauthorizedException extends HttpException {
|
|
557
|
+
constructor(response?: string | HttpExceptionBody);
|
|
558
|
+
}
|
|
559
|
+
declare class ForbiddenException extends HttpException {
|
|
560
|
+
constructor(response?: string | HttpExceptionBody);
|
|
561
|
+
}
|
|
562
|
+
declare class NotFoundException extends HttpException {
|
|
563
|
+
constructor(response?: string | HttpExceptionBody);
|
|
564
|
+
}
|
|
565
|
+
declare class MethodNotAllowedException extends HttpException {
|
|
566
|
+
constructor(response?: string | HttpExceptionBody);
|
|
567
|
+
}
|
|
568
|
+
declare class NotAcceptableException extends HttpException {
|
|
569
|
+
constructor(response?: string | HttpExceptionBody);
|
|
570
|
+
}
|
|
571
|
+
declare class RequestTimeoutException extends HttpException {
|
|
572
|
+
constructor(response?: string | HttpExceptionBody);
|
|
573
|
+
}
|
|
574
|
+
declare class ConflictException extends HttpException {
|
|
575
|
+
constructor(response?: string | HttpExceptionBody);
|
|
576
|
+
}
|
|
577
|
+
declare class GoneException extends HttpException {
|
|
578
|
+
constructor(response?: string | HttpExceptionBody);
|
|
579
|
+
}
|
|
580
|
+
declare class PayloadTooLargeException extends HttpException {
|
|
581
|
+
constructor(response?: string | HttpExceptionBody);
|
|
582
|
+
}
|
|
583
|
+
declare class UnsupportedMediaTypeException extends HttpException {
|
|
584
|
+
constructor(response?: string | HttpExceptionBody);
|
|
585
|
+
}
|
|
586
|
+
declare class UnprocessableEntityException extends HttpException {
|
|
587
|
+
constructor(response?: string | HttpExceptionBody);
|
|
588
|
+
}
|
|
589
|
+
declare class TooManyRequestsException extends HttpException {
|
|
590
|
+
constructor(response?: string | HttpExceptionBody);
|
|
591
|
+
}
|
|
592
|
+
declare class InternalServerErrorException extends HttpException {
|
|
593
|
+
constructor(response?: string | HttpExceptionBody);
|
|
594
|
+
}
|
|
595
|
+
declare class NotImplementedException extends HttpException {
|
|
596
|
+
constructor(response?: string | HttpExceptionBody);
|
|
597
|
+
}
|
|
598
|
+
declare class BadGatewayException extends HttpException {
|
|
599
|
+
constructor(response?: string | HttpExceptionBody);
|
|
600
|
+
}
|
|
601
|
+
declare class ServiceUnavailableException extends HttpException {
|
|
602
|
+
constructor(response?: string | HttpExceptionBody);
|
|
603
|
+
}
|
|
604
|
+
declare class GatewayTimeoutException extends HttpException {
|
|
605
|
+
constructor(response?: string | HttpExceptionBody);
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
interface ExceptionContext {
|
|
609
|
+
exception: Error;
|
|
610
|
+
request: FastifyRequest;
|
|
611
|
+
reply: FastifyReply;
|
|
612
|
+
path: string;
|
|
613
|
+
method: string;
|
|
614
|
+
requestId?: string;
|
|
615
|
+
}
|
|
616
|
+
interface ExceptionFilter<T extends Error = Error> {
|
|
617
|
+
catch(exception: T, context: ExceptionContext): void | Promise<void>;
|
|
618
|
+
}
|
|
619
|
+
interface ErrorResponse {
|
|
620
|
+
statusCode: number;
|
|
621
|
+
message: string;
|
|
622
|
+
error: string;
|
|
623
|
+
timestamp: string;
|
|
624
|
+
path: string;
|
|
625
|
+
requestId?: string;
|
|
626
|
+
details?: unknown;
|
|
627
|
+
code?: string;
|
|
628
|
+
stack?: string;
|
|
629
|
+
}
|
|
630
|
+
declare class GlobalExceptionFilter implements ExceptionFilter {
|
|
631
|
+
private readonly includeStack;
|
|
632
|
+
private readonly logErrors;
|
|
633
|
+
constructor(options?: GlobalExceptionFilterOptions);
|
|
634
|
+
catch(exception: Error, context: ExceptionContext): void;
|
|
635
|
+
private buildResponse;
|
|
636
|
+
private isFastifyValidationError;
|
|
637
|
+
private isFastifyError;
|
|
638
|
+
private logError;
|
|
639
|
+
}
|
|
640
|
+
interface GlobalExceptionFilterOptions {
|
|
641
|
+
includeStack?: boolean;
|
|
642
|
+
logErrors?: boolean;
|
|
643
|
+
}
|
|
644
|
+
declare function createExceptionHandler(filter: ExceptionFilter, customFilters?: Map<Function, ExceptionFilter>): (error: FastifyError | Error, request: FastifyRequest, reply: FastifyReply) => Promise<void>;
|
|
645
|
+
|
|
646
|
+
declare const CATCH_METADATA: unique symbol;
|
|
647
|
+
interface CatchMetadata {
|
|
648
|
+
exceptions: Constructor$1<Error>[];
|
|
649
|
+
}
|
|
650
|
+
declare function Catch(...exceptions: Constructor$1<Error>[]): ClassDecorator;
|
|
651
|
+
declare function getCatchMetadata(target: Constructor$1): CatchMetadata | undefined;
|
|
652
|
+
|
|
653
|
+
declare class ConfigProviderAlreadyRegisteredException extends Error {
|
|
654
|
+
constructor(token: string, existingClass: string, newClass: string);
|
|
655
|
+
}
|
|
656
|
+
declare class ConfigProviderNotFoundException extends Error {
|
|
657
|
+
constructor(token: string, availableTokens?: string[]);
|
|
658
|
+
}
|
|
659
|
+
declare class ConfigProviderInstantiationException extends Error {
|
|
660
|
+
constructor(token: string, className: string, cause: Error);
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
interface CanActivate {
|
|
664
|
+
canActivate(context: ExecutionContext): boolean | Promise<boolean>;
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
type GuardClass = Constructor$1<CanActivate>;
|
|
668
|
+
declare function UseGuards(...guards: GuardClass[]): ClassDecorator & MethodDecorator;
|
|
669
|
+
declare function getGuardsMetadata(target: Constructor$1, propertyKey?: string | symbol): GuardClass[];
|
|
670
|
+
|
|
671
|
+
declare function Middleware(): ClassDecorator;
|
|
672
|
+
|
|
673
|
+
type NextFunction = () => void | Promise<void>;
|
|
674
|
+
interface RiktaMiddleware {
|
|
675
|
+
use(req: FastifyRequest, res: FastifyReply, next: NextFunction): void | Promise<void>;
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
type MiddlewareClass = Constructor$1<RiktaMiddleware>;
|
|
679
|
+
declare function UseMiddleware(...middleware: MiddlewareClass[]): ClassDecorator & MethodDecorator;
|
|
680
|
+
declare function getMiddlewareMetadata(target: Constructor$1, propertyKey?: string | symbol): MiddlewareClass[];
|
|
681
|
+
|
|
682
|
+
interface Interceptor {
|
|
683
|
+
intercept(context: ExecutionContext, next: CallHandler): Promise<unknown>;
|
|
684
|
+
}
|
|
685
|
+
interface CallHandler {
|
|
686
|
+
handle(): Promise<unknown>;
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
type InterceptorClass = Constructor$1<Interceptor>;
|
|
690
|
+
declare function UseInterceptors(...interceptors: InterceptorClass[]): ClassDecorator & MethodDecorator;
|
|
691
|
+
declare function getInterceptorsMetadata(controllerClass: Constructor$1, methodName: string | symbol): InterceptorClass[];
|
|
692
|
+
|
|
693
|
+
declare class ConfigValidationException extends Error {
|
|
694
|
+
readonly errors: z.ZodError;
|
|
695
|
+
constructor(errors: z.ZodError, providerName: string);
|
|
696
|
+
}
|
|
697
|
+
declare abstract class AbstractConfigProvider {
|
|
698
|
+
private _cache?;
|
|
699
|
+
protected abstract schema(): ZodSchema;
|
|
700
|
+
constructor();
|
|
701
|
+
private validateAndCache;
|
|
702
|
+
protected populate(): void;
|
|
703
|
+
protected getConfig(): Readonly<Record<string, unknown>>;
|
|
704
|
+
protected get<T = unknown>(key: string): T | undefined;
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
declare function loadEnvFiles(): void;
|
|
708
|
+
declare function isEnvLoaded(): boolean;
|
|
709
|
+
declare function resetEnvLoaded(): void;
|
|
710
|
+
|
|
711
|
+
type Constructor<T = unknown> = new (...args: any[]) => T;
|
|
712
|
+
declare function getControllerMetadata(target: Constructor): ControllerMetadata | undefined;
|
|
713
|
+
declare function isController(target: Constructor): boolean;
|
|
714
|
+
declare function getControllerPath(target: Constructor): string;
|
|
715
|
+
declare function getRoutes(target: Constructor): RouteDefinition[];
|
|
716
|
+
declare function hasRoutes(target: Constructor): boolean;
|
|
717
|
+
declare function getParamMetadata(target: Constructor, methodName: string | symbol): ParamMetadata[];
|
|
718
|
+
declare function getParamMetadataByIndex(target: Constructor, methodName: string | symbol, paramIndex: number): ParamMetadata | undefined;
|
|
719
|
+
declare function getHttpCode(target: Constructor, methodName: string | symbol): number | undefined;
|
|
720
|
+
declare function getGuards(target: Constructor, methodName?: string | symbol): Function[];
|
|
721
|
+
declare function getZodSchema(target: Constructor, methodName: string | symbol): unknown;
|
|
722
|
+
declare function getClassMetadata<T = unknown>(metadataKey: symbol, target: Constructor): T | undefined;
|
|
723
|
+
declare function getMethodMetadata<T = unknown>(metadataKey: symbol, target: Constructor, methodName: string | symbol): T | undefined;
|
|
724
|
+
declare function hasClassMetadata(metadataKey: symbol, target: Constructor): boolean;
|
|
725
|
+
declare function hasMethodMetadata(metadataKey: symbol, target: Constructor, methodName: string | symbol): boolean;
|
|
726
|
+
declare function getMethodsWithMetadata(metadataKey: symbol, target: Constructor): (string | symbol)[];
|
|
727
|
+
|
|
728
|
+
interface PerformanceMetric {
|
|
729
|
+
name: string;
|
|
730
|
+
duration: number;
|
|
731
|
+
startTime: number;
|
|
732
|
+
metadata?: Record<string, unknown>;
|
|
733
|
+
}
|
|
734
|
+
interface RouteMetric extends PerformanceMetric {
|
|
735
|
+
method: string;
|
|
736
|
+
path: string;
|
|
737
|
+
statusCode: number;
|
|
738
|
+
}
|
|
739
|
+
interface BootstrapMetrics {
|
|
740
|
+
total: number;
|
|
741
|
+
discovery: number;
|
|
742
|
+
containerInit: number;
|
|
743
|
+
routeRegistration: number;
|
|
744
|
+
lifecycleHooks: number;
|
|
745
|
+
}
|
|
746
|
+
declare class PerformanceProfiler {
|
|
747
|
+
private enabled;
|
|
748
|
+
private eventBus?;
|
|
749
|
+
private listeners;
|
|
750
|
+
private bootstrapMetrics;
|
|
751
|
+
constructor(options?: {
|
|
752
|
+
enabled?: boolean;
|
|
753
|
+
eventBus?: EventBus;
|
|
754
|
+
});
|
|
755
|
+
setEnabled(enabled: boolean): void;
|
|
756
|
+
isEnabled(): boolean;
|
|
757
|
+
startTimer(name: string): (metadata?: Record<string, unknown>) => PerformanceMetric | null;
|
|
758
|
+
measure<T>(name: string, fn: () => T | Promise<T>): Promise<T>;
|
|
759
|
+
recordRouteMetric(metric: RouteMetric): void;
|
|
760
|
+
recordBootstrapPhase(phase: keyof BootstrapMetrics, duration: number): void;
|
|
761
|
+
getBootstrapMetrics(): Partial<BootstrapMetrics>;
|
|
762
|
+
onMetric(listener: (metric: PerformanceMetric) => void): () => void;
|
|
763
|
+
private emitMetric;
|
|
764
|
+
createConsoleTimer(prefix?: string): (name: string) => (metadata?: Record<string, unknown>) => void;
|
|
765
|
+
}
|
|
766
|
+
declare let profiler: PerformanceProfiler;
|
|
767
|
+
declare function setGlobalProfiler(newProfiler: PerformanceProfiler): void;
|
|
768
|
+
declare function getGlobalProfiler(): PerformanceProfiler;
|
|
769
|
+
|
|
770
|
+
export { AUTOWIRED_METADATA, AbstractClass, AbstractConfigProvider, type AbstractConstructor, type AnyConstructor, Autowired, type AutowiredMetadata, BadGatewayException, BadRequestException, Body, type BootstrapMetrics, CATCH_METADATA, CONFIG_PROPERTY_METADATA, CONFIG_PROVIDER_METADATA, CONTROLLER_METADATA, CUSTOM_PARAM_METADATA, type CallHandler, type CanActivate, Catch, type CatchMetadata, type ClassProvider, ConfigProperty, type ConfigPropertyMapping, ConfigProviderAlreadyRegisteredException, ConfigProviderInstantiationException, type ConfigProviderMetadata, ConfigProviderNotFoundException, ConfigValidationException, ConflictException, type Constructor$1 as Constructor, Container, Context, Controller, type ControllerMetadata, type ControllerOptions, Ctx, type CustomParamFactory, type CustomParamMetadata, DEFAULT_CONFIG, Delete, DiscoveryException, type DiscoveryFailure, type DiscoveryOptions, type ErrorResponse, EventBus, type EventPayload, type ExceptionContext, type ExceptionFilter, type ExceptionFilterConfig, type ExecutionContext, ExecutionContextImpl, type ExistingProvider, type FactoryProvider, ForbiddenException, GUARDS_METADATA, GatewayTimeoutException, Get, GlobalExceptionFilter, type GlobalExceptionFilterOptions, GoneException, type Guard, HEADERS_METADATA, HTTP_CODE_METADATA, Head, Headers, HttpCode, HttpException, type HttpExceptionBody, type HttpExceptionResponse, type HttpMethod, IMPLEMENTS_METADATA, INJECTABLE_METADATA, INJECT_METADATA, INTERCEPTORS_METADATA, Implements, Injectable, type InjectableOptions, InjectionToken, type Interceptor, type InterceptorClass, InternalServerErrorException, type LifecycleEvent, MIDDLEWARE_METADATA, MethodNotAllowedException, Middleware, type MiddlewareClass, type MiddlewareFunction, Named, type NextFunction, NotAcceptableException, NotFoundException, NotImplementedException, ON_EVENT_METADATA, On, type OnApplicationBootstrap, type OnApplicationListen, type OnApplicationShutdown, type OnEventMetadata, type OnProviderDestroy, type OnProviderInit, Optional, Options, PARAM_METADATA, PRIMARY_METADATA, PROVIDER_METADATA, Param, type ParamMetadata, ParamType, Patch, PayloadTooLargeException, type PerformanceMetric, PerformanceProfiler, Post, Primary, Provider, type ProviderDefinition, type ProviderMetadata, type ProviderScope, Put, Query, ROUTES_METADATA, Registry, Reply, Req, Request, RequestScopeStorage, RequestTimeoutException, Res, RiktaFactory as Rikta, type RiktaApplication, type RiktaConfig, RiktaFactory, type RiktaMiddleware, type RouteContext, type RouteDefinition, type RouteMetric, Router, ServiceUnavailableException, SetMetadata, type Token, TooManyRequestsException, UnauthorizedException, UnprocessableEntityException, UnsupportedMediaTypeException, UseGuards, UseInterceptors, UseMiddleware, type ValidationErrorDetails, ValidationException, type ValueProvider, ZOD_SCHEMA_METADATA, applyDecorators, clearPropertyNameCache, container, createExceptionHandler, createParamDecorator, RiktaFactory as default, discoverModules, extendsFrom, getCallerDirectory, getCatchMetadata, getClassMetadata, getConfigPropertyMappings, getConfigProviderMetadata, getControllerMetadata, getControllerPath, getCustomParamMetadata, getGlobalProfiler, getGuards, getGuardsMetadata, getHttpCode, getImplementedAbstract, getInterceptorsMetadata, getMethodMetadata, getMethodsWithMetadata, getMiddlewareMetadata, getMiddlewareMetadata as getMiddlewaresMetadata, getParamMetadata, getParamMetadataByIndex, getRoutes, getZodSchema, hasClassMetadata, hasConfigProperties, hasMethodMetadata, hasRoutes, isAbstractClass, isConfigProvider, isController, isEnvLoaded, isPrimaryImplementation, loadEnvFiles, markAsAbstract, profiler, registry, requestScopeStorage, resetEnvLoaded, setGlobalProfiler, setImplementsMetadata, setPrimaryMetadata };
|