@nextrush/class 1.0.0-beta.0 → 1.0.0-beta.2
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.d.ts +33 -33
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { InternalServerError, HttpErrorOptions, ForbiddenError, BadRequestError
|
|
|
6
6
|
export { HttpError } from '@nextrush/errors';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* @nextrush/
|
|
9
|
+
* @nextrush/class - Controller Type Definitions
|
|
10
10
|
*
|
|
11
11
|
* Metadata and options shapes for the @Controller decorator, plus the shared
|
|
12
12
|
* middleware reference type used by both controller- and route-level metadata.
|
|
@@ -43,7 +43,7 @@ interface ControllerOptions {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
/**
|
|
46
|
-
* @nextrush/
|
|
46
|
+
* @nextrush/class - Route Type Definitions
|
|
47
47
|
*
|
|
48
48
|
* Metadata and options shapes for route decorators (@Get, @Post, etc.) and the
|
|
49
49
|
* response-shaping decorators (@SetHeader, @Redirect).
|
|
@@ -123,7 +123,7 @@ interface RedirectMetadata {
|
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
/**
|
|
126
|
-
* @nextrush/
|
|
126
|
+
* @nextrush/class - Parameter Type Definitions
|
|
127
127
|
*
|
|
128
128
|
* Metadata and options shapes for parameter decorators (@Body, @Param, @Query,
|
|
129
129
|
* @Header, and custom param decorators), plus their transform/extractor types.
|
|
@@ -206,7 +206,7 @@ interface HeaderOptions {
|
|
|
206
206
|
}
|
|
207
207
|
|
|
208
208
|
/**
|
|
209
|
-
* @nextrush/
|
|
209
|
+
* @nextrush/class - Guard Type Definitions
|
|
210
210
|
*
|
|
211
211
|
* Types for the @UseGuard decorator: the guard context, function and
|
|
212
212
|
* class-based guard contracts, and the stored guard metadata. Also home to the
|
|
@@ -285,7 +285,7 @@ interface GuardMetadata {
|
|
|
285
285
|
}
|
|
286
286
|
|
|
287
287
|
/**
|
|
288
|
-
* @nextrush/
|
|
288
|
+
* @nextrush/class - Exception Filter Type Definitions
|
|
289
289
|
*
|
|
290
290
|
* Types for the @UseFilter / @Catch decorators: the filter contract, its class
|
|
291
291
|
* constructor alias, and the stored filter metadata.
|
|
@@ -340,7 +340,7 @@ interface FilterMetadata {
|
|
|
340
340
|
}
|
|
341
341
|
|
|
342
342
|
/**
|
|
343
|
-
* @nextrush/
|
|
343
|
+
* @nextrush/class - Interceptor Type Definitions
|
|
344
344
|
*
|
|
345
345
|
* Types for the @UseInterceptor decorator: the interceptor contract, its class
|
|
346
346
|
* constructor alias, and the stored interceptor metadata.
|
|
@@ -398,7 +398,7 @@ interface InterceptorMetadata {
|
|
|
398
398
|
}
|
|
399
399
|
|
|
400
400
|
/**
|
|
401
|
-
* @nextrush/
|
|
401
|
+
* @nextrush/class - Service Lifecycle Hook Type Definitions
|
|
402
402
|
*
|
|
403
403
|
* Two duck-typed behavioral interfaces — `OnInit` and `OnShutdown` — that a
|
|
404
404
|
* `@Service`/`@Repository`/`@Config` (or any DI-managed instance) may implement
|
|
@@ -411,7 +411,7 @@ interface InterceptorMetadata {
|
|
|
411
411
|
* already resolved each service from the container before deciding whether it
|
|
412
412
|
* takes part in the lifecycle.
|
|
413
413
|
*
|
|
414
|
-
* @see `@nextrush/
|
|
414
|
+
* @see `@nextrush/class` `registerControllers` — bridges these hooks into
|
|
415
415
|
* `app.ready()` (calls `onInit`) and `app.close()` (calls `onShutdown`).
|
|
416
416
|
*/
|
|
417
417
|
/**
|
|
@@ -477,7 +477,7 @@ declare function isOnInit(value: unknown): value is OnInit;
|
|
|
477
477
|
declare function isOnShutdown(value: unknown): value is OnShutdown;
|
|
478
478
|
|
|
479
479
|
/**
|
|
480
|
-
* @nextrush/
|
|
480
|
+
* @nextrush/class - Metadata Keys & Runtime Helpers
|
|
481
481
|
*
|
|
482
482
|
* The reflect-metadata storage keys plus the runtime type-guard helpers that
|
|
483
483
|
* back the decorator implementations. These are the only runtime values in the
|
|
@@ -519,7 +519,7 @@ declare function isValidParamSource(source: string): source is ParamSource;
|
|
|
519
519
|
declare function isGuardClass(guard: Guard): guard is Constructor<CanActivate>;
|
|
520
520
|
|
|
521
521
|
/**
|
|
522
|
-
* @nextrush/
|
|
522
|
+
* @nextrush/class - Class Decorators
|
|
523
523
|
*
|
|
524
524
|
* Controller decorator that marks a class as an HTTP controller.
|
|
525
525
|
* Makes the class injectable for DI via @nextrush/di abstraction.
|
|
@@ -561,7 +561,7 @@ declare function isGuardClass(guard: Guard): guard is Constructor<CanActivate>;
|
|
|
561
561
|
declare function Controller(pathOrOptions?: string | ControllerOptions): ClassDecorator;
|
|
562
562
|
|
|
563
563
|
/**
|
|
564
|
-
* @nextrush/
|
|
564
|
+
* @nextrush/class - Module Type Definitions
|
|
565
565
|
*
|
|
566
566
|
* Metadata and options shapes for the @Module decorator. A module groups a
|
|
567
567
|
* feature's imports, controllers, and providers behind one registration entry
|
|
@@ -628,11 +628,11 @@ interface ModuleMetadata {
|
|
|
628
628
|
}
|
|
629
629
|
|
|
630
630
|
/**
|
|
631
|
-
* @nextrush/
|
|
631
|
+
* @nextrush/class - Module Decorator
|
|
632
632
|
*
|
|
633
633
|
* `@Module` records a feature's composition — its imported modules, controllers,
|
|
634
634
|
* providers, and exports — as reflect-metadata. It is a grouping/composition
|
|
635
|
-
* unit; the `@nextrush/
|
|
635
|
+
* unit; the `@nextrush/class` `registerModule` registrar reads this
|
|
636
636
|
* metadata to wire the whole module graph in one call.
|
|
637
637
|
*
|
|
638
638
|
* This layer stores metadata only. Provider registration, route building, and
|
|
@@ -670,7 +670,7 @@ declare function isModule(target: Function): boolean;
|
|
|
670
670
|
declare function getModuleMetadata(target: Function): ModuleMetadata | undefined;
|
|
671
671
|
|
|
672
672
|
/**
|
|
673
|
-
* @nextrush/
|
|
673
|
+
* @nextrush/class - @HttpCode Decorator
|
|
674
674
|
*
|
|
675
675
|
* Sets the HTTP status code returned when a controller method resolves with a
|
|
676
676
|
* value. Lives in its own module because `routes.ts` is already at the
|
|
@@ -701,7 +701,7 @@ declare function getModuleMetadata(target: Function): ModuleMetadata | undefined
|
|
|
701
701
|
declare function HttpCode(statusCode: number): MethodDecorator;
|
|
702
702
|
|
|
703
703
|
/**
|
|
704
|
-
* @nextrush/
|
|
704
|
+
* @nextrush/class - Response Decorators
|
|
705
705
|
*
|
|
706
706
|
* Method decorators that shape the HTTP response: @SetHeader attaches response
|
|
707
707
|
* headers and @Redirect declares a redirect. Stored as reflect-metadata read by
|
|
@@ -760,7 +760,7 @@ declare function SetHeader(name: string, value: string): MethodDecorator;
|
|
|
760
760
|
declare function Redirect(url: string, statusCode?: number): MethodDecorator;
|
|
761
761
|
|
|
762
762
|
/**
|
|
763
|
-
* @nextrush/
|
|
763
|
+
* @nextrush/class - Route Decorators
|
|
764
764
|
*
|
|
765
765
|
* HTTP method decorators for controller methods.
|
|
766
766
|
* Uses legacy decorators for compatibility with parameter decorators.
|
|
@@ -886,7 +886,7 @@ declare const Options: (pathOrOptions?: string | RouteOptions, options?: RouteOp
|
|
|
886
886
|
declare const All: (pathOrOptions?: string | RouteOptions, options?: RouteOptions) => MethodDecorator;
|
|
887
887
|
|
|
888
888
|
/**
|
|
889
|
-
* @nextrush/
|
|
889
|
+
* @nextrush/class - Standard Parameter Decorators
|
|
890
890
|
*
|
|
891
891
|
* Parameter decorators for injecting request data into controller method parameters.
|
|
892
892
|
* Uses legacy decorators (parameter decorators not supported in Stage 3).
|
|
@@ -1048,7 +1048,7 @@ declare function Req(): ParameterDecorator;
|
|
|
1048
1048
|
declare function Res(): ParameterDecorator;
|
|
1049
1049
|
|
|
1050
1050
|
/**
|
|
1051
|
-
* @nextrush/
|
|
1051
|
+
* @nextrush/class - Custom Parameter Decorator Factory
|
|
1052
1052
|
*
|
|
1053
1053
|
* User-defined parameter extractors for custom injection patterns.
|
|
1054
1054
|
*/
|
|
@@ -1091,7 +1091,7 @@ declare function createCustomParamDecorator(extractor: CustomParamExtractor, opt
|
|
|
1091
1091
|
}): ParameterDecorator;
|
|
1092
1092
|
|
|
1093
1093
|
/**
|
|
1094
|
-
* @nextrush/
|
|
1094
|
+
* @nextrush/class - Guard Decorators
|
|
1095
1095
|
*
|
|
1096
1096
|
* Guards are functions or classes that determine if a request should be handled.
|
|
1097
1097
|
* They run BEFORE the route handler and can prevent execution.
|
|
@@ -1222,7 +1222,7 @@ declare function getMethodGuards(target: Function, methodName: string | symbol):
|
|
|
1222
1222
|
declare function getAllGuards(target: Function, methodName: string | symbol): Guard[];
|
|
1223
1223
|
|
|
1224
1224
|
/**
|
|
1225
|
-
* @nextrush/
|
|
1225
|
+
* @nextrush/class - Exception Filter Decorators
|
|
1226
1226
|
*
|
|
1227
1227
|
* Exception filters localize error handling to a controller or route. A filter
|
|
1228
1228
|
* is a class implementing {@link ExceptionFilter}; it declares which errors it
|
|
@@ -1318,7 +1318,7 @@ declare function getMethodFilters(target: Function, methodName: string | symbol)
|
|
|
1318
1318
|
declare function getAllFilters(target: Function, methodName: string | symbol): ExceptionFilterClass[];
|
|
1319
1319
|
|
|
1320
1320
|
/**
|
|
1321
|
-
* @nextrush/
|
|
1321
|
+
* @nextrush/class - Interceptor Decorators
|
|
1322
1322
|
*
|
|
1323
1323
|
* Interceptors wrap the controller-method call (onion / around advice). An
|
|
1324
1324
|
* interceptor runs code before calling `next()`, awaits the downstream result,
|
|
@@ -1396,10 +1396,10 @@ declare function getMethodInterceptors(target: Function, methodName: string | sy
|
|
|
1396
1396
|
declare function getAllInterceptors(target: Function, methodName: string | symbol): InterceptorClass[];
|
|
1397
1397
|
|
|
1398
1398
|
/**
|
|
1399
|
-
* @nextrush/
|
|
1399
|
+
* @nextrush/class - Metadata Readers
|
|
1400
1400
|
*
|
|
1401
1401
|
* Utility functions to read decorator metadata from controller classes.
|
|
1402
|
-
* Used by @nextrush/
|
|
1402
|
+
* Used by @nextrush/class' registrar to build routes.
|
|
1403
1403
|
*/
|
|
1404
1404
|
|
|
1405
1405
|
/**
|
|
@@ -1528,7 +1528,7 @@ declare function getRedirectMetadata(target: Function, methodName: string): Redi
|
|
|
1528
1528
|
declare function getHttpCode(target: Function, methodName: string): number | undefined;
|
|
1529
1529
|
|
|
1530
1530
|
/**
|
|
1531
|
-
* @nextrush/
|
|
1531
|
+
* @nextrush/class - Reflection API Isolation
|
|
1532
1532
|
*
|
|
1533
1533
|
* Single point of contact for all Reflect.getMetadata, Reflect.defineMetadata,
|
|
1534
1534
|
* and design:paramtypes reads. Isolates reflection plumbing from business logic.
|
|
@@ -1546,7 +1546,7 @@ declare function getHttpCode(target: Function, methodName: string): number | und
|
|
|
1546
1546
|
declare function getConstructorParamTypes(target: Function): unknown[];
|
|
1547
1547
|
|
|
1548
1548
|
/**
|
|
1549
|
-
* @nextrush/
|
|
1549
|
+
* @nextrush/class - Error Classes
|
|
1550
1550
|
*
|
|
1551
1551
|
* Production-grade error classes with actionable messages.
|
|
1552
1552
|
* Client errors (4xx) extend HttpError for proper status codes.
|
|
@@ -1705,7 +1705,7 @@ declare class MemorySource implements DiscoverySource {
|
|
|
1705
1705
|
}
|
|
1706
1706
|
|
|
1707
1707
|
/**
|
|
1708
|
-
* @nextrush/
|
|
1708
|
+
* @nextrush/class - Type Definitions
|
|
1709
1709
|
*
|
|
1710
1710
|
* Types for the controller registrar.
|
|
1711
1711
|
*/
|
|
@@ -1920,7 +1920,7 @@ interface DiscoveryOptions {
|
|
|
1920
1920
|
}
|
|
1921
1921
|
|
|
1922
1922
|
/**
|
|
1923
|
-
* @nextrush/
|
|
1923
|
+
* @nextrush/class - Controller registration
|
|
1924
1924
|
*
|
|
1925
1925
|
* `registerControllers(app, options)` is a **registrar**: it scans for
|
|
1926
1926
|
* `@Controller` classes (or takes them explicitly), builds their routes, and
|
|
@@ -1948,7 +1948,7 @@ interface DiscoveryOptions {
|
|
|
1948
1948
|
declare function registerControllers(app: Application, options?: ControllersOptions): Promise<void>;
|
|
1949
1949
|
|
|
1950
1950
|
/**
|
|
1951
|
-
* @nextrush/
|
|
1951
|
+
* @nextrush/class - Module registrar
|
|
1952
1952
|
*
|
|
1953
1953
|
* `registerModule(app, RootModule, options?)` wires a whole `@Module` graph in
|
|
1954
1954
|
* one call: it walks `imports`, registers every module's providers into the DI
|
|
@@ -1989,7 +1989,7 @@ type ModuleRegistrationOptions = Pick<ControllersOptions, 'prefix' | 'middleware
|
|
|
1989
1989
|
declare function registerModule(app: Application, rootModule: Function, options?: ModuleRegistrationOptions): Promise<void>;
|
|
1990
1990
|
|
|
1991
1991
|
/**
|
|
1992
|
-
* @nextrush/
|
|
1992
|
+
* @nextrush/class - Module graph traversal
|
|
1993
1993
|
*
|
|
1994
1994
|
* Walks a module's `imports` into a flat, ordered, deduplicated list. The walk
|
|
1995
1995
|
* is post-order (imported feature modules before their importer), dedupes
|
|
@@ -2016,7 +2016,7 @@ declare function collectModuleGraph(root: Function): Function[];
|
|
|
2016
2016
|
declare function collectModuleControllers(modules: Function[]): Function[];
|
|
2017
2017
|
|
|
2018
2018
|
/**
|
|
2019
|
-
* @nextrush/
|
|
2019
|
+
* @nextrush/class - Controller Discovery
|
|
2020
2020
|
*
|
|
2021
2021
|
* Automatic controller discovery by scanning directories.
|
|
2022
2022
|
* Uses glob patterns to find files and imports them to discover controllers.
|
|
@@ -2070,7 +2070,7 @@ declare function getControllersFromResults(results: DiscoveryResult[]): Function
|
|
|
2070
2070
|
declare function getErrorsFromResults(results: DiscoveryResult[]): DiscoveryError[];
|
|
2071
2071
|
|
|
2072
2072
|
/**
|
|
2073
|
-
* @nextrush/
|
|
2073
|
+
* @nextrush/class - ApplicationGraph IR (Immutable Intermediate Representation)
|
|
2074
2074
|
*
|
|
2075
2075
|
* RFC-NEXTRUSH-CLASS-CONSOLIDATION P3.4: Immutable IR that documents the
|
|
2076
2076
|
* bootstrap read-once, freeze-then-execute pattern.
|
|
@@ -2202,7 +2202,7 @@ interface DiagnosticsReport {
|
|
|
2202
2202
|
declare function getClassDiagnostics(app: Application): DiagnosticsReport | undefined;
|
|
2203
2203
|
|
|
2204
2204
|
/**
|
|
2205
|
-
* @nextrush/
|
|
2205
|
+
* @nextrush/class - Controller Registry
|
|
2206
2206
|
*
|
|
2207
2207
|
* Manages registration and tracking of controllers.
|
|
2208
2208
|
*/
|
|
@@ -2286,7 +2286,7 @@ declare class ControllerRegistry {
|
|
|
2286
2286
|
}
|
|
2287
2287
|
|
|
2288
2288
|
/**
|
|
2289
|
-
* @nextrush/
|
|
2289
|
+
* @nextrush/class - Handler Builder
|
|
2290
2290
|
*
|
|
2291
2291
|
* Builds route handlers from controller methods with parameter injection.
|
|
2292
2292
|
* Orchestrates path construction, middleware resolution, and route metadata,
|