@orkestrel/qualifier 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 +27 -18
- package/dist/src/core/index.cjs +402 -218
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +740 -454
- package/dist/src/core/index.d.ts +740 -454
- package/dist/src/core/index.js +394 -209
- package/dist/src/core/index.js.map +1 -1
- package/package.json +15 -17
package/README.md
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
# @orkestrel/qualifier
|
|
2
2
|
|
|
3
|
-
A
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
> A synchronous, deterministic eligibility engine that runs a pure,
|
|
4
|
+
> JSON-serializable `QualificationDefinition`'s ordered `passes` against one
|
|
5
|
+
> subject through one `@orkestrel/reason` engine and returns a fresh
|
|
6
|
+
> `QualificationResult` carrying global and scoped eligibility, evidence-rich
|
|
7
|
+
> `findings`, and quantitative `derivations`.
|
|
8
|
+
|
|
9
|
+
Author the passes — quantitative derivations and logical rule gates — hand a subject
|
|
10
|
+
(a plain data record) to `qualify`, and read what comes back. The caller supplies the
|
|
11
|
+
definition; `Qualifier` only evaluates what it is given. Inject a
|
|
12
|
+
[`@orkestrel/reason`](https://github.com/orkestrel/reason) `ReasonInterface` where
|
|
13
|
+
qualification shares an engine with the rest of your reasoning, and call `destroy()`
|
|
14
|
+
when the qualifier's work is done. Environment-agnostic — no I/O, no browser or
|
|
15
|
+
server assumptions. Part of the `@orkestrel` line.
|
|
11
16
|
|
|
12
17
|
## Install
|
|
13
18
|
|
|
@@ -17,22 +22,26 @@ npm install @orkestrel/qualifier
|
|
|
17
22
|
|
|
18
23
|
## Requirements
|
|
19
24
|
|
|
20
|
-
- Node.js >=
|
|
21
|
-
- ESM (`import`) and CommonJS (`require`)
|
|
25
|
+
- Node.js >= 22.12.0
|
|
26
|
+
- ESM (`import`) and CommonJS (`require`) through the `exports` field
|
|
22
27
|
|
|
23
28
|
## Usage
|
|
24
29
|
|
|
25
30
|
```ts
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
|
|
29
|
-
const gates =
|
|
30
|
-
|
|
31
|
+
import { createQualificationDefinition, createQualifier, createRuling } from '@orkestrel/qualifier'
|
|
32
|
+
import { createAtom, createLogicalDefinition, createRule } from '@orkestrel/reason'
|
|
33
|
+
|
|
34
|
+
const gates = createLogicalDefinition('gates', 'Eligibility gates', [
|
|
35
|
+
createRule(
|
|
36
|
+
'licensed',
|
|
37
|
+
[createAtom('licensed', 'equals', false)],
|
|
38
|
+
createAtom('blocked', 'equals', true),
|
|
39
|
+
),
|
|
31
40
|
])
|
|
32
41
|
|
|
33
|
-
const definition =
|
|
42
|
+
const definition = createQualificationDefinition('standard', 'Standard eligibility', [gates], {
|
|
34
43
|
rulings: [
|
|
35
|
-
|
|
44
|
+
createRuling('license', 'gates', 'licensed', 'restriction', {
|
|
36
45
|
message: 'A license is required',
|
|
37
46
|
}),
|
|
38
47
|
],
|
|
@@ -55,7 +64,7 @@ overload. Every `qualify` call fires once through `qualifier.emitter` (`qualify`
|
|
|
55
64
|
|
|
56
65
|
For the full surface — `Qualifier`, `QualificationResult`, finding types, validators,
|
|
57
66
|
factories, errors, and options — see
|
|
58
|
-
[`guides/
|
|
67
|
+
[`guides/qualifier.md`](guides/qualifier.md).
|
|
59
68
|
|
|
60
69
|
## Package
|
|
61
70
|
|