@markcolabs/mcp 0.3.0 → 0.4.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.
Files changed (114) hide show
  1. package/dist/index.d.ts +9 -35
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +52 -285
  4. package/dist/index.js.map +1 -1
  5. package/package.json +7 -12
  6. package/LICENSE-API.md +0 -111
  7. package/dist/disclaimers/ymyl.d.ts +0 -16
  8. package/dist/disclaimers/ymyl.d.ts.map +0 -1
  9. package/dist/disclaimers/ymyl.js +0 -20
  10. package/dist/disclaimers/ymyl.js.map +0 -1
  11. package/dist/engines/compoundInterest.d.ts +0 -75
  12. package/dist/engines/compoundInterest.d.ts.map +0 -1
  13. package/dist/engines/compoundInterest.js +0 -74
  14. package/dist/engines/compoundInterest.js.map +0 -1
  15. package/dist/engines/data/federalTax.d.ts +0 -47
  16. package/dist/engines/data/federalTax.d.ts.map +0 -1
  17. package/dist/engines/data/federalTax.js +0 -111
  18. package/dist/engines/data/federalTax.js.map +0 -1
  19. package/dist/engines/data/irs2026.d.ts +0 -137
  20. package/dist/engines/data/irs2026.d.ts.map +0 -1
  21. package/dist/engines/data/irs2026.js +0 -113
  22. package/dist/engines/data/irs2026.js.map +0 -1
  23. package/dist/engines/data/rmd2026.d.ts +0 -59
  24. package/dist/engines/data/rmd2026.d.ts.map +0 -1
  25. package/dist/engines/data/rmd2026.js +0 -75
  26. package/dist/engines/data/rmd2026.js.map +0 -1
  27. package/dist/engines/data/ssa.d.ts +0 -39
  28. package/dist/engines/data/ssa.d.ts.map +0 -1
  29. package/dist/engines/data/ssa.js +0 -55
  30. package/dist/engines/data/ssa.js.map +0 -1
  31. package/dist/engines/data/stateTax2026.d.ts +0 -114
  32. package/dist/engines/data/stateTax2026.d.ts.map +0 -1
  33. package/dist/engines/data/stateTax2026.js +0 -348
  34. package/dist/engines/data/stateTax2026.js.map +0 -1
  35. package/dist/engines/hsa.d.ts +0 -110
  36. package/dist/engines/hsa.d.ts.map +0 -1
  37. package/dist/engines/hsa.js +0 -83
  38. package/dist/engines/hsa.js.map +0 -1
  39. package/dist/engines/ira.d.ts +0 -115
  40. package/dist/engines/ira.d.ts.map +0 -1
  41. package/dist/engines/ira.js +0 -127
  42. package/dist/engines/ira.js.map +0 -1
  43. package/dist/engines/mortgage.d.ts +0 -70
  44. package/dist/engines/mortgage.d.ts.map +0 -1
  45. package/dist/engines/mortgage.js +0 -60
  46. package/dist/engines/mortgage.js.map +0 -1
  47. package/dist/engines/paycheck.d.ts +0 -128
  48. package/dist/engines/paycheck.d.ts.map +0 -1
  49. package/dist/engines/paycheck.js +0 -142
  50. package/dist/engines/paycheck.js.map +0 -1
  51. package/dist/engines/retirement401k.d.ts +0 -109
  52. package/dist/engines/retirement401k.d.ts.map +0 -1
  53. package/dist/engines/retirement401k.js +0 -130
  54. package/dist/engines/retirement401k.js.map +0 -1
  55. package/dist/engines/rmd.d.ts +0 -107
  56. package/dist/engines/rmd.d.ts.map +0 -1
  57. package/dist/engines/rmd.js +0 -109
  58. package/dist/engines/rmd.js.map +0 -1
  59. package/dist/engines/rothConversion.d.ts +0 -124
  60. package/dist/engines/rothConversion.d.ts.map +0 -1
  61. package/dist/engines/rothConversion.js +0 -145
  62. package/dist/engines/rothConversion.js.map +0 -1
  63. package/dist/engines/socialSecurity.d.ts +0 -63
  64. package/dist/engines/socialSecurity.d.ts.map +0 -1
  65. package/dist/engines/socialSecurity.js +0 -139
  66. package/dist/engines/socialSecurity.js.map +0 -1
  67. package/dist/envelope.d.ts +0 -76
  68. package/dist/envelope.d.ts.map +0 -1
  69. package/dist/envelope.js +0 -34
  70. package/dist/envelope.js.map +0 -1
  71. package/dist/shared/bounds.d.ts +0 -133
  72. package/dist/shared/bounds.d.ts.map +0 -1
  73. package/dist/shared/bounds.js +0 -206
  74. package/dist/shared/bounds.js.map +0 -1
  75. package/dist/tools/compoundInterest.d.ts +0 -48
  76. package/dist/tools/compoundInterest.d.ts.map +0 -1
  77. package/dist/tools/compoundInterest.js +0 -107
  78. package/dist/tools/compoundInterest.js.map +0 -1
  79. package/dist/tools/hsa.d.ts +0 -58
  80. package/dist/tools/hsa.d.ts.map +0 -1
  81. package/dist/tools/hsa.js +0 -129
  82. package/dist/tools/hsa.js.map +0 -1
  83. package/dist/tools/ira.d.ts +0 -55
  84. package/dist/tools/ira.d.ts.map +0 -1
  85. package/dist/tools/ira.js +0 -117
  86. package/dist/tools/ira.js.map +0 -1
  87. package/dist/tools/mortgage.d.ts +0 -51
  88. package/dist/tools/mortgage.d.ts.map +0 -1
  89. package/dist/tools/mortgage.js +0 -112
  90. package/dist/tools/mortgage.js.map +0 -1
  91. package/dist/tools/paycheck.d.ts +0 -61
  92. package/dist/tools/paycheck.d.ts.map +0 -1
  93. package/dist/tools/paycheck.js +0 -135
  94. package/dist/tools/paycheck.js.map +0 -1
  95. package/dist/tools/retirement401k.d.ts +0 -85
  96. package/dist/tools/retirement401k.d.ts.map +0 -1
  97. package/dist/tools/retirement401k.js +0 -141
  98. package/dist/tools/retirement401k.js.map +0 -1
  99. package/dist/tools/rmd.d.ts +0 -60
  100. package/dist/tools/rmd.d.ts.map +0 -1
  101. package/dist/tools/rmd.js +0 -130
  102. package/dist/tools/rmd.js.map +0 -1
  103. package/dist/tools/rothConversion.d.ts +0 -66
  104. package/dist/tools/rothConversion.d.ts.map +0 -1
  105. package/dist/tools/rothConversion.js +0 -141
  106. package/dist/tools/rothConversion.js.map +0 -1
  107. package/dist/tools/socialSecurity.d.ts +0 -51
  108. package/dist/tools/socialSecurity.d.ts.map +0 -1
  109. package/dist/tools/socialSecurity.js +0 -117
  110. package/dist/tools/socialSecurity.js.map +0 -1
  111. package/dist/util/zod-to-json-schema.d.ts +0 -28
  112. package/dist/util/zod-to-json-schema.d.ts.map +0 -1
  113. package/dist/util/zod-to-json-schema.js +0 -98
  114. package/dist/util/zod-to-json-schema.js.map +0 -1
@@ -1,76 +0,0 @@
1
- /**
2
- * Result + Error envelopes per ADR-0039 § 3 and § 4.
3
- *
4
- * Every tool returns a `ToolResult<T>` on success or a `ToolError` on failure.
5
- * The envelope shape is invariant across all tools — only the `result` payload
6
- * type varies. Provenance (engineVersion, methodology, calculatedAt) is
7
- * non-negotiable.
8
- */
9
- /**
10
- * Successful tool result envelope.
11
- * @template T - Tool-specific payload type (always a structured object, never a bare number).
12
- */
13
- export interface ToolResult<T> {
14
- /** Tool-specific payload. Structured object. Monetary fields are bare USD numbers. */
15
- result: T;
16
- /** Canonical YMYL disclaimer string (single source of truth at packages/mcp/src/disclaimers/ymyl.ts). */
17
- disclaimer: string;
18
- /** Methodology pointer with versioned URL. */
19
- methodology: {
20
- /** Absolute URL to the methodology .md companion (ADR-0033) or HTML page if no companion. */
21
- url: string;
22
- /** ISO date of the methodology document's last-modified front-matter (per ADR-0035). */
23
- version: string;
24
- };
25
- /** ISO-8601 UTC timestamp the tool was invoked. */
26
- calculatedAt: string;
27
- /** SemVer of the calc engine module that produced `result`. Bumped when math changes. */
28
- engineVersion: string;
29
- }
30
- /**
31
- * Error envelope namespaces per ADR-0039 § 4.
32
- *
33
- * - INPUT_VALIDATION: Zod or bounds validation failed. Not retriable.
34
- * - BUSINESS_RULE: Inputs valid but produce an undefined result. Not retriable.
35
- * - INTERNAL: Unexpected engine error. Not retriable; opaque message to caller.
36
- * - RATE_LIMIT: Free-tier rate limit hit. Retriable after the window resets.
37
- */
38
- export type ToolErrorCode = "INPUT_VALIDATION" | "BUSINESS_RULE" | "INTERNAL" | "RATE_LIMIT";
39
- /**
40
- * Failure envelope returned to the MCP transport with `isError: true`.
41
- * Tools never throw to the transport — all failures funnel through this shape.
42
- */
43
- export interface ToolError {
44
- error: {
45
- /** Stable machine-readable code, namespaced by tool family. */
46
- code: ToolErrorCode;
47
- /** Human-readable description (no PII; safe to surface to end-user). */
48
- message: string;
49
- /** For validation errors, the input field that failed. */
50
- field?: string;
51
- /** True if a retry with same inputs *might* succeed. Validation errors are always false. */
52
- retriable: boolean;
53
- };
54
- }
55
- /**
56
- * Build a ToolResult envelope around a successful payload. Helper to keep tools terse.
57
- */
58
- export declare function makeResult<T>(args: {
59
- result: T;
60
- methodology: {
61
- url: string;
62
- version: string;
63
- };
64
- engineVersion: string;
65
- disclaimer: string;
66
- }): ToolResult<T>;
67
- /**
68
- * Build a ToolError envelope for a failure path. Helper for terse call sites.
69
- */
70
- export declare function makeError(args: {
71
- code: ToolErrorCode;
72
- message: string;
73
- field?: string;
74
- retriable?: boolean;
75
- }): ToolError;
76
- //# sourceMappingURL=envelope.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"envelope.d.ts","sourceRoot":"","sources":["../src/envelope.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;GAGG;AACH,MAAM,WAAW,UAAU,CAAC,CAAC;IAC3B,sFAAsF;IACtF,MAAM,EAAE,CAAC,CAAC;IACV,yGAAyG;IACzG,UAAU,EAAE,MAAM,CAAC;IACnB,8CAA8C;IAC9C,WAAW,EAAE;QACX,6FAA6F;QAC7F,GAAG,EAAE,MAAM,CAAC;QACZ,wFAAwF;QACxF,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,mDAAmD;IACnD,YAAY,EAAE,MAAM,CAAC;IACrB,yFAAyF;IACzF,aAAa,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,aAAa,GACrB,kBAAkB,GAClB,eAAe,GACf,UAAU,GACV,YAAY,CAAC;AAEjB;;;GAGG;AACH,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE;QACL,+DAA+D;QAC/D,IAAI,EAAE,aAAa,CAAC;QACpB,wEAAwE;QACxE,OAAO,EAAE,MAAM,CAAC;QAChB,0DAA0D;QAC1D,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,4FAA4F;QAC5F,SAAS,EAAE,OAAO,CAAC;KACpB,CAAC;CACH;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,IAAI,EAAE;IAClC,MAAM,EAAE,CAAC,CAAC;IACV,WAAW,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAC9C,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;CACpB,GAAG,UAAU,CAAC,CAAC,CAAC,CAQhB;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE;IAC9B,IAAI,EAAE,aAAa,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,GAAG,SAAS,CASZ"}
package/dist/envelope.js DELETED
@@ -1,34 +0,0 @@
1
- /**
2
- * Result + Error envelopes per ADR-0039 § 3 and § 4.
3
- *
4
- * Every tool returns a `ToolResult<T>` on success or a `ToolError` on failure.
5
- * The envelope shape is invariant across all tools — only the `result` payload
6
- * type varies. Provenance (engineVersion, methodology, calculatedAt) is
7
- * non-negotiable.
8
- */
9
- /**
10
- * Build a ToolResult envelope around a successful payload. Helper to keep tools terse.
11
- */
12
- export function makeResult(args) {
13
- return {
14
- result: args.result,
15
- disclaimer: args.disclaimer,
16
- methodology: args.methodology,
17
- calculatedAt: new Date().toISOString(),
18
- engineVersion: args.engineVersion,
19
- };
20
- }
21
- /**
22
- * Build a ToolError envelope for a failure path. Helper for terse call sites.
23
- */
24
- export function makeError(args) {
25
- return {
26
- error: {
27
- code: args.code,
28
- message: args.message,
29
- field: args.field,
30
- retriable: args.retriable ?? args.code === "RATE_LIMIT",
31
- },
32
- };
33
- }
34
- //# sourceMappingURL=envelope.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"envelope.js","sourceRoot":"","sources":["../src/envelope.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAuDH;;GAEG;AACH,MAAM,UAAU,UAAU,CAAI,IAK7B;IACC,OAAO;QACL,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,YAAY,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACtC,aAAa,EAAE,IAAI,CAAC,aAAa;KAClC,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,IAKzB;IACC,OAAO;QACL,KAAK,EAAE;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,SAAS,EAAE,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,IAAI,KAAK,YAAY;SACxD;KACF,CAAC;AACJ,CAAC"}
@@ -1,133 +0,0 @@
1
- /**
2
- * Numeric bounds shared between Zod schemas and engines.
3
- *
4
- * Per ADR-0039 § 2: "Bounds match the constants already defined in the source
5
- * calculator JS (e.g., MAX_HOME_PRICE = 100000000 from mortgage-calculator.js).
6
- * Bounds are imported from a shared bounds.ts module so engine and schema cannot drift."
7
- *
8
- * If the site calculator constants change, update both surfaces in lockstep.
9
- */
10
- export declare const MORTGAGE_BOUNDS: {
11
- readonly MIN_PRINCIPAL: 0;
12
- readonly MAX_PRINCIPAL: 100000000;
13
- readonly MIN_RATE_PERCENT: 0;
14
- readonly MAX_RATE_PERCENT: 30;
15
- readonly MIN_TERM_YEARS: 1;
16
- readonly MAX_TERM_YEARS: 50;
17
- };
18
- export declare const COMPOUND_INTEREST_BOUNDS: {
19
- readonly MIN_PRINCIPAL: 0;
20
- readonly MAX_PRINCIPAL: 100000000;
21
- readonly MIN_RATE_PERCENT: 0;
22
- readonly MAX_RATE_PERCENT: 50;
23
- readonly MIN_YEARS: 0;
24
- readonly MAX_YEARS: 100;
25
- readonly MIN_MONTHLY_CONTRIBUTION: 0;
26
- readonly MAX_MONTHLY_CONTRIBUTION: 1000000;
27
- };
28
- /**
29
- * Allowed compounding-frequency labels and their per-year period counts.
30
- * Matches the site calculator's compoundFrequency input options.
31
- */
32
- export declare const COMPOUNDING_FREQUENCY: Record<"annually" | "semiannually" | "quarterly" | "monthly" | "daily", number>;
33
- export type CompoundingFrequencyLabel = keyof typeof COMPOUNDING_FREQUENCY;
34
- export declare const RETIREMENT_401K_BOUNDS: {
35
- readonly MIN_CURRENT_BALANCE: 0;
36
- readonly MAX_CURRENT_BALANCE: 100000000;
37
- readonly MIN_ANNUAL_SALARY: 0;
38
- readonly MAX_ANNUAL_SALARY: 100000000;
39
- readonly MIN_CONTRIBUTION_PERCENT: 0;
40
- readonly MAX_CONTRIBUTION_PERCENT: 100;
41
- readonly MIN_EMPLOYER_MATCH_PERCENT: 0;
42
- readonly MAX_EMPLOYER_MATCH_PERCENT: 100;
43
- readonly MIN_EMPLOYER_MATCH_LIMIT_PERCENT: 0;
44
- readonly MAX_EMPLOYER_MATCH_LIMIT_PERCENT: 100;
45
- readonly MIN_SALARY_GROWTH_PERCENT: 0;
46
- readonly MAX_SALARY_GROWTH_PERCENT: 20;
47
- readonly MIN_RETURN_PERCENT: 0;
48
- readonly MAX_RETURN_PERCENT: 20;
49
- readonly MIN_AGE: 18;
50
- readonly MAX_AGE: 100;
51
- };
52
- export declare const SOCIAL_SECURITY_BOUNDS: {
53
- readonly MIN_BIRTH_YEAR: 1943;
54
- readonly MAX_BIRTH_YEAR: 2004;
55
- readonly MIN_CURRENT_EARNINGS: 0;
56
- readonly MAX_CURRENT_EARNINGS: 1000000;
57
- readonly MIN_CLAIM_AGE: 62;
58
- readonly MAX_CLAIM_AGE: 70;
59
- readonly MIN_LIFE_EXPECTANCY: 62;
60
- readonly MAX_LIFE_EXPECTANCY: 120;
61
- readonly MIN_YEARS_WORKED: 0;
62
- readonly MAX_YEARS_WORKED: 50;
63
- };
64
- export declare const PAYCHECK_BOUNDS: {
65
- readonly MIN_GROSS_ANNUAL_SALARY: 0;
66
- readonly MAX_GROSS_ANNUAL_SALARY: 10000000;
67
- readonly MIN_DEPENDENTS: 0;
68
- readonly MAX_DEPENDENTS: 20;
69
- readonly MIN_PRETAX_DEDUCTIONS: 0;
70
- readonly MAX_PRETAX_DEDUCTIONS: 1000000;
71
- readonly MIN_POSTTAX_DEDUCTIONS: 0;
72
- readonly MAX_POSTTAX_DEDUCTIONS: 1000000;
73
- };
74
- /**
75
- * Allowed paycheck pay-frequency labels. Mirrors site PAY_PERIODS keys
76
- * (excluding hourly, which is computed differently and out of scope for v1).
77
- */
78
- export declare const PAYCHECK_PAY_FREQUENCY: Record<"weekly" | "biweekly" | "semimonthly" | "monthly" | "quarterly" | "annual", number>;
79
- export type PaycheckPayFrequencyLabel = keyof typeof PAYCHECK_PAY_FREQUENCY;
80
- /** Federal filing-status enum (camelCase, matches paycheck engine). */
81
- export declare const FEDERAL_FILING_STATUS: readonly ["single", "married", "marriedSeparate", "headOfHousehold"];
82
- export type FederalFilingStatusLabel = (typeof FEDERAL_FILING_STATUS)[number];
83
- export declare const IRA_BOUNDS: {
84
- readonly MIN_AGE: 18;
85
- readonly MAX_AGE: 100;
86
- readonly MIN_MAGI: 0;
87
- readonly MAX_MAGI: 10000000;
88
- };
89
- /**
90
- * Allowed IRA filing-status labels. Mirrors the engine's `IraFilingStatus`.
91
- * Camelcase keys match the rest of the MCP package's filing-status convention
92
- * (paycheck engine, federal-tax data).
93
- */
94
- export declare const IRA_FILING_STATUS: readonly ["single", "marriedFilingJointly", "marriedFilingSeparately", "headOfHousehold"];
95
- export type IraFilingStatusLabel = (typeof IRA_FILING_STATUS)[number];
96
- /** Allowed IRA types — drives Roth vs Traditional phase-out semantics. */
97
- export declare const IRA_TYPES: readonly ["traditional", "roth"];
98
- export type IraTypeLabel = (typeof IRA_TYPES)[number];
99
- export declare const ROTH_CONVERSION_BOUNDS: {
100
- readonly MIN_CONVERSION: 0;
101
- readonly MAX_CONVERSION: 10000000;
102
- readonly MIN_AGE: 18;
103
- readonly MAX_AGE: 100;
104
- readonly MIN_TAXABLE_INCOME: 0;
105
- readonly MAX_TAXABLE_INCOME: 10000000;
106
- readonly MIN_RETIREMENT_RATE_PERCENT: 0;
107
- readonly MAX_RETIREMENT_RATE_PERCENT: 50;
108
- readonly MIN_RETURN_PERCENT: 0;
109
- readonly MAX_RETURN_PERCENT: 20;
110
- };
111
- export declare const RMD_BOUNDS: {
112
- readonly MIN_OWNER_AGE: 73;
113
- readonly MAX_OWNER_AGE: 120;
114
- readonly MIN_BALANCE: 0;
115
- readonly MAX_BALANCE: 100000000;
116
- };
117
- export declare const HSA_BOUNDS: {
118
- readonly MIN_AGE: 18;
119
- readonly MAX_AGE: 100;
120
- readonly MIN_EMPLOYER_CONTRIBUTION: 0;
121
- readonly MAX_EMPLOYER_CONTRIBUTION: 50000;
122
- readonly MIN_MARGINAL_RATE_PERCENT: 0;
123
- readonly MAX_MARGINAL_RATE_PERCENT: 50;
124
- };
125
- /**
126
- * Allowed HSA coverage-tier labels. Mirrors the site calc's `coverageType`
127
- * values (`'individual'` and `'family'`) but uses the IRS-canonical name
128
- * `'self-only'` for the individual tier (matches IRS Rev. Proc. 2025-19
129
- * language). Tool callers using the site spelling can map at the boundary.
130
- */
131
- export declare const HSA_COVERAGE_TIER: readonly ["self-only", "family"];
132
- export type HsaCoverageTierLabel = (typeof HSA_COVERAGE_TIER)[number];
133
- //# sourceMappingURL=bounds.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bounds.d.ts","sourceRoot":"","sources":["../../src/shared/bounds.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,eAAO,MAAM,eAAe;;;;;;;CAOlB,CAAC;AAKX,eAAO,MAAM,wBAAwB;;;;;;;;;CAS3B,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,MAAM,CACxC,UAAU,GAAG,cAAc,GAAG,WAAW,GAAG,SAAS,GAAG,OAAO,EAC/D,MAAM,CAOP,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,MAAM,OAAO,qBAAqB,CAAC;AAQ3E,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;CAiBzB,CAAC;AASX,eAAO,MAAM,sBAAsB;;;;;;;;;;;CAWzB,CAAC;AAMX,eAAO,MAAM,eAAe;;;;;;;;;CASlB,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,sBAAsB,EAAE,MAAM,CACzC,QAAQ,GAAG,UAAU,GAAG,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,EAC1E,MAAM,CAQP,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,MAAM,OAAO,sBAAsB,CAAC;AAE5E,uEAAuE;AACvE,eAAO,MAAM,qBAAqB,sEAKxB,CAAC;AAEX,MAAM,MAAM,wBAAwB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AAS9E,eAAO,MAAM,UAAU;;;;;CAKb,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,2FAKpB,CAAC;AAEX,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEtE,0EAA0E;AAC1E,eAAO,MAAM,SAAS,kCAAmC,CAAC;AAC1D,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;AAQtD,eAAO,MAAM,sBAAsB;;;;;;;;;;;CAazB,CAAC;AAYX,eAAO,MAAM,UAAU;;;;;CAKb,CAAC;AAUX,eAAO,MAAM,UAAU;;;;;;;CAOb,CAAC;AAEX;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,kCAAmC,CAAC;AAClE,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC"}
@@ -1,206 +0,0 @@
1
- /**
2
- * Numeric bounds shared between Zod schemas and engines.
3
- *
4
- * Per ADR-0039 § 2: "Bounds match the constants already defined in the source
5
- * calculator JS (e.g., MAX_HOME_PRICE = 100000000 from mortgage-calculator.js).
6
- * Bounds are imported from a shared bounds.ts module so engine and schema cannot drift."
7
- *
8
- * If the site calculator constants change, update both surfaces in lockstep.
9
- */
10
- // -----------------------------------------------------------------------------
11
- // Mortgage calculator bounds
12
- // -----------------------------------------------------------------------------
13
- export const MORTGAGE_BOUNDS = {
14
- MIN_PRINCIPAL: 0,
15
- MAX_PRINCIPAL: 100_000_000,
16
- MIN_RATE_PERCENT: 0,
17
- MAX_RATE_PERCENT: 30,
18
- MIN_TERM_YEARS: 1,
19
- MAX_TERM_YEARS: 50,
20
- };
21
- // -----------------------------------------------------------------------------
22
- // Compound-interest calculator bounds
23
- // -----------------------------------------------------------------------------
24
- export const COMPOUND_INTEREST_BOUNDS = {
25
- MIN_PRINCIPAL: 0,
26
- MAX_PRINCIPAL: 100_000_000,
27
- MIN_RATE_PERCENT: 0,
28
- MAX_RATE_PERCENT: 50,
29
- MIN_YEARS: 0,
30
- MAX_YEARS: 100,
31
- MIN_MONTHLY_CONTRIBUTION: 0,
32
- MAX_MONTHLY_CONTRIBUTION: 1_000_000,
33
- };
34
- /**
35
- * Allowed compounding-frequency labels and their per-year period counts.
36
- * Matches the site calculator's compoundFrequency input options.
37
- */
38
- export const COMPOUNDING_FREQUENCY = {
39
- annually: 1,
40
- semiannually: 2,
41
- quarterly: 4,
42
- monthly: 12,
43
- daily: 365,
44
- };
45
- // -----------------------------------------------------------------------------
46
- // 401(k) projection bounds (S136)
47
- // -----------------------------------------------------------------------------
48
- // Mirrors the site 401k calculator's form ranges (see formFields config in
49
- // site/src/pages/401k-retirement-calculator/401k-retirement-calculator.js).
50
- // `MAX_RETURN_PERCENT` matches MAX_EXPECTED_RETURN constant in that file.
51
- export const RETIREMENT_401K_BOUNDS = {
52
- MIN_CURRENT_BALANCE: 0,
53
- MAX_CURRENT_BALANCE: 100_000_000,
54
- MIN_ANNUAL_SALARY: 0,
55
- MAX_ANNUAL_SALARY: 100_000_000,
56
- MIN_CONTRIBUTION_PERCENT: 0,
57
- MAX_CONTRIBUTION_PERCENT: 100,
58
- MIN_EMPLOYER_MATCH_PERCENT: 0,
59
- MAX_EMPLOYER_MATCH_PERCENT: 100,
60
- MIN_EMPLOYER_MATCH_LIMIT_PERCENT: 0,
61
- MAX_EMPLOYER_MATCH_LIMIT_PERCENT: 100,
62
- MIN_SALARY_GROWTH_PERCENT: 0,
63
- MAX_SALARY_GROWTH_PERCENT: 20,
64
- MIN_RETURN_PERCENT: 0,
65
- MAX_RETURN_PERCENT: 20,
66
- MIN_AGE: 18,
67
- MAX_AGE: 100,
68
- };
69
- // -----------------------------------------------------------------------------
70
- // Social Security estimate bounds (S136)
71
- // -----------------------------------------------------------------------------
72
- // Mirrors site/src/pages/social-security-calculator form ranges.
73
- // Birth year range matches site min/max (1943..2004) — anyone outside that
74
- // range can't realistically use 2014+ bend points or hasn't been born yet.
75
- // Claim age 62-70 is the SSA-allowed claiming window.
76
- export const SOCIAL_SECURITY_BOUNDS = {
77
- MIN_BIRTH_YEAR: 1943,
78
- MAX_BIRTH_YEAR: 2004,
79
- MIN_CURRENT_EARNINGS: 0,
80
- MAX_CURRENT_EARNINGS: 1_000_000,
81
- MIN_CLAIM_AGE: 62,
82
- MAX_CLAIM_AGE: 70,
83
- MIN_LIFE_EXPECTANCY: 62,
84
- MAX_LIFE_EXPECTANCY: 120,
85
- MIN_YEARS_WORKED: 0,
86
- MAX_YEARS_WORKED: 50,
87
- };
88
- // -----------------------------------------------------------------------------
89
- // Paycheck net-pay bounds (S136)
90
- // -----------------------------------------------------------------------------
91
- // Mirrors site/src/pages/paycheck-calculator form ranges + IRS reasonable caps.
92
- export const PAYCHECK_BOUNDS = {
93
- MIN_GROSS_ANNUAL_SALARY: 0,
94
- MAX_GROSS_ANNUAL_SALARY: 10_000_000,
95
- MIN_DEPENDENTS: 0,
96
- MAX_DEPENDENTS: 20,
97
- MIN_PRETAX_DEDUCTIONS: 0,
98
- MAX_PRETAX_DEDUCTIONS: 1_000_000,
99
- MIN_POSTTAX_DEDUCTIONS: 0,
100
- MAX_POSTTAX_DEDUCTIONS: 1_000_000,
101
- };
102
- /**
103
- * Allowed paycheck pay-frequency labels. Mirrors site PAY_PERIODS keys
104
- * (excluding hourly, which is computed differently and out of scope for v1).
105
- */
106
- export const PAYCHECK_PAY_FREQUENCY = {
107
- weekly: 52,
108
- biweekly: 26,
109
- semimonthly: 24,
110
- monthly: 12,
111
- quarterly: 4,
112
- annual: 1,
113
- };
114
- /** Federal filing-status enum (camelCase, matches paycheck engine). */
115
- export const FEDERAL_FILING_STATUS = [
116
- "single",
117
- "married",
118
- "marriedSeparate",
119
- "headOfHousehold",
120
- ];
121
- // -----------------------------------------------------------------------------
122
- // IRA contribution-limit bounds (S141 Wave 1A)
123
- // -----------------------------------------------------------------------------
124
- // Mirrors site/src/pages/ira-calculator form ranges + IRS plausibility caps.
125
- // MAX_MAGI = $10M caps obvious absurd inputs while leaving room for actual
126
- // high-earner Roth phase-out math (Roth single phase-out ends $168k 2026;
127
- // MFJ ends $252k; cap of $10M leaves the curve well-defined either side).
128
- export const IRA_BOUNDS = {
129
- MIN_AGE: 18,
130
- MAX_AGE: 100,
131
- MIN_MAGI: 0,
132
- MAX_MAGI: 10_000_000,
133
- };
134
- /**
135
- * Allowed IRA filing-status labels. Mirrors the engine's `IraFilingStatus`.
136
- * Camelcase keys match the rest of the MCP package's filing-status convention
137
- * (paycheck engine, federal-tax data).
138
- */
139
- export const IRA_FILING_STATUS = [
140
- "single",
141
- "marriedFilingJointly",
142
- "marriedFilingSeparately",
143
- "headOfHousehold",
144
- ];
145
- /** Allowed IRA types — drives Roth vs Traditional phase-out semantics. */
146
- export const IRA_TYPES = ["traditional", "roth"];
147
- // -----------------------------------------------------------------------------
148
- // Roth Conversion bounds (S141 Wave 1A)
149
- // -----------------------------------------------------------------------------
150
- // Mirrors site/src/pages/roth-conversion-calculator VALIDATION ranges.
151
- // MIN_AGE=18 (legal IRA owner), MAX_AGE=100 (sanity cap), MAX_CONVERSION=$10M
152
- // (per site MAX_BALANCE), MAX_TAXABLE_INCOME=$10M (same cap rationale).
153
- export const ROTH_CONVERSION_BOUNDS = {
154
- MIN_CONVERSION: 0,
155
- MAX_CONVERSION: 10_000_000,
156
- MIN_AGE: 18,
157
- MAX_AGE: 100,
158
- MIN_TAXABLE_INCOME: 0,
159
- MAX_TAXABLE_INCOME: 10_000_000,
160
- MIN_RETIREMENT_RATE_PERCENT: 0,
161
- // Top federal bracket is 37%; cap at 50% leaves headroom for SECURE-2.0+
162
- // policy moves without re-bounding.
163
- MAX_RETIREMENT_RATE_PERCENT: 50,
164
- MIN_RETURN_PERCENT: 0,
165
- MAX_RETURN_PERCENT: 20,
166
- };
167
- // -----------------------------------------------------------------------------
168
- // RMD (Required Minimum Distribution) bounds (S141 Wave 1B)
169
- // -----------------------------------------------------------------------------
170
- // Owner age floor 73 matches SECURE 2.0 RMD age for the 1951-1959 birth-year
171
- // cohort (the common case for clients querying this tool in 2026). The site
172
- // rmd-engine.js allows 70.5 (legacy pre-1951 cohort) but tool callers asking
173
- // for an RMD before age 73 are almost certainly making an error; INPUT_VALIDATION
174
- // is the safer default. Max age 120 matches Uniform Lifetime Table upper bound.
175
- // MAX_BALANCE $100M caps obvious absurd inputs while leaving headroom for
176
- // ultra-high-balance IRAs (Roth conversion litigation cases, etc.).
177
- export const RMD_BOUNDS = {
178
- MIN_OWNER_AGE: 73,
179
- MAX_OWNER_AGE: 120,
180
- MIN_BALANCE: 0,
181
- MAX_BALANCE: 100_000_000,
182
- };
183
- // -----------------------------------------------------------------------------
184
- // HSA (Health Savings Account) bounds (S141 Wave 1B)
185
- // -----------------------------------------------------------------------------
186
- // MIN_AGE 18 is the legal-adult floor for HDHP enrollment; MAX_AGE 100 is a
187
- // sanity cap. MAX_EMPLOYER_CONTRIBUTION matches the family + catch-up limit
188
- // ($9,750) — a single employer contribution exceeding that is implausible but
189
- // gracefully clamped by the engine via Math.max(0, ...). MAX_MARGINAL_RATE 50%
190
- // matches the Roth Conversion ceiling rationale.
191
- export const HSA_BOUNDS = {
192
- MIN_AGE: 18,
193
- MAX_AGE: 100,
194
- MIN_EMPLOYER_CONTRIBUTION: 0,
195
- MAX_EMPLOYER_CONTRIBUTION: 50_000,
196
- MIN_MARGINAL_RATE_PERCENT: 0,
197
- MAX_MARGINAL_RATE_PERCENT: 50,
198
- };
199
- /**
200
- * Allowed HSA coverage-tier labels. Mirrors the site calc's `coverageType`
201
- * values (`'individual'` and `'family'`) but uses the IRS-canonical name
202
- * `'self-only'` for the individual tier (matches IRS Rev. Proc. 2025-19
203
- * language). Tool callers using the site spelling can map at the boundary.
204
- */
205
- export const HSA_COVERAGE_TIER = ["self-only", "family"];
206
- //# sourceMappingURL=bounds.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bounds.js","sourceRoot":"","sources":["../../src/shared/bounds.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,gFAAgF;AAChF,6BAA6B;AAC7B,gFAAgF;AAChF,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,aAAa,EAAE,CAAC;IAChB,aAAa,EAAE,WAAW;IAC1B,gBAAgB,EAAE,CAAC;IACnB,gBAAgB,EAAE,EAAE;IACpB,cAAc,EAAE,CAAC;IACjB,cAAc,EAAE,EAAE;CACV,CAAC;AAEX,gFAAgF;AAChF,sCAAsC;AACtC,gFAAgF;AAChF,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,aAAa,EAAE,CAAC;IAChB,aAAa,EAAE,WAAW;IAC1B,gBAAgB,EAAE,CAAC;IACnB,gBAAgB,EAAE,EAAE;IACpB,SAAS,EAAE,CAAC;IACZ,SAAS,EAAE,GAAG;IACd,wBAAwB,EAAE,CAAC;IAC3B,wBAAwB,EAAE,SAAS;CAC3B,CAAC;AAEX;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAG9B;IACF,QAAQ,EAAE,CAAC;IACX,YAAY,EAAE,CAAC;IACf,SAAS,EAAE,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AAoC;IACpC,2BAA2B,EAAE,EAAE;IAC/B,kBAAkB,EAAE,CAAC;IACrB,kBAAkB,EAAE,EAAE;CACd,CAAC;AAEX,gFAAgF;AAChF,4DAA4D;AAC5D,gFAAgF;AAChF,6EAA6E;AAC7E,4EAA4E;AAC5E,6EAA6E;AAC7E,kFAAkF;AAClF,gFAAgF;AAChF,0EAA0E;AAC1E,oEAAoE;AACpE,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,aAAa,EAAE,EAAE;IACjB,aAAa,EAAE,GAAG;IAClB,WAAW,EAAE,CAAC;IACd,WAAW,EAAE,WAAW;CAChB,CAAC;AAEX,gFAAgF;AAChF,qDAAqD;AACrD,gFAAgF;AAChF,4EAA4E;AAC5E,4EAA4E;AAC5E,8EAA8E;AAC9E,+EAA+E;AAC/E,iDAAiD;AACjD,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,OAAO,EAAE,EAAE;IACX,OAAO,EAAE,GAAG;IACZ,yBAAyB,EAAE,CAAC;IAC5B,yBAAyB,EAAE,MAAM;IACjC,yBAAyB,EAAE,CAAC;IAC5B,yBAAyB,EAAE,EAAE;CACrB,CAAC;AAEX;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,WAAW,EAAE,QAAQ,CAAU,CAAC"}
@@ -1,48 +0,0 @@
1
- /**
2
- * MCP tool wrapper for `dc.calculator.compoundInterest.futureValue`.
3
- *
4
- * Per ADR-0039 § 1: tool name locked.
5
- * Per ADR-0039 § 2: Zod input with bounds from shared/bounds.ts; rate as Percent.
6
- * Per ADR-0039 § 3: returns ToolResult<CompoundInterestFutureValueResult>.
7
- * Per ADR-0039 § 4: errors funnel through ToolError.
8
- */
9
- import { z } from "zod";
10
- import { type CompoundInterestFutureValueResult } from "../engines/compoundInterest.js";
11
- import { type ToolResult, type ToolError } from "../envelope.js";
12
- /** Locked tool name per ADR-0039 § 1. */
13
- export declare const TOOL_NAME = "dc.calculator.compoundInterest.futureValue";
14
- /**
15
- * Zod input schema. `compoundingFrequency` is an enum of the supported labels.
16
- */
17
- export declare const CompoundInterestFutureValueInputSchema: z.ZodObject<{
18
- principal: z.ZodNumber;
19
- annualRatePercent: z.ZodNumber;
20
- years: z.ZodNumber;
21
- compoundingFrequency: z.ZodEnum<["annually" | "semiannually" | "quarterly" | "monthly" | "daily", ...("annually" | "semiannually" | "quarterly" | "monthly" | "daily")[]]>;
22
- monthlyContribution: z.ZodOptional<z.ZodNumber>;
23
- }, "strip", z.ZodTypeAny, {
24
- principal: number;
25
- annualRatePercent: number;
26
- years: number;
27
- compoundingFrequency: "annually" | "semiannually" | "quarterly" | "monthly" | "daily";
28
- monthlyContribution?: number | undefined;
29
- }, {
30
- principal: number;
31
- annualRatePercent: number;
32
- years: number;
33
- compoundingFrequency: "annually" | "semiannually" | "quarterly" | "monthly" | "daily";
34
- monthlyContribution?: number | undefined;
35
- }>;
36
- export type CompoundInterestFutureValueToolInput = z.infer<typeof CompoundInterestFutureValueInputSchema>;
37
- export declare const TOOL_DESCRIPTION: string;
38
- /**
39
- * Execute the tool. Tagged-union return; SDK adapter maps to MCP isError.
40
- */
41
- export declare function execute(rawInput: unknown): {
42
- ok: true;
43
- value: ToolResult<CompoundInterestFutureValueResult>;
44
- } | {
45
- ok: false;
46
- error: ToolError;
47
- };
48
- //# sourceMappingURL=compoundInterest.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"compoundInterest.d.ts","sourceRoot":"","sources":["../../src/tools/compoundInterest.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAGL,KAAK,iCAAiC,EACvC,MAAM,gCAAgC,CAAC;AAMxC,OAAO,EAGL,KAAK,UAAU,EACf,KAAK,SAAS,EACf,MAAM,gBAAgB,CAAC;AAExB,yCAAyC;AACzC,eAAO,MAAM,SAAS,+CAA+C,CAAC;AAYtE;;GAEG;AACH,eAAO,MAAM,sCAAsC;;;;;;;;;;;;;;;;;;EA2BjD,CAAC;AAEH,MAAM,MAAM,oCAAoC,GAAG,CAAC,CAAC,KAAK,CACxD,OAAO,sCAAsC,CAC9C,CAAC;AAEF,eAAO,MAAM,gBAAgB,QAGyD,CAAC;AAEvF;;GAEG;AACH,wBAAgB,OAAO,CACrB,QAAQ,EAAE,OAAO,GAEf;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,UAAU,CAAC,iCAAiC,CAAC,CAAA;CAAE,GAClE;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,SAAS,CAAA;CAAE,CAuDlC"}
@@ -1,107 +0,0 @@
1
- /**
2
- * MCP tool wrapper for `dc.calculator.compoundInterest.futureValue`.
3
- *
4
- * Per ADR-0039 § 1: tool name locked.
5
- * Per ADR-0039 § 2: Zod input with bounds from shared/bounds.ts; rate as Percent.
6
- * Per ADR-0039 § 3: returns ToolResult<CompoundInterestFutureValueResult>.
7
- * Per ADR-0039 § 4: errors funnel through ToolError.
8
- */
9
- import { z } from "zod";
10
- import { futureValue, ENGINE_VERSION, } from "../engines/compoundInterest.js";
11
- import { COMPOUND_INTEREST_BOUNDS, COMPOUNDING_FREQUENCY, } from "../shared/bounds.js";
12
- import { YMYL_DISCLAIMER } from "../disclaimers/ymyl.js";
13
- import { makeResult, makeError, } from "../envelope.js";
14
- /** Locked tool name per ADR-0039 § 1. */
15
- export const TOOL_NAME = "dc.calculator.compoundInterest.futureValue";
16
- const METHODOLOGY = {
17
- url: "https://www.digitalcalculator.info/compound-interest-calculator/",
18
- version: "2026-05-09",
19
- };
20
- const FREQUENCY_LABELS = Object.keys(COMPOUNDING_FREQUENCY);
21
- /**
22
- * Zod input schema. `compoundingFrequency` is an enum of the supported labels.
23
- */
24
- export const CompoundInterestFutureValueInputSchema = z.object({
25
- principal: z
26
- .number()
27
- .min(COMPOUND_INTEREST_BOUNDS.MIN_PRINCIPAL)
28
- .max(COMPOUND_INTEREST_BOUNDS.MAX_PRINCIPAL)
29
- .describe("Initial principal in USD."),
30
- annualRatePercent: z
31
- .number()
32
- .min(COMPOUND_INTEREST_BOUNDS.MIN_RATE_PERCENT)
33
- .max(COMPOUND_INTEREST_BOUNDS.MAX_RATE_PERCENT)
34
- .describe("Annual interest rate as whole-number percent (e.g., 7 for 7%)."),
35
- years: z
36
- .number()
37
- .min(COMPOUND_INTEREST_BOUNDS.MIN_YEARS)
38
- .max(COMPOUND_INTEREST_BOUNDS.MAX_YEARS)
39
- .describe("Investment period in years."),
40
- compoundingFrequency: z
41
- .enum(FREQUENCY_LABELS)
42
- .describe("How often interest compounds: annually | semiannually | quarterly | monthly | daily."),
43
- monthlyContribution: z
44
- .number()
45
- .min(COMPOUND_INTEREST_BOUNDS.MIN_MONTHLY_CONTRIBUTION)
46
- .max(COMPOUND_INTEREST_BOUNDS.MAX_MONTHLY_CONTRIBUTION)
47
- .optional()
48
- .describe("Optional monthly contribution in USD. Defaults to 0."),
49
- });
50
- export const TOOL_DESCRIPTION = "Project the future value of an initial principal with optional regular monthly " +
51
- "contributions, compounding at the chosen frequency. Inputs are in USD; rate is a " +
52
- "whole-number percent. Returns { futureValue, totalContributions, interestEarned }.";
53
- /**
54
- * Execute the tool. Tagged-union return; SDK adapter maps to MCP isError.
55
- */
56
- export function execute(rawInput) {
57
- const parsed = CompoundInterestFutureValueInputSchema.safeParse(rawInput);
58
- if (!parsed.success) {
59
- const first = parsed.error.issues[0];
60
- return {
61
- ok: false,
62
- error: makeError({
63
- code: "INPUT_VALIDATION",
64
- message: first?.message ?? "Invalid input.",
65
- field: first?.path.join(".") || undefined,
66
- retriable: false,
67
- }),
68
- };
69
- }
70
- const input = parsed.data;
71
- let payload;
72
- try {
73
- payload = futureValue(input);
74
- }
75
- catch (err) {
76
- return {
77
- ok: false,
78
- error: makeError({
79
- code: "INTERNAL",
80
- message: "Engine error computing compound-interest future value.",
81
- retriable: false,
82
- }),
83
- };
84
- }
85
- if (!Number.isFinite(payload.futureValue) ||
86
- !Number.isFinite(payload.totalContributions) ||
87
- !Number.isFinite(payload.interestEarned)) {
88
- return {
89
- ok: false,
90
- error: makeError({
91
- code: "INTERNAL",
92
- message: "Compound-interest engine produced a non-finite result.",
93
- retriable: false,
94
- }),
95
- };
96
- }
97
- return {
98
- ok: true,
99
- value: makeResult({
100
- result: payload,
101
- methodology: METHODOLOGY,
102
- engineVersion: ENGINE_VERSION,
103
- disclaimer: YMYL_DISCLAIMER,
104
- }),
105
- };
106
- }
107
- //# sourceMappingURL=compoundInterest.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"compoundInterest.js","sourceRoot":"","sources":["../../src/tools/compoundInterest.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,WAAW,EACX,cAAc,GAEf,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,wBAAwB,EACxB,qBAAqB,GACtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EACL,UAAU,EACV,SAAS,GAGV,MAAM,gBAAgB,CAAC;AAExB,yCAAyC;AACzC,MAAM,CAAC,MAAM,SAAS,GAAG,4CAA4C,CAAC;AAEtE,MAAM,WAAW,GAAG;IAClB,GAAG,EAAE,kEAAkE;IACvE,OAAO,EAAE,YAAY;CACtB,CAAC;AAEF,MAAM,gBAAgB,GAAG,MAAM,CAAC,IAAI,CAAC,qBAAqB,CAGzD,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,sCAAsC,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7D,SAAS,EAAE,CAAC;SACT,MAAM,EAAE;SACR,GAAG,CAAC,wBAAwB,CAAC,aAAa,CAAC;SAC3C,GAAG,CAAC,wBAAwB,CAAC,aAAa,CAAC;SAC3C,QAAQ,CAAC,2BAA2B,CAAC;IACxC,iBAAiB,EAAE,CAAC;SACjB,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