@pax2pay/model-banking 0.1.267 → 0.1.268
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/Rule/Other.ts +10 -0
- package/Rule/Rule/Score.ts +11 -0
- package/Rule/Rule/index.ts +35 -0
- package/Rule/State/Transaction.ts +1 -0
- package/Rule/index.ts +31 -29
- package/Transaction/index.ts +2 -0
- package/dist/Rule/Rule/Other.d.ts +9 -0
- package/dist/Rule/Rule/Other.js +7 -0
- package/dist/Rule/Rule/Other.js.map +1 -0
- package/dist/Rule/Rule/Score.d.ts +10 -0
- package/dist/Rule/Rule/Score.js +7 -0
- package/dist/Rule/Rule/Score.js.map +1 -0
- package/dist/Rule/Rule/index.d.ts +22 -0
- package/dist/Rule/Rule/index.js +20 -0
- package/dist/Rule/Rule/index.js.map +1 -0
- package/dist/Rule/State/Transaction.d.ts +1 -0
- package/dist/Rule/State/Transaction.js.map +1 -1
- package/dist/Rule/index.d.ts +11 -24
- package/dist/Rule/index.js +19 -6
- package/dist/Rule/index.js.map +1 -1
- package/dist/Transaction/index.d.ts +1 -0
- package/dist/Transaction/index.js +1 -0
- package/dist/Transaction/index.js.map +1 -1
- package/package.json +1 -1
- package/Rule/Rule.ts +0 -28
- package/dist/Rule/Rule.d.ts +0 -17
- package/dist/Rule/Rule.js +0 -15
- package/dist/Rule/Rule.js.map +0 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { isly } from "isly"
|
|
2
|
+
|
|
3
|
+
export interface Other {
|
|
4
|
+
action: Other.Action
|
|
5
|
+
}
|
|
6
|
+
export namespace Other {
|
|
7
|
+
export const actions = ["review", "reject", "flag"] as const
|
|
8
|
+
export type Action = typeof actions[number]
|
|
9
|
+
export const type = isly.object<Other>({ action: isly.string<Action>(actions) })
|
|
10
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { isly } from "isly"
|
|
2
|
+
|
|
3
|
+
export interface Score {
|
|
4
|
+
action: "score"
|
|
5
|
+
risk: Score.Risk
|
|
6
|
+
}
|
|
7
|
+
export namespace Score {
|
|
8
|
+
export type Risk = number
|
|
9
|
+
export const Risk = isly.number<Risk>(["positive", "integer"])
|
|
10
|
+
export const type = isly.object<Score>({ action: isly.string("score"), risk: Risk })
|
|
11
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { isly } from "isly"
|
|
2
|
+
import { Other as RuleOther } from "./Other"
|
|
3
|
+
import { Score as RuleScore } from "./Score"
|
|
4
|
+
|
|
5
|
+
export type Rule = Rule.Base & (Rule.Other | Rule.Score)
|
|
6
|
+
|
|
7
|
+
export namespace Rule {
|
|
8
|
+
export import Other = RuleOther
|
|
9
|
+
export import Score = RuleScore
|
|
10
|
+
export const actions = [...Other.actions, "score"] as const
|
|
11
|
+
export type Action = typeof actions[number]
|
|
12
|
+
export const kinds = ["authorization", "outbound", "inbound"] as const
|
|
13
|
+
export type Kind = typeof kinds[number]
|
|
14
|
+
export interface Base {
|
|
15
|
+
name: string
|
|
16
|
+
description: string
|
|
17
|
+
type: Rule.Kind
|
|
18
|
+
condition: string
|
|
19
|
+
flags: string[]
|
|
20
|
+
groups?: string[]
|
|
21
|
+
}
|
|
22
|
+
export const Base = isly.object<Base>({
|
|
23
|
+
name: isly.string(),
|
|
24
|
+
description: isly.string(),
|
|
25
|
+
type: isly.string(kinds),
|
|
26
|
+
condition: isly.string(),
|
|
27
|
+
flags: isly.string().array(),
|
|
28
|
+
groups: isly.string().array().optional(),
|
|
29
|
+
})
|
|
30
|
+
}
|
|
31
|
+
// Outside of the namespace otherwise the Rule import in Card/Card.Creatable and Organization causes a circular dependency crash
|
|
32
|
+
export const type = isly.intersection<Rule, Rule.Base, Rule.Other | Rule.Score>(
|
|
33
|
+
Rule.Base,
|
|
34
|
+
isly.union<Rule.Other | Rule.Score, Rule.Other, Rule.Score>(Rule.Other.type, Rule.Score.type)
|
|
35
|
+
)
|
|
@@ -3,6 +3,7 @@ import type { Transaction as ModelTransaction } from "../../Transaction"
|
|
|
3
3
|
|
|
4
4
|
export interface Transaction extends Omit<ModelTransaction.Creatable, "currency" | "amount"> {
|
|
5
5
|
amount: number
|
|
6
|
+
risk?: number
|
|
6
7
|
original: { currency: isoly.Currency; amount: number }
|
|
7
8
|
}
|
|
8
9
|
export namespace Transaction {
|
package/Rule/index.ts
CHANGED
|
@@ -1,48 +1,50 @@
|
|
|
1
1
|
import { selectively } from "selectively"
|
|
2
2
|
import { definitions } from "./definitions"
|
|
3
|
-
import
|
|
3
|
+
import { Rule as ModelRule, type as ruleType } from "./Rule"
|
|
4
4
|
import { State as RuleState } from "./State"
|
|
5
5
|
|
|
6
|
-
export type Rule = ModelRule
|
|
6
|
+
export type Rule = ModelRule
|
|
7
7
|
|
|
8
8
|
export namespace Rule {
|
|
9
9
|
export const actions = ModelRule.actions
|
|
10
10
|
export type Action = ModelRule.Action
|
|
11
11
|
export const kinds = ModelRule.kinds
|
|
12
12
|
export type Kind = ModelRule.Kind
|
|
13
|
-
export
|
|
14
|
-
export
|
|
15
|
-
export
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
13
|
+
export import Other = ModelRule.Other
|
|
14
|
+
export import Score = ModelRule.Score
|
|
15
|
+
export import State = RuleState
|
|
16
|
+
export const type = ruleType
|
|
17
|
+
export const is = ruleType.is
|
|
18
|
+
export const flaw = ruleType.flaw
|
|
19
|
+
function control(rule: ModelRule, state: State, macros?: Record<string, selectively.Definition>) {
|
|
20
|
+
return selectively.resolve({ ...macros, ...definitions }, selectively.parse(rule.condition)).is(state)
|
|
21
|
+
}
|
|
22
|
+
function score(
|
|
23
|
+
rules: (Rule & ModelRule.Score)[],
|
|
24
|
+
state: State,
|
|
25
|
+
macros?: Record<string, selectively.Definition>
|
|
26
|
+
): number | undefined {
|
|
27
|
+
return rules.reduce(
|
|
28
|
+
(r: number | undefined, rule) => (control(rule, state, macros) ? (r ?? 100) * (rule.risk / 100) : undefined),
|
|
29
|
+
undefined
|
|
30
|
+
)
|
|
30
31
|
}
|
|
31
|
-
|
|
32
|
-
export const type = ModelRule.type
|
|
33
|
-
export const is = ModelRule.type.is
|
|
34
|
-
export const flaw = ModelRule.type.flaw
|
|
35
32
|
export function evaluate(
|
|
36
33
|
rules: Rule[],
|
|
37
34
|
state: State,
|
|
38
35
|
macros?: Record<string, selectively.Definition>
|
|
39
|
-
): Record<Action, Rule[]> {
|
|
40
|
-
const result: Record<Action, Rule[]> = { review: [], reject: [], flag: [] }
|
|
41
|
-
rules.
|
|
42
|
-
r =>
|
|
43
|
-
|
|
44
|
-
|
|
36
|
+
): Record<ModelRule.Other.Action, Rule[]> & { risk?: number } {
|
|
37
|
+
const result: Record<ModelRule.Other.Action, Rule[]> & { risk?: number } = { review: [], reject: [], flag: [] }
|
|
38
|
+
const [other, scorers] = rules.reduce(
|
|
39
|
+
(r: [(Rule & ModelRule.Other)[], (Rule & ModelRule.Score)[]], rule) => {
|
|
40
|
+
rule.action == "score" ? r[1].push(rule) : r[0].push(rule)
|
|
41
|
+
return r
|
|
42
|
+
},
|
|
43
|
+
[[], []]
|
|
45
44
|
)
|
|
45
|
+
state.transaction.risk = score(scorers, state, macros)
|
|
46
|
+
result.risk = state.transaction.risk
|
|
47
|
+
other.forEach(rule => control(rule, state, macros) && result[rule.action].push(rule))
|
|
46
48
|
return result
|
|
47
49
|
}
|
|
48
50
|
}
|
package/Transaction/index.ts
CHANGED
|
@@ -32,6 +32,7 @@ export interface Transaction extends Transaction.Creatable {
|
|
|
32
32
|
flags: ("review" | string)[]
|
|
33
33
|
oldFlags: string[]
|
|
34
34
|
notes: Transaction.Note[]
|
|
35
|
+
risk?: number
|
|
35
36
|
}
|
|
36
37
|
export namespace Transaction {
|
|
37
38
|
export type Creatable = TransactionCreatable
|
|
@@ -73,6 +74,7 @@ export namespace Transaction {
|
|
|
73
74
|
flags: isly.array(isly.string() || "review"),
|
|
74
75
|
oldFlags: isly.string().array(),
|
|
75
76
|
notes: Note.type.array(),
|
|
77
|
+
risk: isly.number().optional(),
|
|
76
78
|
})
|
|
77
79
|
export const is = type.is
|
|
78
80
|
export const flaw = type.flaw
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { isly } from "isly";
|
|
2
|
+
export interface Other {
|
|
3
|
+
action: Other.Action;
|
|
4
|
+
}
|
|
5
|
+
export declare namespace Other {
|
|
6
|
+
const actions: readonly ["review", "reject", "flag"];
|
|
7
|
+
type Action = typeof actions[number];
|
|
8
|
+
const type: isly.object.ExtendableType<Other>;
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Other.js","sourceRoot":"../","sources":["Rule/Rule/Other.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAK3B,MAAM,KAAW,KAAK,CAIrB;AAJD,WAAiB,KAAK;IACR,aAAO,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAU,CAAA;IAE/C,UAAI,GAAG,IAAI,CAAC,MAAM,CAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAS,MAAA,OAAO,CAAC,EAAE,CAAC,CAAA;AACjF,CAAC,EAJgB,KAAK,KAAL,KAAK,QAIrB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { isly } from "isly";
|
|
2
|
+
export var Score;
|
|
3
|
+
(function (Score) {
|
|
4
|
+
Score.Risk = isly.number(["positive", "integer"]);
|
|
5
|
+
Score.type = isly.object({ action: isly.string("score"), risk: Score.Risk });
|
|
6
|
+
})(Score || (Score = {}));
|
|
7
|
+
//# sourceMappingURL=Score.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Score.js","sourceRoot":"../","sources":["Rule/Rule/Score.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAM3B,MAAM,KAAW,KAAK,CAIrB;AAJD,WAAiB,KAAK;IAER,UAAI,GAAG,IAAI,CAAC,MAAM,CAAO,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC,CAAA;IACjD,UAAI,GAAG,IAAI,CAAC,MAAM,CAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,MAAA,IAAI,EAAE,CAAC,CAAA;AACrF,CAAC,EAJgB,KAAK,KAAL,KAAK,QAIrB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { isly } from "isly";
|
|
2
|
+
import { Other as RuleOther } from "./Other";
|
|
3
|
+
import { Score as RuleScore } from "./Score";
|
|
4
|
+
export type Rule = Rule.Base & (Rule.Other | Rule.Score);
|
|
5
|
+
export declare namespace Rule {
|
|
6
|
+
export import Other = RuleOther;
|
|
7
|
+
export import Score = RuleScore;
|
|
8
|
+
const actions: readonly ["review", "reject", "flag", "score"];
|
|
9
|
+
type Action = typeof actions[number];
|
|
10
|
+
const kinds: readonly ["authorization", "outbound", "inbound"];
|
|
11
|
+
type Kind = typeof kinds[number];
|
|
12
|
+
interface Base {
|
|
13
|
+
name: string;
|
|
14
|
+
description: string;
|
|
15
|
+
type: Rule.Kind;
|
|
16
|
+
condition: string;
|
|
17
|
+
flags: string[];
|
|
18
|
+
groups?: string[];
|
|
19
|
+
}
|
|
20
|
+
const Base: isly.object.ExtendableType<Base>;
|
|
21
|
+
}
|
|
22
|
+
export declare const type: isly.Type<Rule>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { isly } from "isly";
|
|
2
|
+
import { Other as RuleOther } from "./Other";
|
|
3
|
+
import { Score as RuleScore } from "./Score";
|
|
4
|
+
export var Rule;
|
|
5
|
+
(function (Rule) {
|
|
6
|
+
Rule.Other = RuleOther;
|
|
7
|
+
Rule.Score = RuleScore;
|
|
8
|
+
Rule.actions = [...Rule.Other.actions, "score"];
|
|
9
|
+
Rule.kinds = ["authorization", "outbound", "inbound"];
|
|
10
|
+
Rule.Base = isly.object({
|
|
11
|
+
name: isly.string(),
|
|
12
|
+
description: isly.string(),
|
|
13
|
+
type: isly.string(Rule.kinds),
|
|
14
|
+
condition: isly.string(),
|
|
15
|
+
flags: isly.string().array(),
|
|
16
|
+
groups: isly.string().array().optional(),
|
|
17
|
+
});
|
|
18
|
+
})(Rule || (Rule = {}));
|
|
19
|
+
export const type = isly.intersection(Rule.Base, isly.union(Rule.Other.type, Rule.Score.type));
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../","sources":["Rule/Rule/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,SAAS,CAAA;AAC5C,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,SAAS,CAAA;AAI5C,MAAM,KAAW,IAAI,CAuBpB;AAvBD,WAAiB,IAAI;IACN,UAAK,GAAG,SAAS,CAAA;IACjB,UAAK,GAAG,SAAS,CAAA;IAClB,YAAO,GAAG,CAAC,GAAG,KAAA,KAAK,CAAC,OAAO,EAAE,OAAO,CAAU,CAAA;IAE9C,UAAK,GAAG,CAAC,eAAe,EAAE,UAAU,EAAE,SAAS,CAAU,CAAA;IAUzD,SAAI,GAAG,IAAI,CAAC,MAAM,CAAO;QACrC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE;QACnB,WAAW,EAAE,IAAI,CAAC,MAAM,EAAE;QAC1B,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,KAAA,KAAK,CAAC;QACxB,SAAS,EAAE,IAAI,CAAC,MAAM,EAAE;QACxB,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE;QAC5B,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE;KACxC,CAAC,CAAA;AACH,CAAC,EAvBgB,IAAI,KAAJ,IAAI,QAuBpB;AAED,MAAM,CAAC,MAAM,IAAI,GAAG,IAAI,CAAC,YAAY,CACpC,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,KAAK,CAAkD,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAC7F,CAAA"}
|
|
@@ -2,6 +2,7 @@ import { isoly } from "isoly";
|
|
|
2
2
|
import type { Transaction as ModelTransaction } from "../../Transaction";
|
|
3
3
|
export interface Transaction extends Omit<ModelTransaction.Creatable, "currency" | "amount"> {
|
|
4
4
|
amount: number;
|
|
5
|
+
risk?: number;
|
|
5
6
|
original: {
|
|
6
7
|
currency: isoly.Currency;
|
|
7
8
|
amount: number;
|
|
@@ -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":"AAQA,MAAM,KAAW,WAAW,CAQ3B;AARD,WAAiB,WAAW;IAC3B,SAAgB,IAAI,CAAC,WAAuC;QAC3D,OAAO;YACN,GAAG,WAAW;YACd,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;IANe,gBAAI,OAMnB,CAAA;AACF,CAAC,EARgB,WAAW,KAAX,WAAW,QAQ3B"}
|
package/dist/Rule/index.d.ts
CHANGED
|
@@ -1,32 +1,19 @@
|
|
|
1
1
|
import { selectively } from "selectively";
|
|
2
|
-
import
|
|
2
|
+
import { Rule as ModelRule } from "./Rule";
|
|
3
3
|
import { State as RuleState } from "./State";
|
|
4
|
-
export type Rule = ModelRule
|
|
4
|
+
export type Rule = ModelRule;
|
|
5
5
|
export declare namespace Rule {
|
|
6
|
-
const actions: readonly ["review", "reject", "flag"];
|
|
6
|
+
const actions: readonly ["review", "reject", "flag", "score"];
|
|
7
7
|
type Action = ModelRule.Action;
|
|
8
8
|
const kinds: readonly ["authorization", "outbound", "inbound"];
|
|
9
9
|
type Kind = ModelRule.Kind;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
type Transactions = RuleState.Account.Transactions;
|
|
16
|
-
type Days = RuleState.Account.Days;
|
|
17
|
-
}
|
|
18
|
-
type Authorization = RuleState.Authorization;
|
|
19
|
-
type Card = RuleState.Card;
|
|
20
|
-
namespace Card {
|
|
21
|
-
type Statistics = RuleState.Card.Statistics;
|
|
22
|
-
}
|
|
23
|
-
type Transaction = RuleState.Transaction;
|
|
24
|
-
type Data = RuleState.Data;
|
|
25
|
-
type Partial = RuleState.Partial;
|
|
26
|
-
type Organization = RuleState.Organization;
|
|
27
|
-
}
|
|
28
|
-
const type: import("isly/dist/cjs/object").object.ExtendableType<ModelRule.Rule>;
|
|
29
|
-
const is: import("isly/dist/cjs/Type").Type.IsFunction<ModelRule.Rule>;
|
|
10
|
+
export import Other = ModelRule.Other;
|
|
11
|
+
export import Score = ModelRule.Score;
|
|
12
|
+
export import State = RuleState;
|
|
13
|
+
const type: import("isly/dist/cjs/Type").Type<ModelRule>;
|
|
14
|
+
const is: import("isly/dist/cjs/Type").Type.IsFunction<ModelRule>;
|
|
30
15
|
const flaw: import("isly/dist/cjs/Type").Type.FlawFunction;
|
|
31
|
-
function evaluate(rules: Rule[], state: State, macros?: Record<string, selectively.Definition>): Record<Action, Rule[]
|
|
16
|
+
function evaluate(rules: Rule[], state: State, macros?: Record<string, selectively.Definition>): Record<ModelRule.Other.Action, Rule[]> & {
|
|
17
|
+
risk?: number;
|
|
18
|
+
};
|
|
32
19
|
}
|
package/dist/Rule/index.js
CHANGED
|
@@ -1,19 +1,32 @@
|
|
|
1
1
|
import { selectively } from "selectively";
|
|
2
2
|
import { definitions } from "./definitions";
|
|
3
|
-
import
|
|
3
|
+
import { Rule as ModelRule, type as ruleType } from "./Rule";
|
|
4
4
|
import { State as RuleState } from "./State";
|
|
5
5
|
export var Rule;
|
|
6
6
|
(function (Rule) {
|
|
7
7
|
Rule.actions = ModelRule.actions;
|
|
8
8
|
Rule.kinds = ModelRule.kinds;
|
|
9
|
+
Rule.Other = ModelRule.Other;
|
|
10
|
+
Rule.Score = ModelRule.Score;
|
|
9
11
|
Rule.State = RuleState;
|
|
10
|
-
Rule.type =
|
|
11
|
-
Rule.is =
|
|
12
|
-
Rule.flaw =
|
|
12
|
+
Rule.type = ruleType;
|
|
13
|
+
Rule.is = ruleType.is;
|
|
14
|
+
Rule.flaw = ruleType.flaw;
|
|
15
|
+
function control(rule, state, macros) {
|
|
16
|
+
return selectively.resolve({ ...macros, ...definitions }, selectively.parse(rule.condition)).is(state);
|
|
17
|
+
}
|
|
18
|
+
function score(rules, state, macros) {
|
|
19
|
+
return rules.reduce((r, rule) => (control(rule, state, macros) ? (r ?? 100) * (rule.risk / 100) : undefined), undefined);
|
|
20
|
+
}
|
|
13
21
|
function evaluate(rules, state, macros) {
|
|
14
22
|
const result = { review: [], reject: [], flag: [] };
|
|
15
|
-
|
|
16
|
-
|
|
23
|
+
const [other, scorers] = rules.reduce((r, rule) => {
|
|
24
|
+
rule.action == "score" ? r[1].push(rule) : r[0].push(rule);
|
|
25
|
+
return r;
|
|
26
|
+
}, [[], []]);
|
|
27
|
+
state.transaction.risk = score(scorers, state, macros);
|
|
28
|
+
result.risk = state.transaction.risk;
|
|
29
|
+
other.forEach(rule => control(rule, state, macros) && result[rule.action].push(rule));
|
|
17
30
|
return result;
|
|
18
31
|
}
|
|
19
32
|
Rule.evaluate = evaluate;
|
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;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../","sources":["Rule/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACzC,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,CA0CpB;AA1CD,WAAiB,IAAI;IACP,YAAO,GAAG,SAAS,CAAC,OAAO,CAAA;IAE3B,UAAK,GAAG,SAAS,CAAC,KAAK,CAAA;IAEtB,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,OAAO,CAAC,IAAe,EAAE,KAAY,EAAE,MAA+C;QAC9F,OAAO,WAAW,CAAC,OAAO,CAAC,EAAE,GAAG,MAAM,EAAE,GAAG,WAAW,EAAE,EAAE,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;IACvG,CAAC;IACD,SAAS,KAAK,CACb,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,MAAM,CAAA;IACd,CAAC;IAjBe,aAAQ,WAiBvB,CAAA;AACF,CAAC,EA1CgB,IAAI,KAAJ,IAAI,QA0CpB"}
|
|
@@ -39,6 +39,7 @@ export var Transaction;
|
|
|
39
39
|
flags: isly.array(isly.string() || "review"),
|
|
40
40
|
oldFlags: isly.string().array(),
|
|
41
41
|
notes: Transaction.Note.type.array(),
|
|
42
|
+
risk: isly.number().optional(),
|
|
42
43
|
});
|
|
43
44
|
Transaction.is = Transaction.type.is;
|
|
44
45
|
Transaction.flaw = Transaction.type.flaw;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"../","sources":["Transaction/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC9B,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,WAAW,CAAA;AACzD,OAAO,EAAE,SAAS,IAAI,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAC/D,OAAO,EAAE,QAAQ,IAAI,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAC5D,OAAO,EAAE,IAAI,IAAI,eAAe,EAAE,MAAM,QAAQ,CAAA;AAChD,OAAO,EAAE,SAAS,IAAI,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAC/D,OAAO,EAAE,MAAM,IAAI,iBAAiB,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../","sources":["Transaction/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CA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M,UAAU,GAAG,IAAI,GAAG,CAAS,WAAW,CAAC,QAAQ,CAAC,CAAA;QACxD,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,CACvB,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC;YAChB,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;YAClE,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CACzC,CAAA;QACD,WAAW,CAAC,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QACvC,WAAW,CAAC,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;IAC9C,CAAC;IAVe,gBAAI,OAUnB,CAAA;AACF,CAAC,EAxHgB,WAAW,KAAX,WAAW,QAwH3B"}
|
package/package.json
CHANGED
package/Rule/Rule.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { isly } from "isly"
|
|
2
|
-
|
|
3
|
-
export interface Rule {
|
|
4
|
-
name: string
|
|
5
|
-
description: string
|
|
6
|
-
action: Action
|
|
7
|
-
type: Kind
|
|
8
|
-
condition: string
|
|
9
|
-
flags: string[]
|
|
10
|
-
groups?: string[]
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export const actions = ["review", "reject", "flag"] as const
|
|
14
|
-
export type Action = typeof actions[number]
|
|
15
|
-
export const kinds = ["authorization", "outbound", "inbound"] as const
|
|
16
|
-
export type Kind = typeof kinds[number]
|
|
17
|
-
|
|
18
|
-
export const type = isly.object<Rule>({
|
|
19
|
-
name: isly.string(),
|
|
20
|
-
description: isly.string(),
|
|
21
|
-
action: isly.string(actions),
|
|
22
|
-
type: isly.string(kinds),
|
|
23
|
-
condition: isly.string(),
|
|
24
|
-
flags: isly.string().array(),
|
|
25
|
-
groups: isly.string().array().optional(),
|
|
26
|
-
})
|
|
27
|
-
export const is = type.is
|
|
28
|
-
export const flaw = type.flaw
|
package/dist/Rule/Rule.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { isly } from "isly";
|
|
2
|
-
export interface Rule {
|
|
3
|
-
name: string;
|
|
4
|
-
description: string;
|
|
5
|
-
action: Action;
|
|
6
|
-
type: Kind;
|
|
7
|
-
condition: string;
|
|
8
|
-
flags: string[];
|
|
9
|
-
groups?: string[];
|
|
10
|
-
}
|
|
11
|
-
export declare const actions: readonly ["review", "reject", "flag"];
|
|
12
|
-
export type Action = typeof actions[number];
|
|
13
|
-
export declare const kinds: readonly ["authorization", "outbound", "inbound"];
|
|
14
|
-
export type Kind = typeof kinds[number];
|
|
15
|
-
export declare const type: isly.object.ExtendableType<Rule>;
|
|
16
|
-
export declare const is: isly.Type.IsFunction<Rule>;
|
|
17
|
-
export declare const flaw: isly.Type.FlawFunction;
|
package/dist/Rule/Rule.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { isly } from "isly";
|
|
2
|
-
export const actions = ["review", "reject", "flag"];
|
|
3
|
-
export const kinds = ["authorization", "outbound", "inbound"];
|
|
4
|
-
export const type = isly.object({
|
|
5
|
-
name: isly.string(),
|
|
6
|
-
description: isly.string(),
|
|
7
|
-
action: isly.string(actions),
|
|
8
|
-
type: isly.string(kinds),
|
|
9
|
-
condition: isly.string(),
|
|
10
|
-
flags: isly.string().array(),
|
|
11
|
-
groups: isly.string().array().optional(),
|
|
12
|
-
});
|
|
13
|
-
export const is = type.is;
|
|
14
|
-
export const flaw = type.flaw;
|
|
15
|
-
//# sourceMappingURL=Rule.js.map
|
package/dist/Rule/Rule.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Rule.js","sourceRoot":"../","sources":["Rule/Rule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAY3B,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAU,CAAA;AAE5D,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,eAAe,EAAE,UAAU,EAAE,SAAS,CAAU,CAAA;AAGtE,MAAM,CAAC,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAO;IACrC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE;IACnB,WAAW,EAAE,IAAI,CAAC,MAAM,EAAE;IAC1B,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;IAC5B,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;IACxB,SAAS,EAAE,IAAI,CAAC,MAAM,EAAE;IACxB,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE;IAC5B,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE;CACxC,CAAC,CAAA;AACF,MAAM,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,EAAE,CAAA;AACzB,MAAM,CAAC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAA"}
|