# @ifc-lite/rules

> Filter-rule vocabulary, evaluator and .rules.json information-validation engine for IFC-Lite

Latest version **0.2.0** (published 2026-09-24) · MPL-2.0 license · 0 weekly downloads

## Install

```sh
npm install @ifc-lite/rules
pnpm add @ifc-lite/rules
yarn add @ifc-lite/rules
bun add @ifc-lite/rules
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; recently updated; high maintenance score; high quality score.

Warnings: low downloads; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2026-09-24 |
| First published | 2026-09-24 |
| Weekly downloads | 0 |
| License | MPL-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 6 |
| Unpacked size | 609.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 392 |
| Author | Louis True |
| Maintainers | louistrue |
| Keywords | ifc, bim, validation, ids, rules, filter, aec |

## Links

- npm: https://www.npmjs.com/package/@ifc-lite/rules
- Repository: https://github.com/LTplus-AG/ifc-lite
- Homepage: https://ifclite.dev/docs/
- Issues: https://github.com/LTplus-AG/ifc-lite/issues
- npm.io page: https://npm.io/package/@ifc-lite/rules

## Dependencies (6)

- [@ifc-lite/ids](https://npm.io/package/@ifc-lite/ids.md) 2.0.0
- [@ifc-lite/data](https://npm.io/package/@ifc-lite/data.md) 5.0.0
- [@ifc-lite/lists](https://npm.io/package/@ifc-lite/lists.md) 2.2.5
- [@ifc-lite/parser](https://npm.io/package/@ifc-lite/parser.md) 8.0.0
- [@ifc-lite/encoding](https://npm.io/package/@ifc-lite/encoding.md) 2.2.0
- [@ifc-lite/mutations](https://npm.io/package/@ifc-lite/mutations.md) 2.6.0

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 0.2.0 (latest) — 2026-09-24

## README

# @ifc-lite/rules

The filter-rule vocabulary, the Path-B rule evaluator, and the `.rules.json` information-validation engine for IFC-Lite. This is the shared core behind the viewer's Advanced Filter / Data Validation panel and the `ifc-lite check` CLI command (#5138) — one evaluator, one `.rules.json` format, run identically in the browser and on the command line.

## Install

```bash
npm install @ifc-lite/rules
```

## Usage

```ts
import { Rule, evaluateFilterRules, parseRuleSetFile, runRuleSet } from '@ifc-lite/rules';
import type { IfcDataStore } from '@ifc-lite/parser';

declare const store: IfcDataStore;
declare const ruleSetJson: string; // the text of a saved `<name>.rules.json`

// Evaluate an ad-hoc filter against one model.
const matches = evaluateFilterRules('model-1', store, [Rule.ifcType(['IfcWall'])], 'AND');

// Parse and run a saved `.rules.json` rule set against every loaded model.
const parsed = parseRuleSetFile(JSON.parse(ruleSetJson));
if (parsed.ok) {
  const report = await runRuleSet({
    ruleSet: parsed.file,
    models: [{ id: 'model-1', store }],
  });
}
```

## Features

- `FilterRule` / `FilterGroup` vocabulary (`ifcType`, `name`, `property`, `quantity`, `material`, `classification`, `storey`, `model`, `modelTag`, `parent`, `group`, `elevation`, `type`, `predefinedType`, `attribute`, `globalId`) plus the `Rule` builder helpers.
- `evaluateFilterRules` / `evaluateFilterRulesFederated` (sync + async chunked, cancellable, multi-model) — the same Path-B evaluator the viewer's Advanced Filter and Data Validation panel use, with index prefiltering and cheap-first rule ordering for large models.
- `parseRuleSetFile` / `serializeRuleSet` — validate and round-trip a `<name>.rules.json` file (never throws; failures come back as `{ ok: false, error }`).
- `ruleSetToIds` / `idsToRuleSet` — export the IDS-expressible rules of a rule set as IDS 1.0 XML, and import the simple specifications of an IDS as rules. Each rule or specification that has no exact equivalent is refused with its reasons (see the [IDS guide](https://ifclite.dev/docs/guide/ids/#converting-between-rule-sets-and-ids)).
- `runRuleSet` / `resolveTargetModels` — the information-validation engine: resolve applicability, check cardinality, dispatch `element` / `unique` / `aggregate` / `compare` / `unit` requirements, and fold the result into a `@ifc-lite/ids`-shaped `ValidationReport`.

No React, no store, no DOM — every export takes plain data (`IfcDataStore`, `EvaluatorModel[]`) in and returns plain data out, so it runs the same in a browser tab and a Node CLI process.

## License

MPL-2.0

---
_Source: https://npm.io/package/@ifc-lite/rules · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
