# Changelog

## v0.4.1 - 2026-10-17

- add `browser` directive

## v0.4.0 - 2026-10-13

### Added

- The `settings` environment option is typed: `validateResult`, `types`, and `resolveImport` are declared with their signatures and descriptions, other keys stay open
- A business knowledge model evaluates directly through `definition.evaluate(bkmId, input)`, its formal parameters bound from `input` by name, yielding the invocation result (DMN TCK 1157)
- Under `validateResult`, business knowledge model and decision service results are coerced to the output type their variable declares through an item definition `functionItem`, whether invoked directly or from FEEL (DMN TCK 1157)
- FEEL evaluation warnings reported by feelin — unknown variables and context keys, missing functions, invalid built-in arguments — are logged through the `Logger` environment option at `warn` level under the `feel` scope; FEEL yields null in these cases without an error, so a mistyped service or variable name is now visible under `DEBUG` — a `Logger` passed through `Definition` options receives them too

### Changed

- A scalar value where a collection item definition is expected widens to a singleton list, per the DMN implicit conversion rules, instead of failing with a `DecisionError` — applies at every typed seam: input data, decision table columns, decision results under `validateResult`, context entries, and business knowledge model parameters (DMN TCK 1157)
- A date where a `date and time` is declared widens to that date at midnight UTC, per the DMN implicit conversion rules, instead of passing through as a date — same seams as above (DMN TCK 1157)

### Fixed

- Several imports without a name (allowed since DMN 1.5, imported elements are then referenced unqualified) no longer collide — each import resolves against its own namespace, so a requirement into the second nameless import is found (DMN TCK 1160)

## v0.3.0 - 2026-09-20

### Breaking

- Requires [feelin](https://github.com/nikku/feelin) 8 as peer dependency — temporal values in decision results are feelin's own `FeelDate`, `FeelTime`, `FeelDateTime` and `FeelDuration` types instead of luxon objects, and feelin 8 rejects week durations and mixed-kind duration arithmetic

### Changed

- DMN TCK conformance rises to 89.0% (3110/3495 assertions) on feelin 8, up from 85.2% — `instance of`, `at` literals, `now()`/`today()`, and the temporal constructor functions now pass

## v0.2.1 - 2026-09-16

- generate table of contents with [@0dep/toc](https://0dep.se/toc/)
- set trailing slash on package homepage

## v0.2.0 - 2026-09-02

### Changed

- A decision table without output columns fails with a pointed `DecisionError` — the result was silently null

### Fixed

- A type override throwing a plain error while coercing an input data value fails the evaluation with a `DecisionError` carrying the message and the original error as `cause`, as it already did for decision results — the plain error used to pass through unwrapped
- A structure component typed by a collection item definition accepts a one-element list — the DMN singleton list conversion was applied before the referenced collection type was consulted, failing with `cannot coerce ... to collection`

## v0.1.0 - 2026-08-21

### Breaking

- `DecisionError.inner` is removed — the original error, e.g. from feelin or a throwing service, is chained as the standard `cause` instead, so Node prints its stack as a nested `[cause]` block

### Added

- Environment `services` are exposed to FEEL under `services` — named host functions callable from any expression or unary test, e.g. `services.creditScore(Applicant)`; a variable or evaluation input named `services` shadows the overlay
- A service function that throws fails the evaluation with a `DecisionError` carrying the service error message and the original error as `cause`
- A service function that returns a promise fails the evaluation with a pointed `DecisionError` naming the service — FEEL evaluation is synchronous, so a leaked promise would silently corrupt the result instead of erroring
- Reading an unregistered service name from FEEL logs a warning through the environment `Logger` (scope `environment`, once per name) — the invocation itself still yields null per FEEL semantics

## v0.0.5 - 2026-08-13

### Changed

- type declarations are generated with dts-buddy

### Fixed

- stray `@type` import path in the published `DrgElement.extensions` declaration comment

## v0.0.4 - 2026-08-05

### Changed

- `id`, `name`, and `type` are typed as strings in the published type declarations (were `any`)

## v0.0.3 - 2026-07-23

### Added

- DMN 1.4 boxed expressions evaluate: conditional, filter, and the iterators (for, some, every) — as decision logic, context entries, list elements, and function bodies. A filter match sees the implicit `item` variable and a context element's entries; a for return sees the iterator variable and `partial` (the results so far); non-conforming values (non-list `in`, non-boolean `if`/`match`/`satisfies`) raise `DecisionError`
- DMN 1.5 item definition `typeConstraint` — unary tests validating the value as a whole (bound to `?`) wherever typeRefs coerce, while `allowedValues` keeps constraining the element type; a collection's elements answer to allowed values and the list itself to the type constraint. Violations raise `DecisionError`. The `dmn-elements/dmn-moddle` grammar carries the element
- New `dmn-elements/dmn-moddle` export for host-side parsing: `dmn` — dmn-moddle's DMN package extended with the 1.4 boxed expression grammar (`new DmnModdle({ dmn })`) — and `alignDmnNamespaces(source)`, rewriting DMN 1.4/1.5 namespace URIs to the 1.3 URIs the package is registered under
- dmn-moddle declared as an optional peer dependency — only needed with the `dmn-elements/dmn-moddle` subpath

### Changed

- DMN TCK conformance: overall 85.2% (was 84.9%) — the DMN 1.4 boxed expression cases (1150–1154) now pass in full

## v0.0.2 - 2026-07-16

### Added

- Extensions via the environment `extensions` option — named functions called per DRG element that decorate the model beyond the DMN schema, e.g. from vendor attributes, optionally hooking in around each evaluation
- Serialized definitions keep vendor extension attributes (`$attrs`), so extensions decorate revived trees like the source

## v0.0.1 - 2026-07-13

First published release — DRG walking and every concrete DMN 1.3 boxed expression evaluate.

### Added

- `dmn:Invocation` decision logic — boxed invocations bind parameters by name
- `dmn:Relation` decision logic — a relation evaluates to a list of row contexts
- `dmn:List` decision logic — a boxed list evaluates to the list of its element values
- `dmn:FunctionDefinition` decision logic — a boxed function definition evaluates to a FEEL-invocable function closing over its definition scope
- Type coercion overrides per typeRef via the environment setting `types`
- Item definitions — a typeRef naming a `dmn:ItemDefinition` coerces through its alias, validates allowed values, coerces structure components, and coerces collection elements
- Opt-in decision result validation via the environment setting `validateResult` — results are coerced and validated against the decision variable type
- Imported type libraries via the environment setting `resolveImport` — the host resolves a declared `dmn:Import` to its parsed definitions (async supported); qualified typeRefs like `logistics.tParcel` then coerce and validate through the imported item definitions
- `serializeDefinitions(definitions)` — precompile parsed definitions to lean JSON; the revived JSON evaluates without dmn-moddle at runtime
- FEEL named-argument invocation of business knowledge models, decision services, and boxed function definitions
- Imported DRG elements — requirement hrefs qualified with an imported namespace resolve into the imported model; the imported element evaluates in its own model and binds under its qualified name (`common.Greeting`)

### Changed

- Decision service positional parameters are input data followed by input decisions, per the DMN TCK
- A decision without decision logic evaluates to null instead of failing
- Invoking a function with surplus arguments yields null; a decision service invoked with too few arguments fails

### Fixed

- Default output entries apply when no rule matches, regardless of hit policy
- PRIORITY and OUTPUT ORDER rank on the output columns that declare output values
- A one-element list coerces to its element for scalar types (DMN singleton list conversion)
- Collections of a named item definition type no longer trip the circular type guard
- Requirement hrefs qualified with the model's own namespace resolve
