@orkestrel/rater 0.0.12 → 0.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,13 +1,17 @@
1
1
  # @orkestrel/rater
2
2
 
3
- A typed **quantitative rating layer** over [`@orkestrel/reason`](https://github.com/orkestrel/reason):
4
- authored **lines** — each a plain reason `QuantitativeDefinition` joined to display
5
- metadata — are rated against a **subject** (a plain data record) to produce a
6
- `LineResult` per line (an `amount` plus its `Worksheet` audit trail) and one
7
- `RatingResult` (every line's outcome plus a derived `total`). The caller decides
8
- which lines to rate; `Rater` only evaluates what it is given. Rating never mutates
9
- its inputs — every result is a fresh object. Environment-agnostic — no I/O, no
10
- browser or server assumptions. Part of the `@orkestrel` line.
3
+ > A typed quantitative rating layer over `@orkestrel/reason`'s shared engine: authored
4
+ > lines, each a plain reason `QuantitativeDefinition` joined to display metadata, rated
5
+ > against one subject to produce a `LineResult` per line — an `amount` and its
6
+ > `Worksheet` audit trail — and one `RatingResult` carrying every line's outcome and a
7
+ > derived `total`.
8
+
9
+ Create a rater with the `createRater` function, hand it the lines a subject is rated
10
+ against, and read the `LineResult` rows and the `total` it derives. Inject a
11
+ [`@orkestrel/reason`](https://github.com/orkestrel/reason) `ReasonInterface` where the
12
+ rating shares an engine with the rest of your reasoning, and call `destroy()` when the
13
+ rater's work is done. Environment-agnostic — no I/O, no browser or server assumptions.
14
+ Part of the `@orkestrel` line.
11
15
 
12
16
  ## Install
13
17
 
@@ -17,22 +21,26 @@ npm install @orkestrel/rater
17
21
 
18
22
  ## Requirements
19
23
 
20
- - Node.js >= 24
21
- - ESM (`import`) and CommonJS (`require`) via the `exports` field
24
+ - Node.js >= 22.12.0
25
+ - ESM (`import`) and CommonJS (`require`) through the `exports` field
22
26
 
23
27
  ## Usage
24
28
 
25
29
  ```ts
26
- import { createRater, lineDefinition } from '@orkestrel/rater'
27
- import { factorGroup, quantitativeDefinition, staticFactor } from '@orkestrel/reason'
30
+ import { buildLineDefinition, createRater } from '@orkestrel/rater'
31
+ import {
32
+ createFactorGroup,
33
+ createQuantitativeDefinition,
34
+ createStaticFactor,
35
+ } from '@orkestrel/reason'
28
36
 
29
37
  const rater = createRater()
30
38
 
31
- const base = lineDefinition(
39
+ const base = buildLineDefinition(
32
40
  'base',
33
41
  'Base Amount',
34
- quantitativeDefinition('base', 'Base', [
35
- factorGroup('amount', 'sum', [staticFactor('flat', 100)]),
42
+ createQuantitativeDefinition('base', 'Base', [
43
+ createFactorGroup('amount', 'sum', [createStaticFactor('flat', 100)]),
36
44
  ]),
37
45
  )
38
46
 
@@ -46,14 +54,14 @@ rater.destroy()
46
54
  ```
47
55
 
48
56
  `rate` accepts a plain `LineDefinition[]` or a full `RatingDefinition` plus one
49
- subject — both overloads rate a single subject. Every `rate` call fires once
57
+ subject, and each overload rates that single subject. Every `rate` call fires once
50
58
  through `rater.emitter` (`rate`).
51
59
 
52
60
  ## Guide
53
61
 
54
62
  For the full surface — `Rater`, `RatingResult`, worksheet types, validators,
55
63
  factories, errors, and options — see
56
- [`guides/src/rater.md`](guides/src/rater.md).
64
+ [`guides/rater.md`](guides/rater.md).
57
65
 
58
66
  ## Package
59
67