UNPKG

navskit

Version:

Deploy TypeScript logic on Ethereum. Includes core library, CLI tools, and utilities.

74 lines (73 loc) 2.3 kB
import * as child_process from 'child_process'; export interface PackageInfo { name: string; version: string; installPath: string; process?: child_process.ChildProcess; } export interface FunctionExecutionResult { success: boolean; result?: any; error?: string; } export declare class PackageManager { private packageCache; private cacheDir; constructor(cacheDir?: string); /** * Gets the cache key for a package name and version */ private getCacheKey; /** * Gets the installation directory for a package */ private getPackageDir; /** * Checks if a package is already cached */ isPackageCached(serviceName: string, serviceVersion: string): Promise<boolean>; /** * Downloads and installs a package to the cache */ downloadPackage(serviceName: string, serviceVersion: string): Promise<string>; /** * Creates a worker script for executing functions in the package */ private createWorkerScript; /** * Starts a worker process for a package */ startWorker(serviceName: string, serviceVersion: string): Promise<child_process.ChildProcess>; /** * Sends a message to a worker process and waits for response */ private sendWorkerMessage; /** * Gets a package, downloading it if necessary and starting worker if needed */ getPackage(serviceName: string, serviceVersion: string): Promise<PackageInfo>; /** * Lists functions available in a package */ listFunctions(serviceName: string, serviceVersion: string): Promise<Record<string, any>>; /** * Executes a function in a package */ executeFunction(serviceName: string, serviceVersion: string, functionName: string, encodedArgs: `0x${string}`, isConsensus?: boolean, consensusArgs?: any): Promise<any>; /** * Cleans up resources for a package */ cleanup(serviceName: string, serviceVersion: string): Promise<void>; /** * Clears all package cache and kills all worker processes */ clearCache(): Promise<void>; /** * Gets cache statistics */ getCacheStats(): { cachedPackages: number; activeWorkers: number; }; } export declare const packageManager: PackageManager;