Global

Members

# PersistenceKeys[undefined]

Key for created-by ownership metadata

.

Key for created-by ownership metadata

View Source persistence/constants.ts, line 33

# PersistenceKeys[undefined]

Key for updated-by ownership metadata

.

Key for updated-by ownership metadata

View Source persistence/constants.ts, line 35

# PersistenceKeys[undefined]

Key for one-to-one relation metadata

.

Key for one-to-one relation metadata

View Source persistence/constants.ts, line 42

# PersistenceKeys[undefined]

Key for one-to-many relation metadata

.

Key for one-to-many relation metadata

View Source persistence/constants.ts, line 44

# PersistenceKeys[undefined]

Key for many-to-one relation metadata

.

Key for many-to-one relation metadata

View Source persistence/constants.ts, line 46

# PersistenceKeys[undefined]

Key for many-to-one relation metadata

.

Key for many-to-one relation metadata

View Source persistence/constants.ts, line 48

# constant roles

A decorator function that sets the roles required for authentication and authorization to the model in NestJS.

A decorator function that sets the roles required for authentication and authorization to the model in NestJS.

View Source utils/decorators.ts, line 90

Example
```typescript

Methods

# column(columnName) → {function}

Decorator that maps a model property to a specific column name in the database

Specifies the database column name for a model property

Parameters:
Name Type Description
columnName string

The name of the column in the database

View Source model/decorators.ts, line 31

A decorator function that can be applied to a class property

function

# createdBy() → {function}

Decorator that marks a property to store the identifier of the user who created the model instance

Tracks the creator of a model instance

View Source model/decorators.ts, line 126

A decorator function that can be applied to a class property

function
Example
```typescript
class Document extends BaseModel {
  

# index(directionsopt, compositionsopt) → {function}

Decorator that marks a property to be indexed in the database, optionally with specific directions and compositions

Creates an index on a model property for improved query performance

Parameters:
Name Type Attributes Description
directions Array.<OrderDirection> <optional>

Optional array of sort directions for the index

compositions Array.<string> <optional>

Optional array of property names to create a composite index

View Source model/indexing.ts, line 44

A decorator function that can be applied to a class property

function

# manyToOne(clazz, cascadeOptionsopt, populateopt) → {function}

Decorator that establishes a many-to-one relationship between multiple instances of the current model and another model

Defines a many-to-one relationship between models

Parameters:
Name Type Attributes Default Description
clazz Constructor.<M>

The constructor of the related model class

cascadeOptions CascadeMetadata <optional>
DefaultCascade

Options for cascading operations (create, update, delete)

populate boolean <optional>
true

If true, automatically populates the relationship when the model is retrieved

See:

View Source model/decorators.ts, line 375

A decorator function that can be applied to a class property

function
Example
```typescript
class Book extends BaseModel {
  

# oneToMany(clazz, cascadeOptionsopt, populateopt) → {function}

Decorator that establishes a one-to-many relationship between the current model and multiple instances of another model

Defines a one-to-many relationship between models

Parameters:
Name Type Attributes Default Description
clazz Constructor.<M>

The constructor of the related model class

cascadeOptions CascadeMetadata <optional>
DefaultCascade

Options for cascading operations (create, update, delete)

populate boolean <optional>
true

If true, automatically populates the relationship when the model is retrieved

See:

View Source model/decorators.ts, line 255

A decorator function that can be applied to a class property

function
Example
```typescript
class Author extends BaseModel {
  

# oneToOne(clazz, cascadeOptionsopt, populateopt) → {function}

Decorator that establishes a one-to-one relationship between the current model and another model

Defines a one-to-one relationship between models

Parameters:
Name Type Attributes Default Description
clazz Constructor.<M>

The constructor of the related model class

cascadeOptions CascadeMetadata <optional>
DefaultCascade

Options for cascading operations (create, update, delete)

populate boolean <optional>
true

If true, automatically populates the relationship when the model is retrieved

See:

View Source model/decorators.ts, line 198

A decorator function that can be applied to a class property

function
Example
```typescript
class User extends BaseModel {
  

# pk(opts) → {PropertyDecorator}

Marks a property as the model's primary key with automatic sequence generation This decorator combines multiple behaviors: it marks the property as unique, required, and ensures the index is created properly according to the provided sequence options.

Primary Key Decorator

Parameters:
Name Type Description
opts Omit.<SequenceOptions, ("cycle"|"startWith"|"incrementBy")>

Options for the sequence generation

View Source identity/decorators.ts, line 121

A property decorator that can be applied to model properties

PropertyDecorator
Example
```typescript
class User extends BaseModel {
  

# pkOnCreate(context, data, key, model) → {Promise.<void>}

Handles the creation of primary key values for models using sequences

Callback function for primary key creation

sequenceDiagram participant Model participant pkOnCreate participant Adapter participant Sequence Model->>pkOnCreate: Call with model instance Note over pkOnCreate: Check if key already exists alt Key exists or no type specified pkOnCreate-->>Model: Return early else Key needs to be created pkOnCreate->>pkOnCreate: Generate sequence name if not provided pkOnCreate->>Adapter: Request Sequence(data) Adapter->>Sequence: Create sequence Sequence-->>pkOnCreate: Return sequence pkOnCreate->>Sequence: Call next() Sequence-->>pkOnCreate: Return next value pkOnCreate->>Model: Set primary key value end
Parameters:
Name Type Description
context Context.<F>

The execution context

data V

The sequence options

key

The property key to set as primary key

model M

The model instance

View Source identity/decorators.ts, line 9

A promise that resolves when the primary key is set

Promise.<void>

# relation() → {function}

Decorator that specifies the model property as a relation in the database

Specifies the model property as a relation

View Source model/decorators.ts, line 451

A decorator function that can be applied to a class property

function

# repository(model, flavouropt) → {any}

Creates and registers a repository for a model class. Can be used as both a property decorator and a class decorator.

Repository decorator for model classes.

sequenceDiagram participant C as Client Code participant D as Decorator participant R as Repository participant M as Metadata C->>D: Apply @repository(Model) alt Property Decorator D->>D: Check if propertyKey exists D->>+C: Return inject(name) decorator else Class Decorator D->>M: Set repository metadata on model D->>R: Register model with Repository D->>+C: Return injectable decorator with config C->>C: Define DBKeys.CLASS property end
Parameters:
Name Type Attributes Description
model Constructor.<T>

The constructor of the model class.

flavour string <optional>

the required adapter's flavour/alias. If not provided, it will be retrieved from the model metadata..

View Source repository/decorators.ts, line 9

  • The decorator function.
any

# table(opts) → {function}

Decorator that sets the table name for a model class in the database

Specifies the database table name for a model

Parameters:
Name Type Description
opts string

The name of the table in the database

View Source model/decorators.ts, line 10

A decorator function that can be applied to a class

function

# unique() → {function}

Decorator that ensures a property value is unique across all instances of a model in the database

Tags a property as unique

View Source model/decorators.ts, line 77

A decorator function that can be applied to a class property

function
Example
```typescript
class User extends BaseModel {
  

# updatedBy() → {function}

Decorator that marks a property to store the identifier of the user who last updated the model instance

Tracks the last updater of a model instance

View Source model/decorators.ts, line 153

A decorator function that can be applied to a class property

function
Example
```typescript
class Document extends BaseModel {
  

# uuidCreateUpdateHandler(context, data, key, model) → {Promise.<void>}

Updates a model property with the current timestamp from the repository context.

Handler function that sets a timestamp property to the current timestamp.

Parameters:
Name Type Description
context C

The repository context containing the current timestamp

data V

The data being processed

key

The property key to update

model M

The model instance being updated

View Source persistence/decorators.ts, line 7

A promise that resolves when the timestamp has been set

Promise.<void>

Type Definitions

object

# JoinColumnOptions

Describes join column options.

Describes join column options.

Properties:
Name Type Attributes Description
name string <optional>

Name of the column.

referencedColumnName string <optional>

Name of the column in the entity to which this column is referenced.

foreignKeyConstraintName string <optional>

Name of the foreign key constraint.

View Source model/types.ts, line 7

object

# TaskErrorFrom

Generic type that preserves the original error type while adding task-specific properties.

Generic type that preserves the original error type while adding task-specific properties. Use this to type errors from TaskTracker.resolve() and TaskTracker.wait().

The original error is preserved (e.g., ValidationError stays ValidationError), with the nextAction property added to identify the appropriate response:

  • TaskStatus.CANCELED: Task was explicitly canceled
  • TaskStatus.SCHEDULED: Task was rescheduled
  • TaskStatus.WAITING_RETRY: Task is waiting for retry
  • TaskStatus.FAILED: Task has permanently failed

View Source tasks/TaskErrors.ts, line 74

Example
```typescript
try {
  await tracker.resolve();
} catch (error: unknown) {
  if (isTaskError<ValidationError>(error, ValidationError)) {
    // error is typed as TaskErrorFrom<ValidationError>
    console.log(error.nextAction); // TaskNextAction
    console.log(error.code);       // ValidationError's code property
  }
}
```
object

# TaskErrorProps

Additional properties added to errors from TaskTracker.resolve() and TaskTracker.wait()

.

Additional properties added to errors from TaskTracker.resolve() and TaskTracker.wait()

Properties:
Name Type Attributes Description
nextAction TaskNextAction

The next action to take in response to this error

taskId string <optional>

The task ID this error relates to (optional, present on TaskControlError)

details TaskErrorModel <optional>

Additional error details (optional, present on TaskControlError)

meta Record.<string, any> <optional>

Additional metadata (optional, present on TaskControlError)

View Source tasks/TaskErrors.ts, line 66

TaskStatus.CANCELED | TaskStatus.WAITING_RETRY | TaskStatus.SCHEDULED | TaskStatus.FAILED

# TaskNextAction

Represents the next action to take after a task error.

Represents the next action to take after a task error. Used to identify the appropriate response to task failures.

View Source tasks/TaskErrors.ts, line 61