inversify#BindingScopeEnum TypeScript Examples

The following examples show how to use inversify#BindingScopeEnum. 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: inversify.config.ts    From nr-apm-stack with Apache License 2.0 5 votes vote down vote up
/**
 * Create the container
 * @returns The container
 */
function create(): Container {
  const myContainer = new Container({defaultScope: BindingScopeEnum.Singleton});
  myContainer.bind<LoggerService>(TYPES.LoggerService).to(LoggerConsoleService);
  myContainer.bind<EcsTransformService>(TYPES.EcsTransformService).to(EcsTransformService);
  myContainer.bind<FieldExtractorService>(TYPES.FieldExtractorService).to(FieldExtractorService);
  myContainer.bind<GeoIpService>(TYPES.GeoIpService).to(GeoIpMaxmindService);
  myContainer.bind<MaxmindCityLookupService>(TYPES.MaxmindCityLookupService).to(MaxmindCityLookupService);
  myContainer.bind<MaxmindAsnLookupService>(TYPES.MaxmindAsnLookupService).to(MaxmindAsnLookupService);
  myContainer.bind<AwsHttpClientService>(TYPES.AwsHttpClientService).to(AwsHttpClientService);
  myContainer.bind<OpenSearchService>(TYPES.OpenSearchService)
    .to(OpenSearchPostService).whenNoAncestorTagged('localhost', true);
  myContainer.bind<OpenSearchService>(TYPES.OpenSearchService)
    .to(OpenSearchDummyService).whenAnyAncestorTagged('localhost', true);
  myContainer.bind<KinesisStreamRecordMapperService>(TYPES.KinesisStreamRecordMapperService)
    .to(KinesisStreamRecordMapperService);
  myContainer.bind<KinesisStreamService>(TYPES.KinesisStreamService).to(KinesisStreamService);
  myContainer.bind<KinesisStreamWrapperService>(TYPES.KinesisStreamWrapperService).to(KinesisStreamWrapperService);

  myContainer.bind<DateAndTimeService>(TYPES.DateAndTimeService).to(DateAndTimeService);
  myContainer.bind<RegexService>(TYPES.RegexService).to(RegexService);
  myContainer.bind<SubsetService>(TYPES.SubsetService).to(SubsetService);

  // Stage: PreInit
  myContainer.bind<Parser>(TYPES.PreInitParser).to(KeyAsPathParser);

  // Stage: Init
  myContainer.bind<Parser>(TYPES.InitParser).to(KinesisParser);

  // Stage: PreParse
  myContainer.bind<Parser>(TYPES.PreParser).to(ApacheParser);
  myContainer.bind<Parser>(TYPES.PreParser).to(TomcatParser);
  myContainer.bind<Parser>(TYPES.PreParser).to(RenameParser);

  // Stage: Parse
  myContainer.bind<Parser>(TYPES.Parser).to(DeslashParser);
  myContainer.bind<Parser>(TYPES.Parser).to(EnvironmentStandardizeParser);
  myContainer.bind<Parser>(TYPES.Parser).to(HttpStatusEventOutcomeParser);
  myContainer.bind<Parser>(TYPES.Parser).to(IpvParser);
  myContainer.bind<Parser>(TYPES.Parser).to(JoinKvParser);
  myContainer.bind<Parser>(TYPES.Parser).to(GeoIpParser);
  myContainer.bind<Parser>(TYPES.Parser).to(UserAgentParser);
  myContainer.bind<Parser>(TYPES.Parser).to(UrlExplodeParser);
  myContainer.bind<Parser>(TYPES.Parser).to(ApplicationClassificationParser);
  myContainer.bind<Parser>(TYPES.Parser).to(ThreatPhpParser);

  // Stage: Post Parse
  myContainer.bind<Parser>(TYPES.PostParser).to(HashParser);

  // Stage: FINALIZE
  myContainer.bind<Parser>(TYPES.FinalizeParser).to(TimestampFieldParser);
  myContainer.bind<Parser>(TYPES.FinalizeParser).to(TimestampGuardParser);
  myContainer.bind<Parser>(TYPES.FinalizeParser).to(DocumentIndexParser);
  myContainer.bind<Parser>(TYPES.FinalizeParser).to(DocumentIdParser);
  myContainer.bind<Parser>(TYPES.FinalizeParser).to(RemoveMetadataParser);

  return myContainer;
}