@pax2pay/model-banking 0.0.5 → 0.0.7
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/Client/Accounts.ts +13 -0
- package/Client/Version.ts +12 -0
- package/Client/index.ts +18 -0
- package/Operation/index.ts +4 -1
- package/Organization/Rules.ts +59 -0
- package/Organization/index.ts +18 -1
- package/Transaction/Creatable.ts +1 -3
- package/Transaction/Incoming.ts +26 -0
- package/Transaction/index.ts +29 -1
- package/dist/Operation/index.d.ts +2 -1
- package/dist/Operation/index.js +3 -1
- package/dist/Operation/index.js.map +1 -1
- package/dist/Organization/Rules.d.ts +9 -0
- package/dist/Organization/Rules.js +36 -0
- package/dist/Organization/Rules.js.map +1 -0
- package/dist/Organization/index.d.ts +7 -0
- package/dist/Organization/index.js +14 -1
- package/dist/Organization/index.js.map +1 -1
- package/dist/Transaction/Creatable.d.ts +0 -1
- package/dist/Transaction/Creatable.js +0 -2
- package/dist/Transaction/Creatable.js.map +1 -1
- package/dist/Transaction/Incoming.d.ts +13 -0
- package/dist/Transaction/Incoming.js +16 -0
- package/dist/Transaction/Incoming.js.map +1 -0
- package/dist/Transaction/index.d.ts +9 -1
- package/dist/Transaction/index.js +22 -2
- package/dist/Transaction/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{Monitoring → monitoring}/Decision.d.ts +3 -2
- package/dist/{Monitoring → monitoring}/Decision.js +4 -0
- package/dist/monitoring/Decision.js.map +1 -0
- package/dist/{Monitoring → monitoring}/Reviewable.d.ts +1 -0
- package/dist/{Monitoring → monitoring}/Reviewable.js.map +1 -1
- package/dist/monitoring/index.js.map +1 -0
- package/index.ts +1 -1
- package/{Monitoring → monitoring}/Decision.ts +6 -1
- package/{Monitoring → monitoring}/Reviewable.ts +1 -0
- package/package.json +9 -6
- package/dist/Monitoring/Decision.js.map +0 -1
- package/dist/Monitoring/index.js.map +0 -1
- /package/dist/{Monitoring → monitoring}/Reviewable.js +0 -0
- /package/dist/{Monitoring → monitoring}/index.d.ts +0 -0
- /package/dist/{Monitoring → monitoring}/index.js +0 -0
- /package/{Monitoring → monitoring}/index.ts +0 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as gracely from "gracely"
|
|
2
|
+
import * as http from "cloudly-http"
|
|
3
|
+
import * as rest from "cloudly-rest"
|
|
4
|
+
import { Account } from "../Account"
|
|
5
|
+
|
|
6
|
+
export class Accounts extends rest.Collection<gracely.Error> {
|
|
7
|
+
constructor(client: http.Client) {
|
|
8
|
+
super(client)
|
|
9
|
+
}
|
|
10
|
+
async create(account: Account.Creatable): Promise<Account | gracely.Error> {
|
|
11
|
+
return this.client.post<Account>("/account", account)
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as gracely from "gracely"
|
|
2
|
+
import * as http from "cloudly-http"
|
|
3
|
+
import * as rest from "cloudly-rest"
|
|
4
|
+
|
|
5
|
+
export class Version extends rest.Collection<gracely.Error> {
|
|
6
|
+
constructor(client: http.Client) {
|
|
7
|
+
super(client)
|
|
8
|
+
}
|
|
9
|
+
async fetch() {
|
|
10
|
+
return this.client.get<any>("/version")
|
|
11
|
+
}
|
|
12
|
+
}
|
package/Client/index.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as gracely from "gracely"
|
|
2
|
+
import * as http from "cloudly-http"
|
|
3
|
+
import * as rest from "cloudly-rest"
|
|
4
|
+
import { Accounts } from "./Accounts"
|
|
5
|
+
import { Version } from "./Version"
|
|
6
|
+
|
|
7
|
+
export class Client extends rest.Client<gracely.Error> {
|
|
8
|
+
readonly accounts = new Accounts(this.client)
|
|
9
|
+
readonly version = new Version(this.client)
|
|
10
|
+
|
|
11
|
+
static create<T = Record<string, any>>(server: string, _?: string, load?: (client: http.Client) => T): Client & T {
|
|
12
|
+
let httpClient: http.Client<gracely.Error>
|
|
13
|
+
const result = new Client((httpClient = new http.Client<gracely.Error>(server, undefined)))
|
|
14
|
+
if (load)
|
|
15
|
+
Object.assign(result, load(httpClient))
|
|
16
|
+
return result as Client & T
|
|
17
|
+
}
|
|
18
|
+
}
|
package/Operation/index.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { Creatable as OperationCreatable } from "./Creatable"
|
|
|
4
4
|
|
|
5
5
|
export interface Operation extends OperationCreatable {
|
|
6
6
|
id: cryptly.Identifier
|
|
7
|
+
transactionId: cryptly.Identifier
|
|
7
8
|
created: isoly.DateTime
|
|
8
9
|
}
|
|
9
10
|
export namespace Operation {
|
|
@@ -11,16 +12,18 @@ export namespace Operation {
|
|
|
11
12
|
return (
|
|
12
13
|
typeof value == "object" &&
|
|
13
14
|
cryptly.Identifier.is(value.id, 8) &&
|
|
15
|
+
cryptly.Identifier.is(value.transactionId, 8) &&
|
|
14
16
|
isoly.DateTime.is(value.created) &&
|
|
15
17
|
OperationCreatable.is({ ...value })
|
|
16
18
|
)
|
|
17
19
|
}
|
|
18
|
-
export function fromCreatable(operation: Creatable): Operation {
|
|
20
|
+
export function fromCreatable(transaction: cryptly.Identifier, operation: Creatable): Operation {
|
|
19
21
|
const id = cryptly.Identifier.generate(8)
|
|
20
22
|
const timestamp = isoly.DateTime.now()
|
|
21
23
|
return {
|
|
22
24
|
...operation,
|
|
23
25
|
id: id,
|
|
26
|
+
transactionId: transaction,
|
|
24
27
|
created: timestamp,
|
|
25
28
|
}
|
|
26
29
|
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import * as selectively from "selectively"
|
|
2
|
+
|
|
3
|
+
export interface Rules {
|
|
4
|
+
calls: string[]
|
|
5
|
+
functions: Record<string, selectively.Definition>
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export namespace Rules {
|
|
9
|
+
export function is(value: Rules): value is Rules {
|
|
10
|
+
//const functionCalls = value.calls
|
|
11
|
+
// .map(c => selectively.parse(c))
|
|
12
|
+
// .map(r => r.class == "FunctionCall")
|
|
13
|
+
// .includes(false)
|
|
14
|
+
//const functions = Object.entries(value.functions)
|
|
15
|
+
// .map(
|
|
16
|
+
// functions =>
|
|
17
|
+
// typeof functions[0] == "string" &&
|
|
18
|
+
// typeof functions[1] == "object" &&
|
|
19
|
+
// Object.entries(functions[1])
|
|
20
|
+
// .map(definitions => typeof definitions[0] == "string")
|
|
21
|
+
// .includes(false)
|
|
22
|
+
// )
|
|
23
|
+
// .includes(false)
|
|
24
|
+
return (
|
|
25
|
+
value &&
|
|
26
|
+
typeof value == "object" &&
|
|
27
|
+
value.calls &&
|
|
28
|
+
typeof value.calls == "object" &&
|
|
29
|
+
Array.isArray(value.calls) &&
|
|
30
|
+
!value.calls
|
|
31
|
+
.map(c => selectively.parse(c))
|
|
32
|
+
.map(r => r.class == "FunctionCall")
|
|
33
|
+
.includes(false) &&
|
|
34
|
+
value.functions &&
|
|
35
|
+
typeof value.functions == "object" &&
|
|
36
|
+
!Object.entries(value.functions)
|
|
37
|
+
.map(
|
|
38
|
+
functions =>
|
|
39
|
+
typeof functions[0] == "string" &&
|
|
40
|
+
typeof functions[1] == "object" &&
|
|
41
|
+
Object.entries(functions[1])
|
|
42
|
+
.map(definitions => typeof definitions[0] == "string")
|
|
43
|
+
.includes(false)
|
|
44
|
+
)
|
|
45
|
+
.includes(false)
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// dummy function, remove later
|
|
50
|
+
export function activate(rules: Rules): boolean {
|
|
51
|
+
const result: boolean[] = []
|
|
52
|
+
for (const call in rules.calls) {
|
|
53
|
+
const parsed = selectively.parse(call)
|
|
54
|
+
const resolved = selectively.resolve(rules.functions, parsed)
|
|
55
|
+
result.push(resolved.is(resolved, {}))
|
|
56
|
+
}
|
|
57
|
+
return !result.includes(false)
|
|
58
|
+
}
|
|
59
|
+
}
|
package/Organization/index.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import * as cryptly from "cryptly"
|
|
2
|
+
import * as selectively from "selectively"
|
|
2
3
|
import { Creatable as OrganizationCreatable } from "./Creatable"
|
|
4
|
+
import { Rules as OrganizationRules } from "./Rules"
|
|
3
5
|
|
|
4
6
|
export interface Organization extends OrganizationCreatable {
|
|
5
7
|
readonly id: cryptly.Identifier
|
|
8
|
+
calls: string[]
|
|
9
|
+
functions: Record<string, selectively.Definition>
|
|
6
10
|
}
|
|
7
11
|
|
|
8
12
|
export namespace Organization {
|
|
@@ -10,12 +14,25 @@ export namespace Organization {
|
|
|
10
14
|
return value && OrganizationCreatable.is({ ...value }) && typeof value.id == "string"
|
|
11
15
|
}
|
|
12
16
|
export function fromCreatable(organization: Creatable): Organization {
|
|
13
|
-
return { ...organization, id: cryptly.Identifier.generate(8) }
|
|
17
|
+
return { ...organization, id: cryptly.Identifier.generate(8), calls: [], functions: {} }
|
|
14
18
|
}
|
|
15
19
|
export function isIdentifier(value: cryptly.Identifier | any): value is cryptly.Identifier {
|
|
16
20
|
return cryptly.Identifier.is(value, 8)
|
|
17
21
|
}
|
|
18
22
|
|
|
23
|
+
// dummy function, remove later
|
|
24
|
+
export function activate(organization: Organization): boolean {
|
|
25
|
+
const result: boolean[] = []
|
|
26
|
+
for (const call in organization.calls) {
|
|
27
|
+
const parsed = selectively.parse(call)
|
|
28
|
+
const resolved = selectively.resolve(organization.functions, parsed)
|
|
29
|
+
result.push(resolved.is(resolved, {}))
|
|
30
|
+
}
|
|
31
|
+
return !result.includes(false)
|
|
32
|
+
}
|
|
33
|
+
|
|
19
34
|
export type Creatable = OrganizationCreatable
|
|
20
35
|
export const Creatable = OrganizationCreatable
|
|
36
|
+
export type Rules = OrganizationRules
|
|
37
|
+
export const Rules = OrganizationRules
|
|
21
38
|
}
|
package/Transaction/Creatable.ts
CHANGED
|
@@ -3,7 +3,6 @@ import { Operation } from "../Operation"
|
|
|
3
3
|
import { Rail } from "../Rail"
|
|
4
4
|
|
|
5
5
|
export interface Creatable {
|
|
6
|
-
account: Rail
|
|
7
6
|
counterpart: Rail
|
|
8
7
|
currency: isoly.Currency
|
|
9
8
|
amount: number
|
|
@@ -15,9 +14,8 @@ export namespace Creatable {
|
|
|
15
14
|
export function is(value: any | Creatable): value is Creatable {
|
|
16
15
|
return (
|
|
17
16
|
typeof value == "object" &&
|
|
18
|
-
Rail.is(value.account) &&
|
|
17
|
+
//Rail.is(value.account) &&
|
|
19
18
|
Rail.is(value.counterpart) &&
|
|
20
|
-
!Rail.hasSameIdentifiers(value.account, value.counterpart) &&
|
|
21
19
|
isoly.Currency.is(value.currency) &&
|
|
22
20
|
typeof value.amount == "number" &&
|
|
23
21
|
(value.description == undefined || typeof value.description == "string") &&
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as isoly from "isoly"
|
|
2
|
+
import { Rail } from "../Rail"
|
|
3
|
+
import { Creatable as TransactionCreatable } from "./Creatable"
|
|
4
|
+
|
|
5
|
+
export interface Incoming extends TransactionCreatable {
|
|
6
|
+
account: Rail
|
|
7
|
+
counterpart: Rail
|
|
8
|
+
currency: isoly.Currency
|
|
9
|
+
amount: number
|
|
10
|
+
// some sort of timestamp
|
|
11
|
+
description?: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export namespace Incoming {
|
|
15
|
+
export function is(value: any | Incoming): value is Incoming {
|
|
16
|
+
return (
|
|
17
|
+
typeof value == "object" &&
|
|
18
|
+
Rail.is(value.account) &&
|
|
19
|
+
Rail.is(value.counterpart) &&
|
|
20
|
+
!Rail.hasSameIdentifiers(value.account, value.counterpart) &&
|
|
21
|
+
isoly.Currency.is(value.currency) &&
|
|
22
|
+
typeof value.amount == "number" &&
|
|
23
|
+
(value.description == undefined || typeof value.description == "string")
|
|
24
|
+
)
|
|
25
|
+
}
|
|
26
|
+
}
|
package/Transaction/index.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import * as cryptly from "cryptly"
|
|
2
2
|
import * as isoly from "isoly"
|
|
3
3
|
import { Operation } from "../Operation"
|
|
4
|
+
import { Rail } from "../Rail"
|
|
4
5
|
import { Creatable as TransactionCreatable } from "./Creatable"
|
|
6
|
+
import { Incoming as TransactionIncoming } from "./Incoming"
|
|
5
7
|
|
|
6
8
|
export interface Transaction extends TransactionCreatable {
|
|
9
|
+
account: Rail
|
|
7
10
|
readonly id: cryptly.Identifier
|
|
8
11
|
readonly posted: isoly.DateTime
|
|
9
12
|
readonly transacted?: isoly.DateTime
|
|
@@ -26,6 +29,7 @@ export namespace Transaction {
|
|
|
26
29
|
)
|
|
27
30
|
}
|
|
28
31
|
export function fromCreatable(
|
|
32
|
+
account: Rail,
|
|
29
33
|
transaction: Creatable & { operations: Operation.Creatable[] },
|
|
30
34
|
type: "actual" | "available",
|
|
31
35
|
result: number
|
|
@@ -37,12 +41,34 @@ export namespace Transaction {
|
|
|
37
41
|
if ("posted" in transaction)
|
|
38
42
|
delete transaction.posted
|
|
39
43
|
return {
|
|
44
|
+
account: account,
|
|
40
45
|
id: id,
|
|
41
46
|
posted: timestamp,
|
|
42
47
|
type: type,
|
|
43
48
|
balance: result,
|
|
44
49
|
...transaction,
|
|
45
|
-
operations: transaction.operations.map(Operation.fromCreatable),
|
|
50
|
+
operations: transaction.operations.map(o => Operation.fromCreatable(id, o)),
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function fromIncoming(
|
|
55
|
+
transaction: Incoming & { operations: Operation.Creatable[] },
|
|
56
|
+
type: "actual" | "available",
|
|
57
|
+
result: number
|
|
58
|
+
): Transaction {
|
|
59
|
+
const id = cryptly.Identifier.generate(8)
|
|
60
|
+
const timestamp = isoly.DateTime.now()
|
|
61
|
+
if ("id" in transaction)
|
|
62
|
+
delete transaction.id
|
|
63
|
+
if ("posted" in transaction)
|
|
64
|
+
delete transaction.posted
|
|
65
|
+
return {
|
|
66
|
+
id: id,
|
|
67
|
+
posted: timestamp,
|
|
68
|
+
type: type,
|
|
69
|
+
balance: result,
|
|
70
|
+
...transaction,
|
|
71
|
+
operations: transaction.operations.map(o => Operation.fromCreatable(id, o)),
|
|
46
72
|
}
|
|
47
73
|
}
|
|
48
74
|
export function isIdentifier(value: cryptly.Identifier | any): value is cryptly.Identifier {
|
|
@@ -51,4 +77,6 @@ export namespace Transaction {
|
|
|
51
77
|
|
|
52
78
|
export type Creatable = TransactionCreatable
|
|
53
79
|
export const Creatable = TransactionCreatable
|
|
80
|
+
export type Incoming = TransactionIncoming
|
|
81
|
+
export const Incoming = TransactionIncoming
|
|
54
82
|
}
|
|
@@ -3,11 +3,12 @@ import * as isoly from "isoly";
|
|
|
3
3
|
import { Creatable as OperationCreatable } from "./Creatable";
|
|
4
4
|
export interface Operation extends OperationCreatable {
|
|
5
5
|
id: cryptly.Identifier;
|
|
6
|
+
transactionId: cryptly.Identifier;
|
|
6
7
|
created: isoly.DateTime;
|
|
7
8
|
}
|
|
8
9
|
export declare namespace Operation {
|
|
9
10
|
function is(value: any | Operation): value is Operation;
|
|
10
|
-
function fromCreatable(operation: Creatable): Operation;
|
|
11
|
+
function fromCreatable(transaction: cryptly.Identifier, operation: Creatable): Operation;
|
|
11
12
|
type Creatable = OperationCreatable;
|
|
12
13
|
const Creatable: typeof OperationCreatable;
|
|
13
14
|
}
|
package/dist/Operation/index.js
CHANGED
|
@@ -6,16 +6,18 @@ export var Operation;
|
|
|
6
6
|
function is(value) {
|
|
7
7
|
return (typeof value == "object" &&
|
|
8
8
|
cryptly.Identifier.is(value.id, 8) &&
|
|
9
|
+
cryptly.Identifier.is(value.transactionId, 8) &&
|
|
9
10
|
isoly.DateTime.is(value.created) &&
|
|
10
11
|
OperationCreatable.is({ ...value }));
|
|
11
12
|
}
|
|
12
13
|
Operation.is = is;
|
|
13
|
-
function fromCreatable(operation) {
|
|
14
|
+
function fromCreatable(transaction, operation) {
|
|
14
15
|
const id = cryptly.Identifier.generate(8);
|
|
15
16
|
const timestamp = isoly.DateTime.now();
|
|
16
17
|
return {
|
|
17
18
|
...operation,
|
|
18
19
|
id: id,
|
|
20
|
+
transactionId: transaction,
|
|
19
21
|
created: timestamp,
|
|
20
22
|
};
|
|
21
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"../","sources":["Operation/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAA;AAClC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,SAAS,IAAI,kBAAkB,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../","sources":["Operation/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAA;AAClC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,SAAS,IAAI,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAO7D,MAAM,KAAW,SAAS,CAuBzB;AAvBD,WAAiB,SAAS;IACzB,SAAgB,EAAE,CAAC,KAAsB;QACxC,OAAO,CACN,OAAO,KAAK,IAAI,QAAQ;YACxB,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;YAClC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC,KAAK,CAAC,aAAa,EAAE,CAAC,CAAC;YAC7C,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC;YAChC,kBAAkB,CAAC,EAAE,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC,CACnC,CAAA;IACF,CAAC;IARe,YAAE,KAQjB,CAAA;IACD,SAAgB,aAAa,CAAC,WAA+B,EAAE,SAAoB;QAClF,MAAM,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAA;QACzC,MAAM,SAAS,GAAG,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAA;QACtC,OAAO;YACN,GAAG,SAAS;YACZ,EAAE,EAAE,EAAE;YACN,aAAa,EAAE,WAAW;YAC1B,OAAO,EAAE,SAAS;SAClB,CAAA;IACF,CAAC;IATe,uBAAa,gBAS5B,CAAA;IAGY,mBAAS,GAAG,kBAAkB,CAAA;AAC5C,CAAC,EAvBgB,SAAS,KAAT,SAAS,QAuBzB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as selectively from "selectively";
|
|
2
|
+
export interface Rules {
|
|
3
|
+
calls: string[];
|
|
4
|
+
functions: Record<string, selectively.Definition>;
|
|
5
|
+
}
|
|
6
|
+
export declare namespace Rules {
|
|
7
|
+
function is(value: Rules): value is Rules;
|
|
8
|
+
function activate(rules: Rules): boolean;
|
|
9
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as selectively from "selectively";
|
|
2
|
+
export var Rules;
|
|
3
|
+
(function (Rules) {
|
|
4
|
+
function is(value) {
|
|
5
|
+
return (value &&
|
|
6
|
+
typeof value == "object" &&
|
|
7
|
+
value.calls &&
|
|
8
|
+
typeof value.calls == "object" &&
|
|
9
|
+
Array.isArray(value.calls) &&
|
|
10
|
+
!value.calls
|
|
11
|
+
.map(c => selectively.parse(c))
|
|
12
|
+
.map(r => r.class == "FunctionCall")
|
|
13
|
+
.includes(false) &&
|
|
14
|
+
value.functions &&
|
|
15
|
+
typeof value.functions == "object" &&
|
|
16
|
+
!Object.entries(value.functions)
|
|
17
|
+
.map(functions => typeof functions[0] == "string" &&
|
|
18
|
+
typeof functions[1] == "object" &&
|
|
19
|
+
Object.entries(functions[1])
|
|
20
|
+
.map(definitions => typeof definitions[0] == "string")
|
|
21
|
+
.includes(false))
|
|
22
|
+
.includes(false));
|
|
23
|
+
}
|
|
24
|
+
Rules.is = is;
|
|
25
|
+
function activate(rules) {
|
|
26
|
+
const result = [];
|
|
27
|
+
for (const call in rules.calls) {
|
|
28
|
+
const parsed = selectively.parse(call);
|
|
29
|
+
const resolved = selectively.resolve(rules.functions, parsed);
|
|
30
|
+
result.push(resolved.is(resolved, {}));
|
|
31
|
+
}
|
|
32
|
+
return !result.includes(false);
|
|
33
|
+
}
|
|
34
|
+
Rules.activate = activate;
|
|
35
|
+
})(Rules || (Rules = {}));
|
|
36
|
+
//# sourceMappingURL=Rules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Rules.js","sourceRoot":"../","sources":["Organization/Rules.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,aAAa,CAAA;AAO1C,MAAM,KAAW,KAAK,CAmDrB;AAnDD,WAAiB,KAAK;IACrB,SAAgB,EAAE,CAAC,KAAY;QAe9B,OAAO,CACN,KAAK;YACL,OAAO,KAAK,IAAI,QAAQ;YACxB,KAAK,CAAC,KAAK;YACX,OAAO,KAAK,CAAC,KAAK,IAAI,QAAQ;YAC9B,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC;YAC1B,CAAC,KAAK,CAAC,KAAK;iBACV,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;iBAC9B,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,IAAI,cAAc,CAAC;iBACnC,QAAQ,CAAC,KAAK,CAAC;YACjB,KAAK,CAAC,SAAS;YACf,OAAO,KAAK,CAAC,SAAS,IAAI,QAAQ;YAClC,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC;iBAC9B,GAAG,CACH,SAAS,CAAC,EAAE,CACX,OAAO,SAAS,CAAC,CAAC,CAAC,IAAI,QAAQ;gBAC/B,OAAO,SAAS,CAAC,CAAC,CAAC,IAAI,QAAQ;gBAC/B,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;qBAC1B,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,IAAI,QAAQ,CAAC;qBACrD,QAAQ,CAAC,KAAK,CAAC,CAClB;iBACA,QAAQ,CAAC,KAAK,CAAC,CACjB,CAAA;IACF,CAAC;IAtCe,QAAE,KAsCjB,CAAA;IAGD,SAAgB,QAAQ,CAAC,KAAY;QACpC,MAAM,MAAM,GAAc,EAAE,CAAA;QAC5B,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,KAAK,EAAE;YAC/B,MAAM,MAAM,GAAG,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;YACtC,MAAM,QAAQ,GAAG,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,EAAE,MAAM,CAAC,CAAA;YAC7D,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAA;SACtC;QACD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;IAC/B,CAAC;IARe,cAAQ,WAQvB,CAAA;AACF,CAAC,EAnDgB,KAAK,KAAL,KAAK,QAmDrB"}
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import * as cryptly from "cryptly";
|
|
2
|
+
import * as selectively from "selectively";
|
|
2
3
|
import { Creatable as OrganizationCreatable } from "./Creatable";
|
|
4
|
+
import { Rules as OrganizationRules } from "./Rules";
|
|
3
5
|
export interface Organization extends OrganizationCreatable {
|
|
4
6
|
readonly id: cryptly.Identifier;
|
|
7
|
+
calls: string[];
|
|
8
|
+
functions: Record<string, selectively.Definition>;
|
|
5
9
|
}
|
|
6
10
|
export declare namespace Organization {
|
|
7
11
|
function is(value: Organization | any): value is Organization;
|
|
8
12
|
function fromCreatable(organization: Creatable): Organization;
|
|
9
13
|
function isIdentifier(value: cryptly.Identifier | any): value is cryptly.Identifier;
|
|
14
|
+
function activate(organization: Organization): boolean;
|
|
10
15
|
type Creatable = OrganizationCreatable;
|
|
11
16
|
const Creatable: typeof OrganizationCreatable;
|
|
17
|
+
type Rules = OrganizationRules;
|
|
18
|
+
const Rules: typeof OrganizationRules;
|
|
12
19
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import * as cryptly from "cryptly";
|
|
2
|
+
import * as selectively from "selectively";
|
|
2
3
|
import { Creatable as OrganizationCreatable } from "./Creatable";
|
|
4
|
+
import { Rules as OrganizationRules } from "./Rules";
|
|
3
5
|
export var Organization;
|
|
4
6
|
(function (Organization) {
|
|
5
7
|
function is(value) {
|
|
@@ -7,13 +9,24 @@ export var Organization;
|
|
|
7
9
|
}
|
|
8
10
|
Organization.is = is;
|
|
9
11
|
function fromCreatable(organization) {
|
|
10
|
-
return { ...organization, id: cryptly.Identifier.generate(8) };
|
|
12
|
+
return { ...organization, id: cryptly.Identifier.generate(8), calls: [], functions: {} };
|
|
11
13
|
}
|
|
12
14
|
Organization.fromCreatable = fromCreatable;
|
|
13
15
|
function isIdentifier(value) {
|
|
14
16
|
return cryptly.Identifier.is(value, 8);
|
|
15
17
|
}
|
|
16
18
|
Organization.isIdentifier = isIdentifier;
|
|
19
|
+
function activate(organization) {
|
|
20
|
+
const result = [];
|
|
21
|
+
for (const call in organization.calls) {
|
|
22
|
+
const parsed = selectively.parse(call);
|
|
23
|
+
const resolved = selectively.resolve(organization.functions, parsed);
|
|
24
|
+
result.push(resolved.is(resolved, {}));
|
|
25
|
+
}
|
|
26
|
+
return !result.includes(false);
|
|
27
|
+
}
|
|
28
|
+
Organization.activate = activate;
|
|
17
29
|
Organization.Creatable = OrganizationCreatable;
|
|
30
|
+
Organization.Rules = OrganizationRules;
|
|
18
31
|
})(Organization || (Organization = {}));
|
|
19
32
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"../","sources":["Organization/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAA;AAClC,OAAO,EAAE,SAAS,IAAI,qBAAqB,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../","sources":["Organization/index.ts"],"names":[],"mappings":"AAAA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CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;IAC/B,CAAC;IARe,qBAAQ,WAQvB,CAAA;IAGY,sBAAS,GAAG,qBAAqB,CAAA;IAEjC,kBAAK,GAAG,iBAAiB,CAAA;AACvC,CAAC,EA1BgB,YAAY,KAAZ,YAAY,QA0B5B"}
|
|
@@ -5,9 +5,7 @@ export var Creatable;
|
|
|
5
5
|
(function (Creatable) {
|
|
6
6
|
function is(value) {
|
|
7
7
|
return (typeof value == "object" &&
|
|
8
|
-
Rail.is(value.account) &&
|
|
9
8
|
Rail.is(value.counterpart) &&
|
|
10
|
-
!Rail.hasSameIdentifiers(value.account, value.counterpart) &&
|
|
11
9
|
isoly.Currency.is(value.currency) &&
|
|
12
10
|
typeof value.amount == "number" &&
|
|
13
11
|
(value.description == undefined || typeof value.description == "string") &&
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Creatable.js","sourceRoot":"../","sources":["Transaction/Creatable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"Creatable.js","sourceRoot":"../","sources":["Transaction/Creatable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAU9B,MAAM,KAAW,SAAS,CAazB;AAbD,WAAiB,SAAS;IACzB,SAAgB,EAAE,CAAC,KAAsB;QACxC,OAAO,CACN,OAAO,KAAK,IAAI,QAAQ;YAExB,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC;YAC1B,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC;YACjC,OAAO,KAAK,CAAC,MAAM,IAAI,QAAQ;YAC/B,CAAC,KAAK,CAAC,WAAW,IAAI,SAAS,IAAI,OAAO,KAAK,CAAC,WAAW,IAAI,QAAQ,CAAC;YACxE,CAAC,KAAK,CAAC,UAAU,IAAI,SAAS;gBAC7B,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,CACrF,CAAA;IACF,CAAC;IAXe,YAAE,KAWjB,CAAA;AACF,CAAC,EAbgB,SAAS,KAAT,SAAS,QAazB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as isoly from "isoly";
|
|
2
|
+
import { Rail } from "../Rail";
|
|
3
|
+
import { Creatable as TransactionCreatable } from "./Creatable";
|
|
4
|
+
export interface Incoming extends TransactionCreatable {
|
|
5
|
+
account: Rail;
|
|
6
|
+
counterpart: Rail;
|
|
7
|
+
currency: isoly.Currency;
|
|
8
|
+
amount: number;
|
|
9
|
+
description?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare namespace Incoming {
|
|
12
|
+
function is(value: any | Incoming): value is Incoming;
|
|
13
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as isoly from "isoly";
|
|
2
|
+
import { Rail } from "../Rail";
|
|
3
|
+
export var Incoming;
|
|
4
|
+
(function (Incoming) {
|
|
5
|
+
function is(value) {
|
|
6
|
+
return (typeof value == "object" &&
|
|
7
|
+
Rail.is(value.account) &&
|
|
8
|
+
Rail.is(value.counterpart) &&
|
|
9
|
+
!Rail.hasSameIdentifiers(value.account, value.counterpart) &&
|
|
10
|
+
isoly.Currency.is(value.currency) &&
|
|
11
|
+
typeof value.amount == "number" &&
|
|
12
|
+
(value.description == undefined || typeof value.description == "string"));
|
|
13
|
+
}
|
|
14
|
+
Incoming.is = is;
|
|
15
|
+
})(Incoming || (Incoming = {}));
|
|
16
|
+
//# sourceMappingURL=Incoming.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Incoming.js","sourceRoot":"../","sources":["Transaction/Incoming.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAY9B,MAAM,KAAW,QAAQ,CAYxB;AAZD,WAAiB,QAAQ;IACxB,SAAgB,EAAE,CAAC,KAAqB;QACvC,OAAO,CACN,OAAO,KAAK,IAAI,QAAQ;YACxB,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC;YACtB,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC;YAC1B,CAAC,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,WAAW,CAAC;YAC1D,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC;YACjC,OAAO,KAAK,CAAC,MAAM,IAAI,QAAQ;YAC/B,CAAC,KAAK,CAAC,WAAW,IAAI,SAAS,IAAI,OAAO,KAAK,CAAC,WAAW,IAAI,QAAQ,CAAC,CACxE,CAAA;IACF,CAAC;IAVe,WAAE,KAUjB,CAAA;AACF,CAAC,EAZgB,QAAQ,KAAR,QAAQ,QAYxB"}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import * as cryptly from "cryptly";
|
|
2
2
|
import * as isoly from "isoly";
|
|
3
3
|
import { Operation } from "../Operation";
|
|
4
|
+
import { Rail } from "../Rail";
|
|
4
5
|
import { Creatable as TransactionCreatable } from "./Creatable";
|
|
6
|
+
import { Incoming as TransactionIncoming } from "./Incoming";
|
|
5
7
|
export interface Transaction extends TransactionCreatable {
|
|
8
|
+
account: Rail;
|
|
6
9
|
readonly id: cryptly.Identifier;
|
|
7
10
|
readonly posted: isoly.DateTime;
|
|
8
11
|
readonly transacted?: isoly.DateTime;
|
|
@@ -12,10 +15,15 @@ export interface Transaction extends TransactionCreatable {
|
|
|
12
15
|
}
|
|
13
16
|
export declare namespace Transaction {
|
|
14
17
|
function is(value: any | Transaction): value is Transaction;
|
|
15
|
-
function fromCreatable(transaction: Creatable & {
|
|
18
|
+
function fromCreatable(account: Rail, transaction: Creatable & {
|
|
19
|
+
operations: Operation.Creatable[];
|
|
20
|
+
}, type: "actual" | "available", result: number): Transaction;
|
|
21
|
+
function fromIncoming(transaction: Incoming & {
|
|
16
22
|
operations: Operation.Creatable[];
|
|
17
23
|
}, type: "actual" | "available", result: number): Transaction;
|
|
18
24
|
function isIdentifier(value: cryptly.Identifier | any): value is cryptly.Identifier;
|
|
19
25
|
type Creatable = TransactionCreatable;
|
|
20
26
|
const Creatable: typeof TransactionCreatable;
|
|
27
|
+
type Incoming = TransactionIncoming;
|
|
28
|
+
const Incoming: typeof TransactionIncoming;
|
|
21
29
|
}
|
|
@@ -2,6 +2,7 @@ import * as cryptly from "cryptly";
|
|
|
2
2
|
import * as isoly from "isoly";
|
|
3
3
|
import { Operation } from "../Operation";
|
|
4
4
|
import { Creatable as TransactionCreatable } from "./Creatable";
|
|
5
|
+
import { Incoming as TransactionIncoming } from "./Incoming";
|
|
5
6
|
export var Transaction;
|
|
6
7
|
(function (Transaction) {
|
|
7
8
|
function is(value) {
|
|
@@ -15,7 +16,7 @@ export var Transaction;
|
|
|
15
16
|
value.operations.every(Operation.is));
|
|
16
17
|
}
|
|
17
18
|
Transaction.is = is;
|
|
18
|
-
function fromCreatable(transaction, type, result) {
|
|
19
|
+
function fromCreatable(account, transaction, type, result) {
|
|
19
20
|
const id = cryptly.Identifier.generate(8);
|
|
20
21
|
const timestamp = isoly.DateTime.now();
|
|
21
22
|
if ("id" in transaction)
|
|
@@ -23,19 +24,38 @@ export var Transaction;
|
|
|
23
24
|
if ("posted" in transaction)
|
|
24
25
|
delete transaction.posted;
|
|
25
26
|
return {
|
|
27
|
+
account: account,
|
|
26
28
|
id: id,
|
|
27
29
|
posted: timestamp,
|
|
28
30
|
type: type,
|
|
29
31
|
balance: result,
|
|
30
32
|
...transaction,
|
|
31
|
-
operations: transaction.operations.map(Operation.fromCreatable),
|
|
33
|
+
operations: transaction.operations.map(o => Operation.fromCreatable(id, o)),
|
|
32
34
|
};
|
|
33
35
|
}
|
|
34
36
|
Transaction.fromCreatable = fromCreatable;
|
|
37
|
+
function fromIncoming(transaction, type, result) {
|
|
38
|
+
const id = cryptly.Identifier.generate(8);
|
|
39
|
+
const timestamp = isoly.DateTime.now();
|
|
40
|
+
if ("id" in transaction)
|
|
41
|
+
delete transaction.id;
|
|
42
|
+
if ("posted" in transaction)
|
|
43
|
+
delete transaction.posted;
|
|
44
|
+
return {
|
|
45
|
+
id: id,
|
|
46
|
+
posted: timestamp,
|
|
47
|
+
type: type,
|
|
48
|
+
balance: result,
|
|
49
|
+
...transaction,
|
|
50
|
+
operations: transaction.operations.map(o => Operation.fromCreatable(id, o)),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
Transaction.fromIncoming = fromIncoming;
|
|
35
54
|
function isIdentifier(value) {
|
|
36
55
|
return cryptly.Identifier.is(value, 8);
|
|
37
56
|
}
|
|
38
57
|
Transaction.isIdentifier = isIdentifier;
|
|
39
58
|
Transaction.Creatable = TransactionCreatable;
|
|
59
|
+
Transaction.Incoming = TransactionIncoming;
|
|
40
60
|
})(Transaction || (Transaction = {}));
|
|
41
61
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"../","sources":["Transaction/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAA;AAClC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../","sources":["Transaction/index.ts"],"names":[],"mappings":"AAAA,O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WAAW,KAAX,WAAW,QAgE3B"}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,4 +5,4 @@ export { Operation } from "./Operation";
|
|
|
5
5
|
export { Organization } from "./Organization";
|
|
6
6
|
export { Rail } from "./Rail";
|
|
7
7
|
export { Transaction } from "./Transaction";
|
|
8
|
-
export { Decision, Reviewable } from "./
|
|
8
|
+
export { Decision, Reviewable } from "./monitoring";
|
package/dist/index.js
CHANGED
|
@@ -5,5 +5,5 @@ export { Operation } from "./Operation";
|
|
|
5
5
|
export { Organization } from "./Organization";
|
|
6
6
|
export { Rail } from "./Rail";
|
|
7
7
|
export { Transaction } from "./Transaction";
|
|
8
|
-
export { Decision, Reviewable } from "./
|
|
8
|
+
export { Decision, Reviewable } from "./monitoring";
|
|
9
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import * as isoly from "isoly";
|
|
2
|
-
import {
|
|
2
|
+
import { Reviewable } from "./Reviewable";
|
|
3
3
|
export interface Decision extends Decision.Creatable {
|
|
4
|
-
|
|
4
|
+
reviewable: Reviewable;
|
|
5
5
|
timestamp: isoly.DateTime;
|
|
6
6
|
}
|
|
7
7
|
export declare namespace Decision {
|
|
8
|
+
function open(decision: Decision.Creatable, reviewable: Reviewable): Decision;
|
|
8
9
|
function is(value: any | Decision): value is Decision;
|
|
9
10
|
interface Creatable {
|
|
10
11
|
author: string;
|
|
@@ -2,6 +2,10 @@ import * as isoly from "isoly";
|
|
|
2
2
|
import { Transaction } from "../Transaction";
|
|
3
3
|
export var Decision;
|
|
4
4
|
(function (Decision) {
|
|
5
|
+
function open(decision, reviewable) {
|
|
6
|
+
return { reviewable: reviewable, timestamp: isoly.DateTime.now(), ...decision };
|
|
7
|
+
}
|
|
8
|
+
Decision.open = open;
|
|
5
9
|
function is(value) {
|
|
6
10
|
return Creatable.is({ ...value }) && Transaction.is(value.transaction) && isoly.DateTime.is(value.timestamp);
|
|
7
11
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Decision.js","sourceRoot":"../","sources":["monitoring/Decision.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAQ5C,MAAM,KAAW,QAAQ,CAwBxB;AAxBD,WAAiB,QAAQ;IACxB,SAAgB,IAAI,CAAC,QAA4B,EAAE,UAAsB;QACxE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE,EAAE,GAAG,QAAQ,EAAE,CAAA;IAChF,CAAC;IAFe,aAAI,OAEnB,CAAA;IAED,SAAgB,EAAE,CAAC,KAAqB;QACvC,OAAO,SAAS,CAAC,EAAE,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC,IAAI,WAAW,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,CAAA;IAC7G,CAAC;IAFe,WAAE,KAEjB,CAAA;IAMD,IAAiB,SAAS,CAUzB;IAVD,WAAiB,SAAS;QACzB,SAAgB,EAAE,CAAC,KAAsB;YACxC,OAAO,CACN,KAAK;gBACL,OAAO,KAAK,IAAI,QAAQ;gBACxB,OAAO,KAAK,CAAC,MAAM,IAAI,QAAQ;gBAC/B,OAAO,KAAK,CAAC,OAAO,IAAI,QAAQ;gBAChC,CAAC,KAAK,CAAC,MAAM,IAAI,UAAU,IAAI,KAAK,CAAC,MAAM,IAAI,UAAU,CAAC,CAC1D,CAAA;QACF,CAAC;QARe,YAAE,KAQjB,CAAA;IACF,CAAC,EAVgB,SAAS,GAAT,kBAAS,KAAT,kBAAS,QAUzB;AACF,CAAC,EAxBgB,QAAQ,KAAR,QAAQ,QAwBxB"}
|
|
@@ -6,6 +6,7 @@ export interface Reviewable {
|
|
|
6
6
|
organization: cryptly.Identifier;
|
|
7
7
|
account: cryptly.Identifier;
|
|
8
8
|
rule: string;
|
|
9
|
+
comments?: string[];
|
|
9
10
|
}
|
|
10
11
|
export declare namespace Reviewable {
|
|
11
12
|
function open(transaction: Transaction, direction: "incoming" | "outgoing", organization: cryptly.Identifier, account: cryptly.Identifier, rule: string): {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Reviewable.js","sourceRoot":"../","sources":["
|
|
1
|
+
{"version":3,"file":"Reviewable.js","sourceRoot":"../","sources":["monitoring/Reviewable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAA;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAU5C,MAAM,KAAW,UAAU,CA2B1B;AA3BD,WAAiB,UAAU;IAC1B,SAAgB,IAAI,CACnB,WAAwB,EACxB,SAAkC,EAClC,YAAgC,EAChC,OAA2B,EAC3B,IAAY;QAEZ,OAAO;YACN,WAAW,EAAE,WAAW;YACxB,SAAS,EAAE,SAAS;YACpB,YAAY,EAAE,YAAY;YAC1B,OAAO,EAAE,OAAO;YAChB,IAAI,EAAE,IAAI;SACV,CAAA;IACF,CAAC;IAde,eAAI,OAcnB,CAAA;IACD,SAAgB,EAAE,CAAC,KAAuB;QACzC,OAAO,CACN,KAAK;YACL,OAAO,KAAK,IAAI,QAAQ;YACxB,WAAW,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC;YACjC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC;YACzC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC;YACpC,OAAO,KAAK,CAAC,IAAI,IAAI,QAAQ;YAC7B,CAAC,KAAK,CAAC,SAAS,IAAI,UAAU,IAAI,KAAK,CAAC,SAAS,IAAI,UAAU,CAAC,CAChE,CAAA;IACF,CAAC;IAVe,aAAE,KAUjB,CAAA;AACF,CAAC,EA3BgB,UAAU,KAAV,UAAU,QA2B1B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../","sources":["monitoring/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA"}
|
package/index.ts
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import * as isoly from "isoly"
|
|
2
2
|
import { Transaction } from "../Transaction"
|
|
3
|
+
import { Reviewable } from "./Reviewable"
|
|
3
4
|
|
|
4
5
|
export interface Decision extends Decision.Creatable {
|
|
5
|
-
|
|
6
|
+
reviewable: Reviewable
|
|
6
7
|
timestamp: isoly.DateTime
|
|
7
8
|
}
|
|
8
9
|
|
|
9
10
|
export namespace Decision {
|
|
11
|
+
export function open(decision: Decision.Creatable, reviewable: Reviewable): Decision {
|
|
12
|
+
return { reviewable: reviewable, timestamp: isoly.DateTime.now(), ...decision }
|
|
13
|
+
}
|
|
14
|
+
|
|
10
15
|
export function is(value: any | Decision): value is Decision {
|
|
11
16
|
return Creatable.is({ ...value }) && Transaction.is(value.transaction) && isoly.DateTime.is(value.timestamp)
|
|
12
17
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pax2pay/model-banking",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"description": "Library containing data model types and functions for the Pax2Pay Banking API.",
|
|
5
5
|
"author": "Pax2Pay Ltd",
|
|
6
6
|
"license": "MIT",
|
|
@@ -55,20 +55,23 @@
|
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@types/jest": "^29.4.0",
|
|
58
|
-
"@typescript-eslint/eslint-plugin": "5.
|
|
59
|
-
"@typescript-eslint/parser": "5.
|
|
60
|
-
"eslint": "^8.
|
|
58
|
+
"@typescript-eslint/eslint-plugin": "5.53.0",
|
|
59
|
+
"@typescript-eslint/parser": "5.53.0",
|
|
60
|
+
"eslint": "^8.35.0",
|
|
61
61
|
"eslint-plugin-prettierx": "github:utily/eslint-plugin-prettierx#utily-20221229",
|
|
62
62
|
"eslint-plugin-simple-import-sort": "^10.0.0",
|
|
63
|
-
"jest": "^29.4.
|
|
63
|
+
"jest": "^29.4.3",
|
|
64
64
|
"prettierx": "github:utily/prettierx#utily-20221229",
|
|
65
65
|
"rimraf": "^4.1.2",
|
|
66
66
|
"ts-jest": "^29.0.5",
|
|
67
67
|
"typescript": "^4.9.5"
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
+
"cloudly-http": "^0.1.2",
|
|
71
|
+
"cloudly-rest": "^0.1.1",
|
|
70
72
|
"cryptly": "^3.0.2",
|
|
71
73
|
"gracely": "^2.0.3",
|
|
72
|
-
"isoly": "^2.0.14"
|
|
74
|
+
"isoly": "^2.0.14",
|
|
75
|
+
"selectively": "^2.0.4"
|
|
73
76
|
}
|
|
74
77
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Decision.js","sourceRoot":"../","sources":["Monitoring/Decision.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAO5C,MAAM,KAAW,QAAQ,CAoBxB;AApBD,WAAiB,QAAQ;IACxB,SAAgB,EAAE,CAAC,KAAqB;QACvC,OAAO,SAAS,CAAC,EAAE,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC,IAAI,WAAW,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,CAAA;IAC7G,CAAC;IAFe,WAAE,KAEjB,CAAA;IAMD,IAAiB,SAAS,CAUzB;IAVD,WAAiB,SAAS;QACzB,SAAgB,EAAE,CAAC,KAAsB;YACxC,OAAO,CACN,KAAK;gBACL,OAAO,KAAK,IAAI,QAAQ;gBACxB,OAAO,KAAK,CAAC,MAAM,IAAI,QAAQ;gBAC/B,OAAO,KAAK,CAAC,OAAO,IAAI,QAAQ;gBAChC,CAAC,KAAK,CAAC,MAAM,IAAI,UAAU,IAAI,KAAK,CAAC,MAAM,IAAI,UAAU,CAAC,CAC1D,CAAA;QACF,CAAC;QARe,YAAE,KAQjB,CAAA;IACF,CAAC,EAVgB,SAAS,GAAT,kBAAS,KAAT,kBAAS,QAUzB;AACF,CAAC,EApBgB,QAAQ,KAAR,QAAQ,QAoBxB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"../","sources":["Monitoring/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|