@sachfolio/cas-reader 0.0.0-stage → 0.2.0-beta.1
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 +19 -0
- package/LICENSE +71 -0
- package/NOTICE +41 -0
- package/README.md +198 -2
- package/dist/analytics/contract.d.ts +110 -0
- package/dist/analytics/contract.js +79 -0
- package/dist/analytics/eligibility.d.ts +66 -0
- package/dist/analytics/eligibility.js +93 -0
- package/dist/analytics/gains-schema.d.ts +898 -0
- package/dist/analytics/gains-schema.js +170 -0
- package/dist/analytics/gains.d.ts +319 -0
- package/dist/analytics/gains.js +649 -0
- package/dist/analytics/modules.d.ts +33 -0
- package/dist/analytics/modules.js +74 -0
- package/dist/analytics/returns-schema.d.ts +931 -0
- package/dist/analytics/returns-schema.js +152 -0
- package/dist/analytics/returns.d.ts +126 -0
- package/dist/analytics/returns.js +453 -0
- package/dist/analytics/schedule112a.d.ts +77 -0
- package/dist/analytics/schedule112a.js +134 -0
- package/dist/analytics/xirr.d.ts +75 -0
- package/dist/analytics/xirr.js +314 -0
- package/dist/bin/cas.d.ts +2 -0
- package/dist/bin/cas.js +137 -0
- package/dist/checks.d.ts +49 -0
- package/dist/checks.js +227 -0
- package/dist/compat/casparser.d.ts +121 -0
- package/dist/compat/casparser.js +193 -0
- package/dist/detect.d.ts +10 -0
- package/dist/detect.js +69 -0
- package/dist/errors.d.ts +26 -0
- package/dist/errors.js +95 -0
- package/dist/export/csv.d.ts +21 -0
- package/dist/export/csv.js +49 -0
- package/dist/extract/browser.d.ts +17 -0
- package/dist/extract/browser.js +34 -0
- package/dist/extract/budget.d.ts +46 -0
- package/dist/extract/budget.js +88 -0
- package/dist/extract/node.d.ts +11 -0
- package/dist/extract/node.js +31 -0
- package/dist/extract/pdfjs.d.ts +71 -0
- package/dist/extract/pdfjs.js +244 -0
- package/dist/extract/types.d.ts +106 -0
- package/dist/extract/types.js +11 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +26 -0
- package/dist/layout/lines.d.ts +51 -0
- package/dist/layout/lines.js +115 -0
- package/dist/licence/app-licence.d.ts +53 -0
- package/dist/licence/app-licence.js +139 -0
- package/dist/licence/ed25519.d.ts +2 -0
- package/dist/licence/ed25519.js +103 -0
- package/dist/model.d.ts +148 -0
- package/dist/model.js +1 -0
- package/dist/num.d.ts +19 -0
- package/dist/num.js +27 -0
- package/dist/parse.d.ts +4 -0
- package/dist/parse.js +13 -0
- package/dist/parsers/cams/classify.d.ts +25 -0
- package/dist/parsers/cams/classify.js +103 -0
- package/dist/parsers/cams/detailed.d.ts +15 -0
- package/dist/parsers/cams/detailed.js +343 -0
- package/dist/parsers/cams/header.d.ts +47 -0
- package/dist/parsers/cams/header.js +170 -0
- package/dist/parsers/cams/investor.d.ts +28 -0
- package/dist/parsers/cams/investor.js +139 -0
- package/dist/parsers/cams/summary.d.ts +29 -0
- package/dist/parsers/cams/summary.js +413 -0
- package/dist/parsers/cams/table.d.ts +55 -0
- package/dist/parsers/cams/table.js +144 -0
- package/dist/parsers/cams/total.d.ts +17 -0
- package/dist/parsers/cams/total.js +105 -0
- package/dist/parsers/depository/mf.d.ts +22 -0
- package/dist/parsers/depository/mf.js +438 -0
- package/dist/privacy.d.ts +243 -0
- package/dist/privacy.js +256 -0
- package/dist/schema.d.ts +779 -0
- package/dist/schema.js +214 -0
- package/examples/nextjs/app/page.jsx +34 -0
- package/examples/node/server.mjs +45 -0
- package/examples/python/read_cas.py +67 -0
- package/examples/vite/index.html +14 -0
- package/examples/vite/main.js +22 -0
- package/package.json +54 -4
package/dist/checks.js
ADDED
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import { big, halfUlp } from "./num.js";
|
|
2
|
+
/** Rows checked as amount = units × price (rows.purchase_identity). */
|
|
3
|
+
export const PURCHASE_TYPES = new Set(["PURCHASE", "PURCHASE_SIP", "SWITCH_IN", "SWITCH_IN_MERGER", "DIVIDEND_REINVEST"]);
|
|
4
|
+
/**
|
|
5
|
+
* Rows whose units did not come from a purchase in this folio, or whose
|
|
6
|
+
* wording isn't recognised: their history lies outside the statement
|
|
7
|
+
* (PLAN.md §5.4 group 4, docs/SPEC-metrics.md "unexplained lineage").
|
|
8
|
+
*/
|
|
9
|
+
const LINEAGE = {
|
|
10
|
+
GIFT_IN: "gifted units",
|
|
11
|
+
SWITCH_IN_MERGER: "units from a scheme merger",
|
|
12
|
+
SEGREGATION: "units of a segregated portfolio",
|
|
13
|
+
TRANSFER_IN: "units transferred in from another folio or holder",
|
|
14
|
+
BONUS: "bonus units",
|
|
15
|
+
UNIT_ADJUSTMENT: "a unit adjustment",
|
|
16
|
+
UNKNOWN: "a row whose wording isn't recognised",
|
|
17
|
+
};
|
|
18
|
+
// casparser's documented case: a reversed row whose units are printed in cosmetic parentheses.
|
|
19
|
+
const REVERSED_RE = /revers/i;
|
|
20
|
+
/** Bound for |a×b − c| when a, b, c are each rounded to their printed scale. */
|
|
21
|
+
export function productBound(a, b, c) {
|
|
22
|
+
const ea = halfUlp(a);
|
|
23
|
+
const eb = halfUlp(b);
|
|
24
|
+
return big(b).abs().times(ea).plus(big(a).abs().times(eb)).plus(ea.times(eb)).plus(halfUlp(c));
|
|
25
|
+
}
|
|
26
|
+
const fmt = (b, scale = 4) => b.toFixed(scale);
|
|
27
|
+
/**
|
|
28
|
+
* ISIN check digit (ISO 6166): letters become two digits (A=10 … Z=35), then
|
|
29
|
+
* Luhn over the expanded string. Catches a misread character in the ISIN.
|
|
30
|
+
*/
|
|
31
|
+
export function isValidIsin(isin) {
|
|
32
|
+
if (!/^[A-Z]{2}[A-Z0-9]{9}\d$/.test(isin))
|
|
33
|
+
return false;
|
|
34
|
+
const digits = [...isin.slice(0, 11)].map((c) => (/\d/.test(c) ? c : String(c.charCodeAt(0) - 55))).join("");
|
|
35
|
+
let sum = 0;
|
|
36
|
+
for (let i = 0; i < digits.length; i++) {
|
|
37
|
+
let d = Number(digits[digits.length - 1 - i]);
|
|
38
|
+
if (i % 2 === 0) {
|
|
39
|
+
d *= 2;
|
|
40
|
+
if (d > 9)
|
|
41
|
+
d -= 9;
|
|
42
|
+
}
|
|
43
|
+
sum += d;
|
|
44
|
+
}
|
|
45
|
+
return (10 - (sum % 10)) % 10 === Number(isin[11]);
|
|
46
|
+
}
|
|
47
|
+
/** Group 3 validity: the scheme's ISIN, when printed, has a valid check digit. */
|
|
48
|
+
export function isinCheck(scheme) {
|
|
49
|
+
if (!scheme.isin)
|
|
50
|
+
return { id: "identity.isin", status: "unavailable", detail: "No ISIN printed for this scheme" };
|
|
51
|
+
return isValidIsin(scheme.isin)
|
|
52
|
+
? { id: "identity.isin", status: "pass" }
|
|
53
|
+
: { id: "identity.isin", status: "fail", observed: scheme.isin, detail: "ISIN check digit doesn't match; a character may have been misread", source: scheme.source };
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* casparser `_apply_balance_sign_fix`: some templates print a reversed row's
|
|
57
|
+
* units in cosmetic parentheses. When prev − units = printed balance but
|
|
58
|
+
* prev + units ≠ it, the sign is flipped. The printed text stays in `raw`.
|
|
59
|
+
*
|
|
60
|
+
* Narrower than casparser, which flips any row that fits: here the row must
|
|
61
|
+
* be printed negative and say "reversed"/"reversal". Otherwise a dropped row
|
|
62
|
+
* whose units happen to be −2× the next row's is hidden by flipping that row,
|
|
63
|
+
* and both ledger checks then pass by construction. A row that prints a
|
|
64
|
+
* balance without units (unreadable, or a marker row) resyncs the chain
|
|
65
|
+
* instead of being skipped, for the same reason.
|
|
66
|
+
*/
|
|
67
|
+
export function fixSigns(scheme, reclassify) {
|
|
68
|
+
let prev = scheme.open ? big(scheme.open) : null;
|
|
69
|
+
for (const t of scheme.transactions) {
|
|
70
|
+
if (!t.balance || prev === null)
|
|
71
|
+
continue;
|
|
72
|
+
const bal = big(t.balance);
|
|
73
|
+
if (!t.units) {
|
|
74
|
+
prev = bal;
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
const u = big(t.units);
|
|
78
|
+
if (prev.plus(u).eq(bal)) {
|
|
79
|
+
prev = bal;
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
if (prev.minus(u).eq(bal) && /^[(-]/.test(t.units.raw) && REVERSED_RE.test(t.description)) {
|
|
83
|
+
t.units = { ...t.units, value: u.neg().toFixed(t.units.scale) };
|
|
84
|
+
if (t.amount)
|
|
85
|
+
t.amount = { ...t.amount, value: big(t.amount).neg().toFixed(t.amount.scale) };
|
|
86
|
+
t.signCorrected = true;
|
|
87
|
+
reclassify(t);
|
|
88
|
+
}
|
|
89
|
+
prev = bal;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Statement level: the printed portfolio total's market value equals the
|
|
94
|
+
* schemes' printed values added up. Each printed value may be rounded by half
|
|
95
|
+
* a unit in its last place, and so may the total, so the bound is the sum of
|
|
96
|
+
* those half-units; never a percentage. A scheme with units but no printed
|
|
97
|
+
* value makes the sum impossible: "unavailable", never a guess. A
|
|
98
|
+
* zero-balance scheme without a value adds nothing. A scheme the parser
|
|
99
|
+
* couldn't build is missing from the sum, so this check also catches it.
|
|
100
|
+
*/
|
|
101
|
+
export function portfolioTotalCheck(total, schemes) {
|
|
102
|
+
const id = "total.market_value";
|
|
103
|
+
if (!total)
|
|
104
|
+
return { id, status: "unavailable", detail: "No printed portfolio total was found in this statement" };
|
|
105
|
+
const printed = total.marketValue;
|
|
106
|
+
if (!printed)
|
|
107
|
+
return { id, status: "unavailable", detail: "The total row prints no market value we could read", source: total.source };
|
|
108
|
+
const missing = schemes.filter((s) => !s.valuation && !(s.close && big(s.close).eq(0)));
|
|
109
|
+
if (missing.length) {
|
|
110
|
+
return { id, status: "unavailable", detail: `${missing.length} scheme(s) print no market value, so the values can't be added up`, source: total.source };
|
|
111
|
+
}
|
|
112
|
+
const valued = schemes.filter((s) => s.valuation);
|
|
113
|
+
const sum = valued.reduce((acc, s) => acc.plus(big(s.valuation.value)), big(0));
|
|
114
|
+
const bound = valued.reduce((acc, s) => acc.plus(halfUlp(s.valuation.value)), halfUlp(printed));
|
|
115
|
+
const scale = Math.max(printed.scale, ...valued.map((s) => s.valuation.value.scale));
|
|
116
|
+
const ok = sum.minus(big(printed)).abs().lte(bound);
|
|
117
|
+
return {
|
|
118
|
+
id, status: ok ? "pass" : "fail",
|
|
119
|
+
expected: printed.value, observed: sum.toFixed(scale), tolerance: fmt(bound),
|
|
120
|
+
detail: ok
|
|
121
|
+
? `${valued.length} printed scheme values add up to the printed total, within rounding`
|
|
122
|
+
: `${valued.length} printed scheme values don't add up to the printed total; a scheme may be missing or misread`,
|
|
123
|
+
source: total.source,
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
export function checkScheme(scheme, period, options = {}) {
|
|
127
|
+
const checks = [];
|
|
128
|
+
const unitRows = scheme.transactions.filter((t) => t.units);
|
|
129
|
+
// 1. Units ledger: open + Σ units = close, exactly.
|
|
130
|
+
if (scheme.open && scheme.close) {
|
|
131
|
+
const sum = unitRows.reduce((s, t) => s.plus(big(t.units)), big(scheme.open));
|
|
132
|
+
scheme.closeCalculated = sum.toFixed(scheme.close.scale);
|
|
133
|
+
const ok = sum.eq(big(scheme.close));
|
|
134
|
+
checks.push({ id: "ledger.units", status: ok ? "pass" : "fail", expected: scheme.close.value, observed: sum.toFixed(scheme.close.scale), tolerance: "0" });
|
|
135
|
+
}
|
|
136
|
+
else
|
|
137
|
+
checks.push({ id: "ledger.units", status: "unavailable", detail: "Opening or closing unit balance not found" });
|
|
138
|
+
// 2. Running balance chain: prev + units = printed balance on every row.
|
|
139
|
+
// A row that prints a balance but no readable units is compared too, so
|
|
140
|
+
// a lost units cell shows here instead of being skipped.
|
|
141
|
+
const chainRows = scheme.transactions.filter((t) => t.units || t.balance);
|
|
142
|
+
const withBal = chainRows.filter((t) => t.balance);
|
|
143
|
+
if (!scheme.open)
|
|
144
|
+
checks.push({ id: "ledger.running_balance", status: "unavailable", detail: "No opening balance" });
|
|
145
|
+
else if (withBal.length === 0)
|
|
146
|
+
checks.push({ id: "ledger.running_balance", status: "not_applicable", detail: "No rows print a running balance" });
|
|
147
|
+
else {
|
|
148
|
+
let running = big(scheme.open);
|
|
149
|
+
let firstBad = null;
|
|
150
|
+
let bad = 0;
|
|
151
|
+
for (const t of chainRows) {
|
|
152
|
+
if (t.units)
|
|
153
|
+
running = running.plus(big(t.units));
|
|
154
|
+
if (!t.balance)
|
|
155
|
+
continue;
|
|
156
|
+
if (!running.eq(big(t.balance))) {
|
|
157
|
+
bad++;
|
|
158
|
+
firstBad ??= t;
|
|
159
|
+
running = big(t.balance); // resync so one dropped row reports once
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
checks.push(bad === 0
|
|
163
|
+
? { id: "ledger.running_balance", status: "pass", detail: `${withBal.length} printed balances agree` }
|
|
164
|
+
: {
|
|
165
|
+
id: "ledger.running_balance", status: "fail", detail: `${bad} of ${withBal.length} printed balances disagree; a row may be missing or misread`,
|
|
166
|
+
...(firstBad ? { source: firstBad.source, observed: firstBad.balance.value } : {}),
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
// 3. Valuation: close × NAV ≈ value within printed-precision bound.
|
|
170
|
+
if (scheme.close && scheme.nav && scheme.valuation) {
|
|
171
|
+
const product = big(scheme.close).times(big(scheme.nav.value));
|
|
172
|
+
const bound = productBound(scheme.close, scheme.nav.value, scheme.valuation.value);
|
|
173
|
+
const diff = product.minus(big(scheme.valuation.value)).abs();
|
|
174
|
+
const sameDate = scheme.nav.date === scheme.valuation.date;
|
|
175
|
+
checks.push({
|
|
176
|
+
id: "valuation.units_x_nav", status: diff.lte(bound) && sameDate ? "pass" : "fail",
|
|
177
|
+
expected: scheme.valuation.value.value, observed: fmt(product, 2), tolerance: fmt(bound),
|
|
178
|
+
...(scheme.footerSource ? { source: scheme.footerSource } : {}),
|
|
179
|
+
...(sameDate ? {} : { detail: `NAV date ${scheme.nav.date} differs from valuation date ${scheme.valuation.date}` }),
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
else
|
|
183
|
+
checks.push({ id: "valuation.units_x_nav", status: "unavailable", detail: "Closing units, NAV or value not found" });
|
|
184
|
+
// 4. Purchase-type rows: amount = units × price within bound. (M1 evidence:
|
|
185
|
+
// on CAMS and KFin the printed amount is already net of the separate
|
|
186
|
+
// stamp-duty row.) Outflows are informational, not checked: exit load,
|
|
187
|
+
// STT and TDS legitimately make amount differ.
|
|
188
|
+
const buys = scheme.transactions.filter((t) => PURCHASE_TYPES.has(t.type) && t.amount && t.units && t.price && t.price.raw !== "derived");
|
|
189
|
+
const unread = scheme.transactions.filter((t) => PURCHASE_TYPES.has(t.type) && options.unreadable?.has(t));
|
|
190
|
+
if (unread.length) {
|
|
191
|
+
checks.push({ id: "rows.purchase_identity", status: "unavailable", detail: `${unread.length} purchase rows have a cell that couldn't be read`, source: unread[0].source });
|
|
192
|
+
}
|
|
193
|
+
else if (buys.length === 0)
|
|
194
|
+
checks.push({ id: "rows.purchase_identity", status: "not_applicable" });
|
|
195
|
+
else {
|
|
196
|
+
const failed = buys.filter((t) => big(t.units).times(big(t.price)).minus(big(t.amount)).abs().gt(productBound(t.units, t.price, t.amount)));
|
|
197
|
+
checks.push(failed.length === 0
|
|
198
|
+
? { id: "rows.purchase_identity", status: "pass", detail: `${buys.length} rows` }
|
|
199
|
+
: { id: "rows.purchase_identity", status: "fail", detail: `${failed.length} of ${buys.length} purchase rows: amount ≠ units × price`, source: failed[0].source });
|
|
200
|
+
}
|
|
201
|
+
// 5. Dates inside the statement period.
|
|
202
|
+
if (period && scheme.transactions.length) {
|
|
203
|
+
const outside = scheme.transactions.filter((t) => t.date < period.from || t.date > period.to);
|
|
204
|
+
checks.push(outside.length ? { id: "rows.dates_in_period", status: "fail", detail: `${outside.length} rows dated outside ${period.from}…${period.to}`, source: outside[0].source } : { id: "rows.dates_in_period", status: "pass" });
|
|
205
|
+
}
|
|
206
|
+
checks.push(isinCheck(scheme));
|
|
207
|
+
// 6. History completeness: needed for XIRR/gains, not for holdings. A zero
|
|
208
|
+
// opening balance isn't enough: units that arrived by gift, merger or an
|
|
209
|
+
// unrecognised row have a history outside the statement (PLAN.md §5.4
|
|
210
|
+
// group 4, §6.1).
|
|
211
|
+
if (scheme.open) {
|
|
212
|
+
const zero = big(scheme.open).eq(0);
|
|
213
|
+
const lineage = scheme.transactions.find((t) => LINEAGE[t.type]);
|
|
214
|
+
if (!zero) {
|
|
215
|
+
checks.push({ id: "history.complete", status: "fail", detail: "Statement starts mid-history (opening balance > 0); returns and gains need a statement from the first purchase" });
|
|
216
|
+
}
|
|
217
|
+
else if (lineage) {
|
|
218
|
+
checks.push({
|
|
219
|
+
id: "history.complete", status: "fail", source: lineage.source,
|
|
220
|
+
detail: `Statement starts at a zero balance, but holds ${LINEAGE[lineage.type]}, whose history is outside this statement`,
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
else
|
|
224
|
+
checks.push({ id: "history.complete", status: "pass", detail: "Statement starts before the first purchase" });
|
|
225
|
+
}
|
|
226
|
+
return checks;
|
|
227
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import type { CasDocument, TxnType } from "../model.js";
|
|
2
|
+
export type CasparserTxnType = "PURCHASE" | "PURCHASE_SIP" | "REDEMPTION" | "DIVIDEND_PAYOUT" | "DIVIDEND_REINVEST" | "SWITCH_IN" | "SWITCH_IN_MERGER" | "SWITCH_OUT" | "SWITCH_OUT_MERGER" | "STT_TAX" | "STAMP_DUTY_TAX" | "TDS_TAX" | "SEGREGATION" | "GIFT_IN" | "GIFT_OUT" | "MISC" | "UNKNOWN" | "REVERSAL";
|
|
3
|
+
/** Our transaction types → casparser's. Types casparser has no name for become the nearest one. */
|
|
4
|
+
export declare const CASPARSER_TXN_TYPE: Readonly<Record<TxnType, CasparserTxnType>>;
|
|
5
|
+
/** A decimal as an exact string, e.g. "4999.75" (casparser serialises Decimal this way). */
|
|
6
|
+
export type CasparserDecimal = string;
|
|
7
|
+
export interface CasparserTransaction {
|
|
8
|
+
/** ISO date, e.g. "2024-04-01". */
|
|
9
|
+
date: string;
|
|
10
|
+
description: string;
|
|
11
|
+
amount: CasparserDecimal | null;
|
|
12
|
+
units: CasparserDecimal | null;
|
|
13
|
+
nav: CasparserDecimal | null;
|
|
14
|
+
balance: CasparserDecimal | null;
|
|
15
|
+
type: CasparserTxnType;
|
|
16
|
+
dividend_rate: CasparserDecimal | null;
|
|
17
|
+
gift_folio: string | null;
|
|
18
|
+
}
|
|
19
|
+
export interface CasparserScheme {
|
|
20
|
+
scheme: string;
|
|
21
|
+
advisor: string | null;
|
|
22
|
+
rta_code: string;
|
|
23
|
+
rta: string;
|
|
24
|
+
/** casparser fills this from its ISIN database; always null here. */
|
|
25
|
+
type: string | null;
|
|
26
|
+
isin: string | null;
|
|
27
|
+
/** casparser fills this from its ISIN database; always null here. */
|
|
28
|
+
amfi: string | null;
|
|
29
|
+
nominees: string[];
|
|
30
|
+
open: CasparserDecimal;
|
|
31
|
+
close: CasparserDecimal;
|
|
32
|
+
close_calculated: CasparserDecimal;
|
|
33
|
+
valuation: {
|
|
34
|
+
date: string;
|
|
35
|
+
nav: CasparserDecimal;
|
|
36
|
+
cost: CasparserDecimal | null;
|
|
37
|
+
value: CasparserDecimal;
|
|
38
|
+
};
|
|
39
|
+
transactions: CasparserTransaction[];
|
|
40
|
+
}
|
|
41
|
+
export interface CasparserFolio {
|
|
42
|
+
folio: string;
|
|
43
|
+
amc: string;
|
|
44
|
+
name: string | null;
|
|
45
|
+
PAN: string | null;
|
|
46
|
+
KYC: string | null;
|
|
47
|
+
PANKYC: string | null;
|
|
48
|
+
schemes: CasparserScheme[];
|
|
49
|
+
}
|
|
50
|
+
export interface CasparserCasData {
|
|
51
|
+
/** casparser keeps the statement's own "01-Apr-2024" form here. */
|
|
52
|
+
statement_period: {
|
|
53
|
+
from: string;
|
|
54
|
+
to: string;
|
|
55
|
+
};
|
|
56
|
+
file_type: "CAMS" | "KFINTECH";
|
|
57
|
+
cas_type: "DETAILED" | "SUMMARY";
|
|
58
|
+
investor_info: {
|
|
59
|
+
name: string;
|
|
60
|
+
email: string;
|
|
61
|
+
address: string;
|
|
62
|
+
mobile: string;
|
|
63
|
+
};
|
|
64
|
+
folios: CasparserFolio[];
|
|
65
|
+
parse_warnings: string[];
|
|
66
|
+
}
|
|
67
|
+
export interface CasparserOptions {
|
|
68
|
+
/**
|
|
69
|
+
* casparser's `sort_transactions` (default true): when a scheme's rows are not
|
|
70
|
+
* in date order, sort them by date (stable) and recompute the running balance
|
|
71
|
+
* from the opening balance. False keeps the statement's own order and balances.
|
|
72
|
+
*/
|
|
73
|
+
sortTransactions?: boolean;
|
|
74
|
+
}
|
|
75
|
+
/** Reshape a CasDocument into casparser's CAMS/KFintech `CASData` JSON. */
|
|
76
|
+
export declare function toCasparser(doc: CasDocument, options?: CasparserOptions): CasparserCasData;
|
|
77
|
+
/** casparser's `MutualFund` inside an NSDL/CDSL account (casparser types.py, MIT). */
|
|
78
|
+
export interface CasparserDematMutualFund {
|
|
79
|
+
name: string | null;
|
|
80
|
+
isin: string;
|
|
81
|
+
balance: CasparserDecimal;
|
|
82
|
+
nav: CasparserDecimal;
|
|
83
|
+
value: CasparserDecimal;
|
|
84
|
+
total_cost: CasparserDecimal | null;
|
|
85
|
+
folio: string | null;
|
|
86
|
+
}
|
|
87
|
+
export interface CasparserDematAccount {
|
|
88
|
+
name: string;
|
|
89
|
+
type: string;
|
|
90
|
+
dp_id: string;
|
|
91
|
+
client_id: string;
|
|
92
|
+
folios: number;
|
|
93
|
+
/** Sum of the mutual fund values read here; casparser prints the account's roster value, which also counts shares and bonds. */
|
|
94
|
+
balance: CasparserDecimal;
|
|
95
|
+
owners: never[];
|
|
96
|
+
equities: never[];
|
|
97
|
+
mutual_funds: CasparserDematMutualFund[];
|
|
98
|
+
bonds: never[];
|
|
99
|
+
}
|
|
100
|
+
/** casparser's `NSDLCASData` JSON for an NSDL/CDSL statement, mutual funds only. */
|
|
101
|
+
export interface CasparserDematData {
|
|
102
|
+
statement_period: {
|
|
103
|
+
from: string;
|
|
104
|
+
to: string;
|
|
105
|
+
};
|
|
106
|
+
accounts: CasparserDematAccount[];
|
|
107
|
+
investor_info: {
|
|
108
|
+
name: string;
|
|
109
|
+
email: string;
|
|
110
|
+
address: string;
|
|
111
|
+
mobile: string;
|
|
112
|
+
};
|
|
113
|
+
file_type: "NSDL" | "CDSL";
|
|
114
|
+
parse_warnings: string[];
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Reshape an NSDL/CDSL CasDocument into casparser's `NSDLCASData` JSON. Only
|
|
118
|
+
* mutual fund units and ETFs are filled; `equities`, `bonds` and `owners`
|
|
119
|
+
* stay empty because this reader doesn't read them.
|
|
120
|
+
*/
|
|
121
|
+
export declare function toCasparserDemat(doc: CasDocument): CasparserDematData;
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* casparser-compatible output: a CasDocument reshaped into the JSON that the
|
|
3
|
+
* open-source casparser library (MIT, github.com/codereverser/casparser,
|
|
4
|
+
* v1.4) returns for CAMS/KFintech statements (`CASData` with output="json"),
|
|
5
|
+
* so code written against casparser can switch with one line.
|
|
6
|
+
*
|
|
7
|
+
* Same keys, same enums, decimals as exact strings. What casparser fills from
|
|
8
|
+
* its own ISIN database (`amfi`, `type`) is null here. Our extra transaction
|
|
9
|
+
* types fold into casparser's enum (CASPARSER_TXN_TYPE). Failed checks become
|
|
10
|
+
* `parse_warnings`. Sources, checks and coverage are not carried over: read
|
|
11
|
+
* them from the CasDocument itself.
|
|
12
|
+
*
|
|
13
|
+
* Contains the same personal data as the CasDocument (docs/SCHEMA.md): never
|
|
14
|
+
* log it, upload it or put it in a URL.
|
|
15
|
+
*/
|
|
16
|
+
import Big from "big.js";
|
|
17
|
+
import { big } from "../num.js";
|
|
18
|
+
/** Our transaction types → casparser's. Types casparser has no name for become the nearest one. */
|
|
19
|
+
export const CASPARSER_TXN_TYPE = {
|
|
20
|
+
PURCHASE: "PURCHASE",
|
|
21
|
+
PURCHASE_SIP: "PURCHASE_SIP",
|
|
22
|
+
REDEMPTION: "REDEMPTION",
|
|
23
|
+
SWP: "REDEMPTION",
|
|
24
|
+
SWITCH_IN: "SWITCH_IN",
|
|
25
|
+
SWITCH_IN_MERGER: "SWITCH_IN_MERGER",
|
|
26
|
+
SWITCH_OUT: "SWITCH_OUT",
|
|
27
|
+
SWITCH_OUT_MERGER: "SWITCH_OUT_MERGER",
|
|
28
|
+
DIVIDEND_PAYOUT: "DIVIDEND_PAYOUT",
|
|
29
|
+
DIVIDEND_REINVEST: "DIVIDEND_REINVEST",
|
|
30
|
+
SEGREGATION: "SEGREGATION",
|
|
31
|
+
GIFT_IN: "GIFT_IN",
|
|
32
|
+
GIFT_OUT: "GIFT_OUT",
|
|
33
|
+
REVERSAL: "REVERSAL",
|
|
34
|
+
TRANSFER_IN: "MISC",
|
|
35
|
+
TRANSFER_OUT: "MISC",
|
|
36
|
+
BONUS: "MISC",
|
|
37
|
+
UNIT_ADJUSTMENT: "MISC",
|
|
38
|
+
PLEDGE: "MISC",
|
|
39
|
+
PLEDGE_RELEASE: "MISC",
|
|
40
|
+
PLEDGE_INVOKED: "REDEMPTION",
|
|
41
|
+
STAMP_DUTY_TAX: "STAMP_DUTY_TAX",
|
|
42
|
+
STT_TAX: "STT_TAX",
|
|
43
|
+
TDS_TAX: "TDS_TAX",
|
|
44
|
+
MISC: "MISC",
|
|
45
|
+
UNKNOWN: "UNKNOWN",
|
|
46
|
+
};
|
|
47
|
+
const MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
48
|
+
/** "2024-04-01" → "01-Apr-2024". */
|
|
49
|
+
function printedDate(iso) {
|
|
50
|
+
const [y, m, d] = iso.split("-");
|
|
51
|
+
return `${d}-${MONTHS[Number(m) - 1]}-${y}`;
|
|
52
|
+
}
|
|
53
|
+
const dec = (n) => (n ? n.value : null);
|
|
54
|
+
function failures(checks, label) {
|
|
55
|
+
return checks
|
|
56
|
+
.filter((c) => c.status === "fail")
|
|
57
|
+
.map((c) => {
|
|
58
|
+
const numbers = c.expected !== undefined && c.observed !== undefined ? ` (expected ${c.expected}, found ${c.observed})` : "";
|
|
59
|
+
return `${label}: check ${c.id} failed${numbers}`;
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
function transaction(t) {
|
|
63
|
+
return {
|
|
64
|
+
date: t.date,
|
|
65
|
+
description: t.description,
|
|
66
|
+
amount: dec(t.amount),
|
|
67
|
+
units: dec(t.units),
|
|
68
|
+
nav: dec(t.price),
|
|
69
|
+
balance: dec(t.balance),
|
|
70
|
+
type: CASPARSER_TXN_TYPE[t.type],
|
|
71
|
+
dividend_rate: t.dividendRate,
|
|
72
|
+
gift_folio: t.giftFolio,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
/** casparser `_sort_transactions`, with exact decimals. */
|
|
76
|
+
function sortByDate(rows, open) {
|
|
77
|
+
if (rows.every((r, i) => i === 0 || rows[i - 1].date <= r.date))
|
|
78
|
+
return rows;
|
|
79
|
+
const scaleOf = (s) => (s.includes(".") ? s.length - s.indexOf(".") - 1 : 0);
|
|
80
|
+
let balance = big(open);
|
|
81
|
+
let scale = scaleOf(open);
|
|
82
|
+
return [...rows]
|
|
83
|
+
.sort((a, b) => (a.date < b.date ? -1 : a.date > b.date ? 1 : 0))
|
|
84
|
+
.map((r) => {
|
|
85
|
+
if (r.units !== null) {
|
|
86
|
+
balance = balance.plus(r.units);
|
|
87
|
+
scale = Math.max(scale, scaleOf(r.units));
|
|
88
|
+
}
|
|
89
|
+
return { ...r, balance: balance.toFixed(scale) };
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
function scheme(s, fallbackDate, sort) {
|
|
93
|
+
const open = dec(s.open) ?? "0";
|
|
94
|
+
const close = dec(s.close) ?? s.closeCalculated ?? "0";
|
|
95
|
+
const rows = s.transactions.map(transaction);
|
|
96
|
+
return {
|
|
97
|
+
scheme: s.name,
|
|
98
|
+
advisor: s.advisor,
|
|
99
|
+
rta_code: s.rtaCode,
|
|
100
|
+
rta: s.rta,
|
|
101
|
+
type: null,
|
|
102
|
+
isin: s.isin,
|
|
103
|
+
amfi: null,
|
|
104
|
+
nominees: [...s.nominees],
|
|
105
|
+
open,
|
|
106
|
+
close,
|
|
107
|
+
close_calculated: s.closeCalculated ?? close,
|
|
108
|
+
// casparser prints a zero valuation dated at the statement end when none is printed.
|
|
109
|
+
valuation: {
|
|
110
|
+
date: s.valuation?.date ?? s.nav?.date ?? fallbackDate,
|
|
111
|
+
nav: dec(s.nav?.value ?? null) ?? "0",
|
|
112
|
+
cost: dec(s.cost),
|
|
113
|
+
value: dec(s.valuation?.value ?? null) ?? "0",
|
|
114
|
+
},
|
|
115
|
+
transactions: sort ? sortByDate(rows, open) : rows,
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
/** Reshape a CasDocument into casparser's CAMS/KFintech `CASData` JSON. */
|
|
119
|
+
export function toCasparser(doc, options = {}) {
|
|
120
|
+
const { issuer, variant } = doc.source;
|
|
121
|
+
if ((issuer !== "CAMS" && issuer !== "KFINTECH") || (variant !== "DETAILED" && variant !== "SUMMARY")) {
|
|
122
|
+
throw new Error(`casparser-compatible output covers CAMS/KFintech statements only, not ${issuer} ${variant}`);
|
|
123
|
+
}
|
|
124
|
+
const sort = options.sortTransactions ?? true;
|
|
125
|
+
const period = doc.statementPeriod;
|
|
126
|
+
const fallbackDate = period?.to ?? "1970-01-01";
|
|
127
|
+
const warnings = [];
|
|
128
|
+
const folios = doc.folios.map((f) => ({
|
|
129
|
+
folio: f.folio,
|
|
130
|
+
amc: f.amc,
|
|
131
|
+
name: f.holderName,
|
|
132
|
+
PAN: f.pan,
|
|
133
|
+
KYC: f.kyc,
|
|
134
|
+
PANKYC: f.panKyc,
|
|
135
|
+
schemes: f.schemes.map((s) => {
|
|
136
|
+
warnings.push(...failures(s.checks, `'${s.name}' [${s.rtaCode}]`));
|
|
137
|
+
return scheme(s, fallbackDate, sort && variant === "DETAILED");
|
|
138
|
+
}),
|
|
139
|
+
}));
|
|
140
|
+
warnings.push(...failures(doc.checks, "statement"));
|
|
141
|
+
const a = doc.addressee;
|
|
142
|
+
return {
|
|
143
|
+
statement_period: period ? { from: printedDate(period.from), to: printedDate(period.to) } : { from: "", to: "" },
|
|
144
|
+
file_type: issuer,
|
|
145
|
+
cas_type: variant,
|
|
146
|
+
investor_info: { name: a.name ?? "", email: a.email ?? "", address: a.address ?? "", mobile: a.mobile ?? "" },
|
|
147
|
+
folios,
|
|
148
|
+
parse_warnings: warnings,
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Reshape an NSDL/CDSL CasDocument into casparser's `NSDLCASData` JSON. Only
|
|
153
|
+
* mutual fund units and ETFs are filled; `equities`, `bonds` and `owners`
|
|
154
|
+
* stay empty because this reader doesn't read them.
|
|
155
|
+
*/
|
|
156
|
+
export function toCasparserDemat(doc) {
|
|
157
|
+
const { issuer, variant } = doc.source;
|
|
158
|
+
if (variant !== "DEMAT" || (issuer !== "NSDL" && issuer !== "CDSL")) {
|
|
159
|
+
throw new Error(`casparser's depository shape covers NSDL/CDSL statements only, not ${issuer} ${variant}; use toCasparser`);
|
|
160
|
+
}
|
|
161
|
+
const warnings = [];
|
|
162
|
+
const mf = (f, s) => {
|
|
163
|
+
warnings.push(...failures(s.checks, `'${s.name}' [${s.isin ?? ""}]`));
|
|
164
|
+
return { name: s.name, isin: s.isin ?? "", balance: dec(s.close) ?? "0", nav: dec(s.nav?.value ?? null) ?? "0", value: dec(s.valuation?.value ?? null) ?? "0", total_cost: dec(s.cost), folio: s.rta === issuer ? null : f.folio };
|
|
165
|
+
};
|
|
166
|
+
const sum = (list) => list.reduce((acc, m) => acc.plus(m.value), new Big(0)).toFixed(2);
|
|
167
|
+
const accounts = [];
|
|
168
|
+
const folioFunds = [];
|
|
169
|
+
for (const f of doc.folios) {
|
|
170
|
+
// Demat holdings carry the depository as their registrar (parsers/depository/mf.ts).
|
|
171
|
+
if (f.schemes.every((s) => s.rta === issuer)) {
|
|
172
|
+
const [dpId = "", clientId = ""] = f.folio.split("-");
|
|
173
|
+
const funds = f.schemes.map((s) => mf(f, s));
|
|
174
|
+
accounts.push({ name: "", type: `${issuer} Demat Account`, dp_id: dpId, client_id: clientId, folios: funds.length, balance: sum(funds), owners: [], equities: [], mutual_funds: funds, bonds: [] });
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
folioFunds.push(...f.schemes.map((s) => mf(f, s)));
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
if (folioFunds.length) {
|
|
181
|
+
accounts.push({ name: "Mutual Fund Folios", type: "Mutual Fund Folios", dp_id: "", client_id: "", folios: folioFunds.length, balance: sum(folioFunds), owners: [], equities: [], mutual_funds: folioFunds, bonds: [] });
|
|
182
|
+
}
|
|
183
|
+
warnings.push(...failures(doc.checks, "statement"), ...doc.warnings);
|
|
184
|
+
const period = doc.statementPeriod;
|
|
185
|
+
const a = doc.addressee;
|
|
186
|
+
return {
|
|
187
|
+
statement_period: period ? { from: printedDate(period.from), to: printedDate(period.to) } : { from: "", to: "" },
|
|
188
|
+
accounts,
|
|
189
|
+
investor_info: { name: a.name ?? "", email: a.email ?? "", address: a.address ?? "", mobile: a.mobile ?? "" },
|
|
190
|
+
file_type: issuer,
|
|
191
|
+
parse_warnings: warnings,
|
|
192
|
+
};
|
|
193
|
+
}
|
package/dist/detect.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ExtractedDocument } from "./extract/types.js";
|
|
2
|
+
export type Issuer = "CAMS" | "KFINTECH" | "NSDL" | "CDSL";
|
|
3
|
+
export type Variant = "DETAILED" | "SUMMARY" | "DEMAT";
|
|
4
|
+
export interface Detection {
|
|
5
|
+
issuer: Issuer;
|
|
6
|
+
variant: Variant;
|
|
7
|
+
/** Human-readable reasons, for the coverage report and debugging. */
|
|
8
|
+
evidence: string[];
|
|
9
|
+
}
|
|
10
|
+
export declare function detect(doc: ExtractedDocument): Detection;
|
package/dist/detect.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Issuer and variant detection, with explicit rejects (PLAN.md §5.2).
|
|
3
|
+
*
|
|
4
|
+
* Marker strings follow casparser's `parsers/detect.py` (MIT). Detection reads
|
|
5
|
+
* every extracted item on the first pages, including the rotated CAMS/KFin
|
|
6
|
+
* watermark, before any cleanup removes it.
|
|
7
|
+
*/
|
|
8
|
+
import { CasError } from "./errors.js";
|
|
9
|
+
const SAMPLE_PAGES = 2;
|
|
10
|
+
const CAS_TYPE_RE = /consolidated\s+account\s+(statement|summary)/i;
|
|
11
|
+
const MFCENTRAL_RE = /mf\s?central/i;
|
|
12
|
+
// Producers typical of "print to PDF" re-prints, which flatten or drop the
|
|
13
|
+
// issuer watermark and any signature.
|
|
14
|
+
const REPRINT_PRODUCER_RE = /print\s*to\s*pdf|microsoft:\s*print|quartz\s*pdfcontext|ghostscript|skia\/pdf|cairo|pdfium/i;
|
|
15
|
+
export function detect(doc) {
|
|
16
|
+
const sample = doc.pages
|
|
17
|
+
.slice(0, SAMPLE_PAGES)
|
|
18
|
+
.flatMap((p) => p.items.map((i) => i.str))
|
|
19
|
+
.join(" ");
|
|
20
|
+
// Line breaks inside items are rare but possible; collapse whitespace so
|
|
21
|
+
// multi-word markers still match.
|
|
22
|
+
const text = sample.replace(/\s+/g, " ");
|
|
23
|
+
const visibleChars = doc.pages.reduce((n, p) => n + p.items.reduce((m, i) => m + i.str.replace(/\s/g, "").length, 0), 0);
|
|
24
|
+
if (visibleChars < 20) {
|
|
25
|
+
throw new CasError("IMAGE_ONLY", "This PDF has no readable text layer (it may be a scan or photo). Use the original statement emailed to you.");
|
|
26
|
+
}
|
|
27
|
+
const evidence = [];
|
|
28
|
+
let issuer = null;
|
|
29
|
+
if (text.includes("CAMSCASWS")) {
|
|
30
|
+
issuer = "CAMS";
|
|
31
|
+
evidence.push("CAMS watermark marker found");
|
|
32
|
+
}
|
|
33
|
+
else if (text.includes("KFINCASWS")) {
|
|
34
|
+
issuer = "KFINTECH";
|
|
35
|
+
evidence.push("KFintech watermark marker found");
|
|
36
|
+
}
|
|
37
|
+
else if (text.includes("NSDL Consolidated Account Statement") || text.includes("About NSDL")) {
|
|
38
|
+
issuer = "NSDL";
|
|
39
|
+
evidence.push("NSDL header text found");
|
|
40
|
+
}
|
|
41
|
+
else if (text.includes("Central Depository Services (India) Limited")) {
|
|
42
|
+
issuer = "CDSL";
|
|
43
|
+
evidence.push("CDSL header text found");
|
|
44
|
+
}
|
|
45
|
+
// Depository statements: their mutual fund sections are read (parsers/depository/mf.ts).
|
|
46
|
+
if (issuer === "NSDL" || issuer === "CDSL")
|
|
47
|
+
return { issuer, variant: "DEMAT", evidence };
|
|
48
|
+
if (issuer === null) {
|
|
49
|
+
if (MFCENTRAL_RE.test(text)) {
|
|
50
|
+
throw new CasError("MFCENTRAL_UNSUPPORTED", "MF Central statements are not supported yet. Request a detailed CAS from CAMS or KFintech instead.");
|
|
51
|
+
}
|
|
52
|
+
const producer = doc.meta.producer ?? "";
|
|
53
|
+
if (CAS_TYPE_RE.test(text) || REPRINT_PRODUCER_RE.test(producer)) {
|
|
54
|
+
throw new CasError("REPRINTED_PDF", "This looks like a re-saved or printed copy of a statement. Use the original PDF attached to the email.");
|
|
55
|
+
}
|
|
56
|
+
throw new CasError("UNKNOWN_TEMPLATE", "This doesn't look like a CAMS or KFintech consolidated account statement.");
|
|
57
|
+
}
|
|
58
|
+
const m = CAS_TYPE_RE.exec(text);
|
|
59
|
+
const kind = m?.[1]?.toLowerCase();
|
|
60
|
+
if (kind === "statement") {
|
|
61
|
+
evidence.push('Heading "Consolidated Account Statement" → detailed');
|
|
62
|
+
return { issuer, variant: "DETAILED", evidence };
|
|
63
|
+
}
|
|
64
|
+
if (kind === "summary") {
|
|
65
|
+
evidence.push('Heading "Consolidated Account Summary" → summary');
|
|
66
|
+
return { issuer, variant: "SUMMARY", evidence };
|
|
67
|
+
}
|
|
68
|
+
throw new CasError("UNKNOWN_TEMPLATE", `Found ${issuer} markers but couldn't tell whether this is a detailed or summary statement.`);
|
|
69
|
+
}
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every way a statement can fail to load or be recognised gets its own code,
|
|
3
|
+
* so the UI can tell the investor exactly what to do next (PLAN.md §5.2).
|
|
4
|
+
*/
|
|
5
|
+
export type CasErrorCode = "NEED_PASSWORD" | "INCORRECT_PASSWORD" | "DAMAGED_FILE" | "UNSUPPORTED_ENCRYPTION" | "FILE_TOO_LARGE" | "TOO_MANY_PAGES" | "TOO_MUCH_TEXT" | "TIMEOUT" | "CANCELLED" | "IMAGE_ONLY" | "REPRINTED_PDF" | "MFCENTRAL_UNSUPPORTED"
|
|
6
|
+
/** No longer thrown since 17-Nov-2026 (NSDL/CDSL mutual fund sections are read); kept so callers that match on it still compile. */
|
|
7
|
+
| "DEPOSITORY_UNSUPPORTED_YET" | "UNKNOWN_TEMPLATE" | "EXTRACTION_FAILED";
|
|
8
|
+
export declare class CasError extends Error {
|
|
9
|
+
readonly code: CasErrorCode;
|
|
10
|
+
constructor(code: CasErrorCode, message: string, options?: {
|
|
11
|
+
cause?: unknown;
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
export declare function isCasError(e: unknown): e is CasError;
|
|
15
|
+
/**
|
|
16
|
+
* One developer-facing line per code: what happened, what the caller (or its
|
|
17
|
+
* user) can do next, and whether trying the same file again can help. A host app
|
|
18
|
+
* can show `message` and `nextStep` to its users. Meaning follows the Sachfolio
|
|
19
|
+
* app's own error copy (apps/web/src/copy.ts). The hosted API sends the same
|
|
20
|
+
* text as `error.message` / `error.next_step`.
|
|
21
|
+
*/
|
|
22
|
+
export declare const CAS_ERRORS: Record<CasErrorCode, {
|
|
23
|
+
message: string;
|
|
24
|
+
nextStep: string;
|
|
25
|
+
retry: boolean;
|
|
26
|
+
}>;
|