@pax2pay/model-banking 0.1.594 → 0.1.596
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/Operation/Changes.ts +6 -22
- package/Rail/Address/internal.ts +1 -1
- 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/Treasury/Snapshot/Emoney.ts +0 -2
- package/Treasury/Snapshot/Fiat.ts +0 -1
- package/Treasury/Snapshot/index.ts +1 -29
- package/Warning/Snapshot/index.ts +7 -12
- package/Warning/index.ts +0 -1
- package/dist/cjs/Client/Transactions/index.d.ts +2 -2
- package/dist/cjs/Operation/Changes.d.ts +8 -13
- package/dist/cjs/Operation/Changes.js +0 -14
- package/dist/cjs/Operation/Changes.js.map +1 -1
- package/dist/cjs/Rail/Address/internal.d.ts +1 -2
- package/dist/cjs/Rail/index.d.ts +2 -2
- 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/cjs/Treasury/Snapshot/Emoney.d.ts +0 -2
- package/dist/cjs/Treasury/Snapshot/Fiat.d.ts +0 -1
- package/dist/cjs/Treasury/Snapshot/index.d.ts +0 -15
- package/dist/cjs/Treasury/Snapshot/index.js +1 -21
- package/dist/cjs/Treasury/Snapshot/index.js.map +1 -1
- package/dist/cjs/Warning/Snapshot/index.d.ts +1 -3
- package/dist/cjs/Warning/Snapshot/index.js +1 -3
- package/dist/cjs/Warning/Snapshot/index.js.map +1 -1
- package/dist/cjs/Warning/index.d.ts +1 -1
- package/dist/cjs/Warning/index.js +0 -1
- package/dist/cjs/Warning/index.js.map +1 -1
- package/dist/cjs/pax2pay.d.ts +0 -2
- package/dist/cjs/pax2pay.js +1 -5
- package/dist/cjs/pax2pay.js.map +1 -1
- package/dist/mjs/Client/Transactions/index.d.ts +2 -2
- package/dist/mjs/Operation/Changes.d.ts +8 -13
- package/dist/mjs/Operation/Changes.js +0 -14
- package/dist/mjs/Operation/Changes.js.map +1 -1
- package/dist/mjs/Rail/Address/internal.d.ts +1 -2
- package/dist/mjs/Rail/index.d.ts +2 -2
- 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/dist/mjs/Treasury/Snapshot/Emoney.d.ts +0 -2
- package/dist/mjs/Treasury/Snapshot/Fiat.d.ts +0 -1
- package/dist/mjs/Treasury/Snapshot/index.d.ts +0 -15
- package/dist/mjs/Treasury/Snapshot/index.js +1 -21
- package/dist/mjs/Treasury/Snapshot/index.js.map +1 -1
- package/dist/mjs/Warning/Snapshot/index.d.ts +1 -3
- package/dist/mjs/Warning/Snapshot/index.js +1 -3
- package/dist/mjs/Warning/Snapshot/index.js.map +1 -1
- package/dist/mjs/Warning/index.d.ts +1 -1
- package/dist/mjs/Warning/index.js +0 -1
- package/dist/mjs/Warning/index.js.map +1 -1
- package/dist/mjs/pax2pay.d.ts +0 -2
- package/dist/mjs/pax2pay.js +0 -2
- package/dist/mjs/pax2pay.js.map +1 -1
- package/package.json +1 -1
- package/pax2pay.ts +0 -2
- package/Counterbalance.ts +0 -20
- package/Counterbalances.ts +0 -12
- package/Rule/definitions.ts +0 -6
- package/Warning/Snapshot/Counterbalance.ts +0 -16
- package/dist/cjs/Counterbalance.d.ts +0 -15
- package/dist/cjs/Counterbalance.js +0 -16
- package/dist/cjs/Counterbalance.js.map +0 -1
- package/dist/cjs/Counterbalances.d.ts +0 -7
- package/dist/cjs/Counterbalances.js +0 -11
- package/dist/cjs/Counterbalances.js.map +0 -1
- 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/cjs/Warning/Snapshot/Counterbalance.d.ts +0 -10
- package/dist/cjs/Warning/Snapshot/Counterbalance.js +0 -14
- package/dist/cjs/Warning/Snapshot/Counterbalance.js.map +0 -1
- package/dist/mjs/Counterbalance.d.ts +0 -15
- package/dist/mjs/Counterbalance.js +0 -13
- package/dist/mjs/Counterbalance.js.map +0 -1
- package/dist/mjs/Counterbalances.d.ts +0 -7
- package/dist/mjs/Counterbalances.js +0 -8
- package/dist/mjs/Counterbalances.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/dist/mjs/Warning/Snapshot/Counterbalance.d.ts +0 -10
- package/dist/mjs/Warning/Snapshot/Counterbalance.js +0 -11
- package/dist/mjs/Warning/Snapshot/Counterbalance.js.map +0 -1
package/Operation/Changes.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { isoly } from "isoly"
|
|
2
2
|
import { isly } from "isly"
|
|
3
3
|
import { Balance as AccountBalance } from "../Balance"
|
|
4
|
-
import { Counterbalance as CounterbalanceOperation } from "../Counterbalance"
|
|
5
4
|
import type { Settlement } from "../Settlement"
|
|
6
5
|
import { Change } from "./Change"
|
|
7
6
|
|
|
8
|
-
export type Changes = Partial<Record<Changes.Entry.Balance, Change>>
|
|
7
|
+
export type Changes = Partial<Record<Changes.Entry.Balance, Change>>
|
|
9
8
|
export namespace Changes {
|
|
10
9
|
export function available(changes: MaybeLegacy, currency: isoly.Currency, legacy: boolean = false): number {
|
|
11
10
|
return legacy
|
|
@@ -50,31 +49,23 @@ export namespace Changes {
|
|
|
50
49
|
0
|
|
51
50
|
)
|
|
52
51
|
}
|
|
53
|
-
export type Sum = Partial<Record<Changes.Entry.Balance, number>>
|
|
52
|
+
export type Sum = Partial<Record<Changes.Entry.Balance, number>>
|
|
54
53
|
export type MaybeLegacy = Changes | Legacy
|
|
55
|
-
export const type = isly.record<
|
|
56
|
-
export type Legacy = Partial<Record<AccountBalance.Legacy.Entry, Change>>
|
|
57
|
-
Record<Changes.Entry.Counterbalance, Change>
|
|
54
|
+
export const type = isly.record<Changes>(isly.string(), Change.type)
|
|
55
|
+
export type Legacy = Partial<Record<AccountBalance.Legacy.Entry, Change>>
|
|
58
56
|
export namespace Legacy {
|
|
59
57
|
export const type = isly.record<Legacy>(isly.string(), Change.type)
|
|
60
|
-
export type Entry = AccountBalance.Legacy.Entry
|
|
58
|
+
export type Entry = AccountBalance.Legacy.Entry
|
|
61
59
|
export namespace Entry {
|
|
62
|
-
export function split(counterbalance: Counterbalance): [isoly.DateTime, CounterbalanceOperation.Link] {
|
|
63
|
-
const split = counterbalance.split("-")
|
|
64
|
-
const hour = split.splice(-3, 3).join("-")
|
|
65
|
-
return [hour, split.join("-")]
|
|
66
|
-
}
|
|
67
60
|
export type Balance = typeof AccountBalance.Legacy.Entry.values[number]
|
|
68
61
|
export namespace Balance {
|
|
69
62
|
export const type = AccountBalance.Legacy.Entry.type
|
|
70
63
|
}
|
|
71
|
-
export type Counterbalance = `${CounterbalanceOperation.Link}-${isoly.DateTime}`
|
|
72
64
|
}
|
|
73
65
|
}
|
|
74
|
-
export type Entry = Entry.Balance
|
|
66
|
+
export type Entry = Entry.Balance
|
|
75
67
|
export namespace Entry {
|
|
76
68
|
export const type = isly.string<Entry>()
|
|
77
|
-
export type Counterbalance = `${isoly.DateTime}-${CounterbalanceOperation.Link}`
|
|
78
69
|
export function getBalanceType(key: string): string {
|
|
79
70
|
let result = ""
|
|
80
71
|
if (key.includes("net") || key.includes("fee") || key.includes("charge"))
|
|
@@ -87,13 +78,6 @@ export namespace Changes {
|
|
|
87
78
|
result = "fiat"
|
|
88
79
|
return result
|
|
89
80
|
}
|
|
90
|
-
export function split(counterbalance: Counterbalance): [isoly.DateTime, CounterbalanceOperation.Link] {
|
|
91
|
-
const split = counterbalance.split("-")
|
|
92
|
-
const hour = split.slice(0, 3).join("-")
|
|
93
|
-
return isoly.DateTime.is(hour)
|
|
94
|
-
? [hour, split.slice(3, split.length).join("-")]
|
|
95
|
-
: Legacy.Entry.split(counterbalance)
|
|
96
|
-
}
|
|
97
81
|
export type Balance = typeof Balance.values[number]
|
|
98
82
|
export namespace Balance {
|
|
99
83
|
export const values = ["available", "reserved-incoming", "reserved-outgoing", "reserved-buffer"] as const
|
package/Rail/Address/internal.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { Realm } from "../../Realm"
|
|
|
6
6
|
export interface Internal {
|
|
7
7
|
type: "internal"
|
|
8
8
|
name?: string
|
|
9
|
-
identifier: cryptly.Identifier
|
|
9
|
+
identifier: cryptly.Identifier
|
|
10
10
|
organization?: string
|
|
11
11
|
}
|
|
12
12
|
export namespace Internal {
|
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)
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { isoly } from "isoly"
|
|
2
2
|
import { Balances } from "../../Balances"
|
|
3
|
-
import { Counterbalances } from "../../Counterbalances"
|
|
4
3
|
import { Supplier } from "../../Supplier"
|
|
5
4
|
|
|
6
5
|
export interface Emoney {
|
|
@@ -9,5 +8,4 @@ export interface Emoney {
|
|
|
9
8
|
supplier?: Supplier
|
|
10
9
|
timestamp: isoly.DateTime
|
|
11
10
|
balances: Balances
|
|
12
|
-
counterbalances: Counterbalances
|
|
13
11
|
}
|
|
@@ -13,7 +13,6 @@ export interface Snapshot {
|
|
|
13
13
|
emoney: Balance.Extended & { total?: number }
|
|
14
14
|
currency: isoly.Currency
|
|
15
15
|
supplier: Supplier
|
|
16
|
-
counterbalance: Snapshot.Counterbalance
|
|
17
16
|
fiat: {
|
|
18
17
|
safe: number
|
|
19
18
|
unsafe: number
|
|
@@ -27,41 +26,14 @@ export namespace Snapshot {
|
|
|
27
26
|
export import funding = snapshotFunding
|
|
28
27
|
export type Emoney = SnapshotEmoney
|
|
29
28
|
export type Fiat = SnapshotFiat
|
|
30
|
-
export type Counterbalance = Record<string, { total: number; account: Record<string, { amount: number }> }>
|
|
31
|
-
export namespace Counterbalance {
|
|
32
|
-
export const type = isly.record<Counterbalance>(
|
|
33
|
-
isly.string(),
|
|
34
|
-
isly.object<Counterbalance[string]>({
|
|
35
|
-
total: isly.number(),
|
|
36
|
-
account: isly.record<Counterbalance[string]["account"]>(
|
|
37
|
-
isly.string(),
|
|
38
|
-
isly.object<Counterbalance[string]["account"][string]>({ amount: isly.number() })
|
|
39
|
-
),
|
|
40
|
-
})
|
|
41
|
-
)
|
|
42
|
-
export function sum(currency: isoly.Currency, accounts: Record<string, { amount: number }>): number {
|
|
43
|
-
return Object.values(accounts).reduce(
|
|
44
|
-
(result, account) => isoly.Currency.add(currency, result, account.amount),
|
|
45
|
-
0
|
|
46
|
-
)
|
|
47
|
-
}
|
|
48
|
-
export function validate(currency: isoly.Currency, counterbalances: Counterbalance): boolean {
|
|
49
|
-
for (const counterbalance of Object.values(counterbalances))
|
|
50
|
-
if (isoly.Currency.subtract(currency, counterbalance.total, sum(currency, counterbalance.account)))
|
|
51
|
-
return false
|
|
52
|
-
return true
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
29
|
export function validate(snapshot: Snapshot): boolean {
|
|
56
|
-
const validCounterbalance = Counterbalance.validate(snapshot.currency, snapshot.counterbalance)
|
|
57
30
|
const issuable = snapshot.fiat.total
|
|
58
31
|
const actual = snapshot.emoney.actual ?? 0
|
|
59
|
-
return
|
|
32
|
+
return issuable == actual
|
|
60
33
|
}
|
|
61
34
|
export const type = isly.object<Snapshot>({
|
|
62
35
|
warnings: Warning.Snapshot.type.array(),
|
|
63
36
|
emoney: Balance.Extended,
|
|
64
|
-
counterbalance: Counterbalance.type,
|
|
65
37
|
currency: isly.fromIs("currency", isoly.Currency.is),
|
|
66
38
|
supplier: Supplier.type,
|
|
67
39
|
fiat: isly.object({
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { isly } from "isly"
|
|
2
|
-
import { Counterbalance as WarningCounterbalance } from "./Counterbalance"
|
|
3
2
|
import { MissingBuffer as WarningMissingBuffer } from "./MissingBuffer"
|
|
4
3
|
import { MissingEmoney as WarningMissingEmoney } from "./MissingEmoney"
|
|
5
4
|
import { MissingFiat as WarningMissingFiat } from "./MissingFiat"
|
|
@@ -10,7 +9,6 @@ export type Snapshot =
|
|
|
10
9
|
| Snapshot.Overdraft
|
|
11
10
|
| Snapshot.StaleFiat
|
|
12
11
|
| Snapshot.MissingBuffer
|
|
13
|
-
| Snapshot.Counterbalance
|
|
14
12
|
| Snapshot.MissingEmoney
|
|
15
13
|
| Snapshot.MissingFiat
|
|
16
14
|
|
|
@@ -18,16 +16,13 @@ export namespace Snapshot {
|
|
|
18
16
|
export import Overdraft = WarningOverdraft
|
|
19
17
|
export import StaleFiat = WarningStaleFiat
|
|
20
18
|
export import MissingBuffer = WarningMissingBuffer
|
|
21
|
-
export import Counterbalance = WarningCounterbalance
|
|
22
19
|
export import MissingEmoney = WarningMissingEmoney
|
|
23
20
|
export import MissingFiat = WarningMissingFiat
|
|
24
|
-
export const type = isly.union<
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
MissingFiat
|
|
32
|
-
>(Overdraft.type, StaleFiat.type, MissingBuffer.type, Counterbalance.type, MissingEmoney.type, MissingFiat.type)
|
|
21
|
+
export const type = isly.union<Snapshot, Overdraft, StaleFiat, MissingBuffer, MissingEmoney, MissingFiat>(
|
|
22
|
+
Overdraft.type,
|
|
23
|
+
StaleFiat.type,
|
|
24
|
+
MissingBuffer.type,
|
|
25
|
+
MissingEmoney.type,
|
|
26
|
+
MissingFiat.type
|
|
27
|
+
)
|
|
33
28
|
}
|
package/Warning/index.ts
CHANGED
|
@@ -50,8 +50,8 @@ export declare namespace Transactions {
|
|
|
50
50
|
end: string | undefined;
|
|
51
51
|
currency: string | undefined;
|
|
52
52
|
organization: string | undefined;
|
|
53
|
-
rail: "paxgiro" | "mastercard" | "diners" | "visa" | "
|
|
54
|
-
type: "
|
|
53
|
+
rail: "paxgiro" | "mastercard" | "diners" | "visa" | "paxgiro-credit" | "internal" | "transfer" | "fasterpayments" | "chaps" | "bacs" | "credit" | undefined;
|
|
54
|
+
type: "card" | "internal" | "external" | "system" | undefined;
|
|
55
55
|
}>;
|
|
56
56
|
function parse(query: string | http.Request["search"]): Query;
|
|
57
57
|
}
|
|
@@ -1,36 +1,31 @@
|
|
|
1
1
|
import { isoly } from "isoly";
|
|
2
2
|
import { isly } from "isly";
|
|
3
3
|
import { Balance as AccountBalance } from "../Balance";
|
|
4
|
-
import { Counterbalance as CounterbalanceOperation } from "../Counterbalance";
|
|
5
4
|
import type { Settlement } from "../Settlement";
|
|
6
5
|
import { Change } from "./Change";
|
|
7
|
-
export type Changes = Partial<Record<Changes.Entry.Balance, Change
|
|
6
|
+
export type Changes = Partial<Record<Changes.Entry.Balance, Change>>;
|
|
8
7
|
export declare namespace Changes {
|
|
9
8
|
function available(changes: MaybeLegacy, currency: isoly.Currency, legacy?: boolean): number;
|
|
10
9
|
function reserved(changes: MaybeLegacy, currency: isoly.Currency): number;
|
|
11
10
|
function counterbalance(changes: Changes, currency: isoly.Currency): number;
|
|
12
|
-
type Sum = Partial<Record<Changes.Entry.Balance, number
|
|
11
|
+
type Sum = Partial<Record<Changes.Entry.Balance, number>>;
|
|
13
12
|
type MaybeLegacy = Changes | Legacy;
|
|
14
|
-
const type: isly.Type<
|
|
15
|
-
type Legacy = Partial<Record<AccountBalance.Legacy.Entry, Change
|
|
13
|
+
const type: isly.Type<Partial<Record<"available" | "reserved-incoming" | "reserved-outgoing" | "reserved-buffer", Change<"add" | "subtract">>>>;
|
|
14
|
+
type Legacy = Partial<Record<AccountBalance.Legacy.Entry, Change>>;
|
|
16
15
|
namespace Legacy {
|
|
17
|
-
const type: isly.Type<
|
|
18
|
-
type Entry = AccountBalance.Legacy.Entry
|
|
16
|
+
const type: isly.Type<Partial<Record<"actual" | "incomingReserved" | "outgoingReserved" | "bufferReserved", Change<"add" | "subtract">>>>;
|
|
17
|
+
type Entry = AccountBalance.Legacy.Entry;
|
|
19
18
|
namespace Entry {
|
|
20
|
-
function split(counterbalance: Counterbalance): [isoly.DateTime, CounterbalanceOperation.Link];
|
|
21
19
|
type Balance = typeof AccountBalance.Legacy.Entry.values[number];
|
|
22
20
|
namespace Balance {
|
|
23
21
|
const type: isly.Type<"actual" | "incomingReserved" | "outgoingReserved" | "bufferReserved">;
|
|
24
22
|
}
|
|
25
|
-
type Counterbalance = `${CounterbalanceOperation.Link}-${isoly.DateTime}`;
|
|
26
23
|
}
|
|
27
24
|
}
|
|
28
|
-
type Entry = Entry.Balance
|
|
25
|
+
type Entry = Entry.Balance;
|
|
29
26
|
namespace Entry {
|
|
30
|
-
const type: isly.Type<
|
|
31
|
-
type Counterbalance = `${isoly.DateTime}-${CounterbalanceOperation.Link}`;
|
|
27
|
+
const type: isly.Type<"available" | "reserved-incoming" | "reserved-outgoing" | "reserved-buffer">;
|
|
32
28
|
function getBalanceType(key: string): string;
|
|
33
|
-
function split(counterbalance: Counterbalance): [isoly.DateTime, CounterbalanceOperation.Link];
|
|
34
29
|
type Balance = typeof Balance.values[number];
|
|
35
30
|
namespace Balance {
|
|
36
31
|
const values: readonly ["available", "reserved-incoming", "reserved-outgoing", "reserved-buffer"];
|
|
@@ -35,12 +35,6 @@ var Changes;
|
|
|
35
35
|
Legacy.type = isly_1.isly.record(isly_1.isly.string(), Change_1.Change.type);
|
|
36
36
|
let Entry;
|
|
37
37
|
(function (Entry) {
|
|
38
|
-
function split(counterbalance) {
|
|
39
|
-
const split = counterbalance.split("-");
|
|
40
|
-
const hour = split.splice(-3, 3).join("-");
|
|
41
|
-
return [hour, split.join("-")];
|
|
42
|
-
}
|
|
43
|
-
Entry.split = split;
|
|
44
38
|
let Balance;
|
|
45
39
|
(function (Balance) {
|
|
46
40
|
Balance.type = Balance_1.Balance.Legacy.Entry.type;
|
|
@@ -63,14 +57,6 @@ var Changes;
|
|
|
63
57
|
return result;
|
|
64
58
|
}
|
|
65
59
|
Entry.getBalanceType = getBalanceType;
|
|
66
|
-
function split(counterbalance) {
|
|
67
|
-
const split = counterbalance.split("-");
|
|
68
|
-
const hour = split.slice(0, 3).join("-");
|
|
69
|
-
return isoly_1.isoly.DateTime.is(hour)
|
|
70
|
-
? [hour, split.slice(3, split.length).join("-")]
|
|
71
|
-
: Legacy.Entry.split(counterbalance);
|
|
72
|
-
}
|
|
73
|
-
Entry.split = split;
|
|
74
60
|
let Balance;
|
|
75
61
|
(function (Balance) {
|
|
76
62
|
Balance.values = ["available", "reserved-incoming", "reserved-outgoing", "reserved-buffer"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Changes.js","sourceRoot":"","sources":["../../../Operation/Changes.ts"],"names":[],"mappings":";;;AAAA,iCAA6B;AAC7B,+BAA2B;AAC3B,wCAAsD;
|
|
1
|
+
{"version":3,"file":"Changes.js","sourceRoot":"","sources":["../../../Operation/Changes.ts"],"names":[],"mappings":";;;AAAA,iCAA6B;AAC7B,+BAA2B;AAC3B,wCAAsD;AAEtD,qCAAiC;AAGjC,IAAiB,OAAO,CAmGvB;AAnGD,WAAiB,OAAO;IACvB,SAAgB,SAAS,CAAC,OAAoB,EAAE,QAAwB,EA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
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { cryptly } from "cryptly";
|
|
2
|
-
import { Operation } from "../../Operation";
|
|
3
2
|
import { Realm } from "../../Realm";
|
|
4
3
|
export interface Internal {
|
|
5
4
|
type: "internal";
|
|
6
5
|
name?: string;
|
|
7
|
-
identifier: cryptly.Identifier
|
|
6
|
+
identifier: cryptly.Identifier;
|
|
8
7
|
organization?: string;
|
|
9
8
|
}
|
|
10
9
|
export declare namespace Internal {
|
package/dist/cjs/Rail/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { Address as RailAddress } from "./Address";
|
|
|
4
4
|
export type Rail = typeof Rail.rails[number];
|
|
5
5
|
export declare namespace Rail {
|
|
6
6
|
const rails: readonly ["internal", "paxgiro", "paxgiro-credit", "mastercard", "diners", "visa", "fasterpayments", "chaps", "bacs", "transfer", "credit"];
|
|
7
|
-
const type: isly.Type<"paxgiro" | "mastercard" | "diners" | "visa" | "
|
|
8
|
-
const type2: isly2.String<"paxgiro" | "mastercard" | "diners" | "visa" | "
|
|
7
|
+
const type: isly.Type<"paxgiro" | "mastercard" | "diners" | "visa" | "paxgiro-credit" | "internal" | "transfer" | "fasterpayments" | "chaps" | "bacs" | "credit">;
|
|
8
|
+
const type2: isly2.String<"paxgiro" | "mastercard" | "diners" | "visa" | "paxgiro-credit" | "internal" | "transfer" | "fasterpayments" | "chaps" | "bacs" | "credit">;
|
|
9
9
|
export import Address = RailAddress;
|
|
10
10
|
}
|
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":"","sources":["../../../Rule/Other.ts"],"names":[],"mappings":";;;AAAA,iCAA6B;AAC7B,+BAA2B;AAC3B,iCAAqC;AAErC,iCAA6B;AAC7B,uCAAmC;AAMnC,IAAiB,KAAK,CAuCrB;AAvCD,WAAiB,KAAK;IAErB,IAAiB,MAAM,CAOtB;IAPD,WAAiB,MAAM;QACT,aAAM,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAU,CAAA;QAC9C,WAA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,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,IAAiB,KAAK,CAsDrB;AAtDD,WAAiB,KAAK;IACP,aAAO,GAAG,iBAAY,CAAA;IACtB,mBAAa,GAAG,6BAAkB,CAAA;IAClC,UAAI,GAAG,WAAS,CAAA;IAChB,aAAO,GAAG,iBAAY,CAAA;IACtB,iBAAW,GAAG,yBAAgB,CAAA;IAC9B,kBAAY,GAAG,2BAAiB,CAAA;IAE9C,IAAiB,OAAO,CAGvB;IAHD,WAAiB,OAAO;QACV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tDgB,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
|
}
|