harmony-plugin-manager
Version:
A comprehensive TypeScript library for generating harmonious color palettes with WCAG 2.1 accessibility compliance
88 lines • 3.18 kB
TypeScript
/**
* Plugin Context Implementation
*
* Provides execution context for plugins with:
* - Access to pipeline context (execution ID, timing, logging)
* - Plugin-specific settings management
* - Shared state management between plugins
* - Warning and metadata management
*/
import type { PipelineContext } from 'harmony-pipeline';
import type { PluginContext, PluginSettings } from '../core/types';
export declare class PluginContextImpl<T extends Record<string, unknown> = Record<string, unknown>> implements PluginContext<T> {
private readonly baseContext;
private readonly pluginSettings;
private readonly _shared;
constructor(baseContext: PipelineContext<T>, pluginSettings: ReadonlyMap<string, PluginSettings>);
/** Unique identifier for this execution */
get executionId(): string;
/** Execution start timestamp */
get startTime(): number;
/** Execution metadata provided by caller */
get metadata(): Readonly<T>;
/** Logger instance for plugin output */
get logger(): import("harmony-pipeline").Logger;
/**
* Adds a warning to the execution context
* Warnings don't stop execution but are reported in results
*/
addWarning(code: string, message: string, details?: unknown): void;
/**
* Internal method to access warnings (used by pipeline)
*/
_getWarnings(): readonly import("harmony-pipeline").PipelineWarning[];
/** Read-only access to all plugin settings */
get settings(): ReadonlyMap<string, PluginSettings>;
/** Shared state map for inter-plugin communication */
get shared(): Map<string, unknown>;
/**
* Retrieves settings for a specific plugin
*
* @param pluginName - Name of plugin to get settings for
* @returns Plugin settings or undefined if not found
*/
getSettings(pluginName: string): PluginSettings | undefined;
/**
* Stores a value in shared state for other plugins to access
*
* @template V - Type of value being stored
* @param key - Unique key for the value
* @param value - Value to store
*/
share<V>(key: string, value: V): void;
/**
* Retrieves a value from shared state
*
* @template V - Expected type of the retrieved value
* @param key - Key of value to retrieve
* @returns Retrieved value or undefined if not found
*/
retrieve<V>(key: string): V | undefined;
/**
* Checks if a key exists in shared state
*
* @param key - Key to check for existence
* @returns True if key exists
*/
hasShared(key: string): boolean;
/**
* Removes a value from shared state
*
* @param key - Key of value to remove
* @returns True if value was removed, false if key didn't exist
*/
deleteShared(key: string): boolean;
/**
* Clears all shared state
* Useful for cleanup or isolation between executions
*/
clearShared(): void;
/**
* Gets all shared state keys
* Useful for debugging or state inspection
*
* @returns Array of all shared state keys
*/
getSharedKeys(): readonly string[];
}
//# sourceMappingURL=plugin-context.d.ts.map