inversify#multiInject TypeScript Examples

The following examples show how to use inversify#multiInject. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ecs-transform.service.ts    From nr-apm-stack with Apache License 2.0 6 votes vote down vote up
/**
   * Constructor
   * @param parsers
   * @param logger
   */
  constructor(
    @multiInject(TYPES.PreInitParser) private preInitParsers: Parser[],
    @multiInject(TYPES.InitParser) private initParsers: Parser[],
    @multiInject(TYPES.PreParser) private preParsers: Parser[],
    @multiInject(TYPES.Parser) private parsers: Parser[],
    @multiInject(TYPES.PostParser) private postParsers: Parser[],
    @multiInject(TYPES.FinalizeParser) private finalizeParsers: Parser[],
    @inject(TYPES.KinesisStreamRecordMapperService) private ksrMapper: KinesisStreamRecordMapperService,
    @inject(TYPES.LoggerService) private logger: LoggerService,
  ) {}
Example #2
Source File: autowired.ts    From malagu with MIT License 6 votes vote down vote up
export function applyAutowiredDecorator(option: AutowiredOption, target: any, targetKey: string, index?: number,
    doInject: DoInject = ({ id, multi }, t: any, k, i) => multi ? multiInject(id!)(t, k, i) : inject(id!)(t, k, i),
    doGetValue: DoGetValue = ({ id, multi }, t, property) => multi ? ContainerUtil.getAll(id!) : ContainerUtil.get(id!)) {

    if (option.detached) {
        if (index !== undefined) {
            throw new Error(`The ${target.constructor.name} itself is not injected into the container, so the parameter injection of the constructor is not supported.`);
        }
        createAutowiredProperty(option, doGetValue, target, targetKey);
    } else {
        doInject(option, target, targetKey, index);

    }
    return option;
}
Example #3
Source File: index.ts    From The-TypeScript-Workshop with MIT License 5 votes vote down vote up
constructor(
    @multiInject(TYPES.Operator) private operators: Operator[],
    @inject(TYPES.Logger) @optional() private logger?: Logger
  ) {}
Example #4
Source File: index.ts    From The-TypeScript-Workshop with MIT License 5 votes vote down vote up
constructor(@multiInject(TYPES.Operator) private operators: Operator[]) {}