@cubedelement.com/realty-investor-timeline 5.2.0 → 5.3.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/CHANGELOG.md +7 -0
- package/dist/src/calculations/can-invest-by-user.js +6 -4
- package/dist/src/calculations/get-cost-down-user-investment-results.js +4 -1
- package/dist/src/calculations/get-equity-capture-user-investment-results.js +4 -1
- package/dist/src/investments/reason-to-rule.js +4 -1
- package/dist/src/investments/user-invest-result.d.ts +12 -1
- package/dist/src/investments/user-invest-result.js +3 -1
- package/dist/src/time/i-historical-reason.d.ts +4 -0
- package/dist/src/time/looper.js +16 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [5.3.0](https://github.com/kvernon/realty-investor-timeline/compare/v5.2.0...v5.3.0) (2025-12-19)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* more no money; expose properties ([#70](https://github.com/kvernon/realty-investor-timeline/issues/70)) ([52f0ee7](https://github.com/kvernon/realty-investor-timeline/commit/52f0ee718fccc33c4891add239bd50f4228661c8))
|
|
7
|
+
|
|
1
8
|
# [5.2.0](https://github.com/kvernon/realty-investor-timeline/compare/v5.1.0...v5.2.0) (2025-12-19)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -16,18 +16,20 @@ const get_min_cost_down_by_rule_1 = require("./get-min-cost-down-by-rule");
|
|
|
16
16
|
function canInvestByUser(rental, user, date, properties) {
|
|
17
17
|
const result = new rental_investor_validator_1.RentalInvestorValidator();
|
|
18
18
|
if (rental.isOwned) {
|
|
19
|
-
result.results.push(new user_invest_result_1.UserInvestResult(investment_reasons_1.InvestmentReasons.PropertyIsAlreadyOwned));
|
|
19
|
+
result.results.push(new user_invest_result_1.UserInvestResult(investment_reasons_1.InvestmentReasons.PropertyIsAlreadyOwned, '', []));
|
|
20
20
|
return result;
|
|
21
21
|
}
|
|
22
22
|
const minCostDownByRule = (0, get_min_cost_down_by_rule_1.getMinCostDownByRule)(rental, user.purchaseRules);
|
|
23
23
|
if (!user.hasMoneyToInvest(date, properties, minCostDownByRule)) {
|
|
24
|
-
result.results.push(new user_invest_result_1.UserInvestResult(investment_reasons_1.InvestmentReasons.UserHasNoMoneyToInvest, `user balance: ${user.ledgerCollection.getBalance(date)}
|
|
24
|
+
result.results.push(new user_invest_result_1.UserInvestResult(investment_reasons_1.InvestmentReasons.UserHasNoMoneyToInvest, `user balance: ${user.ledgerCollection.getBalance(date)}`, [
|
|
25
|
+
{ name: 'balance', value: user.ledgerCollection.getBalance(date) },
|
|
26
|
+
]));
|
|
25
27
|
}
|
|
26
28
|
if (!user.hasMinimumSavings(date, properties)) {
|
|
27
|
-
result.results.push(new user_invest_result_1.UserInvestResult(investment_reasons_1.InvestmentReasons.UserHasNotSavedEnoughMoney, `user balance: ${user.ledgerCollection.getBalance(date)}, minimumSavings: ${user.getMinimumSavings(date, properties)}
|
|
29
|
+
result.results.push(new user_invest_result_1.UserInvestResult(investment_reasons_1.InvestmentReasons.UserHasNotSavedEnoughMoney, `user balance: ${user.ledgerCollection.getBalance(date)}, minimumSavings: ${user.getMinimumSavings(date, properties)}`, [{ name: 'balance', value: user.ledgerCollection.getBalance(date) }]));
|
|
28
30
|
}
|
|
29
31
|
if (!user.purchaseRules || user.purchaseRules.length === 0) {
|
|
30
|
-
result.results.push(new user_invest_result_1.UserInvestResult(investment_reasons_1.InvestmentReasons.NoRules, 'user has no purchase rules'));
|
|
32
|
+
result.results.push(new user_invest_result_1.UserInvestResult(investment_reasons_1.InvestmentReasons.NoRules, 'user has no purchase rules', []));
|
|
31
33
|
return result;
|
|
32
34
|
}
|
|
33
35
|
if (!result.canInvest) {
|
|
@@ -18,7 +18,10 @@ const getCostDownUserInvestmentResults = (rental, _holdRules, purchaseRules) =>
|
|
|
18
18
|
}
|
|
19
19
|
const userInvestResults = resultReasonToRule.values.map((v) => {
|
|
20
20
|
if (!outOfPocket.evaluate(v)) {
|
|
21
|
-
return new user_invest_result_1.UserInvestResult(resultReasonToRule.investmentReason, `rule: ${outOfPocket.value} property: ${v}
|
|
21
|
+
return new user_invest_result_1.UserInvestResult(resultReasonToRule.investmentReason, `rule: ${outOfPocket.value} property: ${v}`, [
|
|
22
|
+
{ value: outOfPocket.value, name: 'rule' },
|
|
23
|
+
{ value: v, name: 'property' },
|
|
24
|
+
]);
|
|
22
25
|
}
|
|
23
26
|
return null;
|
|
24
27
|
});
|
|
@@ -31,7 +31,10 @@ const getEquityCaptureUserInvestmentResults = (rental, holdRules, purchaseRules,
|
|
|
31
31
|
}
|
|
32
32
|
const equityCaptureAmount = (0, get_equity_capture_amount_1.getEquityCaptureAmount)(investmentPercent, v, sellPriceEstimate);
|
|
33
33
|
if (!maxCapGains.evaluate(equityCaptureAmount)) {
|
|
34
|
-
return new user_invest_result_1.UserInvestResult(resultReasonToRule.investmentReason, `rule: ${maxCapGains.value} property: ${equityCaptureAmount}
|
|
34
|
+
return new user_invest_result_1.UserInvestResult(resultReasonToRule.investmentReason, `rule: ${maxCapGains.value} property: ${equityCaptureAmount}`, [
|
|
35
|
+
{ value: maxCapGains.value, name: 'rule' },
|
|
36
|
+
{ value: equityCaptureAmount, name: 'property' },
|
|
37
|
+
]);
|
|
35
38
|
}
|
|
36
39
|
return null;
|
|
37
40
|
});
|
|
@@ -58,7 +58,10 @@ class ReasonToRule {
|
|
|
58
58
|
}
|
|
59
59
|
return this.values.map((v) => {
|
|
60
60
|
if (!rule.evaluate(v)) {
|
|
61
|
-
return new user_invest_result_1.UserInvestResult(this.investmentReason, `rule: ${rule.value} property: ${v}
|
|
61
|
+
return new user_invest_result_1.UserInvestResult(this.investmentReason, `rule: ${rule.value} property: ${v}`, [
|
|
62
|
+
{ name: 'rule', value: rule.value },
|
|
63
|
+
{ name: 'property', value: v },
|
|
64
|
+
]);
|
|
62
65
|
}
|
|
63
66
|
});
|
|
64
67
|
}
|
|
@@ -2,10 +2,21 @@ import { InvestmentReasons } from './investment-reasons';
|
|
|
2
2
|
export interface IUserInvestResult {
|
|
3
3
|
message: string;
|
|
4
4
|
investmentReason: InvestmentReasons;
|
|
5
|
+
properties: {
|
|
6
|
+
name: string;
|
|
7
|
+
value: number;
|
|
8
|
+
}[];
|
|
5
9
|
}
|
|
6
10
|
export declare class UserInvestResult implements IUserInvestResult {
|
|
7
11
|
get message(): string;
|
|
8
12
|
investmentReason: InvestmentReasons;
|
|
9
|
-
|
|
13
|
+
properties: {
|
|
14
|
+
name: string;
|
|
15
|
+
value: number;
|
|
16
|
+
}[];
|
|
17
|
+
constructor(reason: InvestmentReasons, message: string, properties: {
|
|
18
|
+
name: string;
|
|
19
|
+
value: number;
|
|
20
|
+
}[]);
|
|
10
21
|
private readonly _message;
|
|
11
22
|
}
|
|
@@ -8,9 +8,11 @@ class UserInvestResult {
|
|
|
8
8
|
return `${investment_reasons_1.InvestmentReasons[this.investmentReason]}${theMessage}`;
|
|
9
9
|
}
|
|
10
10
|
investmentReason;
|
|
11
|
-
|
|
11
|
+
properties;
|
|
12
|
+
constructor(reason = investment_reasons_1.InvestmentReasons.Unknown, message, properties) {
|
|
12
13
|
this.investmentReason = reason;
|
|
13
14
|
this._message = message;
|
|
15
|
+
this.properties = properties;
|
|
14
16
|
}
|
|
15
17
|
_message;
|
|
16
18
|
}
|
package/dist/src/time/looper.js
CHANGED
|
@@ -63,11 +63,12 @@ const looper = (options, timeline) => {
|
|
|
63
63
|
result.user.ledgerCollection.add(equityFromSell);
|
|
64
64
|
}
|
|
65
65
|
if (!result.user.hasMoneyToInvest(timeline.endDate, result.rentals.map((x) => x.property).filter((x) => x.isOwned))) {
|
|
66
|
-
const
|
|
66
|
+
const issueUserHasNoMoneyToInvest = new investments_1.UserInvestResult(investments_1.InvestmentReasons.UserHasNoMoneyToInvest, `user balance: ${result.user.ledgerCollection.getBalance(result.endDate)}`, [{ name: 'balance', value: result.user.ledgerCollection.getBalance(result.endDate) }]);
|
|
67
67
|
result.rentals.forEach((r) => {
|
|
68
68
|
r.reasons.push({
|
|
69
|
-
reason:
|
|
69
|
+
reason: issueUserHasNoMoneyToInvest.message,
|
|
70
70
|
date: (0, data_clone_date_1.cloneDateUtc)(timeline.endDate),
|
|
71
|
+
additionalInfo: [{ name: 'balance', value: result.user.ledgerCollection.getBalance(result.endDate) }],
|
|
71
72
|
});
|
|
72
73
|
});
|
|
73
74
|
return result;
|
|
@@ -81,6 +82,7 @@ const looper = (options, timeline) => {
|
|
|
81
82
|
r.reasons = r.reasons.concat(validator.results.map((reasons) => ({
|
|
82
83
|
reason: reasons.message,
|
|
83
84
|
date: (0, data_clone_date_1.cloneDateUtc)(timeline.endDate),
|
|
85
|
+
additionalInfo: reasons.properties,
|
|
84
86
|
})));
|
|
85
87
|
}
|
|
86
88
|
return validator.canInvest ? r.property : null;
|
|
@@ -114,6 +116,18 @@ const looper = (options, timeline) => {
|
|
|
114
116
|
}
|
|
115
117
|
}
|
|
116
118
|
}
|
|
119
|
+
else {
|
|
120
|
+
const issueMetMinCostYetUserHasNoMoneyToInvest = new investments_1.UserInvestResult(investments_1.InvestmentReasons.UserHasNoMoneyToInvest, `user balance: ${result.user.ledgerCollection.getBalance(result.endDate)}`, [{ name: 'balance', value: result.user.ledgerCollection.getBalance(result.endDate) }]);
|
|
121
|
+
result.rentals
|
|
122
|
+
.filter((x) => x.property.id === rentalProperty.id)
|
|
123
|
+
.forEach((r) => {
|
|
124
|
+
r.reasons.push({
|
|
125
|
+
reason: issueMetMinCostYetUserHasNoMoneyToInvest.message,
|
|
126
|
+
date: (0, data_clone_date_1.cloneDateUtc)(timeline.endDate),
|
|
127
|
+
additionalInfo: issueMetMinCostYetUserHasNoMoneyToInvest.properties,
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
}
|
|
117
131
|
}
|
|
118
132
|
}
|
|
119
133
|
return result;
|
package/package.json
CHANGED