feat: Implement Plugin Marketplace Manager and Client

- Added PluginMarketplaceManager to coordinate marketplace reads and manage installed plugins.
- Introduced PluginMarketplaceClient for fetching marketplace metadata.
- Implemented storage management for installed plugins using MemoryStorage.
- Added methods for installing, uninstalling, and enabling/disabling plugins.
- Created type definitions for PluginMarketplaceManager options and installed plugin records.
- Added support for fetching full marketplace catalog and individual plugin metadata.
- Included error handling for fetch operations and validation of plugin data.
- Updated index.browser.ts to export new modules and types.
This commit is contained in:
2026-04-19 01:03:58 +10:00
parent da18b7dfe5
commit dcc17946ef
22 changed files with 1018 additions and 44 deletions

53
dist/PluginMarketplaceClient.d.ts vendored Normal file
View File

@@ -0,0 +1,53 @@
import type { PluginIndex, PluginMetadata } from './types.js';
/**
* Minimal response shape required by marketplace client.
*/
export interface PluginMarketplaceResponse {
ok: boolean;
status: number;
json(): Promise<unknown>;
}
/**
* Fetch function used by marketplace client.
*/
export type PluginMarketplaceFetch = (input: string, init?: Record<string, unknown>) => Promise<PluginMarketplaceResponse>;
/**
* Construction options for {@link PluginMarketplaceClient}.
*/
export interface PluginMarketplaceClientOptions {
/** URL of marketplace index JSON file. */
indexUrl: string;
/** Base URL used to resolve `${pluginId}.json` metadata files. */
baseUrl: string;
/** Optional fetch implementation. Falls back to global `fetch`. */
fetchFn?: PluginMarketplaceFetch;
}
/**
* Host-agnostic client for reading marketplace metadata.
*/
export declare class PluginMarketplaceClient {
private readonly indexUrl;
private readonly baseUrl;
private readonly fetchFn?;
constructor(options: PluginMarketplaceClientOptions);
/**
* Fetches and validates marketplace index.
*/
fetchIndex(): Promise<PluginIndex>;
/**
* Fetches and validates single plugin metadata entry.
*
* @param pluginId - Identifier referenced by marketplace index.
*/
fetchPlugin(pluginId: string): Promise<PluginMetadata>;
/**
* Fetches full marketplace catalog.
*
* Entries that fail fetch or validation get skipped so host can still render
* rest of catalog.
*/
fetchPlugins(): Promise<PluginMetadata[]>;
private buildMetadataUrl;
private getFetchFn;
}
//# sourceMappingURL=PluginMarketplaceClient.d.ts.map