import { Logger } from '@terascope/core-utils'; import { OpAPI, Context, ExecutionConfig } from '../interfaces/index.js'; import { Observer, APIConstructor } from '../operations/index.js'; import { JobAPIInstances } from './interfaces.js'; export interface MetadataFns { update: (exId: string, metadata: Record) => Promise; get: (exId: string) => Promise>; } /** * A utility API exposed on the Terafoundation Context APIs. * The following functionality is included: * - Registering Operation API * - Creating an API (usually done from an Operation), * it also includes attaching the API to the Execution LifeCycle. * An API will only be created once. * - Getting a reference to an API */ export declare class ExecutionContextAPI { private readonly _apis; private readonly _context; private readonly _events; private readonly _executionConfig; private readonly _logger; constructor(context: Context, executionConfig: ExecutionConfig); /** For backwards compatibility */ get registry(): Record; get apis(): Readonly; registerMetadataFns(fns: MetadataFns): void; /** Add an API constructor to the registry */ addToRegistry(name: string, API: APIConstructor): void; /** * Get a reference to a specific operation API, * the must be initialized and created */ getObserver(name: string): T; /** * Get a reference to a specific operation API, * the must be initialized and created */ getAPI(name: string): T; /** * Create an instance of the API * * @param name the name of API to create * @param params any additional options that the API may need */ initAPI(name: string, ...params: any[]): Promise; makeLogger(moduleName: string, extra?: Record): Logger; /** * Update metadata on the execution context * Only update the metadata after the execution has been initialized */ setMetadata(key: string, value: unknown): Promise; getMetadata(key?: string): Promise>; private _updateMetadata; private _getMetadata; } //# sourceMappingURL=api.d.ts.map