@pax2pay/model-banking 0.1.312 → 0.1.313
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/Rule/State/Transaction.ts +4 -1
- package/Rule/State/index.ts +34 -21
- package/Rule/index.ts +23 -12
- package/dist/Rule/State/Transaction.d.ts +3 -1
- package/dist/Rule/State/Transaction.js +2 -1
- package/dist/Rule/State/Transaction.js.map +1 -1
- package/dist/Rule/State/index.d.ts +20 -7
- package/dist/Rule/State/index.js +14 -8
- package/dist/Rule/State/index.js.map +1 -1
- package/dist/Rule/index.d.ts +1 -3
- package/dist/Rule/index.js +19 -7
- package/dist/Rule/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import { isoly } from "isoly"
|
|
2
2
|
import type { Transaction as ModelTransaction } from "../../Transaction"
|
|
3
|
+
import { Rule } from "../Rule"
|
|
3
4
|
|
|
4
5
|
export interface Transaction extends Omit<ModelTransaction.Creatable, "currency" | "amount"> {
|
|
6
|
+
kind: Rule.Base.Kind
|
|
5
7
|
amount: number
|
|
6
8
|
risk?: number
|
|
7
9
|
original: { currency: isoly.Currency; amount: number }
|
|
8
10
|
}
|
|
9
11
|
export namespace Transaction {
|
|
10
|
-
export function from(transaction: ModelTransaction.Creatable): Transaction {
|
|
12
|
+
export function from(transaction: ModelTransaction.Creatable, kind: Rule.Base.Kind): Transaction {
|
|
11
13
|
return {
|
|
12
14
|
...transaction,
|
|
15
|
+
kind,
|
|
13
16
|
amount: Math.abs(transaction.amount),
|
|
14
17
|
original: { currency: transaction.currency, amount: Math.abs(transaction.amount) },
|
|
15
18
|
}
|
package/Rule/State/index.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { isly } from "isly"
|
|
1
2
|
import { Account as ModelAccount } from "../../Account"
|
|
2
3
|
import { Transaction as ModelTransaction } from "../../Transaction"
|
|
4
|
+
import { Rule } from "../Rule"
|
|
3
5
|
import { Account as StateAccount } from "./Account"
|
|
4
6
|
import { Authorization as StateAuthorization } from "./Authorization"
|
|
5
7
|
import { Card as StateCard } from "./Card"
|
|
@@ -9,39 +11,50 @@ import { Partial as StatePartial } from "./Partial"
|
|
|
9
11
|
import { Transaction as StateTransaction } from "./Transaction"
|
|
10
12
|
|
|
11
13
|
export interface State {
|
|
12
|
-
data:
|
|
13
|
-
account:
|
|
14
|
-
transaction:
|
|
15
|
-
authorization?:
|
|
16
|
-
card?:
|
|
17
|
-
organization?:
|
|
14
|
+
data: State.Data
|
|
15
|
+
account: State.Account
|
|
16
|
+
transaction: State.Transaction
|
|
17
|
+
authorization?: State.Authorization
|
|
18
|
+
card?: State.Card
|
|
19
|
+
organization?: State.Organization
|
|
18
20
|
}
|
|
19
|
-
|
|
20
21
|
export namespace State {
|
|
22
|
+
export import Partial = StatePartial
|
|
23
|
+
export import Authorization = StateAuthorization
|
|
24
|
+
export import Card = StateCard
|
|
25
|
+
export import Account = StateAccount
|
|
26
|
+
export import Transaction = StateTransaction
|
|
27
|
+
export import Organization = StateOrganization
|
|
28
|
+
export type Data = StateData
|
|
29
|
+
export type Outcome = typeof Outcome.values[number]
|
|
30
|
+
export namespace Outcome {
|
|
31
|
+
export const values = ["approve", "reject", "review"] as const
|
|
32
|
+
export const type = isly.string<Outcome>(values)
|
|
33
|
+
}
|
|
34
|
+
export interface Evaluated extends State {
|
|
35
|
+
outcomes: Record<Rule.Other.Action, Rule[]>
|
|
36
|
+
outcome: Outcome
|
|
37
|
+
flags: string[]
|
|
38
|
+
notes: ModelTransaction.Note[]
|
|
39
|
+
}
|
|
21
40
|
export function from(
|
|
22
|
-
data:
|
|
41
|
+
data: Data,
|
|
23
42
|
account: ModelAccount,
|
|
24
|
-
transactions:
|
|
25
|
-
days:
|
|
43
|
+
transactions: Account.Transactions,
|
|
44
|
+
days: Account.Days,
|
|
26
45
|
transaction: ModelTransaction.Creatable,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
46
|
+
kind: Rule.Base.Kind,
|
|
47
|
+
authorization?: Authorization,
|
|
48
|
+
card?: Card,
|
|
49
|
+
organization?: Organization
|
|
30
50
|
): State {
|
|
31
51
|
return {
|
|
32
52
|
data,
|
|
33
53
|
account: Account.from(account, transactions, days),
|
|
34
|
-
transaction: Transaction.from(transaction),
|
|
54
|
+
transaction: Transaction.from(transaction, kind),
|
|
35
55
|
authorization,
|
|
36
56
|
card,
|
|
37
57
|
organization,
|
|
38
58
|
}
|
|
39
59
|
}
|
|
40
|
-
export import Partial = StatePartial
|
|
41
|
-
export import Authorization = StateAuthorization
|
|
42
|
-
export import Card = StateCard
|
|
43
|
-
export import Account = StateAccount
|
|
44
|
-
export import Transaction = StateTransaction
|
|
45
|
-
export import Organization = StateOrganization
|
|
46
|
-
export type Data = StateData
|
|
47
60
|
}
|
package/Rule/index.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { isoly } from "isoly"
|
|
1
2
|
import { selectively } from "selectively"
|
|
3
|
+
import { Note } from "../Transaction/Note"
|
|
2
4
|
import { definitions } from "./definitions"
|
|
3
5
|
import { Rule as ModelRule, type as ruleType } from "./Rule"
|
|
4
6
|
import { State as RuleState } from "./State"
|
|
@@ -15,6 +17,12 @@ export namespace Rule {
|
|
|
15
17
|
export const type = ruleType
|
|
16
18
|
export const is = ruleType.is
|
|
17
19
|
export const flaw = ruleType.flaw
|
|
20
|
+
function shouldUse(kind: Rule.Kind, rule: Rule, groups: string[] | undefined): boolean {
|
|
21
|
+
return (
|
|
22
|
+
kind == rule.type &&
|
|
23
|
+
(!rule.groups || rule.groups.some(ruleGroup => groups?.some(organizationGroup => organizationGroup == ruleGroup)))
|
|
24
|
+
)
|
|
25
|
+
}
|
|
18
26
|
function control(rule: ModelRule, state: State, macros?: Record<string, selectively.Definition>) {
|
|
19
27
|
return selectively.resolve({ ...macros, ...definitions }, selectively.parse(rule.condition)).is(state)
|
|
20
28
|
}
|
|
@@ -32,26 +40,29 @@ export namespace Rule {
|
|
|
32
40
|
rules: Rule[],
|
|
33
41
|
state: State,
|
|
34
42
|
macros?: Record<string, selectively.Definition>
|
|
35
|
-
):
|
|
36
|
-
const
|
|
43
|
+
): State.Evaluated {
|
|
44
|
+
const outcomes: Record<ModelRule.Other.Action, Rule[]> = { review: [], reject: [], flag: [] }
|
|
37
45
|
const [other, scorers] = rules.reduce(
|
|
38
46
|
(r: [ModelRule.Other[], ModelRule.Score[]], rule) => {
|
|
39
|
-
if (
|
|
40
|
-
!rule.groups ||
|
|
41
|
-
rule.groups.some(ruleGroup =>
|
|
42
|
-
state.organization?.groups?.some(organizationGroup => organizationGroup == ruleGroup)
|
|
43
|
-
)
|
|
44
|
-
) {
|
|
47
|
+
if (shouldUse(state.transaction.kind, rule, state.organization?.groups))
|
|
45
48
|
rule.action == "score" ? r[1].push(rule) : r[0].push(rule)
|
|
46
|
-
}
|
|
47
49
|
return r
|
|
48
50
|
},
|
|
49
51
|
[[], []]
|
|
50
52
|
)
|
|
51
53
|
state.transaction.risk = score(scorers, state, macros)
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
const notes: Note[] = []
|
|
55
|
+
const flags: Set<string> = new Set()
|
|
56
|
+
const now = isoly.DateTime.now()
|
|
57
|
+
for (const rule of other) {
|
|
58
|
+
if (control(rule, state, macros)) {
|
|
59
|
+
outcomes[rule.action].push(rule)
|
|
60
|
+
notes.push({ author: "automatic", created: now, text: rule.name, rule })
|
|
61
|
+
rule.flags.forEach(f => flags.add(f))
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
const outcome = outcomes.reject.length > 0 ? "reject" : outcomes.review.length > 0 ? "review" : "approve"
|
|
65
|
+
return { ...state, flags: [...flags], notes, outcomes, outcome }
|
|
55
66
|
}
|
|
56
67
|
export function isLegacy(rule: Rule): boolean {
|
|
57
68
|
return !ModelRule.Base.Category.type.is(rule.category)
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { isoly } from "isoly";
|
|
2
2
|
import type { Transaction as ModelTransaction } from "../../Transaction";
|
|
3
|
+
import { Rule } from "../Rule";
|
|
3
4
|
export interface Transaction extends Omit<ModelTransaction.Creatable, "currency" | "amount"> {
|
|
5
|
+
kind: Rule.Base.Kind;
|
|
4
6
|
amount: number;
|
|
5
7
|
risk?: number;
|
|
6
8
|
original: {
|
|
@@ -9,5 +11,5 @@ export interface Transaction extends Omit<ModelTransaction.Creatable, "currency"
|
|
|
9
11
|
};
|
|
10
12
|
}
|
|
11
13
|
export declare namespace Transaction {
|
|
12
|
-
function from(transaction: ModelTransaction.Creatable): Transaction;
|
|
14
|
+
function from(transaction: ModelTransaction.Creatable, kind: Rule.Base.Kind): Transaction;
|
|
13
15
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export var Transaction;
|
|
2
2
|
(function (Transaction) {
|
|
3
|
-
function from(transaction) {
|
|
3
|
+
function from(transaction, kind) {
|
|
4
4
|
return {
|
|
5
5
|
...transaction,
|
|
6
|
+
kind,
|
|
6
7
|
amount: Math.abs(transaction.amount),
|
|
7
8
|
original: { currency: transaction.currency, amount: Math.abs(transaction.amount) },
|
|
8
9
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Transaction.js","sourceRoot":"../","sources":["Rule/State/Transaction.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Transaction.js","sourceRoot":"../","sources":["Rule/State/Transaction.ts"],"names":[],"mappings":"AAUA,MAAM,KAAW,WAAW,CAS3B;AATD,WAAiB,WAAW;IAC3B,SAAgB,IAAI,CAAC,WAAuC,EAAE,IAAoB;QACjF,OAAO;YACN,GAAG,WAAW;YACd,IAAI;YACJ,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,MAAM,CAAC;YACpC,QAAQ,EAAE,EAAE,QAAQ,EAAE,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE;SAClF,CAAA;IACF,CAAC;IAPe,gBAAI,OAOnB,CAAA;AACF,CAAC,EATgB,WAAW,KAAX,WAAW,QAS3B"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { isly } from "isly";
|
|
1
2
|
import { Account as ModelAccount } from "../../Account";
|
|
2
3
|
import { Transaction as ModelTransaction } from "../../Transaction";
|
|
4
|
+
import { Rule } from "../Rule";
|
|
3
5
|
import { Account as StateAccount } from "./Account";
|
|
4
6
|
import { Authorization as StateAuthorization } from "./Authorization";
|
|
5
7
|
import { Card as StateCard } from "./Card";
|
|
@@ -8,15 +10,14 @@ import { Organization as StateOrganization } from "./Organization";
|
|
|
8
10
|
import { Partial as StatePartial } from "./Partial";
|
|
9
11
|
import { Transaction as StateTransaction } from "./Transaction";
|
|
10
12
|
export interface State {
|
|
11
|
-
data:
|
|
12
|
-
account:
|
|
13
|
-
transaction:
|
|
14
|
-
authorization?:
|
|
15
|
-
card?:
|
|
16
|
-
organization?:
|
|
13
|
+
data: State.Data;
|
|
14
|
+
account: State.Account;
|
|
15
|
+
transaction: State.Transaction;
|
|
16
|
+
authorization?: State.Authorization;
|
|
17
|
+
card?: State.Card;
|
|
18
|
+
organization?: State.Organization;
|
|
17
19
|
}
|
|
18
20
|
export declare namespace State {
|
|
19
|
-
function from(data: StateData, account: ModelAccount, transactions: StateAccount.Transactions, days: StateAccount.Days, transaction: ModelTransaction.Creatable, authorization?: StateAuthorization, card?: StateCard, organization?: StateOrganization): State;
|
|
20
21
|
export import Partial = StatePartial;
|
|
21
22
|
export import Authorization = StateAuthorization;
|
|
22
23
|
export import Card = StateCard;
|
|
@@ -24,4 +25,16 @@ export declare namespace State {
|
|
|
24
25
|
export import Transaction = StateTransaction;
|
|
25
26
|
export import Organization = StateOrganization;
|
|
26
27
|
type Data = StateData;
|
|
28
|
+
type Outcome = typeof Outcome.values[number];
|
|
29
|
+
namespace Outcome {
|
|
30
|
+
const values: readonly ["approve", "reject", "review"];
|
|
31
|
+
const type: isly.Type<"review" | "reject" | "approve">;
|
|
32
|
+
}
|
|
33
|
+
interface Evaluated extends State {
|
|
34
|
+
outcomes: Record<Rule.Other.Action, Rule[]>;
|
|
35
|
+
outcome: Outcome;
|
|
36
|
+
flags: string[];
|
|
37
|
+
notes: ModelTransaction.Note[];
|
|
38
|
+
}
|
|
39
|
+
function from(data: Data, account: ModelAccount, transactions: Account.Transactions, days: Account.Days, transaction: ModelTransaction.Creatable, kind: Rule.Base.Kind, authorization?: Authorization, card?: Card, organization?: Organization): State;
|
|
27
40
|
}
|
package/dist/Rule/State/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isly } from "isly";
|
|
1
2
|
import { Account as StateAccount } from "./Account";
|
|
2
3
|
import { Authorization as StateAuthorization } from "./Authorization";
|
|
3
4
|
import { Card as StateCard } from "./Card";
|
|
@@ -6,22 +7,27 @@ import { Partial as StatePartial } from "./Partial";
|
|
|
6
7
|
import { Transaction as StateTransaction } from "./Transaction";
|
|
7
8
|
export var State;
|
|
8
9
|
(function (State) {
|
|
9
|
-
|
|
10
|
+
State.Partial = StatePartial;
|
|
11
|
+
State.Authorization = StateAuthorization;
|
|
12
|
+
State.Card = StateCard;
|
|
13
|
+
State.Account = StateAccount;
|
|
14
|
+
State.Transaction = StateTransaction;
|
|
15
|
+
State.Organization = StateOrganization;
|
|
16
|
+
let Outcome;
|
|
17
|
+
(function (Outcome) {
|
|
18
|
+
Outcome.values = ["approve", "reject", "review"];
|
|
19
|
+
Outcome.type = isly.string(Outcome.values);
|
|
20
|
+
})(Outcome = State.Outcome || (State.Outcome = {}));
|
|
21
|
+
function from(data, account, transactions, days, transaction, kind, authorization, card, organization) {
|
|
10
22
|
return {
|
|
11
23
|
data,
|
|
12
24
|
account: State.Account.from(account, transactions, days),
|
|
13
|
-
transaction: State.Transaction.from(transaction),
|
|
25
|
+
transaction: State.Transaction.from(transaction, kind),
|
|
14
26
|
authorization,
|
|
15
27
|
card,
|
|
16
28
|
organization,
|
|
17
29
|
};
|
|
18
30
|
}
|
|
19
31
|
State.from = from;
|
|
20
|
-
State.Partial = StatePartial;
|
|
21
|
-
State.Authorization = StateAuthorization;
|
|
22
|
-
State.Card = StateCard;
|
|
23
|
-
State.Account = StateAccount;
|
|
24
|
-
State.Transaction = StateTransaction;
|
|
25
|
-
State.Organization = StateOrganization;
|
|
26
32
|
})(State || (State = {}));
|
|
27
33
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"../","sources":["Rule/State/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../","sources":["Rule/State/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAI3B,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,WAAW,CAAA;AACnD,OAAO,EAAE,aAAa,IAAI,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AACrE,OAAO,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,QAAQ,CAAA;AAE1C,OAAO,EAAE,YAAY,IAAI,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAClE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,WAAW,CAAA;AACnD,OAAO,EAAE,WAAW,IAAI,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAU/D,MAAM,KAAW,KAAK,CAuCrB;AAvCD,WAAiB,KAAK;IACP,aAAO,GAAG,YAAY,CAAA;IACtB,mBAAa,GAAG,kBAAkB,CAAA;IAClC,UAAI,GAAG,SAAS,CAAA;IAChB,aAAO,GAAG,YAAY,CAAA;IACtB,iBAAW,GAAG,gBAAgB,CAAA;IAC9B,kBAAY,GAAG,iBAAiB,CAAA;IAG9C,IAAiB,OAAO,CAGvB;IAHD,WAAiB,OAAO;QACV,cAAM,GAAG,CAAC,SAAS,EAAE,QAAQ,EAAE,QAAQ,CAAU,CAAA;QACjD,YAAI,GAAG,IAAI,CAAC,MAAM,CAAU,QAAA,MAAM,CAAC,CAAA;IACjD,CAAC,EAHgB,OAAO,GAAP,aAAO,KAAP,aAAO,QAGvB;IAOD,SAAgB,IAAI,CACnB,IAAU,EACV,OAAqB,EACrB,YAAkC,EAClC,IAAkB,EAClB,WAAuC,EACvC,IAAoB,EACpB,aAA6B,EAC7B,IAAW,EACX,YAA2B;QAE3B,OAAO;YACN,IAAI;YACJ,OAAO,EAAE,MAAA,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,YAAY,EAAE,IAAI,CAAC;YAClD,WAAW,EAAE,MAAA,WAAW,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC;YAChD,aAAa;YACb,IAAI;YACJ,YAAY;SACZ,CAAA;IACF,CAAC;IAnBe,UAAI,OAmBnB,CAAA;AACF,CAAC,EAvCgB,KAAK,KAAL,KAAK,QAuCrB"}
|
package/dist/Rule/index.d.ts
CHANGED
|
@@ -12,9 +12,7 @@ export declare namespace Rule {
|
|
|
12
12
|
const type: import("isly/dist/cjs/Type").Type<Other | Score>;
|
|
13
13
|
const is: import("isly/dist/cjs/Type").Type.IsFunction<Other | Score>;
|
|
14
14
|
const flaw: import("isly/dist/cjs/Type").Type.FlawFunction;
|
|
15
|
-
function evaluate(rules: Rule[], state: State, macros?: Record<string, selectively.Definition>):
|
|
16
|
-
risk?: number;
|
|
17
|
-
};
|
|
15
|
+
function evaluate(rules: Rule[], state: State, macros?: Record<string, selectively.Definition>): State.Evaluated;
|
|
18
16
|
function isLegacy(rule: Rule): boolean;
|
|
19
17
|
function fromLegacy(rule: Rule): Rule;
|
|
20
18
|
}
|
package/dist/Rule/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isoly } from "isoly";
|
|
1
2
|
import { selectively } from "selectively";
|
|
2
3
|
import { definitions } from "./definitions";
|
|
3
4
|
import { Rule as ModelRule, type as ruleType } from "./Rule";
|
|
@@ -13,6 +14,10 @@ export var Rule;
|
|
|
13
14
|
Rule.type = ruleType;
|
|
14
15
|
Rule.is = ruleType.is;
|
|
15
16
|
Rule.flaw = ruleType.flaw;
|
|
17
|
+
function shouldUse(kind, rule, groups) {
|
|
18
|
+
return (kind == rule.type &&
|
|
19
|
+
(!rule.groups || rule.groups.some(ruleGroup => groups?.some(organizationGroup => organizationGroup == ruleGroup))));
|
|
20
|
+
}
|
|
16
21
|
function control(rule, state, macros) {
|
|
17
22
|
return selectively.resolve({ ...macros, ...definitions }, selectively.parse(rule.condition)).is(state);
|
|
18
23
|
}
|
|
@@ -20,18 +25,25 @@ export var Rule;
|
|
|
20
25
|
return rules.reduce((r, rule) => (control(rule, state, macros) ? (r ?? 100) * (rule.risk / 100) : undefined), undefined);
|
|
21
26
|
}
|
|
22
27
|
function evaluate(rules, state, macros) {
|
|
23
|
-
const
|
|
28
|
+
const outcomes = { review: [], reject: [], flag: [] };
|
|
24
29
|
const [other, scorers] = rules.reduce((r, rule) => {
|
|
25
|
-
if (
|
|
26
|
-
rule.groups.some(ruleGroup => state.organization?.groups?.some(organizationGroup => organizationGroup == ruleGroup))) {
|
|
30
|
+
if (shouldUse(state.transaction.kind, rule, state.organization?.groups))
|
|
27
31
|
rule.action == "score" ? r[1].push(rule) : r[0].push(rule);
|
|
28
|
-
}
|
|
29
32
|
return r;
|
|
30
33
|
}, [[], []]);
|
|
31
34
|
state.transaction.risk = score(scorers, state, macros);
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
+
const notes = [];
|
|
36
|
+
const flags = new Set();
|
|
37
|
+
const now = isoly.DateTime.now();
|
|
38
|
+
for (const rule of other) {
|
|
39
|
+
if (control(rule, state, macros)) {
|
|
40
|
+
outcomes[rule.action].push(rule);
|
|
41
|
+
notes.push({ author: "automatic", created: now, text: rule.name, rule });
|
|
42
|
+
rule.flags.forEach(f => flags.add(f));
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
const outcome = outcomes.reject.length > 0 ? "reject" : outcomes.review.length > 0 ? "review" : "approve";
|
|
46
|
+
return { ...state, flags: [...flags], notes, outcomes, outcome };
|
|
35
47
|
}
|
|
36
48
|
Rule.evaluate = evaluate;
|
|
37
49
|
function isLegacy(rule) {
|
package/dist/Rule/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"../","sources":["Rule/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../","sources":["Rule/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAEzC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,IAAI,IAAI,SAAS,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAC5D,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,SAAS,CAAA;AAI5C,MAAM,KAAW,IAAI,CA+DpB;AA/DD,WAAiB,IAAI;IACN,WAAM,GAAG,SAAS,CAAC,MAAM,CAAA;IACzB,aAAQ,GAAG,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAA;IAClC,SAAI,GAAG,SAAS,CAAC,IAAI,CAAC,IAAI,CAAA;IAC1B,UAAK,GAAG,SAAS,CAAC,KAAK,CAAA;IACvB,UAAK,GAAG,SAAS,CAAC,KAAK,CAAA;IACvB,UAAK,GAAG,SAAS,CAAA;IAClB,SAAI,GAAG,QAAQ,CAAA;IACf,OAAE,GAAG,QAAQ,CAAC,EAAE,CAAA;IAChB,SAAI,GAAG,QAAQ,CAAC,IAAI,CAAA;IACjC,SAAS,SAAS,CAAC,IAAe,EAAE,IAAU,EAAE,MAA4B;QAC3E,OAAO,CACN,IAAI,IAAI,IAAI,CAAC,IAAI;YACjB,CAAC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