@orkestrel/qualifier 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 +67 -0
- package/dist/src/core/index.cjs +747 -0
- package/dist/src/core/index.cjs.map +1 -0
- package/dist/src/core/index.d.cts +569 -0
- package/dist/src/core/index.d.ts +569 -0
- package/dist/src/core/index.js +713 -0
- package/dist/src/core/index.js.map +1 -0
- package/package.json +85 -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,67 @@
|
|
|
1
|
+
# @orkestrel/qualifier
|
|
2
|
+
|
|
3
|
+
A typed **pre-rating eligibility engine** over [`@orkestrel/reason`](https://github.com/orkestrel/reason):
|
|
4
|
+
authored **passes** — quantitative derivations and logical rule gates — run in order
|
|
5
|
+
against a **subject** (a plain data record) to produce **findings** (evidence-rich
|
|
6
|
+
ruling outcomes), **derivations** (quantitative audit trails), and **eligibility**
|
|
7
|
+
(global plus per-scope). The caller supplies the definition; `Qualifier` only
|
|
8
|
+
evaluates what it is given. Qualification never mutates its inputs — every result is
|
|
9
|
+
a fresh object. Environment-agnostic — no I/O, no browser or server assumptions.
|
|
10
|
+
Part of the `@orkestrel` line.
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
npm install @orkestrel/qualifier
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Requirements
|
|
19
|
+
|
|
20
|
+
- Node.js >= 24
|
|
21
|
+
- ESM (`import`) and CommonJS (`require`) via the `exports` field
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
import { createQualifier, qualificationDefinition, rulingDefinition } from '@orkestrel/qualifier'
|
|
27
|
+
import { atom, logicalDefinition, rule } from '@orkestrel/reason'
|
|
28
|
+
|
|
29
|
+
const gates = logicalDefinition('gates', 'Eligibility gates', [
|
|
30
|
+
rule('licensed', [atom('licensed', 'equals', false)], atom('blocked', 'equals', true)),
|
|
31
|
+
])
|
|
32
|
+
|
|
33
|
+
const definition = qualificationDefinition('standard', 'Standard eligibility', [gates], {
|
|
34
|
+
rulings: [
|
|
35
|
+
rulingDefinition('license', 'gates', 'licensed', 'restriction', {
|
|
36
|
+
message: 'A license is required',
|
|
37
|
+
}),
|
|
38
|
+
],
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
const qualifier = createQualifier()
|
|
42
|
+
const result = qualifier.qualify({ id: 'risk-1', licensed: false }, definition)
|
|
43
|
+
|
|
44
|
+
result.eligibility // 'ineligible'
|
|
45
|
+
result.findings[0]?.message // 'A license is required'
|
|
46
|
+
result.derivations // [] — no quantitative pass ran
|
|
47
|
+
|
|
48
|
+
qualifier.destroy()
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
`qualify` accepts exactly one subject per call — there is no batch-of-subjects
|
|
52
|
+
overload. Every `qualify` call fires once through `qualifier.emitter` (`qualify`).
|
|
53
|
+
|
|
54
|
+
## Guide
|
|
55
|
+
|
|
56
|
+
For the full surface — `Qualifier`, `QualificationResult`, finding types, validators,
|
|
57
|
+
factories, errors, and options — see
|
|
58
|
+
[`guides/src/qualifier.md`](guides/src/qualifier.md).
|
|
59
|
+
|
|
60
|
+
## Package
|
|
61
|
+
|
|
62
|
+
Published as a single typed entry point per the `exports` field in
|
|
63
|
+
`package.json`.
|
|
64
|
+
|
|
65
|
+
## License
|
|
66
|
+
|
|
67
|
+
MIT © [Orkestrel](https://github.com/orkestrel) — see [LICENSE](./LICENSE).
|