@orkestrel/rater 0.0.1
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/LICENSE +21 -0
- package/README.md +73 -0
- package/dist/src/core/index.cjs +1625 -0
- package/dist/src/core/index.cjs.map +1 -0
- package/dist/src/core/index.d.cts +1171 -0
- package/dist/src/core/index.d.ts +1171 -0
- package/dist/src/core/index.js +1551 -0
- package/dist/src/core/index.js.map +1 -0
- package/package.json +86 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Orkestrel
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# @orkestrel/rater
|
|
2
|
+
|
|
3
|
+
A typed **rating engine**: programs compile line, pass, and ruling definitions
|
|
4
|
+
into determinations, worksheets, and aggregates for rated subjects. Pure,
|
|
5
|
+
authored **program definitions** — `lines` (quantitative rating), `passes`
|
|
6
|
+
(ordered pre-rating overlays), `rulings` (rule id → effect routing), `notices`,
|
|
7
|
+
and an optional `authority` (a final logical gate deriving a `decision`) — are
|
|
8
|
+
compiled and rated over ONE shared [`@orkestrel/reason`](https://github.com/orkestrel/reason)
|
|
9
|
+
engine (`quantitative` + `logical` reasoners). Rating never mutates its
|
|
10
|
+
inputs: every result — `LineResult`, `ProgramResult`, `SubjectResult`,
|
|
11
|
+
`AggregateResult` — is a fresh object carrying a `trace` and accumulated
|
|
12
|
+
`errors`. Batch rating additionally supports per-program aggregate fields, an
|
|
13
|
+
optional partition key, and gated aggregate determinations, plus per-`Status`
|
|
14
|
+
tallies. Environment-agnostic — no I/O, no browser or server assumptions.
|
|
15
|
+
Part of the `@orkestrel` line.
|
|
16
|
+
|
|
17
|
+
## Install
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
npm install @orkestrel/rater
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Requirements
|
|
24
|
+
|
|
25
|
+
- Node.js >= 24
|
|
26
|
+
- ESM-only (no CommonJS build)
|
|
27
|
+
|
|
28
|
+
## Usage
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
import { createRater, lineDefinition, programDefinition } from '@orkestrel/rater'
|
|
32
|
+
import { factorGroup, quantitativeDefinition, staticFactor } from '@orkestrel/reason'
|
|
33
|
+
|
|
34
|
+
const rater = createRater()
|
|
35
|
+
|
|
36
|
+
const base = lineDefinition(
|
|
37
|
+
'base',
|
|
38
|
+
'Base Amount',
|
|
39
|
+
quantitativeDefinition('base', 'Base', [
|
|
40
|
+
factorGroup('amount', 'sum', [staticFactor('flat', 100)]),
|
|
41
|
+
]),
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
rater.programs.add(programDefinition('p1', 'Program', [base]))
|
|
45
|
+
|
|
46
|
+
const result = rater.rate({ id: 'subject-1' }) // one subject → one SubjectResult
|
|
47
|
+
result.programs[0]?.eligibility // 'eligible'
|
|
48
|
+
|
|
49
|
+
rater.rate([{ id: 'a' }, { id: 'b' }]) // an ARRAY resolves to the batch AggregateResult overload
|
|
50
|
+
|
|
51
|
+
rater.destroy()
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
`rate` dispatches by input shape — an ARRAY resolves to the batch
|
|
55
|
+
`AggregateResult` overload, a single subject resolves to `SubjectResult`.
|
|
56
|
+
Every applied determination and derived decision fires through
|
|
57
|
+
`rater.emitter` (`rate` / `aggregate` / `determine` / `decide`).
|
|
58
|
+
|
|
59
|
+
## Guide
|
|
60
|
+
|
|
61
|
+
For the full surface — the `Rater` orchestrator, compiled `Program`s, the
|
|
62
|
+
ordered `ProgramManager`, worksheet and determination helpers, validators,
|
|
63
|
+
factories, errors, and the observation surface — see
|
|
64
|
+
[`guides/src/rater.md`](guides/src/rater.md).
|
|
65
|
+
|
|
66
|
+
## Package
|
|
67
|
+
|
|
68
|
+
Published as a single typed entry point per the `exports` field in
|
|
69
|
+
`package.json`.
|
|
70
|
+
|
|
71
|
+
## License
|
|
72
|
+
|
|
73
|
+
MIT © [Orkestrel](https://github.com/orkestrel) — see [LICENSE](./LICENSE).
|