Global

Members

# constant DecafBody

Custom decorator that extracts the request body and instantiates it using the Model constructor found on the controller.

Custom decorator that extracts the request body and instantiates it using the Model constructor found on the controller. Handles both single objects and arrays.

View Source decaf-model/decorators/DecafBody.ts, line 7

Methods

# ApiOperationFromModel(ModelConstructor, verb, pathopt) → {MethodDecorator}

Maps an HTTP verb to its corresponding CrudOperations key and Nest HTTP decorator (@Get, @Post, etc.). It checks isOperationBlocked(ModelConstructor, crudOp) and, if blocked, applies only @ApiExcludeEndpoint() (Swagger-hidden, no Nest route). If permitted, it applies the appropriate HTTP decorator with the optional path.

Conditionally applies an HTTP method decorator for a given model and verb, hiding the endpoint in Swagger (and not registering the route) when the model blocks that CRUD operation.

Parameters:
Name Type Attributes Description
ModelConstructor ModelConstructor.<any>

The model constructor used to resolve operation-blocking rules.

verb HttpVerbs

The HTTP verb to map (e.g., "GET" | "POST" | "PUT" | "PATCH" | "DELETE").

path string <optional>

Optional route path passed through to the corresponding Nest HTTP method decorator.

View Source decaf-model/decorators/ApiOperationFromModel.ts, line 28

A method decorator that either excludes the endpoint from Swagger (and route registration) or applies the correct HTTP decorator.

MethodDecorator

# ApiParamsFromModel(propsopt) → {any}

Transforms each entry of the provided ApiParam[] into a corresponding @ApiParam() decorator (defaulting description, required, and type when omitted) and composes them into a single decorator via Nest's applyDecorators. Useful for synchronizing runtime route params with OpenAPI documentation in a concise, declarative way.

Applies a set of Swagger @ApiParam decorators generated from a typed specification array.

Parameters:
Name Type Attributes Default Description
props Array.<ApiParam> <optional>
[]

Array describing path parameters to be documented.

name string

The parameter's name as it appears in the route template (e.g., :id).

description string <optional>

Human-readable explanation of the parameter; defaults to "Path parameter: <name>".

required boolean <optional>
true

Whether the parameter is required; defaults to true.

type Constructor.<any> <optional>
String

Constructor/type used by Swagger to infer schema (e.g., String, Number, UUID, custom class).

View Source decaf-model/decorators/ApiParamsFromModel.ts, line 4

A composed decorator applying all generated @ApiParam decorators to the target method or controller.

any

# Auth(model)

A decorator function that applies authentication and authorization metadata to a NestJS controller or method.

A decorator function that applies authentication and authorization metadata to a NestJS controller or method.

Parameters:
Name Type Description
model

The model name or constructor function for the resource being accessed. If a string is provided, it is used as the resource name. If a constructor function is provided, its name is used as the resource name.

View Source decaf-model/decorators/decorators.ts, line 33

  • A function that applies the authentication and authorization decorators to the target.
Examples
```typescript
```typescript

# BulkApiOperationFromModel(ModelConstructor, verb, pathopt) → {MethodDecorator}

Maps an HTTP verb to its corresponding CrudOperations key and Nest HTTP decorator (@Get, @Post, etc.). It checks isOperationBlocked(ModelConstructor, crudOp) and, if blocked, applies only @ApiExcludeEndpoint() (Swagger-hidden, no Nest route). If permitted, it applies the appropriate HTTP decorator with the optional path.

Conditionally applies an HTTP method decorator for a given model and verb, hiding the endpoint in Swagger (and not registering the route) when the model blocks that CRUD operation.

Parameters:
Name Type Attributes Description
ModelConstructor ModelConstructor.<any>

The model constructor used to resolve operation-blocking rules.

verb HttpVerbs

The HTTP verb to map (e.g., "GET" | "POST" | "PUT" | "PATCH" | "DELETE").

path string <optional>

Optional route path passed through to the corresponding Nest HTTP method decorator.

View Source decaf-model/decorators/ApiOperationFromModel.ts, line 49

A method decorator that either excludes the endpoint from Swagger (and route registration) or applies the correct HTTP decorator.

MethodDecorator

# DecafParams(propsopt) → {ParameterDecorator}

DecafParams computes the order of route parameters based on the provided ApiParam[] specification (using each element’s name), then applies OrderedParams(order) as a parameter decorator. This enables parameter-level binding that remains consistent with the documented API parameter metadata.

A higher-level decorator factory that leverages OrderedParams to extract route parameters in a specific order derived from a list of ApiParam definitions.

Parameters:
Name Type Attributes Default Description
props Array.<ApiParam> <optional>
[]

Array of ApiParam definitions whose name fields determine the parameter extraction order.

View Source decaf-model/decorators/DecafParams.ts, line 28

A NestJS parameter decorator that injects an ordered list of parameters and metadata into the controller method argument.

ParameterDecorator

# DtoFor()

Builds a Nest/Swagger DTO class for the given model and CRUD operation.

Builds a Nest/Swagger DTO class for the given model and CRUD operation.

Rules:

  • Only CREATE and UPDATE (and their bulk variants) produce a DTO; all other operations return the original model class unchanged.
  • @generated() properties (createdAt, updatedAt, createdBy, updatedBy, uuid, version, @composed pks, …) are never exposed in any DTO.
  • The @pk() property: • UPDATE – always included. • CREATE – included only when the pk is NOT auto-generated (checked via Model.pkProps().generated AND Model.generated()).
  • Relation properties (@oneToOne, @oneToMany, …): • CREATE – nested as DtoFor(CREATE, RelatedModel). • UPDATE – union of DtoFor(UPDATE, RelatedModel) or the related model's primary-key type (string / integer), expressed as a Swagger oneOf.

Metadata.properties() now returns ALL properties across the prototype chain, so DTO inheritance is no longer needed; every DTO is a flat class.

View Source factory/openapi/DtoBuilder.ts, line 31

# HttpVerbToDecorator(verb)

Maps an HTTP verb to its corresponding NestJS method decorator.

Maps an HTTP verb to its corresponding NestJS method decorator.

Parameters:
Name Type Description
verb

HTTP verb to be converted (e.g. GET, POST, PUT, PATCH, DELETE).

View Source decaf-model/decorators/utils.ts, line 12

If the provided HTTP verb is not supported or not mapped to a NestJS decorator.

Error

A NestJS method decorator matching the provided HTTP verb.

# OrderedParams(order, ctx) → {DecafParamProps}

The OrderedParams decorator reads the incoming HTTP request's params object, optionally orders it according to a provided list of parameter names, and returns an object containing the original params, the ordered values, and the applied order list. This ensures deterministic parameter access for routes with multiple path parameters.

Creates a custom NestJS parameter decorator that extracts and returns route parameters ordered by a specific key sequence.

Parameters:
Name Type Description
order TOrder | undefined

An optional array specifying the parameter names' desired order. If not provided, the decorator will preserve the order of the keys as they appear in the original req.params object.

ctx ExecutionContext

The NestJS execution context, used to retrieve the current HTTP request object.

View Source decaf-model/decorators/DecafParams.ts, line 3

An object containing:

  • original: the raw parameter map from req.params;
  • ordered: an array of parameter values in the requested order;
  • order: the effective order list used.
DecafParamProps

# isOperationBlocked(ModelConstructor, op) → {boolean}

Retrieves the operation-blocking handler metadata stored on the provided model constructor (under OperationKeys.REFLECT + OperationKeys.BLOCK), executes it (if present) with its persisted arguments plus the requested operation, and returns whether the operation is blocked. If no handler exists, the operation is considered allowed (returns false).

Determines if a given CRUD operation is blocked for a specific model constructor.

Parameters:
Name Type Description
ModelConstructor ModelConstructor.<any>

The target model constructor whose metadata may include a blocking handler.

op CrudOperations

The CRUD operation to evaluate (e.g., OperationKeys.CREATE, OperationKeys.READ, OperationKeys.UPDATE, OperationKeys.DELETE).

View Source decaf-model/decorators/ApiOperationFromModel.ts, line 7

true when the operation is explicitly blocked by the model's handler; otherwise false.

boolean

Type Definitions

object

# DecafModuleOptions

Properties:
Name Type Attributes Description
conf Array
alias string <optional>
autoControllers boolean
autoServices boolean <optional>
observerOptions ObserverEventsOptions <optional>
aggregations boolean <optional>
handlers Array <optional>
initialization function <optional>

View Source types.ts, line 11