API Reference

dependency-injection

API entries in this module: 7

Current dependency-injection implementation

This module wraps and re-exports the DI runtime used by rs-x. It is based on Inversify and exposes rs-x-friendly helpers such as InjectionContainer, ContainerModule, decorator aliases (Injectable, Inject, MultiInject), and multi-bind helper functions.

The global InjectionContainer is a shared singleton container used across core, state-manager, and expression-parser modules.

How to extend or modify

Use ContainerModule plus registerMultiInjectServices or overrideMultiInjectServices to add or replace implementations for a multi-inject token list.

Example: register custom DI module

import {
  ContainerModule,
  Inject,
  Injectable,
  InjectionContainer,
  registerMultiInjectServices,
  RsXCoreInjectionTokens,
  type IIndexValueAccessor,
} from '@rs-x/core';

@Injectable()
class MyAccessor implements IIndexValueAccessor {
  public priority = 999;
  public getValue(context: unknown, index: unknown): unknown {
    return (context as Record<string, unknown>)[String(index)];
  }
}

const module = new ContainerModule((options) => {
  registerMultiInjectServices(options, RsXCoreInjectionTokens.IIndexValueAccessorList, [
    { target: MyAccessor, token: Symbol('MyAccessor') },
  ]);

Module API entries