UNPKG

mahler

Version:

A automated task composer and HTN based planner for building autonomous system agents

36 lines (35 loc) 1.25 kB
import type { Operation, DiffOperation } from './operation'; import type { Target } from './target'; import type { ReadOnly } from './readonly'; /** * A diff is a function that allows to find a list of pending operations to a * target. */ export interface Distance<S> { /** * Return the list of operations that need to be applied to the given object * to meet the target. * * If the array is empty, that means the object meets the target and no more * changes are necessary. */ (s: S): Array<Operation<S>>; /** * Get the target of this diff. Note that because of how targets are defined, * where the target passed to the `of` function is really a list of requirements to * meet, that means that `diff(obj).length === 0` only means that `obj` meets the target, but * not that `obj` is equal to `diff.target`. */ get target(): S; } /** * Calculates the list of changes between the current state and the target * * Returns only the leaf operations. */ export declare function diff<S>(s: ReadOnly<S>, t: Target<S>): Array<DiffOperation<S>>; declare function from<S>(src: S, tgt: Target<S>): Distance<S>; export declare const Distance: { from: typeof from; }; export {};