European Parliament MCP Server API - v1.0.1
    Preparing search index...

    Class DIContainer

    Dependency Injection Container Cyclomatic complexity: 5

    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    services: Map<symbol, ServiceDescriptor<unknown>> = ...

    Methods

    • Clear all registered services and cached instances.

      Useful for testing and cleanup between test suites.

      Returns void

      afterEach(() => {
      container.clear();
      });

      0.8.0

    • Check if a service is registered Cyclomatic complexity: 1

      Parameters

      • token: symbol

        Service identifier token

      Returns boolean

      true if the token is registered, false otherwise

      0.8.0

    • Register a service with the container Cyclomatic complexity: 1

      Type Parameters

      • T

      Parameters

      • token: symbol

        Service identifier token

      • factory: ServiceFactory<T>

        Factory function to create service instances

      • lifetime: ServiceLifetime = 'singleton'

        Service lifetime ('singleton' or 'transient')

      Returns void

      const ReportServiceToken = Symbol('ReportService');
      container.register(
      ReportServiceToken,
      (c) => new ReportService(c.resolve(EPClientToken)),
      'singleton'
      );

      0.8.0

    • Resolve a service from the container Cyclomatic complexity: 4

      Type Parameters

      • T

      Parameters

      • token: symbol

        Service identifier token

      Returns T

      Resolved service instance

      If service is not registered

      const reportService = container.resolve(ReportServiceToken);
      

      0.8.0