@orkestrel/program 0.0.11 → 0.0.12
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 +25 -21
- package/dist/src/core/index.cjs +406 -204
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +1800 -1180
- package/dist/src/core/index.d.ts +1800 -1180
- package/dist/src/core/index.js +399 -196
- package/dist/src/core/index.js.map +1 -1
- package/package.json +14 -15
package/README.md
CHANGED
|
@@ -21,52 +21,56 @@ npm install @orkestrel/program
|
|
|
21
21
|
|
|
22
22
|
## Requirements
|
|
23
23
|
|
|
24
|
-
- Node.js >=
|
|
25
|
-
- ESM (`import`) and CommonJS (`require`)
|
|
24
|
+
- Node.js >= 22.12.0
|
|
25
|
+
- ESM (`import`) and CommonJS (`require`) through the `exports` field
|
|
26
26
|
|
|
27
27
|
## Usage
|
|
28
28
|
|
|
29
29
|
```ts
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
30
|
+
import { buildProgramDefinition, createProgram } from '@orkestrel/program'
|
|
31
|
+
import { createQualificationDefinition, createRuling } from '@orkestrel/qualifier'
|
|
32
|
+
import { buildLineDefinition, buildRatingDefinition } from '@orkestrel/rater'
|
|
33
33
|
import {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
createAtom,
|
|
35
|
+
createFactorGroup,
|
|
36
|
+
createLogicalDefinition,
|
|
37
|
+
createQuantitativeDefinition,
|
|
38
|
+
createRule,
|
|
39
|
+
createStaticFactor,
|
|
40
40
|
} from '@orkestrel/reason'
|
|
41
41
|
|
|
42
|
-
const gates =
|
|
43
|
-
|
|
42
|
+
const gates = createLogicalDefinition('gates', 'Eligibility gates', [
|
|
43
|
+
createRule(
|
|
44
|
+
'licensed',
|
|
45
|
+
[createAtom('licensed', 'equals', false)],
|
|
46
|
+
createAtom('blocked', 'equals', true),
|
|
47
|
+
),
|
|
44
48
|
])
|
|
45
49
|
|
|
46
|
-
const qualification =
|
|
50
|
+
const qualification = createQualificationDefinition(
|
|
47
51
|
'standard-qualification',
|
|
48
52
|
'Standard qualification',
|
|
49
53
|
[gates],
|
|
50
54
|
{
|
|
51
55
|
rulings: [
|
|
52
|
-
|
|
56
|
+
createRuling('license', 'gates', 'licensed', 'restriction', {
|
|
53
57
|
message: 'A license is required',
|
|
54
58
|
}),
|
|
55
59
|
],
|
|
56
60
|
},
|
|
57
61
|
)
|
|
58
62
|
|
|
59
|
-
const base =
|
|
63
|
+
const base = buildLineDefinition(
|
|
60
64
|
'base',
|
|
61
65
|
'Base premium',
|
|
62
|
-
|
|
63
|
-
|
|
66
|
+
createQuantitativeDefinition('base-rate', 'Base rate', [
|
|
67
|
+
createFactorGroup('amount', 'sum', [createStaticFactor('minimum', 100)]),
|
|
64
68
|
]),
|
|
65
69
|
)
|
|
66
70
|
|
|
67
|
-
const rating =
|
|
71
|
+
const rating = buildRatingDefinition('standard-rating', 'Standard rating', [base])
|
|
68
72
|
|
|
69
|
-
const definition =
|
|
73
|
+
const definition = buildProgramDefinition('standard', 'Standard program', qualification, rating)
|
|
70
74
|
|
|
71
75
|
const program = createProgram(definition)
|
|
72
76
|
|
|
@@ -102,7 +106,7 @@ one aggregate-aware batch and returns an `AggregateResult`. Every single-subject
|
|
|
102
106
|
|
|
103
107
|
For the full surface — `Program`, `ProgramManager`, `ProgramResult`,
|
|
104
108
|
`AggregateResult`, validators, factories, errors, and options — see
|
|
105
|
-
[`guides/
|
|
109
|
+
[`guides/program.md`](guides/program.md).
|
|
106
110
|
|
|
107
111
|
## Package
|
|
108
112
|
|