export type DecomposerResult = { metadata: string[]; }; export type DecomposerOverride = { /** Suffix-scoped targets (e.g. `permissionset`). Applies to every component of the type. */ metadataTypes?: string[]; /** Component-scoped targets in the form `:` (e.g. `permissionset:HR_Admin`). */ components?: string[]; decomposedFormat?: string; strategy?: string; decomposeNestedPermissions?: boolean; /** * Custom `splitTags` spec for `grouped-by-tag` strategy. Comma-separated rules of the form * `::` or `:::`, where `mode` is `split` (one file * per array item, filename from `field`) or `group` (array items grouped by `field`, one file * per group). When set, this wins over the hardcoded `decomposeNestedPermissions` default * for permission sets. Only applied when the resolved strategy is `grouped-by-tag`. */ splitTags?: string; /** * Custom `multiLevel` spec(s) for nested-array decomposition. Each rule has the form * `::` (the third part is itself a * comma-separated list). Pass a string for a single rule, a string[] for several rules * (preferred), or a single `;`-separated string. When set, this wins over the hardcoded * `loyaltyProgramSetup` default. Applies regardless of strategy because multiLevel * works on a per-file pattern. */ multiLevel?: string | string[]; /** * Comma-separated list of XML element names (and optional compound keys joined by `+`) * used to derive stable filenames during `unique-id` decomposition. When set, this * replaces the hardcoded per-type list from the built-in registry (the global defaults * `fullName` and `name` are always prepended regardless). Useful for metadata types not * yet covered by the built-in registry, or when the default selection produces collisions. * Example: `"developerName,apiName"` or `"actionName+pageOrSobjectType+formFactor"`. */ uniqueIdElements?: string; prePurge?: boolean; postPurge?: boolean; /** * Comma-separated `element:extension` pairs identifying XML elements whose text content * should be extracted to typed companion files during disassembly and injected back during * reassembly. Example: `"schema:yaml"`. When set on a metadata type, overrides the built-in * default (e.g. `externalServiceRegistration` defaults to `"schema:yaml"`). Reassembly always * auto-detects sidecars from `.sidecars.json` — no reassembly flag is needed. */ sidecarElements?: string; }; export type ConfigFile = { metadataSuffixes: string; prePurge: boolean; postPurge: boolean; decomposedFormat: string; ignorePackageDirectories: string; strategy: string; decomposeNestedPermissions: boolean; updateForceignore?: boolean; updateGitattributes?: boolean; manifest?: string; overrides?: DecomposerOverride[]; skipPrerunHook?: boolean; skipPostRetrieveHook?: boolean; }; export type SfdxProject = { packageDirectories: Array<{ path: string; }>; }; export type MetaAttributes = { /** The `--metadata-type` value the type was selected by (suffix or type name); overrides are keyed by it. */ metadataType?: string; metaSuffix: string; strictDirectoryName: boolean; folderType: string; metadataPaths: string[]; uniqueIdElements: string; /** The registry type's name and directory name. */ typeName?: string; directoryName?: string; /** * Members of `metadataPaths` not named after the type's directory: folders where the type's files * were found by suffix (custom names such as `1_settings`, other types' folders, nested * subfolders). They can hold other types' files, so recompose identifies its directories strictly. */ extraPaths?: string[]; }; /** * One walk of the package directories: directories by name, and -- for the suffixes being looked * for -- where those types' files and decomposed directories actually are, wherever they live. */ export type PathIndex = { index: Map; ignorePath: string; /** suffix -> directories directly holding `.-meta.xml` files. */ suffixDirs?: Map; /** suffix -> directories holding a decomposed directory whose leaf names the suffix. */ decomposedParents?: Map; /** Directories holding a decomposed directory with no leaf file (its type is checked later). */ sidecarParents?: string[]; }; export type DecomposeOptions = { metadataTypes?: string[]; prepurge: boolean; postpurge: boolean; format: string; ignoreDirs?: string[]; strategy: string; decomposeNestedPerms: boolean; manifest?: string; overrides?: DecomposerOverride[]; updateForceignore?: boolean; updateGitattributes?: boolean; log: (msg: string) => void; repoRoot?: string; }; export type RecomposeOptions = { metadataTypes?: string[]; postpurge: boolean; ignoreDirs?: string[]; manifest?: string; log: (msg: string) => void; repoRoot?: string; }; export type VerifyOptions = { metadataTypes?: string[]; format: string; ignoreDirs?: string[]; strategy: string; decomposeNestedPerms: boolean; manifest?: string; overrides?: DecomposerOverride[]; log: (msg: string) => void; }; export type VerifyDrift = { /** Path of the offending file relative to its package directory. */ path: string; /** Short human-readable reason: `'content drift'` or `'missing in round-trip output'`. */ reason: string; }; export type VerifyResult = { /** Metadata types that participated in the round trip. */ metadata: string[]; /** One entry per file that did not survive the round trip semantically. Empty on success. */ drift: VerifyDrift[]; /** * Files where the only delta was element ordering — content is semantically identical but not * byte-identical. Repeated siblings keep their order, so this only covers order the round trip * can't record (interleaved tags). Does not fail `verify`, but * review these: order matters for some metadata. */ reordered: string[]; };