@cubedelement.com/realty-investor-timeline 5.1.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 CHANGED
@@ -1,3 +1,17 @@
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
+
8
+ # [5.2.0](https://github.com/kvernon/realty-investor-timeline/compare/v5.1.0...v5.2.0) (2025-12-19)
9
+
10
+
11
+ ### Features
12
+
13
+ * added error reason for no money ([#69](https://github.com/kvernon/realty-investor-timeline/issues/69)) ([2d17a48](https://github.com/kvernon/realty-investor-timeline/commit/2d17a486541d3a349c70f8cb962b57bf439b10e3))
14
+
1
15
  # [5.1.0](https://github.com/kvernon/realty-investor-timeline/compare/v5.0.0...v5.1.0) (2025-11-14)
2
16
 
3
17
 
@@ -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
- constructor(reason?: InvestmentReasons, message?: string);
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
- constructor(reason = investment_reasons_1.InvestmentReasons.Unknown, message = '') {
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
  }
@@ -1,4 +1,8 @@
1
1
  export interface IHistoricalReason {
2
2
  reason: string;
3
3
  date: Date;
4
+ additionalInfo: {
5
+ name: string;
6
+ value: number;
7
+ }[];
4
8
  }
@@ -10,6 +10,7 @@ const update_historical_rentals_1 = require("./update-historical-rentals");
10
10
  const properties_1 = require("../properties");
11
11
  const property_sort_1 = __importDefault(require("../properties/property-sort"));
12
12
  const get_min_cost_down_by_rule_1 = require("../calculations/get-min-cost-down-by-rule");
13
+ const investments_1 = require("../investments");
13
14
  const looper = (options, timeline) => {
14
15
  const result = timeline.clone();
15
16
  result.endDate.setUTCMonth(result.endDate.getUTCMonth() + 1);
@@ -62,6 +63,14 @@ const looper = (options, timeline) => {
62
63
  result.user.ledgerCollection.add(equityFromSell);
63
64
  }
64
65
  if (!result.user.hasMoneyToInvest(timeline.endDate, result.rentals.map((x) => x.property).filter((x) => x.isOwned))) {
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
+ result.rentals.forEach((r) => {
68
+ r.reasons.push({
69
+ reason: issueUserHasNoMoneyToInvest.message,
70
+ date: (0, data_clone_date_1.cloneDateUtc)(timeline.endDate),
71
+ additionalInfo: [{ name: 'balance', value: result.user.ledgerCollection.getBalance(result.endDate) }],
72
+ });
73
+ });
65
74
  return result;
66
75
  }
67
76
  //step 4: buy new properties
@@ -73,6 +82,7 @@ const looper = (options, timeline) => {
73
82
  r.reasons = r.reasons.concat(validator.results.map((reasons) => ({
74
83
  reason: reasons.message,
75
84
  date: (0, data_clone_date_1.cloneDateUtc)(timeline.endDate),
85
+ additionalInfo: reasons.properties,
76
86
  })));
77
87
  }
78
88
  return validator.canInvest ? r.property : null;
@@ -106,6 +116,18 @@ const looper = (options, timeline) => {
106
116
  }
107
117
  }
108
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
+ }
109
131
  }
110
132
  }
111
133
  return result;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cubedelement.com/realty-investor-timeline",
3
- "version": "5.1.0",
3
+ "version": "5.3.0",
4
4
  "description": "A way to determine if and when your expenses would be covered",
5
5
  "main": "./dist/src/index.js",
6
6
  "types": "./dist/src/index.d.ts",