@stackonward/manifest-engine
v0.0.2
Published
Framework-agnostic, backend-shape-agnostic manifest logic (combination-compatibility filtering)
Maintainers
Readme
@stackonward/manifest-engine
Framework- and backend-independent compatibility filtering for multidimensional manifest selections.
The engine accepts already normalized dimensions, selections, combination groups, and candidates. It does not know product vocabulary, aliases, display labels, or backend DTO shapes.
Install
pnpm add @stackonward/manifest-engineUsage
import { filterCompatibleCandidates } from "@stackonward/manifest-engine";
const candidates = filterCompatibleCandidates({
groups: [
{ format: ["png", "webp"], size: ["small"] },
{ format: ["png"], size: ["large"] },
],
selection: { format: "", size: "large" },
targetDimension: "format",
candidates: ["png", "webp"],
});The result is ["png"]: a candidate remains available when at least one group
allows it together with every non-empty selection outside the target dimension.
Matching semantics
- Groups are alternatives: matching any group is sufficient.
- Non-empty selected dimensions inside a group are combined with AND semantics.
- The target dimension's current selection is ignored while evaluating its candidates.
- A missing or empty allowed-value list does not constrain that dimension.
- An empty
groupsarray returns the original candidates unchanged. - Candidate order and duplicates are preserved; normalization, sorting, and deduplication belong to the caller.
Public API
| Export | Purpose |
| ---------------------------- | -------------------------------------- |
| filterCompatibleCandidates | Pure compatibility filter |
| CombinationGroup | Allowed values by normalized dimension |
| Selection | Current normalized values by dimension |
| FilterCompatibleInput | Complete filter input contract |
| Dimension | String dimension key |
Compatibility
- Any ESM JavaScript runtime
- No browser, framework, or backend dependency
- TypeScript declarations included
License
MIT
