Class

OperationsRegistry

OperationsRegistry()

Constructor

# new OperationsRegistry()

Manages and stores operation handlers for different model properties and operations

Registry for database operation handlers

classDiagram class OperationsRegistry { -cache: Record~string, Record~string|symbol, Record~string, Record~string, OperationHandler~~~~ +get(target, propKey, operation, accum) +register(handler, operation, target, propKey) }

View Source operations/OperationsRegistry.ts, line 3

Example
// Create a registry and register a handler
const registry = new OperationsRegistry();
registry.register(myHandler, OperationKeys.CREATE, targetModel, 'propertyName');

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

Methods

# get(target, propKey, operation, accumopt) → {Array.<OperationHandler>|undefined}

Finds all registered handlers for a given target, property, and operation, including from parent classes

Retrieves operation handlers for a specific target and operation

Parameters:
Name Type Attributes Description
target 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

accum Array.<OperationHandler> <optional>

Accumulator for recursive calls

View Source operations/OperationsRegistry.ts, line 115

Array of handlers or undefined if none found

Array.<OperationHandler> | undefined

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

Stores a handler in the registry for a given target, property, and operation

Registers an operation handler for a specific target and operation

Parameters:
Name Type Description
handler OperationHandler

The handler function to register

operation OperationKeys

The operation key to register the handler for

target M

The target model instance

propKey string | symbol

The property key to register the handler for

View Source operations/OperationsRegistry.ts, line 131

void