import _ from 'lodash'; import { RawChainDefinition } from './actions'; import { ChainBuilderRuntime } from './runtime'; import { ChainBuilderContext } from './types'; import { PackageReference } from './package-reference'; import { ZodIssue } from 'zod'; import { AccessRecorderEngine } from './access-recorder'; type OutputClashCheckResult = { actions: string[]; output: string; }; export type ChainDefinitionProblems = { invalidSchema: ZodIssue[] | null; missing: { action: string; dependency: string; }[]; cycles: string[][]; extraneousDeps: { node: string; extraneous: string; inDep: string; }[]; outputClashes: OutputClashCheckResult[]; }; export type StateLayers = { [key: string]: { actions: string[]; depends: string[]; }; }; export declare function validatePackageName(n: string): void; export declare function validatePackageVersion(v: string): void; export declare class ChainDefinition { private raw; private sensitiveDependencies; readonly allActionNames: string[]; private _roots; private _leaves; private cachedLayers; readonly cachedActionDepths: Map; readonly dependencyFor: Map; readonly resolvedDependencies: Map; accessRecorderEngine: AccessRecorderEngine | null; readonly danglingDependencies: Set<`${string}:${string}`>; constructor(def: RawChainDefinition, sensitiveDependencies?: boolean); getName(ctx: ChainBuilderContext): any; getVersion(ctx: ChainBuilderContext): any; getPreset(ctx: ChainBuilderContext): any; getPackageRef(ctx: ChainBuilderContext): PackageReference; getDeployers(): `0x${string}`[]; isPublicSourceCode(): boolean; getConfig(n: string, ctx: ChainBuilderContext): any; /** * Used to determine if a state needs to be re-run or not * @param n action name * @param ctx context used to generate configuration for the action * @returns string representing the current state of the action */ getState(n: string, runtime: ChainBuilderRuntime, ctx: ChainBuilderContext, tainted: boolean): Promise; /** * Returns a list of imported cannon packages which would be needed to successfully build this package * @param ctx context used for interpolation * @returns list of required imported cannon charts */ getRequiredImports(ctx: ChainBuilderContext): { source: any; chainId: number; preset: any; }[]; /** * Get direct dependencies for a given node * @param node action to get dependencies for * @returns direct dependencies for the specified node */ computeDependencies(node: string): string[]; getDependencies(node: string): string[]; /** * @note deps returned in topological order * @returns all dependencies reachable from the specfied node, and the depth of the iteration required */ getDependencyTree: (node: string) => [string[], number]; initializeComputedDependencies: (() => void) & _.MemoizedFunction; get topologicalActions(): string[]; get roots(): Set; get leaves(): Set; checkAll(): ChainDefinitionProblems | null; checkOutputClash(actions?: string[]): OutputClashCheckResult[]; computePossibleNames(): void; /** * Checks for any dependency actions which aren't defined among the given list of dependencies to check * @param actions which actions to check for missing dependencies * @returns a list of missing dependencies */ checkMissing(actions?: string[]): { action: string; dependency: string; }[]; /** * Determines if the nodes reachable from the given list of actions have any cycles. * * If any cycles exist, an array of all the nodes involved in the cycle will be returned * * If more than one cycle exists, returns only the first one encountered. */ checkCycles(actions?: string[], seenNodes?: Set, currentPath?: Set): string[] | null; /** * Runs `checkExtraneousdependenciesOnNode` for all actions, effectively checking the whole * chain definition for any extraneous dependencies. * @note according to wikipidea, this is allegedly the fastest algorithm to verify a transitive reduction * @returns list of extraneous dependencies found */ checkExtraneousDependencies(): { node: string; extraneous: string; inDep: string; }[]; /** * Determines if the given node has any extraneous dependencies (that is, a dependency which is also contained in one of its children). * * If any extraneous dependencies are found, they are returned. * * @param node the node to start verifying from * @returns list of extraneous dependencies found */ checkExtraneousDependenciesOnNode(node: string): { node: string; extraneous: string; inDep: string; }[]; getLayerDependencyTree(n: string, layers: StateLayers): string[]; getStateLayers(): StateLayers; private getPrintLinesUsed; printPartialTopology(n: string, layers?: StateLayers, line?: number): string; /** * returns human-readable representation of the dag dependency graph of this chain definition * @returns array of lines to print */ printTopology(nodes?: string[]): string[]; toJson(): RawChainDefinition; } export {}; //# sourceMappingURL=definition.d.ts.map