import type { MetaTestcase, TestcaseDirectivesInterface, ReferenceDirectiveInterface } from '../model/index.js'; import type { NodeInterface, NodeDirectivesType } from './NodeInterface.js'; import { Reference } from './Reference.js'; import type { NodeGeneratorDirectiveInterface } from './NodeGeneratorDirectiveInterface.js'; import type { NodeReferenceDirectiveInterface } from './NodeReferenceDirectiveInterface.js'; import type { NodeStaticDirectiveInterface } from './NodeStaticDirectiveInterface.js'; import type { NodeFieldDirectiveInterface } from './NodeFieldDirectiveInterface.js'; /** * Options for initializing a Node. */ export interface NodeOptions { /** * Meta information for the test case associated with this node. */ testcaseMeta: MetaTestcase; /** * An optional initial set of directives for the node. */ directives?: TestcaseDirectivesInterface; /** * Indicates if this test case should never be executed. * Such test cases provide data only for other test cases. */ neverExecute?: boolean; /** * An array of tags associated with this test case. */ tags?: string[]; } /** * Represents a node in the data generation graph. * * When traversing the tables, a graph is built to represent the order in which data generation * should occur. This graph is composed of Node instances. Each Node stores its own directives, * references, and caching information for cloned nodes. */ export declare class Node implements NodeInterface { /** * Unique identifier for this node. */ instanceId: string; /** * If this node is created by a reference, stores the instanceId suffix of that reference. */ refInstanceId?: string; /** * Meta information for the test case associated with this node. */ testcaseMeta: MetaTestcase; /** * Indicates whether this test case should never be executed. * Such test cases are only used to provide data for other test cases. */ neverExecute: boolean; /** * An array of tags associated with this node. Tags are used for filtering. */ tags: string[]; /** * Maps field names to references. * Each entry associates a field name with its corresponding Reference object. */ references: Record; /** * Stores all the directives for this node. */ directives: TestcaseDirectivesInterface; /** * Temporary storage for aggregated directives. * This is built by the buildDirectives method. */ tmpDirectives?: NodeDirectivesType; /** * Caches references by their instanceId. */ refCache: Record; /** * Caches cloned nodes by the original node's instanceId. */ cloneRef: Record; /** * Caches generated instanceIds by instanceId suffix. */ instanceIdCache: Record; /** * Constructs a new Node instance. * * @param opts - Options for initializing the node, including test case meta information, directives, execution flag, and tags. */ constructor(opts: NodeOptions); /** * Gets the aggregated generator directives for this node. * * This method builds a local collection of directives by traversing this node's own directives * and any referenced nodes, then returns the generator-type directives. * * @returns An array of NodeGeneratorDirectiveInterface items. */ get generatorDirectives(): NodeGeneratorDirectiveInterface[]; /** * Gets the aggregated reference directives for this node. * * @returns An array of NodeReferenceDirectiveInterface items. */ get referenceDirectives(): NodeReferenceDirectiveInterface[]; /** * Gets the aggregated static directives for this node. * * @returns An array of NodeStaticDirectiveInterface items. */ get staticDirectives(): NodeStaticDirectiveInterface[]; /** * Gets the aggregated field directives for this node. * * @returns An array of NodeFieldDirectiveInterface items. */ get fieldDirectives(): NodeFieldDirectiveInterface[]; /** * Builds and caches a local collection of directives from this node and its references. * * This method initializes a temporary directives object and deep-copies the existing directives from this node. * It then traverses the node's references to aggregate additional directives. * The aggregated directives are stored in the tmpDirectives property. */ private buildDirectives; /** * Creates a unique instanceId for a reference directive. * * If the reference is a self-reference, it returns this node's instanceId. * Otherwise, if an instanceIdSuffix is provided and cached, it returns the cached value. * If not cached, it generates a new instanceId, caches it, and returns it. * * @param referenceCmd - The reference command containing instanceIdSuffix and other info. * @returns A unique instanceId for the reference. */ createReferenceInstanceId(referenceCmd: ReferenceDirectiveInterface): string; /** * Determines whether the given reference command represents a self-reference. * * A reference is considered self-referential if: * - The target test case name is undefined, empty, or equal to this node's test case name. * - The target table name is the same as this node's table name. * - No instanceIdSuffix is provided. * * @param referenceCmd - The reference command to evaluate. * @returns True if the reference is a self-reference; otherwise, false. */ isSelfReference(referenceCmd: ReferenceDirectiveInterface): boolean; /** * Adds a reference to this node. * * The reference is stored in the node's references mapping using its field name. * If the reference is a self-reference, its targetNode is set to this node. * For non-self references, if the node already exists in the cache, that node is used; * otherwise, the reference is cached. * * @param reference - The Reference object to add. */ addReference(reference: Reference): void; /** * Creates a clone of this node. * * If recursive cloning is enabled, the method clones all referenced nodes as well. * The cloned node's reference directives are cleared. * * @param recursive - If true, clones referenced nodes recursively; otherwise, only clones this node. * @returns A cloned Node instance. */ clone(recursive?: boolean): Node; /** * Retrieves a cloned node for the given node. * * If the node has already been cloned for this parent, returns the cached clone. * Otherwise, clones the node and caches it before returning. * * @param nodeToClone - The node to clone. * @returns A cloned NodeInterface instance. */ getCloneFor(nodeToClone: NodeInterface): NodeInterface; } //# sourceMappingURL=Node.d.ts.map