import { a as IsolateStatus, i as TIsolate, n as IsolateKey, o as IsolateKeys, r as IsolatePayload, t as Isolate } from "./Isolate-C-a7xY5w.cjs"; import { t as IsolateSerializer } from "./IsolateSerializer-CbPmwndf.cjs"; import * as vest_utils0 from "vest-utils"; import { BusType, CB, DynamicValue, Maybe, Nullable, Nullish, OneOrMoreOf, Result, TinyState } from "vest-utils"; //#region rolldown:runtime //#endregion //#region src/RuntimeEvents.d.ts type RuntimeEvents = { ASYNC_ISOLATE_DONE: TIsolate; ISOLATE_DONE: TIsolate; ISOLATE_ENTER: TIsolate; ISOLATE_PENDING: TIsolate; ISOLATE_RECONCILED: TIsolate; }; //#endregion //#region src/Reconciler.d.ts interface IReconciler { (currentNode: I, historyNode: I): Nullable; } declare class Reconciler { /** * Reconciles the current isolate with the history isolate. * If the current isolate is of a different type than the history isolate, * the current isolate is returned. * Otherwise, the reconciler function is called to determine the next isolate. * If the reconciler function returns null or undefined, the base reconciler is used. * If no history isolate exists, the current isolate is returned. * @param node The current isolate to reconcile. * @returns The next isolate after reconciliation. */ static reconcile(node: TIsolate): TIsolate; static dropNextNodesOnReorder(reorderLogic: (newNode: I, prevNode: Maybe) => boolean, newNode: I, prevNode: Maybe): boolean; static handleIsolateNodeWithKey(node: TIsolate, revoke: ((node: I) => boolean) | false): TIsolate; } declare namespace IsolateWalker_d_exports { export { closest, closestExists, every, find, findAll, findClosest, has, mapFirst, pluck, reduce, some, walk }; } type VisitOnlyPredicate = (isolate: TIsolate) => boolean; /** * Walks the isolate tree starting from the given node. * @param startNode - The starting node for the traversal. * @param callback - The callback function to be called for each visited node. * @param visitOnly - Optional predicate to filter which nodes to visit. */ declare function walk(startNode: TIsolate, callback: (isolate: TIsolate) => Result, visitOnly?: VisitOnlyPredicate): Result; /** * Reduces the isolate tree to a single value. * @param startNode - The starting node for the traversal. * @param callback - The reducer function. * @param initialValue - The initial value for the accumulator. * @param visitOnly - Optional predicate to filter which nodes to visit. * @returns The final accumulated value. */ declare function reduce(startNode: TIsolate, callback: (acc: T, isolate: TIsolate) => Result, initialValue: T, visitOnly?: VisitOnlyPredicate): T; /** * Checks if any node in the tree satisfies the predicate. * @param startNode - The starting node for the traversal. * @param predicate - The predicate function to test each node. * @param visitOnly - Optional predicate to filter which nodes to visit. * @returns True if any node satisfies the predicate, false otherwise. */ declare function some(startNode: TIsolate, predicate: (node: TIsolate) => boolean, visitOnly?: VisitOnlyPredicate): boolean; /** * Checks if the tree contains a node that matches the predicate. * @param startNode - The starting node for the traversal. * @param match - The predicate function to match nodes. * @returns True if a matching node is found, false otherwise. */ declare function has(startNode: TIsolate, match: VisitOnlyPredicate): boolean; /** * Traverses up the tree to find the closest ancestor that satisfies the predicate, * then returns the first direct descendant of that ancestor that satisfies the predicate. * @param startNode - The starting node. * @param predicate - The predicate to match. * @returns The found node or null. */ declare function findClosest(startNode: TIsolate, predicate: (node: TIsolate) => boolean): Nullable; /** * Finds the first node in the tree that satisfies the predicate. * @param startNode - The starting node. * @param predicate - The predicate to match. * @param visitOnly - Optional predicate to filter which nodes to visit. * @returns The found node or null. */ declare function find(startNode: TIsolate, predicate: (node: TIsolate) => boolean, visitOnly?: VisitOnlyPredicate): Nullable; /** * Finds all nodes in the tree that satisfy the predicate. * @param startNode - The starting node. * @param predicate - The predicate to match. * @param visitOnly - Optional predicate to filter which nodes to visit. * @returns An array of found nodes. */ declare function findAll(startNode: TIsolate, predicate: (node: TIsolate) => boolean, visitOnly?: VisitOnlyPredicate): TIsolate[]; /** * Checks if every node in the tree satisfies the predicate. * @param startNode - The starting node. * @param predicate - The predicate to match. * @param visitOnly - Optional predicate to filter which nodes to visit. * @returns True if all nodes satisfy the predicate, false otherwise. */ declare function every(startNode: TIsolate, predicate: (node: TIsolate) => boolean, visitOnly?: VisitOnlyPredicate): boolean; /** * Removes nodes from the tree that satisfy the predicate. * @param startNode - The starting node. * @param predicate - The predicate to match nodes to remove. * @param visitOnly - Optional predicate to filter which nodes to visit. */ declare function pluck(startNode: TIsolate, predicate: (node: TIsolate) => boolean, visitOnly?: VisitOnlyPredicate): void; /** * Finds the closest ancestor of the startNode that satisfies the predicate. * @param startNode - The starting node. * @param predicate - The predicate to match. * @returns The found ancestor or null. */ declare function closest(startNode: TIsolate, predicate: (node: TIsolate) => boolean): Nullable; /** * Checks if an ancestor satisfying the predicate exists. * @param startNode - The starting node. * @param predicate - The predicate to match. * @returns True if such an ancestor exists, false otherwise. */ declare function closestExists(startNode: TIsolate, predicate: (node: TIsolate) => boolean): boolean; /** * Traverses the tree and returns the first non-nullish value returned by the callback. * It optimizes traversal by only visiting nodes that have pending isolates or are pending themselves. */ declare function mapFirst(startNode: TIsolate, callback: (isolate: TIsolate, breakout: (value: T) => void) => void): T | null; //#endregion //#region src/Orchestrator/RuntimeStates.d.ts declare enum RuntimeState { PENDING = "PENDING", STABLE = "STABLE", } //#endregion //#region src/VestRuntime.d.ts type CTXType = StateRefType & { historyNode: Nullable; runtimeNode: Nullable; runtimeRoot: Nullable; stateRef: StateRefType; }; /** * The state reference type for the Vest runtime. * Holds all mutable state for the runtime instance. */ type StateRefType = { Bus: BusType; appData: Record; historyRoot: TinyState>; Reconciler: IReconciler; implicitOnlyNodes: Set; }; /** * Retrieves the current runtime state (e.g., STABLE, PENDING). */ declare function useRuntimeState(): RuntimeState; /** * Checks if the runtime is currently stable (no pending tests). */ declare function useIsStable(): boolean; /** * Retrieves the application-specific data stored in the runtime. */ declare function useXAppData(): T; /** * Creates a new state reference for such as the history root, pending isolates, and the current runtime state. */ declare function createRef(Reconciler: IReconciler, setter: DynamicValue>): StateRefType; /** * Dispatches a runtime event to the internal Bus. * This is used to trigger state changes and notifications. */ declare function dispatch(event: RuntimeEvents[T] extends void ? { type: T; payload?: void; } : { type: T; payload: RuntimeEvents[T]; }): void; /** * Registers an isolate as pending. * This is used to track async tests and other async operations. */ declare function registerPending(isolate: TIsolate): void; /** * Removes an isolate from the pending set. * This is used when an async test or operation completes. */ declare function removePending(isolate: TIsolate): void; /** * Persists the current runtime context to a callback function. * This allows the callback to be executed later (e.g. in an async operation) * while still having access to the correct runtime context. */ declare function persist any>(cb: T): T; /** * Retrieves the history root state. */ declare function useHistoryRoot(): [value: Nullable, setValue: (next: Nullable | vest_utils0.CB, [prev: Nullable]>) => void, resetValue: () => void]; /** * Sets the history root for the runtime. * This is used to hydrate the runtime with previous results. */ declare function useSetHistoryRoot(history: TIsolate): void; /** * Retrieves the current cursor position within the active isolate. */ declare function useCurrentCursor(): number; /** * Adds a child isolate to the current isolate and sets the parent-child relationship. */ declare function useSetNextIsolateChild(child: TIsolate): void; /** * Returns the available root isolate. * If a runtime root exists (i.e. we are currently running a suite), it returns that. * Otherwise, it returns the history root (i.e. the result of the last run). */ declare function useAvailableRoot(): I; /** * Checks whether a specific key is heavily focused out. */ declare function useIsFocusedOut(key?: string): boolean; declare function hasImplicitOnly(): boolean; /** * Resets the history root. */ declare function reset(): void; declare const RuntimeApi: { Run: (value: Partial, fn: () => R) => R; createRef: typeof createRef; dispatch: typeof dispatch; hasImplicitOnly: typeof hasImplicitOnly; persist: typeof persist; registerPending: typeof registerPending; removePending: typeof removePending; reset: typeof reset; useAvailableRoot: typeof useAvailableRoot; useCurrentCursor: typeof useCurrentCursor; useHistoryRoot: typeof useHistoryRoot; useIsFocusedOut: typeof useIsFocusedOut; useIsStable: typeof useIsStable; useRuntimeState: typeof useRuntimeState; useSetHistoryRoot: typeof useSetHistoryRoot; useSetNextIsolateChild: typeof useSetNextIsolateChild; useXAppData: typeof useXAppData; }; //#endregion //#region src/Isolate/IsolateInspector.d.ts declare class IsolateInspector { static at(isolate: Nullable, at: number): Nullable; static cursor(isolate: Nullable): number; static canReorder(isolate: Nullable): boolean; static allowsReorder>(isolate: Nullable): boolean; static usesKey(isolate: Nullable): boolean; static getChildByKey(isolate: Nullable, key: string): Nullable; static getStatus(isolate: Nullable): IsolateStatus; static statusEquals(isolate: Nullable, status: IsolateStatus): boolean; static isPending(isolate: Nullable): boolean; static isHasPending(isolate: Nullable): boolean; static hasPending(isolate: Nullable): boolean; static hasActiveChildren(isolate: Nullable): boolean; static getParent(isolate: Nullable): Nullable; } //#endregion //#region src/Isolate/IsolateMutator.d.ts declare class IsolateMutator { static setParent(isolate: TIsolate, parent: Nullable): TIsolate; static saveOutput(isolate: TIsolate, output: any): TIsolate; static setKey(isolate: TIsolate, key: Nullable): TIsolate; static addChild(isolate: TIsolate, child: TIsolate): void; static removeChild(isolate: TIsolate, node: TIsolate): void; static addChildKey(isolate: TIsolate, key: string, node: TIsolate): void; static slice(isolate: TIsolate, at: number): void; static setData(isolate: TIsolate, data: any): void; static abort(isolate: TIsolate, reason?: string): void; static setStatus(isolate: TIsolate, status: IsolateStatus, payload?: any): Result; static setPending(isolate: TIsolate): void; static setHasPending(isolate: TIsolate): Result; static setDone(isolate: TIsolate): void; } declare namespace Bus_d_exports { export { useBus, useEmit, usePrepareEmitter }; } declare function useBus = RuntimeEvents>(): BusType; declare function useEmit = RuntimeEvents, T extends keyof E = keyof E>(event: T, ...args: E[T] extends void ? [payload?: E[T]] : [payload: E[T]]): void; declare function useEmit<_E extends Record = RuntimeEvents>(): (event: string, data?: any) => void; declare function usePrepareEmitter = RuntimeEvents, T extends keyof E = keyof E>(event: T): (arg: E[T]) => void; declare namespace IsolateSelectors_d_exports { export { isIsolateType, isSameIsolateIdentity, isSameIsolateType }; } declare function isIsolateType(node: Maybe, type: string): node is I; declare function isSameIsolateType(a: A, b: B): boolean; declare function isSameIsolateIdentity(a: A, b: B): boolean; //#endregion //#region src/Isolate/IsolateStateMachine.d.ts declare const IsolateStateMachine: vest_utils0.TStateMachineApi; declare namespace IsolateRegistry_d_exports { export { RegistryCategoryConfig, RegistryIndex, useClearRegistry, useGetFromRegistry, useHasFromRegistry, useRemoveFieldFromRegistry, useUpdateRegistry }; } /** * A registry index, mapping group keys (like field names) to sets of isolates. */ type RegistryIndex = Map>; /** * Configuration for a registry category. */ type RegistryCategoryConfig = { predicate: (isolate: TIsolate) => boolean; getKey: (isolate: TIsolate) => string; }; /** * Updates the registration of an isolate in all relevant indices based on provided predicates. * * @param isolate - The isolate node to update. * @param predicates - A record of category keys and their corresponding predicate configurations. */ declare function useUpdateRegistry(isolate: TIsolate, predicates: Record): void; /** * Retrieves isolates from the registry based on a category and an optional key. */ declare function useGetFromRegistry(category: string, key?: string): Set; /** * Checks if the registry contains any isolates for a given category and optional key. */ declare function useHasFromRegistry(category: string, key?: string): boolean; /** * Removes all entries for a specific key from the registry. */ declare function useRemoveFieldFromRegistry(key: string): void; /** * Clears all registry entries from the root isolate. */ declare function useClearRegistry(root: TIsolate): void; //#endregion //#region src/Isolate/IsolateReorderable.d.ts declare function IsolateReorderable>(callback: CB, type?: string, payload?: Payload): TIsolate; //#endregion //#region src/Isolate/IsolateTransient.d.ts /** * Creates a transient isolate. * * Transient isolates are isolates that: * 1. Do not persist in the history tree. * 2. Are not reconciled with previous runs. * 3. Do not appear in the serialized suite dump. * 4. Do not interfere with the index of their siblings (they are skipped by the reconciler). * * This is useful for "structural" isolates that are used for control flow or grouping * but do not hold state that needs to be preserved between runs, such as `focused` (skip/only) isolates. */ declare function IsolateTransient(callback: CB, type?: string, payload?: Payload): TIsolate; //#endregion //#region src/Isolate/IsolateFocused.d.ts declare enum FocusModes { SKIP = "skip", ONLY = "only", } type FocusMatchExclusion = Maybe>; type TIsolateFocused = TIsolate; type IsolateFocusedPayload = { focusMode: FocusModes; match: FocusMatchExclusion; matchAll: boolean; }; /** * Creates a focused isolate. * Focused isolates are transient because they only affect the current run * and do not need to be preserved in history or appearing in the suite result. */ declare function IsolateFocused(focusMode: FocusModes, match?: true | FocusMatchExclusion): TIsolateFocused | undefined; declare class FocusSelectors { static isSkipFocused(focus: Nullish, fieldName?: string): boolean; static isOnlyFocused(focus: Nullish, fieldName?: string): boolean; static isIsolateFocused(isolate: TIsolate): isolate is TIsolateFocused; } //#endregion export { Bus_d_exports as Bus, FocusModes, FocusSelectors, type IReconciler, Isolate, IsolateFocused, IsolateInspector, type IsolateKey, IsolateKeys, IsolateMutator, IsolateRegistry_d_exports as IsolateRegistry, IsolateReorderable, IsolateSelectors_d_exports as IsolateSelectors, IsolateSerializer, IsolateStateMachine, IsolateStatus, IsolateTransient, Reconciler, type RegistryCategoryConfig, type RegistryIndex, type RuntimeEvents, type TIsolate, type TIsolateFocused, RuntimeApi as VestRuntime, IsolateWalker_d_exports as Walker }; //# sourceMappingURL=vestjs-runtime.d.cts.map