@clipboard-health/rules-engine 0.1.2 → 0.1.4
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/CHANGELOG.md +13 -0
- package/package.json +1 -1
- package/src/lib/append-output.d.ts +1 -1
- package/src/lib/append-output.js +1 -1
- package/src/lib/rule.d.ts +3 -2
- package/src/lib/rule.d.ts.map +1 -1
- package/src/lib/runners/first-match.d.ts +0 -1
- package/src/lib/runners/first-match.d.ts.map +1 -1
- package/src/lib/runners/first-match.js +0 -1
- package/src/lib/runners/first-match.js.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [0.1.4](https://github.com/ClipboardHealth/cbh-core/compare/rules-engine-0.1.3...rules-engine-0.1.4) (2024-07-12)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* testing Nx upgrade ([f823f5d](https://github.com/ClipboardHealth/cbh-core/commit/f823f5d3e9624d33f55683df8346f99d51bef9e7))
|
|
11
|
+
|
|
12
|
+
## [0.1.3](https://github.com/ClipboardHealth/cbh-core/compare/rules-engine-0.1.2...rules-engine-0.1.3) (2024-07-12)
|
|
13
|
+
|
|
14
|
+
## [0.1.3](https://github.com/ClipboardHealth/cbh-core/compare/rules-engine-0.1.2...rules-engine-0.1.3) (2024-07-11)
|
|
15
|
+
|
|
16
|
+
## [0.1.3](https://github.com/ClipboardHealth/cbh-core/compare/rules-engine-0.1.2...rules-engine-0.1.3) (2024-07-11)
|
|
17
|
+
|
|
5
18
|
## [0.1.2](https://github.com/ClipboardHealth/cbh-core/compare/rules-engine-0.1.1...rules-engine-0.1.2) (2024-02-27)
|
|
6
19
|
|
|
7
20
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ReadonlyDeep } from "type-fest";
|
|
2
2
|
import { type RuleContext } from "./rule";
|
|
3
3
|
/**
|
|
4
|
-
* Rule output is immutable, do not modify existing items, only append.
|
|
4
|
+
* Rule output is immutable, do not modify existing items, only append using this function.
|
|
5
5
|
*/
|
|
6
6
|
export declare function appendOutput<TInput, TOutput>(context: RuleContext<TInput, TOutput>, output: ReadonlyDeep<TOutput>): RuleContext<TInput, TOutput>;
|
|
7
7
|
//# sourceMappingURL=append-output.d.ts.map
|
package/src/lib/append-output.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.appendOutput = void 0;
|
|
4
4
|
/**
|
|
5
|
-
* Rule output is immutable, do not modify existing items, only append.
|
|
5
|
+
* Rule output is immutable, do not modify existing items, only append using this function.
|
|
6
6
|
*/
|
|
7
7
|
function appendOutput(context, output) {
|
|
8
8
|
return {
|
package/src/lib/rule.d.ts
CHANGED
|
@@ -16,11 +16,12 @@ export interface Rule<TInput, TOutput, TContext extends RuleContext<TInput, TOut
|
|
|
16
16
|
* Returns whether the rule should run or not.
|
|
17
17
|
*
|
|
18
18
|
* Only the `input` and not the full `context` is passed to `runIf`. This prevents rules from
|
|
19
|
-
* relying on `output`, which may be
|
|
19
|
+
* relying on `output`, which may be appended to by previous rules by the time `run` is called.
|
|
20
20
|
*/
|
|
21
21
|
runIf: (input: ReadonlyDeep<TInput>) => boolean;
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
23
|
+
* A pure function that runs rule logic and returns a new context by appending to the output
|
|
24
|
+
* array.
|
|
24
25
|
*
|
|
25
26
|
* @see {@link appendOutput}
|
|
26
27
|
*/
|
package/src/lib/rule.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rule.d.ts","sourceRoot":"","sources":["../../../../../packages/rules-engine/src/lib/rule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AAE9C,MAAM,WAAW,WAAW,CAAC,MAAM,EAAE,OAAO;IAC1C;;OAEG;IACH,KAAK,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;IAE5B;;;;OAIG;IACH,MAAM,EAAE,aAAa,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC;CAC9C;AAED,MAAM,WAAW,IAAI,CACnB,MAAM,EACN,OAAO,EACP,QAAQ,SAAS,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC;IAE5E;;;;;OAKG;IACH,KAAK,EAAE,CAAC,KAAK,EAAE,YAAY,CAAC,MAAM,CAAC,KAAK,OAAO,CAAC;IAEhD
|
|
1
|
+
{"version":3,"file":"rule.d.ts","sourceRoot":"","sources":["../../../../../packages/rules-engine/src/lib/rule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AAE9C,MAAM,WAAW,WAAW,CAAC,MAAM,EAAE,OAAO;IAC1C;;OAEG;IACH,KAAK,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;IAE5B;;;;OAIG;IACH,MAAM,EAAE,aAAa,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC;CAC9C;AAED,MAAM,WAAW,IAAI,CACnB,MAAM,EACN,OAAO,EACP,QAAQ,SAAS,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC;IAE5E;;;;;OAKG;IACH,KAAK,EAAE,CAAC,KAAK,EAAE,YAAY,CAAC,MAAM,CAAC,KAAK,OAAO,CAAC;IAEhD;;;;;OAKG;IACH,GAAG,EAAE,CAAC,OAAO,EAAE,QAAQ,KAAK,QAAQ,CAAC;CACtC"}
|
|
@@ -3,7 +3,6 @@ import { type Rule, type RuleContext } from "../rule";
|
|
|
3
3
|
* Run the first rule that returns true for `runIf`.
|
|
4
4
|
*
|
|
5
5
|
* @param rules The rules to run.
|
|
6
|
-
* @returns A rule that runs the first rule that matches the context.
|
|
7
6
|
*/
|
|
8
7
|
export declare function firstMatch<TInput, TOutput, TContext extends RuleContext<TInput, TOutput>>(...rules: Array<Rule<TInput, TOutput, TContext>>): Rule<TInput, TOutput, TContext>;
|
|
9
8
|
//# sourceMappingURL=first-match.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"first-match.d.ts","sourceRoot":"","sources":["../../../../../../packages/rules-engine/src/lib/runners/first-match.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAE,KAAK,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtD
|
|
1
|
+
{"version":3,"file":"first-match.d.ts","sourceRoot":"","sources":["../../../../../../packages/rules-engine/src/lib/runners/first-match.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAE,KAAK,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtD;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,SAAS,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,EACvF,GAAG,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,GAC/C,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,CAQjC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"first-match.js","sourceRoot":"","sources":["../../../../../../packages/rules-engine/src/lib/runners/first-match.ts"],"names":[],"mappings":";;;AAEA
|
|
1
|
+
{"version":3,"file":"first-match.js","sourceRoot":"","sources":["../../../../../../packages/rules-engine/src/lib/runners/first-match.ts"],"names":[],"mappings":";;;AAEA;;;;GAIG;AACH,SAAgB,UAAU,CACxB,GAAG,KAA6C;IAEhD,OAAO;QACL,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACzD,GAAG,EAAE,CAAC,OAAO,EAAE,EAAE;YACf,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;YAC7D,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;QAC5C,CAAC;KACF,CAAC;AACJ,CAAC;AAVD,gCAUC"}
|