Module: core/decorators-runtime
Runtime Utility Decorators
Summary
Utility decorators for runtime class enhancement
Table of contents
Functions
Functions
Cached
▸ Cached(options?): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor
Cached
- Cache method results with optional TTL
Parameters
| Name | Type | Description |
|---|---|---|
options? |
Object |
Cache configuration |
options.keyGenerator? |
(args: any[]) => string |
- |
options.ttl? |
number |
- |
Returns
fn
▸ (target, propertyKey, descriptor): PropertyDescriptor
Parameters
| Name | Type |
|---|---|
target |
any |
propertyKey |
string |
descriptor |
PropertyDescriptor |
Returns
PropertyDescriptor
Defined in
core/src/decorators-runtime.ts:11
Debounce
▸ Debounce(ms): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor
Debounce
- Debounce method calls
Parameters
| Name | Type | Description |
|---|---|---|
ms |
number |
Debounce delay in milliseconds |
Returns
fn
▸ (target, propertyKey, descriptor): PropertyDescriptor
Parameters
| Name | Type |
|---|---|
target |
any |
propertyKey |
string |
descriptor |
PropertyDescriptor |
Returns
PropertyDescriptor
Defined in
core/src/decorators-runtime.ts:242
Lifecycle
▸ Lifecycle(openMethod, closeMethod): (constructor: Function) => void
Lifecycle
- Track open/close state for stateful components
Parameters
| Name | Type | Description |
|---|---|---|
openMethod |
string |
Name of the open method |
closeMethod |
string |
Name of the close method |
Returns
fn
▸ (constructor): void
Parameters
| Name | Type |
|---|---|
constructor |
Function |
Returns
void
Defined in
core/src/decorators-runtime.ts:90
Measure
▸ Measure(label?): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor
Measure
- Performance monitoring for methods
Parameters
| Name | Type | Description |
|---|---|---|
label? |
string |
Optional label for logging |
Returns
fn
▸ (target, propertyKey, descriptor): PropertyDescriptor
Parameters
| Name | Type |
|---|---|
target |
any |
propertyKey |
string |
descriptor |
PropertyDescriptor |
Returns
PropertyDescriptor
Defined in
core/src/decorators-runtime.ts:40
Retry
▸ Retry(options?): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor
Retry
- Automatic retry on failure
Parameters
| Name | Type | Description |
|---|---|---|
options |
Object |
Retry configuration |
options.delay? |
number |
- |
options.maxAttempts? |
number |
- |
Returns
fn
▸ (target, propertyKey, descriptor): PropertyDescriptor
Parameters
| Name | Type |
|---|---|
target |
any |
propertyKey |
string |
descriptor |
PropertyDescriptor |
Returns
PropertyDescriptor
Defined in
core/src/decorators-runtime.ts:191
Synchronized
▸ Synchronized(): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor
Synchronized
- Prevent concurrent execution with queue
Returns
fn
▸ (target, propertyKey, descriptor): PropertyDescriptor
Parameters
| Name | Type |
|---|---|
target |
any |
propertyKey |
string |
descriptor |
PropertyDescriptor |
Returns
PropertyDescriptor
Defined in
core/src/decorators-runtime.ts:144
Throttle
▸ Throttle(ms): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor
Throttle
- Throttle method calls
Parameters
| Name | Type | Description |
|---|---|---|
ms |
number |
Minimum time between calls |
Returns
fn
▸ (target, propertyKey, descriptor): PropertyDescriptor
Parameters
| Name | Type |
|---|---|
target |
any |
propertyKey |
string |
descriptor |
PropertyDescriptor |
Returns
PropertyDescriptor
Defined in
core/src/decorators-runtime.ts:265
Timeout
▸ Timeout(ms): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor
Timeout
- Add timeout to async operations
Parameters
| Name | Type | Description |
|---|---|---|
ms |
number |
Timeout in milliseconds |
Returns
fn
▸ (target, propertyKey, descriptor): PropertyDescriptor
Parameters
| Name | Type |
|---|---|
target |
any |
propertyKey |
string |
descriptor |
PropertyDescriptor |
Returns
PropertyDescriptor
Defined in
core/src/decorators-runtime.ts:223
Transaction
▸ Transaction(): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor
Transaction
- Wrap database operations with transaction semantics
Returns
fn
▸ (target, propertyKey, descriptor): PropertyDescriptor
Parameters
| Name | Type |
|---|---|
target |
any |
propertyKey |
string |
descriptor |
PropertyDescriptor |
Returns
PropertyDescriptor
Defined in
core/src/decorators-runtime.ts:123
Validate
▸ Validate(validator): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor
Validate
- Input validation decorator
Parameters
| Name | Type | Description |
|---|---|---|
validator |
(args: any[]) => string | boolean |
Validation function returning true or error message |
Returns
fn
▸ (target, propertyKey, descriptor): PropertyDescriptor
Parameters
| Name | Type |
|---|---|
target |
any |
propertyKey |
string |
descriptor |
PropertyDescriptor |
Returns
PropertyDescriptor