Class

Operations

Operations()

Constructor

# new Operations()

Provides functionality for registering, retrieving, and managing database operation handlers

Static utility class for database operation management

classDiagram class Operations { -registry: OperationsRegistry +getHandlerName(handler) +key(str) +get(targetName, propKey, operation) -getOpRegistry() +register(handler, operation, target, propKey) } Operations --> OperationsRegistry : uses

View Source operations/Operations.ts, line 5

Example
// Register a handler for a create operation
Operations.register(myHandler, OperationKeys.CREATE, targetModel, 'propertyName');

// Get handlers for a specific operation
const handlers = Operations.get(targetModel.constructor.name, 'propertyName', 'onCreate');

Methods

# static get(targetName, propKey, operation) → {any}

Gets registered handlers from the operations registry for a given target, property, and operation

Retrieves operation handlers for a specific target and operation

Parameters:
Name Type Description
targetName string | Record.<string, any>

The target class name or object

propKey string

The property key to get handlers for

operation string

The operation key to get handlers for

View Source operations/Operations.ts, line 137

The registered handlers for the specified target, property, and operation

any

# static getHandlerName(handler) → {string}

Returns the name of the handler function or generates a hash if name is not available

Gets a unique name for an operation handler

Parameters:
Name Type Description
handler OperationHandler.<any, any, any, any, any>

The handler function to get the name for

View Source operations/Operations.ts, line 114

The name of the handler or a generated hash

string

# static key(str) → {string}

Creates a fully qualified metadata key by prefixing with the reflection namespace

Generates a reflection metadata key

Parameters:
Name Type Description
str string

The operation key string to prefix

View Source operations/Operations.ts, line 122

The fully qualified metadata key

string

# static register(handler, operation, target, propKey) → {void}

Adds a handler to the operations registry for a given target, property, and operation

Registers an operation handler for a specific target and operation

Parameters:
Name Type Description
handler OperationHandler.<V, any, any>

The handler function to register

operation OperationKeys

The operation key to register the handler for

target V

The target model instance

propKey string | symbol

The property key to register the handler for

View Source operations/Operations.ts, line 158

void