sf-decomposer
Version:
Split large Salesforce metadata files into version-control-friendly pieces and rebuild deployment-ready files.
35 lines (34 loc) • 1.88 kB
TypeScript
import { VerifyDrift } from '../../helpers/types.js';
export type DirDiffResult = {
/** Files whose contents are semantically different (real drift). */
drift: VerifyDrift[];
/**
* Files where the only delta is sibling/attribute ordering. Surfaced for awareness — these are
* NOT failures, since Salesforce metadata is generally order-agnostic and `config-disassembler`
* does not preserve original sibling order.
*/
reordered: string[];
};
/**
* Recursively diff two directory trees. Files in the reference tree are compared against the
* mock tree; files that exist only in the mock tree are intentionally ignored, so the helper is
* safe to use against round-trip output that contains transient sidecars (e.g.
* `.config-disassembler.json`) which the original tree never had.
*
* For `.xml` files, comparison is **structural and order-insensitive**: sibling elements with the
* same tag name can appear in any order without registering as drift. Files that are byte-different
* but semantically equal are returned in `reordered` so the caller can surface the difference.
*/
export declare function diffDirectories(referenceDir: string, mockDir: string, prefix?: string): Promise<DirDiffResult>;
/**
* Compare two XML files for structural equality, ignoring sibling order and attribute order.
* Falls back to `false` if either side fails to parse, so genuinely malformed output still
* surfaces as drift through the caller.
*/
export declare function xmlEquivalent(refPath: string, mockPath: string): boolean;
/**
* Convert any JSON value into a stable string representation: object keys are sorted, and arrays
* are sorted by the canonical-JSON of each element. Two values produce the same canonical string
* iff they are deeply equal up to sibling order.
*/
export declare function canonicalJson(value: unknown): string;