Module: @ts-rest/nest
Classes​
- RequestValidationError
- ResponseValidationError
- TsRestException
- TsRestHandlerInterceptor
- TsRestInterceptor
- TsRestModule
Type Aliases​
NestControllerContract​
Ƭ NestControllerContract<T
>: Pick
<T
, { [K in keyof T]-?: T[K] extends AppRoute ? K : never }[keyof T
]>
Type parameters​
Name | Type |
---|---|
T | extends AppRouter |
Defined in​
libs/ts-rest/nest/src/lib/ts-rest-nest.ts:49
NestControllerInterface​
Ƭ NestControllerInterface<T
>: AppRouterControllerShape
<T
>
Type parameters​
Name | Type |
---|---|
T | extends AppRouter |
Defined in​
libs/ts-rest/nest/src/lib/ts-rest-nest.ts:55
NestRequestShapes​
Ƭ NestRequestShapes<T
>: AppRouterRequestShapes
<T
>
Type parameters​
Name | Type |
---|---|
T | extends AppRouter |
Defined in​
libs/ts-rest/nest/src/lib/ts-rest-nest.ts:57
NestResponseShapes​
Ƭ NestResponseShapes<T
>: AppRouterResponseShapes
<T
>
Type parameters​
Name | Type |
---|---|
T | extends AppRouter |
Defined in​
libs/ts-rest/nest/src/lib/ts-rest-nest.ts:58
TsRestOptions​
Ƭ TsRestOptions: Object
Type declaration​
Name | Type |
---|---|
jsonQuery? | boolean |
validateRequestBody? | boolean |
validateRequestHeaders? | boolean |
validateRequestQuery? | boolean |
validateResponses? | boolean |
Defined in​
libs/ts-rest/nest/src/lib/ts-rest-options.ts:4
TsRestRequestShape​
Ƭ TsRestRequestShape<TRoute
>: ServerInferRequest
<TRoute
, Request
["headers"
]>
Type parameters​
Name | Type |
---|---|
TRoute | extends AppRoute |
Defined in​
libs/ts-rest/nest/src/lib/ts-rest-request.decorator.ts:24
Variables​
TsRestAppRouteMetadataKey​
• Const
TsRestAppRouteMetadataKey: typeof TsRestAppRouteMetadataKey
Defined in​
libs/ts-rest/nest/src/lib/constants.ts:1
TsRestOptionsMetadataKey​
• Const
TsRestOptionsMetadataKey: typeof TsRestOptionsMetadataKey
Defined in​
libs/ts-rest/nest/src/lib/constants.ts:2
Functions​
Api​
â–¸ Api(appRoute
): MethodDecorator
Parameters​
Name | Type |
---|---|
appRoute | AppRoute |
Returns​
MethodDecorator
Deprecated
Use TsRest decorator instead
Defined in​
libs/ts-rest/nest/src/lib/ts-rest.decorator.ts:73
ApiDecorator​
â–¸ ApiDecorator(): ParameterDecorator
Returns​
ParameterDecorator
Deprecated
Use TsRestRequest
instead
Defined in​
libs/ts-rest/nest/src/lib/ts-rest-request.decorator.ts:99
TsRest​
â–¸ TsRest(appRoute
, options?
): MethodDecorator
As a class decorator, you can configure ts-rest options. As a method decorator, you can assign the route and also configure options
Parameters​
Name | Type | Description |
---|---|---|
appRoute | AppRoute | - |
options? | TsRestOptions | For a method decorator, this is the options |
Returns​
MethodDecorator
Defined in​
libs/ts-rest/nest/src/lib/ts-rest.decorator.ts:20
â–¸ TsRest(options
): ClassDecorator
As a class decorator, you can configure ts-rest options. As a method decorator, you can assign the route and also configure options
Parameters​
Name | Type | Description |
---|---|---|
options | TsRestOptions | For a method decorator, this is the options |
Returns​
ClassDecorator
Defined in​
libs/ts-rest/nest/src/lib/ts-rest.decorator.ts:21
TsRestHandler​
â–¸ TsRestHandler(appRouterOrRoute
, options?
): MethodDecorator
Parameters​
Name | Type |
---|---|
appRouterOrRoute | AppRoute | AppRouter |
options? | TsRestOptions |
Returns​
MethodDecorator
Defined in​
libs/ts-rest/nest/src/lib/ts-rest-nest-handler.ts:76
TsRestRequest​
â–¸ TsRestRequest(): ParameterDecorator
Parameter decorator used to parse, validate and return the typed request object
Returns​
ParameterDecorator
Defined in​
libs/ts-rest/nest/src/lib/ts-rest-request.decorator.ts:99
doesUrlMatchContractPath​
â–¸ doesUrlMatchContractPath(contractPath
, url
): boolean
Parameters​
Name | Type | Description |
---|---|---|
contractPath | string | Example ts '/posts/:id' |
url | string | Example ts '/posts/1' |
Returns​
boolean
Defined in​
libs/ts-rest/nest/src/lib/ts-rest-nest-handler.ts:165
initNestServer​
â–¸ initNestServer<T
>(router
): Object
Type parameters​
Name | Type |
---|---|
T | extends AppRouter |
Parameters​
Name | Type |
---|---|
router | T |
Returns​
Object
Name | Type |
---|---|
controllerShape | AppRouterControllerShape <T > |
responseShapes | AppRouterResponseShapes <T > |
route | T |
routeShapes | AppRouterRequestShapes <T > |
Deprecated
Use nestControllerContract
, NestControllerInterface
, NestRequestShapes
, and NestResponseShapes
instead
See
docs for more info.
Defined in​
libs/ts-rest/nest/src/lib/ts-rest-nest.ts:40
nestControllerContract​
â–¸ nestControllerContract<T
>(router
): NestControllerContract
<T
>
Returns the contract containing only non-nested routes required by a NestJS controller
Type parameters​
Name | Type |
---|---|
T | extends AppRouter |
Parameters​
Name | Type |
---|---|
router | T |
Returns​
Defined in​
libs/ts-rest/nest/src/lib/ts-rest-nest.ts:64
tsRestHandler​
â–¸ tsRestHandler<T
>(contract
, implementation
): NestHandlerImplementation
<T
>
Type parameters​
Name | Type |
---|---|
T | extends AppRoute | AppRouter |
Parameters​
Name | Type | Description |
---|---|---|
contract | T | The contract or route to implement |
implementation | NestHandlerImplementation <T > | Implementation of the route or entire contract as an object |
Returns​
NestHandlerImplementation
<T
>
Defined in​
libs/ts-rest/nest/src/lib/ts-rest-nest-handler.ts:147