every-plugin
Version:
53 lines • 2.06 kB
text/typescript
import { LoadedPluginWithBinding } from "../plugin.cjs";
import { EveryPlugin, InferRegistryFromEntries, PluginRegistry, PluginRegistryEntry, PluginRuntimeConfig, RegisteredPlugins } from "../types.cjs";
import { PluginRuntime } from "../runtime/index.cjs";
//#region src/testing/index.d.ts
type PluginMap = Record<string, LoadedPluginWithBinding<any, any, any, any>>;
/**
* Simplified type inference for local plugin maps.
* Just use the constructor types directly.
*
* @example
* ```ts
* const pluginMap = { "my-plugin": MyPlugin } as const;
* type MyBindings = InferBindingsFromMap<typeof pluginMap>;
* ```
*/
type InferBindingsFromMap<T extends PluginMap> = { [K in keyof T]: T[K] };
/**
* Creates a plugin runtime for locally available plugins (non-remote).
* Automatically infers type bindings from the plugin map, eliminating
* the need for manual RegistryBindings definitions.
*
* @deprecated Use `createPluginRuntime` with module entries directly instead.
* @example
* ```ts
* // Old API (deprecated)
* const runtime = createLocalPluginRuntime(
* { registry: { "my-plugin": { remoteUrl: "..." } }, secrets },
* { "my-plugin": MyPlugin }
* );
*
* // New API (recommended)
* const runtime = createPluginRuntime({
* registry: { "my-plugin": { module: MyPlugin } },
* secrets
* });
* ```
*/
declare function createLocalPluginRuntime<TMap extends PluginMap>(config: {
registry: Record<string, {
remoteUrl: string;
version?: string;
description?: string;
}>;
secrets?: Record<string, string>;
options?: any;
}, pluginMap: TMap): PluginRuntime<InferRegistryFromEntries<Record<keyof TMap, PluginRegistryEntry>>>;
/**
* @deprecated Use `createLocalPluginRuntime` or `createPluginRuntime` instead.
*/
declare const createTestPluginRuntime: typeof createLocalPluginRuntime;
//#endregion
export { type EveryPlugin, InferBindingsFromMap, PluginMap, type PluginRegistry, type PluginRuntimeConfig, type RegisteredPlugins, createLocalPluginRuntime, createTestPluginRuntime };
//# sourceMappingURL=index.d.cts.map