API Reference

index-value-accessor

API entries in this module: 26

Current index-value-accessor implementation

IndexValueAccessor is the default IIndexValueAccessor service. It receives all registered accessor strategies from IIndexValueAccessorList, sorts them by priority (highest first), and delegates each operation to the first strategy whose applies(context, index) returns true.

In RsXCoreModule, the default strategy order is: PropertyValueAccessor (7), MethodAccessor (6), ArrayIndexAccessor (5), MapKeyAccessor (4), SetKeyAccessor (3), ObservableAccessor (2), PromiseAccessor (1), DatePropertyAccessor (0), GlobalIndexAccessor (-1).

For async wrappers, getValue returns the raw Promise/Observable, while getResolvedValue returns the latest cached resolved/emitted value when available, otherwise PENDING. If no accessor can handle a context/index pair, the service throws NoAccessorFoundExeception.

Example: use IIndexValueAccessor

import {
  InjectionContainer,
  RsXCoreInjectionTokens,
  RsXCoreModule,
  type IIndexValueAccessor,
} from '@rs-x/core';

await InjectionContainer.load(RsXCoreModule);

const accessor = InjectionContainer.get<IIndexValueAccessor>(
  RsXCoreInjectionTokens.IIndexValueAccessor,
);

const model = {
  user: { name: 'Ada' },
  list: [10, 20, 30],
  map: new Map([['x', 99]]),
};

const name = accessor.getValue(model.user, 'name');
const second = accessor.getValue(model.list, 1);
const mapped = accessor.getValue(model.map, 'x');

How to extend or modify

To customize behavior, override IIndexValueAccessorList with your own ordered strategy list. Put special-case accessors near the top and generic catch-all accessors near the bottom, because the first matching accessor is the one that gets used.

Override accessor strategy list

import {
  ArrayIndexAccessor,
  ContainerModule,
  InjectionContainer,
  overrideMultiInjectServices,
  PropertyValueAccessor,
  RsXCoreInjectionTokens,
  RsXCoreModule,
  type IMultiInjectService,
} from '@rs-x/core';

await InjectionContainer.load(RsXCoreModule);

const customAccessorList: IMultiInjectService[] = [
  { target: PropertyValueAccessor, token: RsXCoreInjectionTokens.IPropertyValueAccessor },
  { target: ArrayIndexAccessor, token: RsXCoreInjectionTokens.IArrayIndexAccessor },
  // add your custom accessor(s) here
];

const module = new ContainerModule((options) => {
  overrideMultiInjectServices(
    options,

Module API entries