@abyss-project/banking 2.3.0 → 2.6.0
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/.eslintrc.js +32 -33
- package/dist/api/banking-scoring.api.d.ts +2 -1
- package/dist/api/banking-scoring.api.js +11 -1
- package/dist/api/banking-scoring.api.js.map +1 -1
- package/dist/api/index.d.ts +2 -0
- package/dist/api/index.js +2 -0
- package/dist/api/index.js.map +1 -1
- package/dist/api/transaction-question.api.d.ts +9 -0
- package/dist/api/transaction-question.api.js +33 -0
- package/dist/api/transaction-question.api.js.map +1 -0
- package/dist/api/transaction-watch.api.d.ts +5 -0
- package/dist/api/transaction-watch.api.js +17 -0
- package/dist/api/transaction-watch.api.js.map +1 -0
- package/dist/constants/index.d.ts +2 -0
- package/dist/constants/index.js +19 -0
- package/dist/constants/index.js.map +1 -0
- package/dist/constants/mcc-labels.d.ts +49 -0
- package/dist/constants/mcc-labels.js +178 -0
- package/dist/constants/mcc-labels.js.map +1 -0
- package/dist/constants/naf-sections.d.ts +31 -0
- package/dist/constants/naf-sections.js +66 -0
- package/dist/constants/naf-sections.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +19 -7
- package/dist/index.js.map +1 -1
- package/dist/types/enum/banking-notification-type.enum.d.ts +3 -1
- package/dist/types/enum/banking-notification-type.enum.js +2 -0
- package/dist/types/enum/banking-notification-type.enum.js.map +1 -1
- package/dist/types/enum/counterparty-kind.enum.d.ts +5 -0
- package/dist/types/enum/counterparty-kind.enum.js +10 -0
- package/dist/types/enum/counterparty-kind.enum.js.map +1 -0
- package/dist/types/enum/index.d.ts +5 -0
- package/dist/types/enum/index.js +5 -0
- package/dist/types/enum/index.js.map +1 -1
- package/dist/types/enum/trace.enum.d.ts +6 -0
- package/dist/types/enum/trace.enum.js +12 -0
- package/dist/types/enum/trace.enum.js.map +1 -0
- package/dist/types/enum/transaction-question-status.enum.d.ts +5 -0
- package/dist/types/enum/transaction-question-status.enum.js +10 -0
- package/dist/types/enum/transaction-question-status.enum.js.map +1 -0
- package/dist/types/enum/transaction-question-trigger.enum.d.ts +8 -0
- package/dist/types/enum/transaction-question-trigger.enum.js +13 -0
- package/dist/types/enum/transaction-question-trigger.enum.js.map +1 -0
- package/dist/types/enum/transaction-watch-target.enum.d.ts +4 -0
- package/dist/types/enum/transaction-watch-target.enum.js +9 -0
- package/dist/types/enum/transaction-watch-target.enum.js.map +1 -0
- package/dist/types/interface/api/index.d.ts +4 -0
- package/dist/types/interface/api/index.js +4 -0
- package/dist/types/interface/api/index.js.map +1 -1
- package/dist/types/interface/api/requests/banking-scoring.request.d.ts +11 -0
- package/dist/types/interface/api/requests/banking.request.d.ts +5 -1
- package/dist/types/interface/api/requests/transaction-question.request.d.ts +23 -0
- package/dist/types/interface/api/requests/transaction-question.request.js +3 -0
- package/dist/types/interface/api/requests/transaction-question.request.js.map +1 -0
- package/dist/types/interface/api/requests/transaction-watch.request.d.ts +8 -0
- package/dist/types/interface/api/{responses/saving-goal.response.js → requests/transaction-watch.request.js} +1 -1
- package/dist/types/interface/api/requests/transaction-watch.request.js.map +1 -0
- package/dist/types/interface/api/responses/banking-scoring.response.d.ts +6 -1
- package/dist/types/interface/api/responses/freelance-dashboard.response.d.ts +2 -0
- package/dist/types/interface/api/responses/gdpr.response.d.ts +1 -0
- package/dist/types/interface/api/responses/transaction-question.response.d.ts +31 -0
- package/dist/types/interface/api/responses/transaction-question.response.js +3 -0
- package/dist/types/interface/api/responses/transaction-question.response.js.map +1 -0
- package/dist/types/interface/api/responses/transaction-watch.response.d.ts +11 -0
- package/dist/types/interface/api/responses/{view-account.response.js → transaction-watch.response.js} +1 -1
- package/dist/types/interface/api/responses/transaction-watch.response.js.map +1 -0
- package/dist/types/interface/index.d.ts +4 -0
- package/dist/types/interface/index.js +4 -0
- package/dist/types/interface/index.js.map +1 -1
- package/dist/types/interface/models/account-transaction.model.d.ts +2 -0
- package/dist/types/interface/models/bank-account.model.d.ts +1 -1
- package/dist/types/interface/models/known-counterparty.model.d.ts +13 -0
- package/dist/types/interface/{api/requests/view-account.request.js → models/known-counterparty.model.js} +1 -1
- package/dist/types/interface/models/known-counterparty.model.js.map +1 -0
- package/dist/types/interface/models/score-share.model.d.ts +11 -3
- package/dist/types/interface/models/scoring.model.d.ts +13 -0
- package/dist/types/interface/models/scoring.model.js.map +1 -1
- package/dist/types/interface/models/transaction-explanation.model.d.ts +44 -0
- package/dist/types/interface/models/transaction-explanation.model.js +3 -0
- package/dist/types/interface/models/transaction-explanation.model.js.map +1 -0
- package/dist/types/interface/models/transaction-question.model.d.ts +20 -0
- package/dist/types/interface/models/transaction-question.model.js +3 -0
- package/dist/types/interface/models/transaction-question.model.js.map +1 -0
- package/dist/types/interface/models/transaction-watch.model.d.ts +11 -0
- package/dist/types/interface/{api/requests/saving-goal.request.js → models/transaction-watch.model.js} +1 -1
- package/dist/types/interface/models/transaction-watch.model.js.map +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +2 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/is-manual-bank-account.util.d.ts +1 -1
- package/dist/utils/lender-trace.util.d.ts +8 -0
- package/dist/utils/lender-trace.util.js +167 -0
- package/dist/utils/lender-trace.util.js.map +1 -0
- package/dist/utils/payslip-tax-projection.util.js +2 -2
- package/dist/utils/payslip-tax-projection.util.js.map +1 -1
- package/dist/utils/scoring-functions/index.d.ts +2 -0
- package/dist/utils/scoring-functions/index.js +13 -0
- package/dist/utils/scoring-functions/index.js.map +1 -0
- package/dist/utils/scoring-functions/punctuality.d.ts +3 -0
- package/dist/utils/scoring-functions/punctuality.js +43 -0
- package/dist/utils/scoring-functions/punctuality.js.map +1 -0
- package/package.json +7 -6
- package/tsconfig.json +35 -35
- package/dist/api/saving-goal.api.d.ts +0 -6
- package/dist/api/saving-goal.api.js +0 -25
- package/dist/api/saving-goal.api.js.map +0 -1
- package/dist/api/view-account-analytics.api.d.ts +0 -37
- package/dist/api/view-account-analytics.api.js +0 -27
- package/dist/api/view-account-analytics.api.js.map +0 -1
- package/dist/api/view-account.api.d.ts +0 -14
- package/dist/api/view-account.api.js +0 -33
- package/dist/api/view-account.api.js.map +0 -1
- package/dist/types/enum/currency.enum.d.ts +0 -12
- package/dist/types/enum/currency.enum.js +0 -26
- package/dist/types/enum/currency.enum.js.map +0 -1
- package/dist/types/interface/api/requests/saving-goal.request.d.ts +0 -35
- package/dist/types/interface/api/requests/saving-goal.request.js.map +0 -1
- package/dist/types/interface/api/requests/view-account.request.d.ts +0 -83
- package/dist/types/interface/api/requests/view-account.request.js.map +0 -1
- package/dist/types/interface/api/responses/saving-goal.response.d.ts +0 -17
- package/dist/types/interface/api/responses/saving-goal.response.js.map +0 -1
- package/dist/types/interface/api/responses/view-account.response.d.ts +0 -53
- package/dist/types/interface/api/responses/view-account.response.js.map +0 -1
- package/dist/types/interface/models/saving-goal.model.d.ts +0 -28
- package/dist/types/interface/models/saving-goal.model.js +0 -10
- package/dist/types/interface/models/saving-goal.model.js.map +0 -1
- package/dist/types/interface/models/view-account.model.d.ts +0 -256
- package/dist/types/interface/models/view-account.model.js +0 -71
- package/dist/types/interface/models/view-account.model.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"known-counterparty.model.js","sourceRoot":"","sources":["../../../../src/types/interface/models/known-counterparty.model.ts"],"names":[],"mappings":""}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Trace, Unit } from '@abyss-project/compute';
|
|
1
2
|
export interface IBankingScoreShareSet {
|
|
2
3
|
id?: string;
|
|
3
4
|
label: string;
|
|
@@ -24,7 +25,13 @@ export interface IBankingSharedModuleResult {
|
|
|
24
25
|
grade: string | null;
|
|
25
26
|
confidence: number | null;
|
|
26
27
|
evidenceQuality: string | null;
|
|
27
|
-
reasons:
|
|
28
|
+
reasons: IBankingSharedReason[] | null;
|
|
29
|
+
}
|
|
30
|
+
export interface IBankingSharedReason {
|
|
31
|
+
nodeId: string;
|
|
32
|
+
label: string;
|
|
33
|
+
value: number | boolean;
|
|
34
|
+
unit: Unit;
|
|
28
35
|
}
|
|
29
36
|
export interface IBankingSharedSnapshot {
|
|
30
37
|
snapshotId: string;
|
|
@@ -45,6 +52,7 @@ export interface IBankingSharedSnapshot {
|
|
|
45
52
|
pdEstimate: number | null;
|
|
46
53
|
knockOuts: unknown[] | null;
|
|
47
54
|
modules: IBankingSharedModuleResult[];
|
|
55
|
+
trace: Trace | null;
|
|
48
56
|
}
|
|
49
57
|
export interface IBankingSharedScoreSet {
|
|
50
58
|
label: string;
|
|
@@ -64,7 +72,7 @@ export interface ICreateScoreShareLinkBody {
|
|
|
64
72
|
projectId?: string;
|
|
65
73
|
}
|
|
66
74
|
export interface ICreateScoreShareTargetBody {
|
|
67
|
-
targetType: 'USER' | 'TEAM'
|
|
75
|
+
targetType: 'USER' | 'TEAM';
|
|
68
76
|
targetId: string;
|
|
69
77
|
organizationId?: string;
|
|
70
78
|
projectId?: string;
|
|
@@ -81,7 +89,7 @@ export interface IScoreSharePublicParams {
|
|
|
81
89
|
}
|
|
82
90
|
export interface IBankingScoreShareEntry {
|
|
83
91
|
shareId: string;
|
|
84
|
-
targetType: 'USER' | 'TEAM' | '
|
|
92
|
+
targetType: 'USER' | 'TEAM' | 'LINK';
|
|
85
93
|
targetId: string | null;
|
|
86
94
|
permission: string;
|
|
87
95
|
expiresAt: string | null;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BankingDecisionOutcome, EvidenceQuality, ScoringAxis, SnapshotStatus, SubSignalDirection } from '../../enum/scoring.enum';
|
|
2
2
|
import { ScoringProviderKey } from './external-signal.model';
|
|
3
|
+
import type { Trace } from '@abyss-project/compute';
|
|
3
4
|
export { SnapshotStatus as BankingScoringSnapshotStatus, EvidenceQuality as BankingScoringEvidenceQuality, };
|
|
4
5
|
export declare enum BankingScoringModelVersionStatus {
|
|
5
6
|
DRAFT = "draft",
|
|
@@ -96,11 +97,23 @@ export interface IBankingScoringSnapshot {
|
|
|
96
97
|
decisionGatedFlag?: boolean;
|
|
97
98
|
pendingProvidersJson?: ScoringProviderKey[] | null;
|
|
98
99
|
partialDeadlineAt?: string | Date | null;
|
|
100
|
+
traceJson?: Trace | null;
|
|
99
101
|
createdAt?: Date;
|
|
100
102
|
updatedAt?: Date;
|
|
101
103
|
deletedAt?: Date | null;
|
|
102
104
|
moduleResults?: IBankingScoringModuleResult[];
|
|
103
105
|
}
|
|
106
|
+
export interface IBankingScoringSnapshotInput {
|
|
107
|
+
id: string;
|
|
108
|
+
snapshotId: string;
|
|
109
|
+
sourceTransactionId: string;
|
|
110
|
+
txDate: string;
|
|
111
|
+
amountCents: number;
|
|
112
|
+
currency: string;
|
|
113
|
+
description: string;
|
|
114
|
+
counterpartyName: string | null;
|
|
115
|
+
counterpartyKey: string | null;
|
|
116
|
+
}
|
|
104
117
|
export interface IBankingScoringModuleResult {
|
|
105
118
|
id?: string;
|
|
106
119
|
snapshotId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scoring.model.js","sourceRoot":"","sources":["../../../../src/types/interface/models/scoring.model.ts"],"names":[],"mappings":";;;AAeA,0DAMiC;
|
|
1
|
+
{"version":3,"file":"scoring.model.js","sourceRoot":"","sources":["../../../../src/types/interface/models/scoring.model.ts"],"names":[],"mappings":";;;AAeA,0DAMiC;AASZ,8GAbnB,8BAAe,OAaiC;AAD9B,6GAVlB,6BAAc,OAUgC;AAKhD,IAAY,gCAIX;AAJD,WAAY,gCAAgC;IAC1C,mDAAe,CAAA;IACf,qDAAiB,CAAA;IACjB,uDAAmB,CAAA;AACrB,CAAC,EAJW,gCAAgC,gDAAhC,gCAAgC,QAI3C;AAuPD,IAAY,kBAMX;AAND,WAAY,kBAAkB;IAC5B,yCAAmB,CAAA;IACnB,uCAAiB,CAAA;IACjB,uCAAiB,CAAA;IACjB,iDAA2B,CAAA;IAC3B,2DAAqC,CAAA;AACvC,CAAC,EANW,kBAAkB,kCAAlB,kBAAkB,QAM7B"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { BankingSystemLabel } from '../../enum';
|
|
2
|
+
import { CounterpartyKind, TransactionQuestionStatus } from '../../enum';
|
|
3
|
+
export interface ITransactionExplanation {
|
|
4
|
+
counterparty: {
|
|
5
|
+
kind: CounterpartyKind | null;
|
|
6
|
+
name: string | null;
|
|
7
|
+
creditorId: string | null;
|
|
8
|
+
mandateId: string | null;
|
|
9
|
+
mcc: string | null;
|
|
10
|
+
systemLabel: BankingSystemLabel | null;
|
|
11
|
+
categoryName: string | null;
|
|
12
|
+
};
|
|
13
|
+
history: {
|
|
14
|
+
firstSeenAt: string;
|
|
15
|
+
debitCount: number;
|
|
16
|
+
totalPaidCents: number;
|
|
17
|
+
currency: string;
|
|
18
|
+
cadence: string | null;
|
|
19
|
+
nextExpectedAt: string | null;
|
|
20
|
+
similar: Array<{
|
|
21
|
+
id: string;
|
|
22
|
+
date: string;
|
|
23
|
+
amountCents: number;
|
|
24
|
+
description: string;
|
|
25
|
+
}>;
|
|
26
|
+
};
|
|
27
|
+
memberAnswers: Array<{
|
|
28
|
+
userId: string;
|
|
29
|
+
status: TransactionQuestionStatus;
|
|
30
|
+
note: string | null;
|
|
31
|
+
answeredAt: string | null;
|
|
32
|
+
}>;
|
|
33
|
+
company: {
|
|
34
|
+
siren: string;
|
|
35
|
+
name: string;
|
|
36
|
+
nafCode: string | null;
|
|
37
|
+
nafLabel: string | null;
|
|
38
|
+
city: string | null;
|
|
39
|
+
} | null;
|
|
40
|
+
sepaDispute: {
|
|
41
|
+
authorizedRefundDeadline: string;
|
|
42
|
+
unauthorizedRefundDeadline: string;
|
|
43
|
+
} | null;
|
|
44
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction-explanation.model.js","sourceRoot":"","sources":["../../../../src/types/interface/models/transaction-explanation.model.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { CounterpartyKind, TransactionQuestionStatus, TransactionQuestionTrigger } from '../../enum';
|
|
2
|
+
import { IAccountTransaction } from './account-transaction.model';
|
|
3
|
+
export interface ITransactionQuestion {
|
|
4
|
+
id?: string;
|
|
5
|
+
userId: string | null;
|
|
6
|
+
organizationId: string | null;
|
|
7
|
+
recipientUserId: string;
|
|
8
|
+
accountTransactionId: string;
|
|
9
|
+
trigger: TransactionQuestionTrigger;
|
|
10
|
+
counterpartyKind: CounterpartyKind | null;
|
|
11
|
+
counterpartyKey: string | null;
|
|
12
|
+
status: TransactionQuestionStatus;
|
|
13
|
+
note: string | null;
|
|
14
|
+
answeredAt: Date | null;
|
|
15
|
+
helpRequestedAt: Date | null;
|
|
16
|
+
digestedAt: Date | null;
|
|
17
|
+
updatedAt?: Date;
|
|
18
|
+
createdAt?: Date;
|
|
19
|
+
accountTransaction?: IAccountTransaction;
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction-question.model.js","sourceRoot":"","sources":["../../../../src/types/interface/models/transaction-question.model.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TransactionWatchTarget } from '../../enum';
|
|
2
|
+
export interface ITransactionWatch {
|
|
3
|
+
id?: string;
|
|
4
|
+
recipientUserId: string;
|
|
5
|
+
userId: string | null;
|
|
6
|
+
organizationId: string | null;
|
|
7
|
+
targetKind: TransactionWatchTarget;
|
|
8
|
+
targetKey: string;
|
|
9
|
+
updatedAt?: Date;
|
|
10
|
+
createdAt?: Date;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction-watch.model.js","sourceRoot":"","sources":["../../../../src/types/interface/models/transaction-watch.model.ts"],"names":[],"mappings":""}
|
package/dist/utils/index.d.ts
CHANGED
package/dist/utils/index.js
CHANGED
|
@@ -18,4 +18,6 @@ __exportStar(require("./error.utils"), exports);
|
|
|
18
18
|
__exportStar(require("./is-manual-bank-account.util"), exports);
|
|
19
19
|
__exportStar(require("./payslip-tax-projection.util"), exports);
|
|
20
20
|
__exportStar(require("./currency-symbol.util"), exports);
|
|
21
|
+
__exportStar(require("./lender-trace.util"), exports);
|
|
22
|
+
__exportStar(require("./scoring-functions"), exports);
|
|
21
23
|
//# sourceMappingURL=index.js.map
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,gEAA8C;AAC9C,gEAA8C;AAC9C,yDAAuC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,gEAA8C;AAC9C,gEAA8C;AAC9C,yDAAuC;AACvC,sDAAoC;AACpC,sDAAoC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { IBankAccount } from '../types/interface/models/bank-account.model';
|
|
2
|
-
export declare const isManualBankAccount: (account: Pick<IBankAccount,
|
|
2
|
+
export declare const isManualBankAccount: (account: Pick<IBankAccount, "bankConnectionId">) => boolean;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Trace } from '@abyss-project/compute';
|
|
2
|
+
export declare const LENDER_METHOD_FN = "abyss.method";
|
|
3
|
+
export declare enum LenderMethodLabel {
|
|
4
|
+
COMBINATION = "combination",
|
|
5
|
+
SCALE = "method_scale"
|
|
6
|
+
}
|
|
7
|
+
export declare const LENDER_ROW_COUNT_META = "rowCount";
|
|
8
|
+
export declare function projectLenderTrace(trace: Trace): Trace;
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LENDER_ROW_COUNT_META = exports.LenderMethodLabel = exports.LENDER_METHOD_FN = void 0;
|
|
4
|
+
exports.projectLenderTrace = projectLenderTrace;
|
|
5
|
+
const compute_1 = require("@abyss-project/compute");
|
|
6
|
+
exports.LENDER_METHOD_FN = 'abyss.method';
|
|
7
|
+
const lenderMethodExpr = () => ({
|
|
8
|
+
op: compute_1.ExprOp.Fn,
|
|
9
|
+
name: exports.LENDER_METHOD_FN,
|
|
10
|
+
version: 1,
|
|
11
|
+
args: [],
|
|
12
|
+
});
|
|
13
|
+
var LenderMethodLabel;
|
|
14
|
+
(function (LenderMethodLabel) {
|
|
15
|
+
LenderMethodLabel["COMBINATION"] = "combination";
|
|
16
|
+
LenderMethodLabel["SCALE"] = "method_scale";
|
|
17
|
+
})(LenderMethodLabel || (exports.LenderMethodLabel = LenderMethodLabel = {}));
|
|
18
|
+
const COMBINATION_META = 'combination';
|
|
19
|
+
exports.LENDER_ROW_COUNT_META = 'rowCount';
|
|
20
|
+
const NEUTRAL_NUMBERS = new Set([0, 1]);
|
|
21
|
+
const projectSource = (source) => {
|
|
22
|
+
switch (source.kind) {
|
|
23
|
+
case compute_1.SourceKind.External:
|
|
24
|
+
return {
|
|
25
|
+
kind: compute_1.SourceKind.External,
|
|
26
|
+
provider: source.provider,
|
|
27
|
+
payload: null,
|
|
28
|
+
fetchedAt: source.fetchedAt,
|
|
29
|
+
};
|
|
30
|
+
case compute_1.SourceKind.Rows:
|
|
31
|
+
return { kind: compute_1.SourceKind.Rows, series: source.series, rowIds: [] };
|
|
32
|
+
case compute_1.SourceKind.Document:
|
|
33
|
+
return { ...source };
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
const rowCountMeta = (node) => node.source?.kind === compute_1.SourceKind.Rows && node.source.rowIds.length > 0
|
|
37
|
+
? { [exports.LENDER_ROW_COUNT_META]: node.source.rowIds.length }
|
|
38
|
+
: null;
|
|
39
|
+
const childrenOf = (expr) => {
|
|
40
|
+
switch (expr.op) {
|
|
41
|
+
case compute_1.ExprOp.Const:
|
|
42
|
+
case compute_1.ExprOp.Ref:
|
|
43
|
+
case compute_1.ExprOp.Sum:
|
|
44
|
+
case compute_1.ExprOp.Count:
|
|
45
|
+
case compute_1.ExprOp.Mean:
|
|
46
|
+
return [];
|
|
47
|
+
case compute_1.ExprOp.Clamp:
|
|
48
|
+
return [expr.value, expr.min, expr.max];
|
|
49
|
+
case compute_1.ExprOp.Abs:
|
|
50
|
+
case compute_1.ExprOp.Exp:
|
|
51
|
+
case compute_1.ExprOp.Log:
|
|
52
|
+
case compute_1.ExprOp.Logistic:
|
|
53
|
+
case compute_1.ExprOp.Not:
|
|
54
|
+
return [expr.arg];
|
|
55
|
+
case compute_1.ExprOp.If:
|
|
56
|
+
return [expr.cond, expr.then, expr.else];
|
|
57
|
+
default:
|
|
58
|
+
return expr.args;
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
const writesNumber = (expr) => expr.op === compute_1.ExprOp.Const
|
|
62
|
+
? typeof expr.value === 'number' && !NEUTRAL_NUMBERS.has(expr.value)
|
|
63
|
+
: childrenOf(expr).some(writesNumber);
|
|
64
|
+
const readsOf = (expr) => {
|
|
65
|
+
const refs = [];
|
|
66
|
+
const series = [];
|
|
67
|
+
const add = (list, item) => {
|
|
68
|
+
if (!list.includes(item)) {
|
|
69
|
+
list.push(item);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
const walk = (e) => {
|
|
73
|
+
if (e.op === compute_1.ExprOp.Ref) {
|
|
74
|
+
add(refs, e.node);
|
|
75
|
+
}
|
|
76
|
+
else if (e.op === compute_1.ExprOp.Sum || e.op === compute_1.ExprOp.Count || e.op === compute_1.ExprOp.Mean) {
|
|
77
|
+
add(series, e.series);
|
|
78
|
+
}
|
|
79
|
+
else if (e.op === compute_1.ExprOp.Fn) {
|
|
80
|
+
(e.series ?? []).forEach((name) => add(series, name));
|
|
81
|
+
}
|
|
82
|
+
childrenOf(e).forEach(walk);
|
|
83
|
+
};
|
|
84
|
+
walk(expr);
|
|
85
|
+
return { refs, series };
|
|
86
|
+
};
|
|
87
|
+
const isCombination = (node) => node.meta !== undefined && COMBINATION_META in node.meta;
|
|
88
|
+
const hidesMethod = (node, kept) => node.inputs.some((id) => !kept.has(id)) ||
|
|
89
|
+
isCombination(node) ||
|
|
90
|
+
(node.expr.op !== compute_1.ExprOp.Const && writesNumber(node.expr));
|
|
91
|
+
const readableBranch = (node, kept) => {
|
|
92
|
+
if (node.branch === undefined || isCombination(node)) {
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
const { expr } = node;
|
|
96
|
+
const taken = expr.op === compute_1.ExprOp.If
|
|
97
|
+
? node.branch === 0
|
|
98
|
+
? expr.then
|
|
99
|
+
: expr.else
|
|
100
|
+
: expr.op === compute_1.ExprOp.Coalesce
|
|
101
|
+
? expr.args[node.branch]
|
|
102
|
+
: undefined;
|
|
103
|
+
if (taken === undefined ||
|
|
104
|
+
readsOf(taken).refs.some((id) => !kept.has(id)) ||
|
|
105
|
+
writesNumber(taken)) {
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
return taken;
|
|
109
|
+
};
|
|
110
|
+
const projectNode = (node, kept) => {
|
|
111
|
+
const source = node.source ? { source: projectSource(node.source) } : {};
|
|
112
|
+
const rowCount = rowCountMeta(node);
|
|
113
|
+
if (!hidesMethod(node, kept)) {
|
|
114
|
+
return {
|
|
115
|
+
...node,
|
|
116
|
+
...source,
|
|
117
|
+
inputs: [...node.inputs],
|
|
118
|
+
...(node.series ? { series: [...node.series] } : {}),
|
|
119
|
+
...(node.meta || rowCount ? { meta: { ...node.meta, ...rowCount } } : {}),
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
const taken = readableBranch(node, kept);
|
|
123
|
+
if (taken !== null) {
|
|
124
|
+
const reads = readsOf(taken);
|
|
125
|
+
return {
|
|
126
|
+
id: node.id,
|
|
127
|
+
label: node.label,
|
|
128
|
+
unit: node.unit,
|
|
129
|
+
visibility: node.visibility,
|
|
130
|
+
value: node.value,
|
|
131
|
+
expr: structuredClone(taken),
|
|
132
|
+
inputs: reads.refs,
|
|
133
|
+
...(reads.series.length > 0 ? { series: reads.series } : {}),
|
|
134
|
+
...(node.meta || rowCount ? { meta: { ...node.meta, ...rowCount } } : {}),
|
|
135
|
+
...source,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
const meta = {};
|
|
139
|
+
for (const [key, value] of Object.entries(node.meta ?? {})) {
|
|
140
|
+
if (key !== COMBINATION_META) {
|
|
141
|
+
meta[key] = value;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
meta.label = isCombination(node) ? LenderMethodLabel.COMBINATION : LenderMethodLabel.SCALE;
|
|
145
|
+
Object.assign(meta, rowCount);
|
|
146
|
+
return {
|
|
147
|
+
id: node.id,
|
|
148
|
+
label: node.label,
|
|
149
|
+
unit: node.unit,
|
|
150
|
+
visibility: node.visibility,
|
|
151
|
+
value: node.value,
|
|
152
|
+
expr: lenderMethodExpr(),
|
|
153
|
+
inputs: node.inputs.filter((id) => kept.has(id)),
|
|
154
|
+
meta,
|
|
155
|
+
...source,
|
|
156
|
+
};
|
|
157
|
+
};
|
|
158
|
+
function projectLenderTrace(trace) {
|
|
159
|
+
const kept = new Set(trace.order.filter((id) => trace.nodes[id]?.visibility === compute_1.Visibility.Lender));
|
|
160
|
+
const order = trace.order.filter((id) => kept.has(id));
|
|
161
|
+
const nodes = {};
|
|
162
|
+
for (const id of order) {
|
|
163
|
+
nodes[id] = projectNode(trace.nodes[id], kept);
|
|
164
|
+
}
|
|
165
|
+
return { traceVersion: trace.traceVersion, nodes, order };
|
|
166
|
+
}
|
|
167
|
+
//# sourceMappingURL=lender-trace.util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lender-trace.util.js","sourceRoot":"","sources":["../../src/utils/lender-trace.util.ts"],"names":[],"mappings":";;;AA4OA,gDAUC;AArPD,oDAAwE;AAgC3D,QAAA,gBAAgB,GAAG,cAAc,CAAC;AAG/C,MAAM,gBAAgB,GAAG,GAAS,EAAE,CAAC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gB,kBAAkB,CAAC,KAAY;IAC7C,MAAM,IAAI,GAAG,IAAI,GAAG,CAClB,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,UAAU,KAAK,oBAAU,CAAC,MAAM,CAAC,CAC9E,CAAC;IACF,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;IACvD,MAAM,KAAK,GAA8B,EAAE,CAAC;IAC5C,KAAK,MAAM,EAAE,IAAI,KAAK,EAAE,CAAC;QACvB,KAAK,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;IACjD,CAAC;IACD,OAAO,EAAE,YAAY,EAAE,KAAK,CAAC,YAAY,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;AAC5D,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.DEFAULT_PAYSLIP_PERIODS_PER_YEAR = void 0;
|
|
4
|
+
exports.computePayslipTaxProjection = computePayslipTaxProjection;
|
|
4
5
|
exports.DEFAULT_PAYSLIP_PERIODS_PER_YEAR = 12;
|
|
5
6
|
function computePayslipTaxProjection(extract, periodsPerYear = exports.DEFAULT_PAYSLIP_PERIODS_PER_YEAR) {
|
|
6
7
|
const { netTaxableCents, pasAmountCents, pasRatePct } = extract;
|
|
@@ -21,5 +22,4 @@ function computePayslipTaxProjection(extract, periodsPerYear = exports.DEFAULT_P
|
|
|
21
22
|
effectivePasRatePct,
|
|
22
23
|
};
|
|
23
24
|
}
|
|
24
|
-
exports.computePayslipTaxProjection = computePayslipTaxProjection;
|
|
25
25
|
//# sourceMappingURL=payslip-tax-projection.util.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payslip-tax-projection.util.js","sourceRoot":"","sources":["../../src/utils/payslip-tax-projection.util.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"payslip-tax-projection.util.js","sourceRoot":"","sources":["../../src/utils/payslip-tax-projection.util.ts"],"names":[],"mappings":";;;AAgDA,kEA4BC;AApEY,QAAA,gCAAgC,GAAG,EAAE,CAAC;AAwCnD,SAAgB,2BAA2B,CACzC,OAAmF,EACnF,iBAAyB,wCAAgC;IAEzD,MAAM,EAAE,eAAe,EAAE,cAAc,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IAEhE,IAAI,eAAe,KAAK,IAAI,IAAI,cAAc,KAAK,IAAI,EAAE,CAAC;QACxD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,qBAAqB,GACzB,eAAe,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,eAAe,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACjF,MAAM,cAAc,GAClB,cAAc,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAE/E,MAAM,mBAAmB,GACvB,eAAe,KAAK,IAAI,IAAI,eAAe,GAAG,CAAC,IAAI,cAAc,KAAK,IAAI;QACxE,CAAC,CAAC,CAAC,cAAc,GAAG,eAAe,CAAC,GAAG,GAAG;QAC1C,CAAC,CAAC,UAAU,CAAC;IAEjB,OAAO;QACL,cAAc;QACd,eAAe;QACf,cAAc;QACd,qBAAqB;QACrB,cAAc;QACd,mBAAmB;KACpB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerPunctualityFunctions = exports.PUNCTUALITY_GAP_DISPERSION_VERSION = exports.PUNCTUALITY_GAP_DISPERSION_FN = void 0;
|
|
4
|
+
exports.registerScoringFunctions = registerScoringFunctions;
|
|
5
|
+
const punctuality_1 = require("./punctuality");
|
|
6
|
+
var punctuality_2 = require("./punctuality");
|
|
7
|
+
Object.defineProperty(exports, "PUNCTUALITY_GAP_DISPERSION_FN", { enumerable: true, get: function () { return punctuality_2.PUNCTUALITY_GAP_DISPERSION_FN; } });
|
|
8
|
+
Object.defineProperty(exports, "PUNCTUALITY_GAP_DISPERSION_VERSION", { enumerable: true, get: function () { return punctuality_2.PUNCTUALITY_GAP_DISPERSION_VERSION; } });
|
|
9
|
+
Object.defineProperty(exports, "registerPunctualityFunctions", { enumerable: true, get: function () { return punctuality_2.registerPunctualityFunctions; } });
|
|
10
|
+
function registerScoringFunctions() {
|
|
11
|
+
(0, punctuality_1.registerPunctualityFunctions)();
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/scoring-functions/index.ts"],"names":[],"mappings":";;;AAgBA,4DAEC;AAXD,+CAA6D;AAE7D,6CAIuB;AAHrB,4HAAA,6BAA6B,OAAA;AAC7B,iIAAA,kCAAkC,OAAA;AAClC,2HAAA,4BAA4B,OAAA;AAI9B,SAAgB,wBAAwB;IACtC,IAAA,0CAA4B,GAAE,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PUNCTUALITY_GAP_DISPERSION_VERSION = exports.PUNCTUALITY_GAP_DISPERSION_FN = void 0;
|
|
4
|
+
exports.registerPunctualityFunctions = registerPunctualityFunctions;
|
|
5
|
+
const compute_1 = require("@abyss-project/compute");
|
|
6
|
+
exports.PUNCTUALITY_GAP_DISPERSION_FN = 'punctuality.gapDispersion';
|
|
7
|
+
exports.PUNCTUALITY_GAP_DISPERSION_VERSION = 1;
|
|
8
|
+
const MS_PER_DAY = 1000 * 60 * 60 * 24;
|
|
9
|
+
const dayIndex = (iso) => Math.floor(new Date(iso.slice(0, 10)).getTime() / MS_PER_DAY);
|
|
10
|
+
const dateOf = (row) => {
|
|
11
|
+
if (typeof row.at !== 'string') {
|
|
12
|
+
throw new Error(`${exports.PUNCTUALITY_GAP_DISPERSION_FN}: row ${row.id} carries no date.`);
|
|
13
|
+
}
|
|
14
|
+
return row.at;
|
|
15
|
+
};
|
|
16
|
+
const coefficientOfVariation = (values) => {
|
|
17
|
+
if (values.length < 2) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
const mean = values.reduce((sum, v) => sum + v, 0) / values.length;
|
|
21
|
+
if (mean === 0) {
|
|
22
|
+
return 0;
|
|
23
|
+
}
|
|
24
|
+
const variance = values.reduce((sum, v) => sum + (v - mean) ** 2, 0) / values.length;
|
|
25
|
+
return Math.sqrt(variance) / Math.abs(mean);
|
|
26
|
+
};
|
|
27
|
+
const gapDispersion = (_args, series) => {
|
|
28
|
+
const days = (series[0] ?? []).map((row) => dayIndex(dateOf(row))).sort((a, b) => a - b);
|
|
29
|
+
const gaps = [];
|
|
30
|
+
for (let i = 1; i < days.length; i += 1) {
|
|
31
|
+
gaps.push(days[i] - days[i - 1]);
|
|
32
|
+
}
|
|
33
|
+
return coefficientOfVariation(gaps);
|
|
34
|
+
};
|
|
35
|
+
let registered = false;
|
|
36
|
+
function registerPunctualityFunctions() {
|
|
37
|
+
if (registered) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
(0, compute_1.registerFunction)(exports.PUNCTUALITY_GAP_DISPERSION_FN, exports.PUNCTUALITY_GAP_DISPERSION_VERSION, gapDispersion);
|
|
41
|
+
registered = true;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=punctuality.js.map
|
|
@@ -0,0 +1 @@
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G,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC;IACrF,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AAC9C,CAAC,CAAC;AAGF,MAAM,aAAa,GAAa,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;IAChD,MAAM,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACzF,MAAM,IAAI,GAAa,EAAE,CAAC;IAC1B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QACxC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACnC,CAAC;IACD,OAAO,sBAAsB,CAAC,IAAI,CAAC,CAAC;AACtC,CAAC,CAAC;AAEF,IAAI,UAAU,GAAG,KAAK,CAAC;AAOvB,SAAgB,4BAA4B;IAC1C,IAAI,UAAU,EAAE,CAAC;QACf,OAAO;IACT,CAAC;IACD,IAAA,0BAAgB,EACd,qCAA6B,EAC7B,0CAAkC,EAClC,aAAa,CACd,CAAC;IACF,UAAU,GAAG,IAAI,CAAC;AACpB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abyss-project/banking",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.0",
|
|
4
4
|
"description": "Core package to interact with Abyss-Banking",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
},
|
|
13
13
|
"homepage": "https://gitlab.com/abyss-group/abyss-banking",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@abyss-project/
|
|
15
|
+
"@abyss-project/compute": "1.0.0",
|
|
16
|
+
"@abyss-project/main": "25.0.0",
|
|
16
17
|
"axios": "^1.6.0",
|
|
17
18
|
"axios-retry": "^4.5.0",
|
|
18
19
|
"core-js": "^3.37.1",
|
|
@@ -24,9 +25,9 @@
|
|
|
24
25
|
"@types/express-serve-static-core": "^4.17.31",
|
|
25
26
|
"@types/node": "^20.11.0",
|
|
26
27
|
"@types/uuid": "^9.0.0",
|
|
27
|
-
"@typescript-eslint/eslint-plugin": "
|
|
28
|
-
"@typescript-eslint/parser": "
|
|
29
|
-
"eslint": "^
|
|
28
|
+
"@typescript-eslint/eslint-plugin": "8.71.0",
|
|
29
|
+
"@typescript-eslint/parser": "8.71.0",
|
|
30
|
+
"eslint": "^8.57.1",
|
|
30
31
|
"eslint-config-prettier": "^8.3.0",
|
|
31
32
|
"eslint-config-standard": "^16.0.3",
|
|
32
33
|
"eslint-plugin-filenames-simple": "^0.7.0",
|
|
@@ -35,7 +36,7 @@
|
|
|
35
36
|
"eslint-plugin-prettier": "^3.4.0",
|
|
36
37
|
"eslint-plugin-promise": "^5.1.0",
|
|
37
38
|
"prettier": "2.3.1",
|
|
38
|
-
"typescript": "5.
|
|
39
|
+
"typescript": "5.9.3",
|
|
39
40
|
"tsc-watch": "^4.6.2"
|
|
40
41
|
},
|
|
41
42
|
"scripts": {
|
package/tsconfig.json
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"incremental": false,
|
|
4
|
-
"target": "es2021",
|
|
5
|
-
"lib": [
|
|
6
|
-
"dom",
|
|
7
|
-
"es2021"
|
|
8
|
-
],
|
|
9
|
-
"experimentalDecorators": true,
|
|
10
|
-
"emitDecoratorMetadata": true,
|
|
11
|
-
"module": "commonjs",
|
|
12
|
-
"rootDir": "src",
|
|
13
|
-
"moduleResolution": "node",
|
|
14
|
-
"resolveJsonModule": true,
|
|
15
|
-
"allowJs": true,
|
|
16
|
-
"declaration": true,
|
|
17
|
-
"sourceMap": true,
|
|
18
|
-
"outDir": "./dist",
|
|
19
|
-
"removeComments": true,
|
|
20
|
-
"allowSyntheticDefaultImports": true,
|
|
21
|
-
"esModuleInterop": true,
|
|
22
|
-
"forceConsistentCasingInFileNames": true,
|
|
23
|
-
"strict": true,
|
|
24
|
-
"strictNullChecks": true,
|
|
25
|
-
"strictFunctionTypes": true,
|
|
26
|
-
"strictPropertyInitialization": false,
|
|
27
|
-
"skipLibCheck": true
|
|
28
|
-
},
|
|
29
|
-
"include": [
|
|
30
|
-
"./src"
|
|
31
|
-
],
|
|
32
|
-
"exclude": [
|
|
33
|
-
"./dist/**/*"
|
|
34
|
-
]
|
|
35
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"incremental": false,
|
|
4
|
+
"target": "es2021",
|
|
5
|
+
"lib": [
|
|
6
|
+
"dom",
|
|
7
|
+
"es2021"
|
|
8
|
+
],
|
|
9
|
+
"experimentalDecorators": true,
|
|
10
|
+
"emitDecoratorMetadata": true,
|
|
11
|
+
"module": "commonjs",
|
|
12
|
+
"rootDir": "src",
|
|
13
|
+
"moduleResolution": "node",
|
|
14
|
+
"resolveJsonModule": true,
|
|
15
|
+
"allowJs": true,
|
|
16
|
+
"declaration": true,
|
|
17
|
+
"sourceMap": true,
|
|
18
|
+
"outDir": "./dist",
|
|
19
|
+
"removeComments": true,
|
|
20
|
+
"allowSyntheticDefaultImports": true,
|
|
21
|
+
"esModuleInterop": true,
|
|
22
|
+
"forceConsistentCasingInFileNames": true,
|
|
23
|
+
"strict": true,
|
|
24
|
+
"strictNullChecks": true,
|
|
25
|
+
"strictFunctionTypes": true,
|
|
26
|
+
"strictPropertyInitialization": false,
|
|
27
|
+
"skipLibCheck": true
|
|
28
|
+
},
|
|
29
|
+
"include": [
|
|
30
|
+
"./src"
|
|
31
|
+
],
|
|
32
|
+
"exclude": [
|
|
33
|
+
"./dist/**/*"
|
|
34
|
+
]
|
|
35
|
+
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { ICreateSavingGoalBody, ICreateSavingGoalResponse, IDeleteSavingGoalParams, IGetSavingGoalProgressParams, IGetSavingGoalProgressResponse, IPaginateSavingGoalQuery, IPaginateSavingGoalResponse, IUpdateSavingGoalBody, IUpdateSavingGoalParams, IUpdateSavingGoalResponse } from '..';
|
|
2
|
-
export declare const paginateSavingGoal: (query: IPaginateSavingGoalQuery) => Promise<IPaginateSavingGoalResponse>;
|
|
3
|
-
export declare const createSavingGoal: (body: ICreateSavingGoalBody) => Promise<ICreateSavingGoalResponse>;
|
|
4
|
-
export declare const updateSavingGoal: (params: IUpdateSavingGoalParams, body: IUpdateSavingGoalBody) => Promise<IUpdateSavingGoalResponse>;
|
|
5
|
-
export declare const deleteSavingGoal: (params: IDeleteSavingGoalParams) => Promise<void>;
|
|
6
|
-
export declare const getSavingGoalProgress: (params: IGetSavingGoalProgressParams) => Promise<IGetSavingGoalProgressResponse>;
|