Default implementation of PluginContext.

Implements

  • PluginContext

Accessors

Constructors

Methods

Properties

Accessors

  • get container(): Container

    Expose container as the minimal Container interface. PluginContext consumers only see the minimal interface.

    Returns Container

Constructors

Methods

  • Gets configuration for this plugin.

    Type Parameters

    • T = Record<string, unknown>

      The configuration type

    Returns T

    The plugin configuration

    const config = context.getConfig<DatabaseConfig>();
    console.log(config.host, config.port);
  • Gets a service from the container if it exists.

    Type Parameters

    • T

      The service type

    Parameters

    • name: string

      The service name

    Returns undefined | T

    The service instance if it exists, undefined otherwise

    const metrics = context.getService<Metrics>('metrics');
    if (metrics) {
    metrics.increment('database.connections');
    }

Properties

logger: Logger