@pax2pay/model-banking 0.1.594 → 0.1.595
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/Other.ts +2 -4
- package/Rule/State/Account.ts +4 -4
- package/Rule/State/index.ts +2 -6
- package/Rule/control.ts +1 -2
- package/Rule/index.ts +2 -10
- package/dist/cjs/Rule/Other.d.ts +1 -2
- package/dist/cjs/Rule/Other.js +2 -2
- package/dist/cjs/Rule/Other.js.map +1 -1
- package/dist/cjs/Rule/State/Account.d.ts +3 -3
- package/dist/cjs/Rule/State/Account.js +2 -2
- package/dist/cjs/Rule/State/Account.js.map +1 -1
- package/dist/cjs/Rule/State/index.d.ts +2 -2
- package/dist/cjs/Rule/State/index.js +4 -4
- package/dist/cjs/Rule/State/index.js.map +1 -1
- package/dist/cjs/Rule/control.js +1 -2
- package/dist/cjs/Rule/control.js.map +1 -1
- package/dist/cjs/Rule/index.d.ts +1 -3
- package/dist/cjs/Rule/index.js +2 -2
- package/dist/cjs/Rule/index.js.map +1 -1
- package/dist/mjs/Rule/Other.d.ts +1 -2
- package/dist/mjs/Rule/Other.js +2 -2
- package/dist/mjs/Rule/Other.js.map +1 -1
- package/dist/mjs/Rule/State/Account.d.ts +3 -3
- package/dist/mjs/Rule/State/Account.js +2 -2
- package/dist/mjs/Rule/State/Account.js.map +1 -1
- package/dist/mjs/Rule/State/index.d.ts +2 -2
- package/dist/mjs/Rule/State/index.js +4 -4
- package/dist/mjs/Rule/State/index.js.map +1 -1
- package/dist/mjs/Rule/control.js +1 -2
- package/dist/mjs/Rule/control.js.map +1 -1
- package/dist/mjs/Rule/index.d.ts +1 -3
- package/dist/mjs/Rule/index.js +2 -2
- package/dist/mjs/Rule/index.js.map +1 -1
- package/package.json +1 -1
- package/Rule/definitions.ts +0 -6
- package/dist/cjs/Rule/definitions.d.ts +0 -2
- package/dist/cjs/Rule/definitions.js +0 -8
- package/dist/cjs/Rule/definitions.js.map +0 -1
- package/dist/mjs/Rule/definitions.d.ts +0 -2
- package/dist/mjs/Rule/definitions.js +0 -5
- package/dist/mjs/Rule/definitions.js.map +0 -1
package/Rule/Other.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { isoly } from "isoly"
|
|
2
|
-
import { selectively } from "selectively"
|
|
3
2
|
import { isly } from "isly"
|
|
4
3
|
import { isly as isly2 } from "isly2"
|
|
5
4
|
import type { Note } from "../Transaction/Note"
|
|
@@ -24,8 +23,7 @@ export namespace Other {
|
|
|
24
23
|
export const type2: isly2.Object<Other> = Base.type2.extend<Other>({ action: Action.type2 })
|
|
25
24
|
export function evaluate(
|
|
26
25
|
rules: Other[],
|
|
27
|
-
state: State
|
|
28
|
-
macros?: Record<string, selectively.Definition>
|
|
26
|
+
state: State
|
|
29
27
|
): { outcomes: Record<Other.Action, Other[]>; notes: Note[]; flags: Set<string> } {
|
|
30
28
|
const now = isoly.DateTime.now()
|
|
31
29
|
const result: ReturnType<typeof evaluate> = {
|
|
@@ -42,7 +40,7 @@ export namespace Other {
|
|
|
42
40
|
["card", "external", "internal"].some(type => type == state.transaction.type)
|
|
43
41
|
)
|
|
44
42
|
for (const rule of rules)
|
|
45
|
-
if (control(rule, state
|
|
43
|
+
if (control(rule, state)) {
|
|
46
44
|
result.outcomes[rule.action].push(rule)
|
|
47
45
|
result.notes.push({ author: "automatic", created: now, text: rule.name, rule })
|
|
48
46
|
rule.flags.forEach(f => result.flags.add(f))
|
package/Rule/State/Account.ts
CHANGED
|
@@ -3,8 +3,8 @@ import { Rail } from "../../Rail"
|
|
|
3
3
|
|
|
4
4
|
export interface Account extends ModelAccount {
|
|
5
5
|
address: Rail.Address
|
|
6
|
-
transactions
|
|
7
|
-
days
|
|
6
|
+
transactions?: Account.Transactions
|
|
7
|
+
days?: Account.Days
|
|
8
8
|
}
|
|
9
9
|
// keep for note so we remember how to store: type Storage = Record<`statistics|currency|${isoly.Currency}`, isoly.DateTime>
|
|
10
10
|
export namespace Account {
|
|
@@ -26,7 +26,7 @@ export namespace Account {
|
|
|
26
26
|
outgoing: { today: Today }
|
|
27
27
|
card: { today: Today }
|
|
28
28
|
}
|
|
29
|
-
export function from(account: ModelAccount, address: Rail.Address
|
|
30
|
-
return { ...account, address
|
|
29
|
+
export function from(account: ModelAccount, address: Rail.Address): Account {
|
|
30
|
+
return { ...account, address }
|
|
31
31
|
}
|
|
32
32
|
}
|
package/Rule/State/index.ts
CHANGED
|
@@ -39,8 +39,6 @@ export namespace State {
|
|
|
39
39
|
export function from(
|
|
40
40
|
account: ModelAccount,
|
|
41
41
|
address: Rail.Address,
|
|
42
|
-
transactions: Account.Transactions,
|
|
43
|
-
days: Account.Days,
|
|
44
42
|
transaction: ModelTransaction.Creatable.Resolved | ModelTransaction,
|
|
45
43
|
kind: Rule.Base.Kind,
|
|
46
44
|
stage: "finalize" | "initiate",
|
|
@@ -48,7 +46,7 @@ export namespace State {
|
|
|
48
46
|
organization?: Organization
|
|
49
47
|
): State {
|
|
50
48
|
return {
|
|
51
|
-
account: Account.from(account, address
|
|
49
|
+
account: Account.from(account, address),
|
|
52
50
|
transaction: Transaction.from(account, transaction, kind, stage),
|
|
53
51
|
authorization: Authorization.from(transaction),
|
|
54
52
|
card,
|
|
@@ -63,14 +61,12 @@ export namespace State {
|
|
|
63
61
|
export function fromPreTransaction(
|
|
64
62
|
account: ModelAccount,
|
|
65
63
|
address: Rail.Address,
|
|
66
|
-
transactions: Account.Transactions,
|
|
67
|
-
days: Account.Days,
|
|
68
64
|
transaction: ModelTransaction.PreTransaction,
|
|
69
65
|
card?: ModelCard & { statistics: Card.Statistics },
|
|
70
66
|
organization?: Organization
|
|
71
67
|
): State {
|
|
72
68
|
return {
|
|
73
|
-
account: Account.from(account, address
|
|
69
|
+
account: Account.from(account, address),
|
|
74
70
|
transaction: Transaction.from(account, transaction, type[transaction.type], "initiate"),
|
|
75
71
|
card: card ? Card.from(card, card.statistics) : undefined,
|
|
76
72
|
organization,
|
package/Rule/control.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { selectively } from "selectively"
|
|
2
2
|
import type { Rule } from "."
|
|
3
|
-
import { definitions } from "./definitions"
|
|
4
3
|
import type { State } from "./State"
|
|
5
4
|
|
|
6
5
|
export function control(rule: Rule, state: State, macros?: Record<string, selectively.Definition>): boolean {
|
|
7
|
-
return selectively.
|
|
6
|
+
return selectively.parse(rule.condition).is(state)
|
|
8
7
|
}
|
package/Rule/index.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { selectively } from "selectively"
|
|
2
1
|
import { isly } from "isly"
|
|
3
|
-
import { Exchange } from "../Exchange"
|
|
4
2
|
import type { Note } from "../Transaction/Note"
|
|
5
3
|
import { Base as RuleBase } from "./Base"
|
|
6
4
|
import { control as ruleControl } from "./control"
|
|
@@ -23,12 +21,7 @@ export namespace Rule {
|
|
|
23
21
|
export const type = isly.string<Action>(values)
|
|
24
22
|
}
|
|
25
23
|
export const type = ruleType
|
|
26
|
-
export function evaluate(
|
|
27
|
-
rules: Rule[],
|
|
28
|
-
state: RuleState,
|
|
29
|
-
macros?: Record<string, selectively.Definition>,
|
|
30
|
-
table: Exchange.Rates = {}
|
|
31
|
-
): RuleState.Evaluated {
|
|
24
|
+
export function evaluate(rules: Rule[], state: RuleState): RuleState.Evaluated {
|
|
32
25
|
const outcomes: Record<Rule.Action, Rule[]> = {
|
|
33
26
|
review: [],
|
|
34
27
|
reject: [],
|
|
@@ -37,8 +30,7 @@ export namespace Rule {
|
|
|
37
30
|
const notes: Note[] = []
|
|
38
31
|
const evaluated = Other.evaluate(
|
|
39
32
|
rules.filter(rule => Base.Kind.is(state.transaction.kind, rule, state.organization?.groups, state.card?.preset)),
|
|
40
|
-
state
|
|
41
|
-
macros
|
|
33
|
+
state
|
|
42
34
|
)
|
|
43
35
|
notes.push(...evaluated.notes)
|
|
44
36
|
outcomes.flag.push(...evaluated.outcomes.flag)
|
package/dist/cjs/Rule/Other.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { selectively } from "selectively";
|
|
2
1
|
import { isly } from "isly";
|
|
3
2
|
import { isly as isly2 } from "isly2";
|
|
4
3
|
import type { Note } from "../Transaction/Note";
|
|
@@ -16,7 +15,7 @@ export declare namespace Other {
|
|
|
16
15
|
}
|
|
17
16
|
const type: import("isly/dist/cjs/object").IslyObject<Other, Base>;
|
|
18
17
|
const type2: isly2.Object<Other>;
|
|
19
|
-
function evaluate(rules: Other[], state: State
|
|
18
|
+
function evaluate(rules: Other[], state: State): {
|
|
20
19
|
outcomes: Record<Other.Action, Other[]>;
|
|
21
20
|
notes: Note[];
|
|
22
21
|
flags: Set<string>;
|
package/dist/cjs/Rule/Other.js
CHANGED
|
@@ -19,7 +19,7 @@ var Other;
|
|
|
19
19
|
})(Action = Other.Action || (Other.Action = {}));
|
|
20
20
|
Other.type = Base_1.Base.type.extend({ action: Action.type });
|
|
21
21
|
Other.type2 = Base_1.Base.type2.extend({ action: Action.type2 });
|
|
22
|
-
function evaluate(rules, state
|
|
22
|
+
function evaluate(rules, state) {
|
|
23
23
|
const now = isoly_1.isoly.DateTime.now();
|
|
24
24
|
const result = {
|
|
25
25
|
outcomes: {
|
|
@@ -33,7 +33,7 @@ var Other;
|
|
|
33
33
|
if (state.transaction.stage == "initiate" &&
|
|
34
34
|
["card", "external", "internal"].some(type => type == state.transaction.type))
|
|
35
35
|
for (const rule of rules)
|
|
36
|
-
if ((0, control_1.control)(rule, state
|
|
36
|
+
if ((0, control_1.control)(rule, state)) {
|
|
37
37
|
result.outcomes[rule.action].push(rule);
|
|
38
38
|
result.notes.push({ author: "automatic", created: now, text: rule.name, rule });
|
|
39
39
|
rule.flags.forEach(f => result.flags.add(f));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Other.js","sourceRoot":"","sources":["../../../Rule/Other.ts"],"names":[],"mappings":";;;AAAA,iCAA6B;
|
|
1
|
+
{"version":3,"file":"Other.js","sourceRoot":"","s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,CAAC,WAAW,CAAC,IAAI,CAAC;YAE7E,KAAK,MAAM,IAAI,IAAI,KAAK;gBACvB,IAAI,IAAA,iBAAO,EAAC,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC;oBAC1B,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;oBACvC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAA;oBAC/E,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;oBAC5C,IAAI,CAAC,MAAM,IAAI,QAAQ,IAAI,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;gBACtD,CAAC;QACH,OAAO,MAAM,CAAA;IACd,CAAC;IA1Be,cAAQ,WA0BvB,CAAA;AACF,CAAC,EAvCgB,KAAK,qBAAL,KAAK,QAuCrB"}
|
|
@@ -2,8 +2,8 @@ import type { Account as ModelAccount } from "../../Account";
|
|
|
2
2
|
import { Rail } from "../../Rail";
|
|
3
3
|
export interface Account extends ModelAccount {
|
|
4
4
|
address: Rail.Address;
|
|
5
|
-
transactions
|
|
6
|
-
days
|
|
5
|
+
transactions?: Account.Transactions;
|
|
6
|
+
days?: Account.Days;
|
|
7
7
|
}
|
|
8
8
|
export declare namespace Account {
|
|
9
9
|
type Today = {
|
|
@@ -30,6 +30,6 @@ export declare namespace Account {
|
|
|
30
30
|
today: Today;
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
-
export function from(account: ModelAccount, address: Rail.Address
|
|
33
|
+
export function from(account: ModelAccount, address: Rail.Address): Account;
|
|
34
34
|
export {};
|
|
35
35
|
}
|
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Account = void 0;
|
|
4
4
|
var Account;
|
|
5
5
|
(function (Account) {
|
|
6
|
-
function from(account, address
|
|
7
|
-
return { ...account, address
|
|
6
|
+
function from(account, address) {
|
|
7
|
+
return { ...account, address };
|
|
8
8
|
}
|
|
9
9
|
Account.from = from;
|
|
10
10
|
})(Account || (exports.Account = Account = {}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Account.js","sourceRoot":"","sources":["../../../../Rule/State/Account.ts"],"names":[],"mappings":";;;AASA,IAAiB,OAAO,CAsBvB;AAtBD,WAAiB,OAAO;IAmBvB,SAAgB,IAAI,CAAC,OAAqB,EAAE,OAAqB
|
|
1
|
+
{"version":3,"file":"Account.js","sourceRoot":"","sources":["../../../../Rule/State/Account.ts"],"names":[],"mappings":";;;AASA,IAAiB,OAAO,CAsBvB;AAtBD,WAAiB,OAAO;IAmBvB,SAAgB,IAAI,CAAC,OAAqB,EAAE,OAAqB;QAChE,OAAO,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,CAAA;IAC/B,CAAC;IAFe,YAAI,OAEnB,CAAA;AACF,CAAC,EAtBgB,OAAO,uBAAP,OAAO,QAsBvB"}
|
|
@@ -35,9 +35,9 @@ export declare namespace State {
|
|
|
35
35
|
flags: string[];
|
|
36
36
|
notes: ModelTransaction.Note[];
|
|
37
37
|
}
|
|
38
|
-
function from(account: ModelAccount, address: Rail.Address,
|
|
38
|
+
function from(account: ModelAccount, address: Rail.Address, transaction: ModelTransaction.Creatable.Resolved | ModelTransaction, kind: Rule.Base.Kind, stage: "finalize" | "initiate", card?: Card, organization?: Organization): State;
|
|
39
39
|
const type: Record<ModelTransaction.PreTransaction["type"], Rule.Base.Kind>;
|
|
40
|
-
function fromPreTransaction(account: ModelAccount, address: Rail.Address,
|
|
40
|
+
function fromPreTransaction(account: ModelAccount, address: Rail.Address, transaction: ModelTransaction.PreTransaction, card?: ModelCard & {
|
|
41
41
|
statistics: Card.Statistics;
|
|
42
42
|
}, organization?: Organization): State;
|
|
43
43
|
}
|
|
@@ -21,9 +21,9 @@ var State;
|
|
|
21
21
|
Outcome.values = ["approve", "reject", "review"];
|
|
22
22
|
Outcome.type = isly_1.isly.string(Outcome.values);
|
|
23
23
|
})(Outcome = State.Outcome || (State.Outcome = {}));
|
|
24
|
-
function from(account, address,
|
|
24
|
+
function from(account, address, transaction, kind, stage, card, organization) {
|
|
25
25
|
return {
|
|
26
|
-
account: State.Account.from(account, address
|
|
26
|
+
account: State.Account.from(account, address),
|
|
27
27
|
transaction: State.Transaction.from(account, transaction, kind, stage),
|
|
28
28
|
authorization: State.Authorization.from(transaction),
|
|
29
29
|
card,
|
|
@@ -36,9 +36,9 @@ var State;
|
|
|
36
36
|
incoming: "inbound",
|
|
37
37
|
outgoing: "outbound",
|
|
38
38
|
};
|
|
39
|
-
function fromPreTransaction(account, address,
|
|
39
|
+
function fromPreTransaction(account, address, transaction, card, organization) {
|
|
40
40
|
return {
|
|
41
|
-
account: State.Account.from(account, address
|
|
41
|
+
account: State.Account.from(account, address),
|
|
42
42
|
transaction: State.Transaction.from(account, transaction, State.type[transaction.type], "initiate"),
|
|
43
43
|
card: card ? State.Card.from(card, card.statistics) : undefined,
|
|
44
44
|
organization,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../Rule/State/index.ts"],"names":[],"mappings":";;;AAAA,+BAA2B;AAM3B,uCAAmD;AACnD,mDAAqE;AACrE,iCAA0C;AAC1C,iDAAkE;AAClE,uCAAmD;AACnD,+CAA+D;AAS/D,IAAiB,KAAK,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../Rule/State/index.ts"],"names":[],"mappings":";;;AAAA,+BAA2B;AAM3B,uCAAmD;AACnD,mDAAqE;AACrE,iCAA0C;AAC1C,iDAAkE;AAClE,uCAAmD;AACnD,+CAA+D;AAS/D,I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AAE,WAAW,EAAE,MAAA,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,UAAU,CAAC;YACvF,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,MAAA,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS;YACzD,YAAY;SACZ,CAAA;IACF,CAAC;IAbe,wBAAkB,qBAajC,CAAA;AACF,CAAC,EAtDgB,KAAK,qBAAL,KAAK,QAsDrB"}
|
package/dist/cjs/Rule/control.js
CHANGED
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.control = control;
|
|
4
4
|
const selectively_1 = require("selectively");
|
|
5
|
-
const definitions_1 = require("./definitions");
|
|
6
5
|
function control(rule, state, macros) {
|
|
7
|
-
return selectively_1.selectively.
|
|
6
|
+
return selectively_1.selectively.parse(rule.condition).is(state);
|
|
8
7
|
}
|
|
9
8
|
//# sourceMappingURL=control.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control.js","sourceRoot":"","sources":["../../../Rule/control.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"control.js","sourceRoot":"","sources":["../../../Rule/control.ts"],"names":[],"mappings":";;AAIA,0BAEC;AAND,6CAAyC;AAIzC,SAAgB,OAAO,CAAC,IAAU,EAAE,KAAY,EAAE,MAA+C;IAChG,OAAO,yBAAW,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;AACnD,CAAC"}
|
package/dist/cjs/Rule/index.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { selectively } from "selectively";
|
|
2
1
|
import { isly } from "isly";
|
|
3
|
-
import { Exchange } from "../Exchange";
|
|
4
2
|
import { Base as RuleBase } from "./Base";
|
|
5
3
|
import { control as ruleControl } from "./control";
|
|
6
4
|
import { Other as RuleOther } from "./Other";
|
|
@@ -19,7 +17,7 @@ export declare namespace Rule {
|
|
|
19
17
|
const type: isly.Type<"reject" | "review" | "flag">;
|
|
20
18
|
}
|
|
21
19
|
const type: import("isly/dist/cjs/object").IslyObject<Other, Base>;
|
|
22
|
-
function evaluate(rules: Rule[], state: RuleState
|
|
20
|
+
function evaluate(rules: Rule[], state: RuleState): RuleState.Evaluated;
|
|
23
21
|
function isLegacy(rule: Rule): boolean;
|
|
24
22
|
function fromLegacy(rule: Rule): Rule;
|
|
25
23
|
}
|
package/dist/cjs/Rule/index.js
CHANGED
|
@@ -21,14 +21,14 @@ var Rule;
|
|
|
21
21
|
Action.type = isly_1.isly.string(Action.values);
|
|
22
22
|
})(Action = Rule.Action || (Rule.Action = {}));
|
|
23
23
|
Rule.type = type_1.type;
|
|
24
|
-
function evaluate(rules, state
|
|
24
|
+
function evaluate(rules, state) {
|
|
25
25
|
const outcomes = {
|
|
26
26
|
review: [],
|
|
27
27
|
reject: [],
|
|
28
28
|
flag: [],
|
|
29
29
|
};
|
|
30
30
|
const notes = [];
|
|
31
|
-
const evaluated = Rule.Other.evaluate(rules.filter(rule => Rule.Base.Kind.is(state.transaction.kind, rule, state.organization?.groups, state.card?.preset)), state
|
|
31
|
+
const evaluated = Rule.Other.evaluate(rules.filter(rule => Rule.Base.Kind.is(state.transaction.kind, rule, state.organization?.groups, state.card?.preset)), state);
|
|
32
32
|
notes.push(...evaluated.notes);
|
|
33
33
|
outcomes.flag.push(...evaluated.outcomes.flag);
|
|
34
34
|
outcomes.review.push(...evaluated.outcomes.review);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../Rule/index.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../Rule/index.ts"],"names":[],"mappings":";;;AAAA,+BAA2B;AAE3B,iCAAyC;AACzC,uCAAkD;AAClD,mCAA4C;AAC5C,mCAA4C;A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CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;QAClD,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;QAClD,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAA;QACzG,OAAO,EAAE,GAAG,KAAK,EAAE,KAAK,EAAE,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAA;IAC3E,CAAC;IAjBe,aAAQ,WAiBvB,CAAA;IACD,SAAgB,QAAQ,CAAC,IAAU;QAClC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IAClD,CAAC;IAFe,aAAQ,WAEvB,CAAA;IACD,SAAgB,UAAU,CAAC,IAAU;QACpC,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,IAAI,CAAA;IACjE,CAAC;IAFe,eAAU,aAEzB,CAAA;AACF,CAAC,EAtCgB,IAAI,oBAAJ,IAAI,QAsCpB"}
|
package/dist/mjs/Rule/Other.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { selectively } from "selectively";
|
|
2
1
|
import { isly } from "isly";
|
|
3
2
|
import { isly as isly2 } from "isly2";
|
|
4
3
|
import type { Note } from "../Transaction/Note";
|
|
@@ -16,7 +15,7 @@ export declare namespace Other {
|
|
|
16
15
|
}
|
|
17
16
|
const type: import("isly/dist/cjs/object").IslyObject<Other, Base>;
|
|
18
17
|
const type2: isly2.Object<Other>;
|
|
19
|
-
function evaluate(rules: Other[], state: State
|
|
18
|
+
function evaluate(rules: Other[], state: State): {
|
|
20
19
|
outcomes: Record<Other.Action, Other[]>;
|
|
21
20
|
notes: Note[];
|
|
22
21
|
flags: Set<string>;
|
package/dist/mjs/Rule/Other.js
CHANGED
|
@@ -16,7 +16,7 @@ export var Other;
|
|
|
16
16
|
})(Action = Other.Action || (Other.Action = {}));
|
|
17
17
|
Other.type = Base.type.extend({ action: Action.type });
|
|
18
18
|
Other.type2 = Base.type2.extend({ action: Action.type2 });
|
|
19
|
-
function evaluate(rules, state
|
|
19
|
+
function evaluate(rules, state) {
|
|
20
20
|
const now = isoly.DateTime.now();
|
|
21
21
|
const result = {
|
|
22
22
|
outcomes: {
|
|
@@ -30,7 +30,7 @@ export var Other;
|
|
|
30
30
|
if (state.transaction.stage == "initiate" &&
|
|
31
31
|
["card", "external", "internal"].some(type => type == state.transaction.type))
|
|
32
32
|
for (const rule of rules)
|
|
33
|
-
if (control(rule, state
|
|
33
|
+
if (control(rule, state)) {
|
|
34
34
|
result.outcomes[rule.action].push(rule);
|
|
35
35
|
result.notes.push({ author: "automatic", created: now, text: rule.name, rule });
|
|
36
36
|
rule.flags.forEach(f => result.flags.add(f));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Other.js","sourceRoot":"","sources":["../../../Rule/Other.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"Other.js","sourceRoot":"","sources":["../../../Rule/Other.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,IAAI,IAAI,KAAK,EAAE,MAAM,OAAO,CAAA;AAErC,OAAO,EAAE,IAAI,EAAE,M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AAK,MAAM,IAAI,IAAI,KAAK;gBACvB,IAAI,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC;oBAC1B,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;oBACvC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAA;oBAC/E,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;oBAC5C,IAAI,CAAC,MAAM,IAAI,QAAQ,IAAI,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;gBACtD,CAAC;QACH,OAAO,MAAM,CAAA;IACd,CAAC;IA1Be,cAAQ,WA0BvB,CAAA;AACF,CAAC,EAvCgB,KAAK,KAAL,KAAK,QAuCrB"}
|
|
@@ -2,8 +2,8 @@ import type { Account as ModelAccount } from "../../Account";
|
|
|
2
2
|
import { Rail } from "../../Rail";
|
|
3
3
|
export interface Account extends ModelAccount {
|
|
4
4
|
address: Rail.Address;
|
|
5
|
-
transactions
|
|
6
|
-
days
|
|
5
|
+
transactions?: Account.Transactions;
|
|
6
|
+
days?: Account.Days;
|
|
7
7
|
}
|
|
8
8
|
export declare namespace Account {
|
|
9
9
|
type Today = {
|
|
@@ -30,6 +30,6 @@ export declare namespace Account {
|
|
|
30
30
|
today: Today;
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
-
export function from(account: ModelAccount, address: Rail.Address
|
|
33
|
+
export function from(account: ModelAccount, address: Rail.Address): Account;
|
|
34
34
|
export {};
|
|
35
35
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export var Account;
|
|
2
2
|
(function (Account) {
|
|
3
|
-
function from(account, address
|
|
4
|
-
return { ...account, address
|
|
3
|
+
function from(account, address) {
|
|
4
|
+
return { ...account, address };
|
|
5
5
|
}
|
|
6
6
|
Account.from = from;
|
|
7
7
|
})(Account || (Account = {}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Account.js","sourceRoot":"","sources":["../../../../Rule/State/Account.ts"],"names":[],"mappings":"AASA,MAAM,KAAW,OAAO,CAsBvB;AAtBD,WAAiB,OAAO;IAmBvB,SAAgB,IAAI,CAAC,OAAqB,EAAE,OAAqB
|
|
1
|
+
{"version":3,"file":"Account.js","sourceRoot":"","sources":["../../../../Rule/State/Account.ts"],"names":[],"mappings":"AASA,MAAM,KAAW,OAAO,CAsBvB;AAtBD,WAAiB,OAAO;IAmBvB,SAAgB,IAAI,CAAC,OAAqB,EAAE,OAAqB;QAChE,OAAO,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,CAAA;IAC/B,CAAC;IAFe,YAAI,OAEnB,CAAA;AACF,CAAC,EAtBgB,OAAO,KAAP,OAAO,QAsBvB"}
|
|
@@ -35,9 +35,9 @@ export declare namespace State {
|
|
|
35
35
|
flags: string[];
|
|
36
36
|
notes: ModelTransaction.Note[];
|
|
37
37
|
}
|
|
38
|
-
function from(account: ModelAccount, address: Rail.Address,
|
|
38
|
+
function from(account: ModelAccount, address: Rail.Address, transaction: ModelTransaction.Creatable.Resolved | ModelTransaction, kind: Rule.Base.Kind, stage: "finalize" | "initiate", card?: Card, organization?: Organization): State;
|
|
39
39
|
const type: Record<ModelTransaction.PreTransaction["type"], Rule.Base.Kind>;
|
|
40
|
-
function fromPreTransaction(account: ModelAccount, address: Rail.Address,
|
|
40
|
+
function fromPreTransaction(account: ModelAccount, address: Rail.Address, transaction: ModelTransaction.PreTransaction, card?: ModelCard & {
|
|
41
41
|
statistics: Card.Statistics;
|
|
42
42
|
}, organization?: Organization): State;
|
|
43
43
|
}
|
|
@@ -18,9 +18,9 @@ export var State;
|
|
|
18
18
|
Outcome.values = ["approve", "reject", "review"];
|
|
19
19
|
Outcome.type = isly.string(Outcome.values);
|
|
20
20
|
})(Outcome = State.Outcome || (State.Outcome = {}));
|
|
21
|
-
function from(account, address,
|
|
21
|
+
function from(account, address, transaction, kind, stage, card, organization) {
|
|
22
22
|
return {
|
|
23
|
-
account: State.Account.from(account, address
|
|
23
|
+
account: State.Account.from(account, address),
|
|
24
24
|
transaction: State.Transaction.from(account, transaction, kind, stage),
|
|
25
25
|
authorization: State.Authorization.from(transaction),
|
|
26
26
|
card,
|
|
@@ -33,9 +33,9 @@ export var State;
|
|
|
33
33
|
incoming: "inbound",
|
|
34
34
|
outgoing: "outbound",
|
|
35
35
|
};
|
|
36
|
-
function fromPreTransaction(account, address,
|
|
36
|
+
function fromPreTransaction(account, address, transaction, card, organization) {
|
|
37
37
|
return {
|
|
38
|
-
account: State.Account.from(account, address
|
|
38
|
+
account: State.Account.from(account, address),
|
|
39
39
|
transaction: State.Transaction.from(account, transaction, State.type[transaction.type], "initiate"),
|
|
40
40
|
card: card ? State.Card.from(card, card.statistics) : undefined,
|
|
41
41
|
organization,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../Rule/State/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAM3B,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;AAC1C,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;AA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,CAAC,IAAI,CAAC,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,KAAK,CAAC;YAChE,aAAa,EAAE,MAAA,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC;YAC9C,IAAI;YACJ,YAAY;SACZ,CAAA;IACF,CAAC;IAhBe,UAAI,OAgBnB,CAAA;IACY,UAAI,GAAoE;QACpF,aAAa,EAAE,eAAe;QAC9B,QAAQ,EAAE,SAAS;QACnB,QAAQ,EAAE,UAAU;KACpB,CAAA;IACD,SAAgB,kBAAkB,CACjC,OAAqB,EACrB,OAAqB,EACrB,WAA4C,EAC5C,IAAkD,EAClD,YAA2B;QAE3B,OAAO;YACN,OAAO,EAAE,MAAA,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC;YACvC,WAAW,EAAE,MAAA,WAAW,CAAC,IAAI,CAAC,OAAO,EAAE,WAAW,EAAE,MAAA,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,UAAU,CAAC;YACvF,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,MAAA,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS;YACzD,YAAY;SACZ,CAAA;IACF,CAAC;IAbe,wBAAkB,qBAajC,CAAA;AACF,CAAC,EAtDgB,KAAK,KAAL,KAAK,QAsDrB"}
|
package/dist/mjs/Rule/control.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { selectively } from "selectively";
|
|
2
|
-
import { definitions } from "./definitions";
|
|
3
2
|
export function control(rule, state, macros) {
|
|
4
|
-
return selectively.
|
|
3
|
+
return selectively.parse(rule.condition).is(state);
|
|
5
4
|
}
|
|
6
5
|
//# sourceMappingURL=control.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control.js","sourceRoot":"","sources":["../../../Rule/control.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"control.js","sourceRoot":"","sources":["../../../Rule/control.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAIzC,MAAM,UAAU,OAAO,CAAC,IAAU,EAAE,KAAY,EAAE,MAA+C;IAChG,OAAO,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;AACnD,CAAC"}
|
package/dist/mjs/Rule/index.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { selectively } from "selectively";
|
|
2
1
|
import { isly } from "isly";
|
|
3
|
-
import { Exchange } from "../Exchange";
|
|
4
2
|
import { Base as RuleBase } from "./Base";
|
|
5
3
|
import { control as ruleControl } from "./control";
|
|
6
4
|
import { Other as RuleOther } from "./Other";
|
|
@@ -19,7 +17,7 @@ export declare namespace Rule {
|
|
|
19
17
|
const type: isly.Type<"reject" | "review" | "flag">;
|
|
20
18
|
}
|
|
21
19
|
const type: import("isly/dist/cjs/object").IslyObject<Other, Base>;
|
|
22
|
-
function evaluate(rules: Rule[], state: RuleState
|
|
20
|
+
function evaluate(rules: Rule[], state: RuleState): RuleState.Evaluated;
|
|
23
21
|
function isLegacy(rule: Rule): boolean;
|
|
24
22
|
function fromLegacy(rule: Rule): Rule;
|
|
25
23
|
}
|
package/dist/mjs/Rule/index.js
CHANGED
|
@@ -18,14 +18,14 @@ export var Rule;
|
|
|
18
18
|
Action.type = isly.string(Action.values);
|
|
19
19
|
})(Action = Rule.Action || (Rule.Action = {}));
|
|
20
20
|
Rule.type = ruleType;
|
|
21
|
-
function evaluate(rules, state
|
|
21
|
+
function evaluate(rules, state) {
|
|
22
22
|
const outcomes = {
|
|
23
23
|
review: [],
|
|
24
24
|
reject: [],
|
|
25
25
|
flag: [],
|
|
26
26
|
};
|
|
27
27
|
const notes = [];
|
|
28
|
-
const evaluated = Rule.Other.evaluate(rules.filter(rule => Rule.Base.Kind.is(state.transaction.kind, rule, state.organization?.groups, state.card?.preset)), state
|
|
28
|
+
const evaluated = Rule.Other.evaluate(rules.filter(rule => Rule.Base.Kind.is(state.transaction.kind, rule, state.organization?.groups, state.card?.preset)), state);
|
|
29
29
|
notes.push(...evaluated.notes);
|
|
30
30
|
outcomes.flag.push(...evaluated.outcomes.flag);
|
|
31
31
|
outcomes.review.push(...evaluated.outcomes.review);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../Rule/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../Rule/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAE3B,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,QAAQ,CAAA;AACzC,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAA;AAClD,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,SAAS,CAAA;AAC5C,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,SAAS,CAAA;AAC5C,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAGzC,MAAM,KAAW,IAAI,CAsCpB;AAtCD,WAAiB,IAAI;IACN,UAAK,GAAG,SAAS,CAAA;IACjB,UAAK,GAAG,SAAS,CAAA;IACjB,SAAI,GAAG,QAAQ,CAAA;IACf,SAAI,GAAG,KAAA,IAAI,CAAC,IAAI,CAAA;IAChB,aAAQ,GAAG,KAAA,IAAI,CAAC,QAAQ,CAAA;IACzB,YAAO,GAAG,WAAW,CAAA;IAGlC,IAAiB,MAAM,CAGtB;IAHD,WAAiB,MAAM;QACT,aAAM,GAAG,CAAC,GAAG,KAAA,KAAK,CAAC,MAAM,CAAC,MAAM,CAAU,CAAA;QAC1C,WAAI,GAAG,IAAI,CAAC,MAAM,CA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,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAA;IAC3E,CAAC;IAjBe,aAAQ,WAiBvB,CAAA;IACD,SAAgB,QAAQ,CAAC,IAAU;QAClC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IAClD,CAAC;IAFe,aAAQ,WAEvB,CAAA;IACD,SAAgB,UAAU,CAAC,IAAU;QACpC,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,IAAI,CAAA;IACjE,CAAC;IAFe,eAAU,aAEzB,CAAA;AACF,CAAC,EAtCgB,IAAI,KAAJ,IAAI,QAsCpB"}
|
package/package.json
CHANGED
package/Rule/definitions.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.definitions = void 0;
|
|
4
|
-
exports.definitions = {
|
|
5
|
-
isInternal: { arguments: [], definition: "transaction.counterpart.type:internal" },
|
|
6
|
-
alwaysTrue: { arguments: [], definition: "a:0|!a:0" },
|
|
7
|
-
};
|
|
8
|
-
//# sourceMappingURL=definitions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../../Rule/definitions.ts"],"names":[],"mappings":";;;AAEa,QAAA,WAAW,GAA2C;IAClE,UAAU,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,UAAU,EAAE,uCAAuC,EAAE;IAClF,UAAU,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE;CACrD,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../../Rule/definitions.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,WAAW,GAA2C;IAClE,UAAU,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,UAAU,EAAE,uCAAuC,EAAE;IAClF,UAAU,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE;CACrD,CAAA"}
|