footprintjs 0.2.1 → 0.2.2

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.
Files changed (2) hide show
  1. package/README.md +27 -8
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -72,13 +72,24 @@ import {
72
72
  FlowChartBuilder, FlowChartExecutor, ScopeFacade, toScopeFactory,
73
73
  } from 'footprintjs';
74
74
 
75
+ // ── The application data ──────────────────────────────────────────────
76
+
77
+ const app = {
78
+ applicantName: 'Bob',
79
+ annualIncome: 42_000,
80
+ monthlyDebts: 2_100,
81
+ creditScore: 580,
82
+ employmentType: 'self-employed',
83
+ employmentYears: 1,
84
+ };
85
+
75
86
  // ── Stage functions: just do the work, no descriptions needed ──────────
76
87
 
77
- const receiveApplication = async (scope: ScopeFacade) => {
78
- scope.setValue('app', app); // objects, arrays, nested — all supported
88
+ const receiveApplication = (scope: ScopeFacade) => {
89
+ scope.setValue('app', app);
79
90
  };
80
91
 
81
- const pullCreditReport = async (scope: ScopeFacade) => {
92
+ const pullCreditReport = (scope: ScopeFacade) => {
82
93
  const { creditScore } = scope.getValue('app') as any;
83
94
  const tier = creditScore >= 740 ? 'excellent' : creditScore >= 670 ? 'good'
84
95
  : creditScore >= 580 ? 'fair' : 'poor';
@@ -86,7 +97,7 @@ const pullCreditReport = async (scope: ScopeFacade) => {
86
97
  scope.setValue('creditFlags', tier === 'fair' ? ['below-average credit'] : []);
87
98
  };
88
99
 
89
- const calculateDTI = async (scope: ScopeFacade) => {
100
+ const calculateDTI = (scope: ScopeFacade) => {
90
101
  const { annualIncome, monthlyDebts } = scope.getValue('app') as any;
91
102
  const dtiRatio = Math.round((monthlyDebts / (annualIncome / 12)) * 100) / 100;
92
103
  scope.setValue('dtiRatio', dtiRatio);
@@ -96,7 +107,15 @@ const calculateDTI = async (scope: ScopeFacade) => {
96
107
  dtiRatio > 0.43 ? [`DTI at ${Math.round(dtiRatio * 100)}% exceeds 43%`] : []);
97
108
  };
98
109
 
99
- const assessRisk = async (scope: ScopeFacade) => {
110
+ const verifyEmployment = (scope: ScopeFacade) => {
111
+ const { employmentType, employmentYears } = scope.getValue('app') as any;
112
+ const verified = employmentType !== 'self-employed' || employmentYears >= 2;
113
+ scope.setValue('employmentVerified', verified);
114
+ scope.setValue('employmentFlags',
115
+ !verified ? [`${employmentType}, ${employmentYears}yr < 2yr minimum`] : []);
116
+ };
117
+
118
+ const assessRisk = (scope: ScopeFacade) => {
100
119
  const creditTier = scope.getValue('creditTier') as string;
101
120
  const dtiStatus = scope.getValue('dtiStatus') as string;
102
121
  const verified = scope.getValue('employmentVerified') as boolean;
@@ -121,9 +140,9 @@ const chart = new FlowChartBuilder()
121
140
  .addFunction('VerifyEmployment', verifyEmployment)
122
141
  .addFunction('AssessRisk', assessRisk)
123
142
  .addDeciderFunction('LoanDecision', loanDecider as any)
124
- .addFunctionBranch('approved', 'ApproveApplication', approveFn)
125
- .addFunctionBranch('rejected', 'RejectApplication', rejectFn)
126
- .addFunctionBranch('manual-review', 'ManualReview', reviewFn)
143
+ .addFunctionBranch('approved', 'ApproveApplication', () => {})
144
+ .addFunctionBranch('rejected', 'RejectApplication', () => {})
145
+ .addFunctionBranch('manual-review', 'ManualReview', () => {})
127
146
  .setDefault('manual-review')
128
147
  .end()
129
148
  .build();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "footprintjs",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Turn your whiteboard flowchart into running code — with automatic causal traces for LLM reasoning",
5
5
  "license": "MIT",
6
6
  "author": "Sanjay Krishna Anbalagan",