sec-edgar-api 0.3.2 → 0.3.4

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.
@@ -1,5 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  /// <reference types="node" />
3
+ /// <reference types="node" />
3
4
  import { ClientRequest, IncomingMessage, RequestOptions } from 'http';
4
5
  type Primitive = string | number | boolean | null | undefined;
5
6
  interface HttpClient {
@@ -66,13 +66,13 @@ var XMLNode = /** @class */ (function () {
66
66
  if (text === '')
67
67
  return null;
68
68
  var colNum = text
69
- .replace(/,|\(|\)|\%/g, '')
69
+ .replace(/,|\(|\)|%/g, '')
70
70
  .replace(/\{\{/g, '')
71
71
  .replace(/\}\}/g, '')
72
72
  .trim();
73
73
  if (colNum === '-' || colNum === '$')
74
74
  return null;
75
- colNum = colNum.replace(/\-|\$/g, '');
75
+ colNum = colNum.replace(/-|\$/g, '');
76
76
  var hasNumBeforeParenthesis = Boolean(/\d+\s*(?=\()/.test(text));
77
77
  colNum = hasNumBeforeParenthesis ? (_a = colNum.split(' ')[0]) === null || _a === void 0 ? void 0 : _a.trim() : colNum;
78
78
  if (!isNaN(Number(colNum))) {
@@ -212,12 +212,10 @@ var XMLParser = /** @class */ (function () {
212
212
  };
213
213
  this.iterateXML({
214
214
  xml: xml,
215
- onCloseTag: function (_a) {
216
- var _b;
217
- var path = _a.path;
218
- var tag = path.split('.').pop();
215
+ onCloseTag: function () {
216
+ var _a;
219
217
  if ((curNode === null || curNode === void 0 ? void 0 : curNode.getPath()) === boldPath) {
220
- curNode === null || curNode === void 0 ? void 0 : curNode.setText("".concat((_b = curNode === null || curNode === void 0 ? void 0 : curNode.getText()) !== null && _b !== void 0 ? _b : '', "}}"));
218
+ curNode === null || curNode === void 0 ? void 0 : curNode.setText("".concat((_a = curNode === null || curNode === void 0 ? void 0 : curNode.getText()) !== null && _a !== void 0 ? _a : '', "}}"));
221
219
  boldPath = null;
222
220
  }
223
221
  },
@@ -11,19 +11,19 @@ function parseCurrentFilingsDaily(params) {
11
11
  var matchCount = Number((_g = (_f = matchHtml.split('>')[1]) === null || _f === void 0 ? void 0 : _f.split('<')[0]) === null || _g === void 0 ? void 0 : _g.trim()) || 0;
12
12
  var totalCount = Number((_j = (_h = totalHtml.split('>')[1]) === null || _h === void 0 ? void 0 : _h.split('<')[0]) === null || _j === void 0 ? void 0 : _j.trim()) || 0;
13
13
  var entries = lines.map(function (line) {
14
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
14
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
15
15
  var parts = line.split('<a ');
16
16
  var partDate = (_a = parts[0]) !== null && _a !== void 0 ? _a : '';
17
17
  var partNameCik = (_b = parts[parts.length - 1]) !== null && _b !== void 0 ? _b : '';
18
18
  var partAccessionForm = (_f = (_e = (_d = ((_c = parts[1]) !== null && _c !== void 0 ? _c : '').split('/Archives/edgar/data/')[1]) === null || _d === void 0 ? void 0 : _d.split('/')) === null || _e === void 0 ? void 0 : _e[1]) !== null && _f !== void 0 ? _f : '';
19
19
  var partNameCikParts = partNameCik.split('</a>');
20
- var _q = partAccessionForm === null || partAccessionForm === void 0 ? void 0 : partAccessionForm.split('>'), accession = _q[0], formUnfiltered = _q[1];
21
- var accessionNumber = ((_g = accession === null || accession === void 0 ? void 0 : accession.substring(0, accession.lastIndexOf('-'))) !== null && _g !== void 0 ? _g : '').trim();
22
- var form = ((_h = formUnfiltered === null || formUnfiltered === void 0 ? void 0 : formUnfiltered.replace(/</g, '')) !== null && _h !== void 0 ? _h : '').trim();
23
- var companyCik = Number((_l = (_k = (_j = partNameCikParts[0]) === null || _j === void 0 ? void 0 : _j.split('>')[1]) === null || _k === void 0 ? void 0 : _k.trim()) !== null && _l !== void 0 ? _l : '');
24
- var companyName = (_o = (_m = partNameCikParts[1]) === null || _m === void 0 ? void 0 : _m.trim()) !== null && _o !== void 0 ? _o : '';
25
- var filedDate = (_p = partDate.trim()) !== null && _p !== void 0 ? _p : '';
26
- var _r = filedDate.split('-'), month = _r[0], day = _r[1], year = _r[2];
20
+ var _r = (_g = partAccessionForm === null || partAccessionForm === void 0 ? void 0 : partAccessionForm.split('>')) !== null && _g !== void 0 ? _g : [], accession = _r[0], formUnfiltered = _r[1];
21
+ var accessionNumber = ((_h = accession === null || accession === void 0 ? void 0 : accession.substring(0, accession.lastIndexOf('-'))) !== null && _h !== void 0 ? _h : '').trim();
22
+ var form = ((_j = formUnfiltered === null || formUnfiltered === void 0 ? void 0 : formUnfiltered.replace(/</g, '')) !== null && _j !== void 0 ? _j : '').trim();
23
+ var companyCik = Number((_m = (_l = (_k = partNameCikParts[0]) === null || _k === void 0 ? void 0 : _k.split('>')[1]) === null || _l === void 0 ? void 0 : _l.trim()) !== null && _m !== void 0 ? _m : '');
24
+ var companyName = (_p = (_o = partNameCikParts[1]) === null || _o === void 0 ? void 0 : _o.trim()) !== null && _p !== void 0 ? _p : '';
25
+ var filedDate = (_q = partDate.trim()) !== null && _q !== void 0 ? _q : '';
26
+ var _s = filedDate.split('-'), month = _s[0], day = _s[1], year = _s[2];
27
27
  return {
28
28
  accessionNumber: accessionNumber,
29
29
  form: form,
@@ -154,10 +154,11 @@ function parseForm4(params, xmlParser) {
154
154
  continue;
155
155
  case 'price':
156
156
  case 'shares':
157
- case 'sharesEnding':
157
+ case 'sharesEnding': {
158
158
  var valueNum = Number(text.replace(/,/g, ''));
159
159
  transaction[colName] = text === '' || isNaN(valueNum) ? null : valueNum;
160
160
  continue;
161
+ }
161
162
  default:
162
163
  transaction[colName] = text;
163
164
  }
@@ -203,12 +204,13 @@ function parseForm4(params, xmlParser) {
203
204
  case 'shares':
204
205
  case 'sharesUnderlying':
205
206
  case 'priceExcercised':
206
- case 'sharesEnding':
207
+ case 'sharesEnding': {
207
208
  if (colName === 'shares' && transaction.shares !== null)
208
209
  continue;
209
210
  var valueNum = Number(text.replace(/,/g, ''));
210
211
  transaction[colName] = text === '' || isNaN(valueNum) ? null : valueNum;
211
212
  continue;
213
+ }
212
214
  default:
213
215
  transaction[colName] = text;
214
216
  }
@@ -8,7 +8,7 @@ interface ReportParserArgs {
8
8
  propertyResolver?: PropertyResolver;
9
9
  keyTranslator?: Record<string, string[]>;
10
10
  }
11
- type TranslateRawReportsCallback<T> = (report: T extends undefined ? ReportTranslated : Record<keyof T, string | number>, reportRaw: ReportRaw, keyTranslator: T) => any;
11
+ type TranslateRawReportsCallback<T> = (report: T extends undefined ? ReportTranslated : Record<keyof T, string | number>, reportRaw: ReportRaw, keyTranslator: T) => ReportTranslated | ReportRaw | Record<string, string | number | null>;
12
12
  /**
13
13
  * Takes company facts data from the SEC and translates them to reports as json objects.
14
14
  */
@@ -32,7 +32,7 @@ var ReportWrapper = /** @class */ (function (_super) {
32
32
  url: report.url,
33
33
  dateFiled: report.dateFiled,
34
34
  dateReport: report.dateReport,
35
- fiscalPeriod: (_a = report.fiscalPeriod) !== null && _a !== void 0 ? _a : '',
35
+ fiscalPeriod: ((_a = report.fiscalPeriod) !== null && _a !== void 0 ? _a : ''),
36
36
  fiscalYear: report.fiscalYear,
37
37
  splitRatio: null,
38
38
  splitDate: null,
@@ -20,7 +20,6 @@ export default class FactFiscalCalculator {
20
20
  add(fact: {
21
21
  end: string;
22
22
  filed: string;
23
- frame?: string;
24
23
  }): void;
25
24
  private getDaysBefore;
26
25
  setReportDates(params: SetReportDatesParams): void;
@@ -16,7 +16,7 @@ var FactFiscalCalculator = /** @class */ (function () {
16
16
  }
17
17
  FactFiscalCalculator.prototype.add = function (fact) {
18
18
  var _a, _b, _c;
19
- var end = fact.end, filed = fact.filed, frame = fact.frame;
19
+ var end = fact.end, filed = fact.filed;
20
20
  if (this.didResolve) {
21
21
  throw new Error('Cannot add fact after resolving');
22
22
  }
@@ -8,6 +8,7 @@ export default class FactGrouper {
8
8
  private preferFirstValue;
9
9
  private createFactGroup;
10
10
  private createGroupKey;
11
+ private toValue;
11
12
  /**
12
13
  * Map structure { 2022_Q3: { name: ... } }. NOTE: Does not include fiscal year report key.
13
14
  * All groups contain both trailing and period values, so use trailing from Q4 to get FY values.
@@ -28,6 +28,9 @@ var FactGrouper = /** @class */ (function () {
28
28
  var fiscalYear = params.fiscalYear, quarter = params.quarter, name = params.name;
29
29
  return "".concat(fiscalYear, "_").concat(quarter, "_").concat(name);
30
30
  };
31
+ FactGrouper.prototype.toValue = function (value) {
32
+ return !isNaN(value) ? Number(value) : value || null;
33
+ };
31
34
  /**
32
35
  * Map structure { 2022_Q3: { name: ... } }. NOTE: Does not include fiscal year report key.
33
36
  * All groups contain both trailing and period values, so use trailing from Q4 to get FY values.
@@ -59,7 +62,7 @@ var FactGrouper = /** @class */ (function () {
59
62
  var period = periodResolver.getPeriod(fact);
60
63
  var isPeriodFact = period <= 3;
61
64
  var isTrailingFact = period > 3 || (isPeriodFact && quarter === 1);
62
- var factValue = Number(fact.value);
65
+ var factValue = this.toValue(fact.value);
63
66
  // if no group exists, create from fact
64
67
  if (!factGroupByKey.has(groupKey)) {
65
68
  var group_1 = this.createFactGroup({
@@ -79,9 +82,12 @@ var FactGrouper = /** @class */ (function () {
79
82
  valuePeriodLast: isPeriodFact ? factValue : null,
80
83
  valueTrailingFirst: isTrailingFact ? factValue : null,
81
84
  valueTrailingLast: isTrailingFact ? factValue : null,
82
- values: [factValue],
85
+ values: [],
83
86
  facts: [fact],
84
87
  });
88
+ if (factValue !== null) {
89
+ group_1.values.push(factValue);
90
+ }
85
91
  accnByFiled.set(fact.filed, (_b = fact.accn) !== null && _b !== void 0 ? _b : '');
86
92
  unitByPropertyName.set(fact.name, fact.unit);
87
93
  factGroupByKey.set(groupKey, group_1);
@@ -94,7 +100,7 @@ var FactGrouper = /** @class */ (function () {
94
100
  group.endLast = fact.end > group.endLast ? fact.end : group.endLast;
95
101
  group.filedFirst = fact.filed < group.filedFirst ? fact.filed : group.filedFirst;
96
102
  group.filedLast = fact.filed > group.filedLast ? fact.filed : group.filedLast;
97
- if (!group.values.includes(factValue)) {
103
+ if (factValue !== null && !group.values.includes(factValue)) {
98
104
  group.values.push(factValue);
99
105
  }
100
106
  if (!group.accn && periodResolver.isOriginalFiling({ end: fact.end, filed: fact.filed })) {
@@ -139,24 +145,26 @@ var FactGrouper = /** @class */ (function () {
139
145
  var period = FactPeriodResolver_1.default.getPeriod(fact);
140
146
  return fact.value === preferredValueTrailing && (period > 3 || period === 0);
141
147
  });
142
- if (selectedFactPeriod) {
148
+ var valuePeriod = _this.toValue((_a = group.valueSplitAdjustedPeriod) !== null && _a !== void 0 ? _a : preferredValuePeriod);
149
+ var valueTrailing = _this.toValue((_b = group.valueSplitAdjustedTrailing) !== null && _b !== void 0 ? _b : preferredValueTrailing);
150
+ if (selectedFactPeriod && valuePeriod !== null) {
143
151
  periodResolver.add({
144
152
  end: selectedFactPeriod.end,
145
153
  filed: selectedFactPeriod.filed,
146
154
  name: selectedFactPeriod.name,
147
155
  quarter: group.quarter,
148
- value: Number((_a = group.valueSplitAdjustedPeriod) !== null && _a !== void 0 ? _a : preferredValuePeriod),
156
+ value: valuePeriod,
149
157
  year: group.fiscalYear,
150
158
  start: selectedFactPeriod.start,
151
159
  });
152
160
  }
153
- if (selectedFactTrailing) {
161
+ if (selectedFactTrailing && valueTrailing !== null) {
154
162
  periodResolver.add({
155
163
  end: selectedFactTrailing.end,
156
164
  filed: selectedFactTrailing.filed,
157
165
  name: selectedFactTrailing.name,
158
166
  quarter: group.quarter,
159
- value: Number((_b = group.valueSplitAdjustedTrailing) !== null && _b !== void 0 ? _b : preferredValueTrailing),
167
+ value: valueTrailing,
160
168
  year: group.fiscalYear,
161
169
  start: selectedFactTrailing.start,
162
170
  });
@@ -150,20 +150,30 @@ var FactSplitAdjuster = /** @class */ (function () {
150
150
  * Splits can be filed multiple times throughout different reports.
151
151
  */
152
152
  FactSplitAdjuster.prototype.didApplySplit = function (params) {
153
- var isShareRatio = params.isShareRatio, factGroup = params.factGroup, split = params.split, isTrailing = params.isTrailing, _a = params.useOppositePeriodFallback, useOppositePeriodFallback = _a === void 0 ? true : _a;
153
+ var _a;
154
+ var isShareRatio = params.isShareRatio, factGroup = params.factGroup, split = params.split, isTrailing = params.isTrailing, _b = params.useOppositePeriodFallback, useOppositePeriodFallback = _b === void 0 ? true : _b;
154
155
  var splitVal = split.splitRatio;
155
- if (!splitVal)
156
+ // string values are not adjusted
157
+ if (typeof ((_a = factGroup.valuePeriodFirst) !== null && _a !== void 0 ? _a : factGroup.valueTrailingFirst) === 'string') {
156
158
  return true;
157
- // these first two criteria will take care of the majority of cases...
159
+ }
160
+ // can't apply split values of 0 or null
161
+ if (!splitVal) {
162
+ return true;
163
+ }
164
+ // these two criteria will take care of the majority of cases where the fact was not filed in
165
+ // the window of the first and last filing of the split
158
166
  if (factGroup.filedFirst > split.filedLast) {
159
167
  return true;
160
168
  }
161
169
  if (factGroup.filedLast < split.filedFirst) {
162
170
  return false;
163
171
  }
172
+ // fact that is being used as the group value
164
173
  var resolvedFact = factGroup.facts.find(function (f) {
165
174
  return isTrailing ? f.value === factGroup.valueTrailingFirst : f.value === factGroup.valuePeriodFirst;
166
175
  });
176
+ // if resolved fact not found, try checking trailing or period (whichever is not the current one)
167
177
  if (!resolvedFact && useOppositePeriodFallback) {
168
178
  return this.didApplySplit(__assign(__assign({}, params), { isTrailing: !isTrailing, useOppositePeriodFallback: false }));
169
179
  }
@@ -185,10 +195,10 @@ var FactSplitAdjuster = /** @class */ (function () {
185
195
  return isAdjusted;
186
196
  }
187
197
  }
188
- if ((resolvedFact === null || resolvedFact === void 0 ? void 0 : resolvedFact.filed) > split.filedLast) {
198
+ if ((resolvedFact === null || resolvedFact === void 0 ? void 0 : resolvedFact.filed) && resolvedFact.filed > split.filedLast) {
189
199
  return true;
190
200
  }
191
- if ((resolvedFact === null || resolvedFact === void 0 ? void 0 : resolvedFact.filed) < split.filedFirst) {
201
+ if ((resolvedFact === null || resolvedFact === void 0 ? void 0 : resolvedFact.filed) && resolvedFact.filed < split.filedFirst) {
192
202
  return false;
193
203
  }
194
204
  // // if the filed date of the fact overlaps with the filed date of the split, try comparing the end dates
@@ -196,12 +206,12 @@ var FactSplitAdjuster = /** @class */ (function () {
196
206
  return false;
197
207
  }
198
208
  // if we still don't know, see if the split value puts us closer to the last known value or further
199
- if (factGroup.valuePeriodLast !== null) {
209
+ if (typeof factGroup.valuePeriodLast === 'number') {
200
210
  var val = this.getGroupValue(factGroup, isTrailing);
201
211
  var valueWithSplit = isShareRatio ? val / splitVal : val * splitVal;
202
212
  return Math.abs(factGroup.valuePeriodLast - val) < Math.abs(factGroup.valuePeriodLast - valueWithSplit);
203
213
  }
204
- if (factGroup.valueTrailingLast !== null) {
214
+ if (typeof factGroup.valueTrailingLast === 'number') {
205
215
  var val = this.getGroupValue(factGroup, isTrailing);
206
216
  var valueWithSplit = isShareRatio ? val / splitVal : val * splitVal;
207
217
  return Math.abs(factGroup.valueTrailingLast - val) < Math.abs(factGroup.valueTrailingLast - valueWithSplit);
@@ -31,6 +31,7 @@ export default class ReportRawBuilder {
31
31
  factGroupsByReportKey: Map<string, FactGroup[]>;
32
32
  fiscalCalculator: FactFiscalCalculator;
33
33
  splits?: SplitData[];
34
+ accessionByYearQuarter?: Map<string, string>;
34
35
  minYear: number;
35
36
  maxYear: number;
36
37
  cik: number;
@@ -36,7 +36,8 @@ var ReportRawBuilder = /** @class */ (function () {
36
36
  accessionByYearQuarter.set("".concat(year, "_").concat(quarter), accn);
37
37
  });
38
38
  var reportsCik = Number(facts[0].cik);
39
- var fiscalCalculator = this.createFiscalCalculator({ facts: facts });
39
+ var fiscalCalculator = reportDates ? new FactFiscalCalculator_1.default() : this.createFiscalCalculator({ facts: facts });
40
+ reportDates === null || reportDates === void 0 ? void 0 : reportDates.forEach(function (params) { return fiscalCalculator.setReportDates(params); });
40
41
  var factGrouper = new FactGrouper_1.default();
41
42
  var factSplitAdjuster = new FactSplitAdjuster_1.default();
42
43
  // if splits not included in params and need to adjust, extract from facts
@@ -65,12 +66,11 @@ var ReportRawBuilder = /** @class */ (function () {
65
66
  return "".concat(year, "_").concat(isAnnual ? 'FY' : "Q".concat(quarter));
66
67
  };
67
68
  ReportRawBuilder.prototype.createReport = function (params) {
68
- var _a;
69
- var group = params.group, isAnnual = params.isAnnual, splitDate = params.splitDate, splitRatio = params.splitRatio, cik = params.cik;
69
+ var group = params.group, isAnnual = params.isAnnual, splitDate = params.splitDate, splitRatio = params.splitRatio, cik = params.cik, accessionNumber = params.accessionNumber;
70
70
  var fiscalPeriod = isAnnual ? 'FY' : "Q".concat(group.quarter);
71
- var accessionNoHyphen = (_a = group.accn) === null || _a === void 0 ? void 0 : _a.replace(/-/g, '');
72
- var url = group.accn
73
- ? "https://www.sec.gov/Archives/edgar/data/".concat(cik, "/").concat(accessionNoHyphen, "/").concat(group.accn, ".txt")
71
+ var accessionNoHyphen = accessionNumber === null || accessionNumber === void 0 ? void 0 : accessionNumber.replace(/-/g, '');
72
+ var url = accessionNumber
73
+ ? "https://www.sec.gov/Archives/edgar/data/".concat(cik, "/").concat(accessionNoHyphen, "/").concat(accessionNumber, ".txt")
74
74
  : null;
75
75
  return {
76
76
  cik: cik,
@@ -89,7 +89,7 @@ var ReportRawBuilder = /** @class */ (function () {
89
89
  };
90
90
  ReportRawBuilder.prototype.buildReportsFromGroups = function (params) {
91
91
  var _this = this;
92
- var factGroupsByReportKey = params.factGroupsByReportKey, minYear = params.minYear, maxYear = params.maxYear, cik = params.cik, splits = params.splits, fiscalCalculator = params.fiscalCalculator;
92
+ var factGroupsByReportKey = params.factGroupsByReportKey, minYear = params.minYear, maxYear = params.maxYear, cik = params.cik, splits = params.splits, fiscalCalculator = params.fiscalCalculator, accessionByYearQuarter = params.accessionByYearQuarter;
93
93
  var splitByFiscals = new Map();
94
94
  var reportByKey = new Map();
95
95
  splits === null || splits === void 0 ? void 0 : splits.forEach(function (split) {
@@ -97,16 +97,19 @@ var ReportRawBuilder = /** @class */ (function () {
97
97
  splitByFiscals.set("".concat(year, "_").concat(quarter), split);
98
98
  });
99
99
  factGroupsByReportKey.forEach(function (groups) {
100
- var _a, _b, _c, _d, _e, _f;
100
+ var _a, _b, _c, _d, _e, _f, _g;
101
101
  var groupWithDates = groups.find(function (g) { return g.reportEnd; });
102
102
  if (!groupWithDates)
103
103
  return;
104
- var split = splitByFiscals.get("".concat(groupWithDates.fiscalYear, "_").concat(groupWithDates.quarter));
105
- var splitDate = (_a = split === null || split === void 0 ? void 0 : split.endLast) !== null && _a !== void 0 ? _a : null;
106
- var splitRatio = (_b = split === null || split === void 0 ? void 0 : split.splitRatio) !== null && _b !== void 0 ? _b : null;
104
+ var keyYearQuarter = "".concat(groupWithDates.fiscalYear, "_").concat(groupWithDates.quarter);
105
+ var split = splitByFiscals.get(keyYearQuarter);
106
+ var accessionNumber = (_a = accessionByYearQuarter === null || accessionByYearQuarter === void 0 ? void 0 : accessionByYearQuarter.get(keyYearQuarter)) !== null && _a !== void 0 ? _a : groupWithDates.accn;
107
+ var splitDate = (_b = split === null || split === void 0 ? void 0 : split.endLast) !== null && _b !== void 0 ? _b : null;
108
+ var splitRatio = (_c = split === null || split === void 0 ? void 0 : split.splitRatio) !== null && _c !== void 0 ? _c : null;
107
109
  var quarter = groupWithDates.quarter;
108
110
  var reportPeriod = _this.createReport({
109
111
  group: groupWithDates,
112
+ accessionNumber: accessionNumber,
110
113
  cik: cik,
111
114
  isAnnual: false,
112
115
  splitDate: splitDate,
@@ -119,7 +122,7 @@ var ReportRawBuilder = /** @class */ (function () {
119
122
  });
120
123
  for (var _i = 0, groups_1 = groups; _i < groups_1.length; _i++) {
121
124
  var group = groups_1[_i];
122
- var value = (_d = (_c = group.valuePeriodResolved) !== null && _c !== void 0 ? _c : group.valuePeriodFirst) !== null && _d !== void 0 ? _d : 0;
125
+ var value = (_e = (_d = group.valuePeriodResolved) !== null && _d !== void 0 ? _d : group.valuePeriodFirst) !== null && _e !== void 0 ? _e : 0;
123
126
  reportPeriod[group.name] = _this.round(value);
124
127
  }
125
128
  reportByKey.set(reportKeyPeriod, reportPeriod);
@@ -127,20 +130,22 @@ var ReportRawBuilder = /** @class */ (function () {
127
130
  return;
128
131
  var reportAnnual = _this.createReport({
129
132
  group: groupWithDates,
133
+ accessionNumber: accessionNumber,
130
134
  cik: cik,
131
135
  isAnnual: true,
132
136
  splitDate: splitDate,
133
137
  splitRatio: splitRatio,
134
138
  });
135
139
  var reportKeyAnnual = "".concat(reportAnnual.fiscalYear, "_").concat(reportAnnual.fiscalPeriod);
136
- for (var _g = 0, groups_2 = groups; _g < groups_2.length; _g++) {
137
- var group = groups_2[_g];
138
- var value = (_f = (_e = group.valueTrailingResolved) !== null && _e !== void 0 ? _e : group.valueTrailingFirst) !== null && _f !== void 0 ? _f : 0;
140
+ for (var _h = 0, groups_2 = groups; _h < groups_2.length; _h++) {
141
+ var group = groups_2[_h];
142
+ var value = (_g = (_f = group.valueTrailingResolved) !== null && _f !== void 0 ? _f : group.valueTrailingFirst) !== null && _g !== void 0 ? _g : 0;
139
143
  reportAnnual[group.name] = _this.round(value);
140
144
  }
141
145
  reportByKey.set(reportKeyAnnual, reportAnnual);
142
146
  });
143
147
  var reports = [];
148
+ // sort reports by year and quarter
144
149
  for (var year = minYear; year <= maxYear; year++) {
145
150
  for (var quarter = 1; quarter <= 5; quarter++) {
146
151
  var isAnnual = quarter === 5;
@@ -0,0 +1,4 @@
1
+ import { FilingListDetails, FilingListItemTranslated } from '../../types';
2
+ export default class FilingMapper {
3
+ mapFilingListDetails(cik: string | number, filingListDetails: FilingListDetails): FilingListItemTranslated[];
4
+ }
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var FilingMapper = /** @class */ (function () {
4
+ function FilingMapper() {
5
+ }
6
+ FilingMapper.prototype.mapFilingListDetails = function (cik, filingListDetails) {
7
+ var _a;
8
+ var filings = [];
9
+ var accessionNumbers = filingListDetails.accessionNumber;
10
+ for (var i = 0; i < accessionNumbers.length; i++) {
11
+ var accessionStrTrimmed = (_a = accessionNumbers[i]) === null || _a === void 0 ? void 0 : _a.replace(/-/g, '');
12
+ var urlPrefix = "https://www.sec.gov/Archives/edgar/data/".concat(Number(cik), "/").concat(accessionStrTrimmed);
13
+ var filing = {
14
+ accessionNumber: accessionNumbers[i],
15
+ filingDate: filingListDetails.filingDate[i],
16
+ reportDate: filingListDetails.reportDate[i],
17
+ acceptanceDateTime: filingListDetails.acceptanceDateTime[i],
18
+ act: filingListDetails.act[i],
19
+ form: filingListDetails.form[i],
20
+ fileNumber: filingListDetails.fileNumber[i],
21
+ filmNumber: filingListDetails.filmNumber[i],
22
+ items: filingListDetails.items[i],
23
+ size: filingListDetails.size[i],
24
+ isXBRL: filingListDetails.isXBRL[i],
25
+ isInlineXBRL: filingListDetails.isInlineXBRL[i],
26
+ primaryDocument: filingListDetails.primaryDocument[i],
27
+ primaryDocDescription: filingListDetails.primaryDocDescription[i],
28
+ url: "".concat(urlPrefix, "/").concat(accessionNumbers[i], ".txt"),
29
+ urlPrimaryDocument: "".concat(urlPrefix, "/").concat(filingListDetails.primaryDocument[i]),
30
+ };
31
+ filings.push(filing);
32
+ }
33
+ return filings;
34
+ };
35
+ return FilingMapper;
36
+ }());
37
+ exports.default = FilingMapper;
@@ -7,6 +7,7 @@ export interface SendRequestParams {
7
7
  }
8
8
  interface SubmissionRequestWrapperArgs<T> {
9
9
  submissions: FilingListItemTranslated[];
10
+ usePrimaryDocument: boolean;
10
11
  options?: SubmissionRequestWrapperOptions;
11
12
  sendRequest: (params: SendRequestParams) => Promise<T>;
12
13
  }
@@ -20,6 +21,7 @@ export default class SubmissionRequestWrapper<T> {
20
21
  private readonly options;
21
22
  private readonly submissions;
22
23
  private readonly errors;
24
+ private readonly usePrimaryDocument;
23
25
  private readonly sendRequest;
24
26
  private requestCount;
25
27
  private isDone;
@@ -38,11 +38,12 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  var SubmissionRequestWrapper = /** @class */ (function () {
40
40
  function SubmissionRequestWrapper(args) {
41
- var submissions = args.submissions, _a = args.options, options = _a === void 0 ? {} : _a, sendRequest = args.sendRequest;
41
+ var submissions = args.submissions, _a = args.options, options = _a === void 0 ? {} : _a, sendRequest = args.sendRequest, usePrimaryDocument = args.usePrimaryDocument;
42
42
  this.options = options;
43
43
  this.submissions = submissions;
44
44
  this.results = [];
45
45
  this.errors = [];
46
+ this.usePrimaryDocument = usePrimaryDocument;
46
47
  this.sendRequest = sendRequest;
47
48
  this.requestCount = 0;
48
49
  this.isDone = (options === null || options === void 0 ? void 0 : options.maxRequests) === 0;
@@ -55,7 +56,7 @@ var SubmissionRequestWrapper = /** @class */ (function () {
55
56
  };
56
57
  SubmissionRequestWrapper.prototype.requestNext = function () {
57
58
  return __awaiter(this, void 0, void 0, function () {
58
- var _a, maxRequests, submission, isComplete, url, result, data, e_1, error;
59
+ var _a, maxRequests, submission, isComplete, url, urlPrimaryDocument, requestUrl, result, data, e_1, error;
59
60
  return __generator(this, function (_b) {
60
61
  switch (_b.label) {
61
62
  case 0:
@@ -69,7 +70,8 @@ var SubmissionRequestWrapper = /** @class */ (function () {
69
70
  result: null,
70
71
  }];
71
72
  }
72
- url = submission.url;
73
+ url = submission.url, urlPrimaryDocument = submission.urlPrimaryDocument;
74
+ requestUrl = this.usePrimaryDocument ? urlPrimaryDocument : url;
73
75
  this.requestCount++;
74
76
  if (this.requestCount >= this.submissions.length || this.requestCount >= maxRequests) {
75
77
  this.isDone = true;
@@ -77,7 +79,7 @@ var SubmissionRequestWrapper = /** @class */ (function () {
77
79
  _b.label = 1;
78
80
  case 1:
79
81
  _b.trys.push([1, 3, , 4]);
80
- return [4 /*yield*/, this.sendRequest({ url: url })];
82
+ return [4 /*yield*/, this.sendRequest({ url: requestUrl })];
81
83
  case 2:
82
84
  result = _b.sent();
83
85
  data = {
@@ -4,6 +4,7 @@ import { IClient } from '../Client';
4
4
  import DocumentParser from '../DocumentParser';
5
5
  import ReportParser from '../ReportParser';
6
6
  import ReportWrapper from '../ReportParser/ReportWrapper';
7
+ import FilingMapper from './FilingMapper';
7
8
  import SubmissionRequestWrapper from './RequestWrapper';
8
9
  import { IThrottler } from './Throttler';
9
10
  interface SecApiArgs {
@@ -12,6 +13,7 @@ interface SecApiArgs {
12
13
  cikBySymbol: Record<string, number>;
13
14
  reportParser: ReportParser;
14
15
  documentParser: DocumentParser;
16
+ filingMapper?: FilingMapper;
15
17
  }
16
18
  export interface CreateRequestWrapperParams {
17
19
  /** symbol or cik */
@@ -67,6 +69,7 @@ export default class SecEdgarApi {
67
69
  private readonly baseUrlSec;
68
70
  private readonly throttler;
69
71
  private readonly client;
72
+ private readonly filingMapper;
70
73
  readonly cikBySymbol: Record<string, number>;
71
74
  readonly reportParser: ReportParser;
72
75
  readonly documentParser: DocumentParser;
@@ -88,7 +91,9 @@ export default class SecEdgarApi {
88
91
  *
89
92
  * endpoint: `/submissions/CIK${cik}.json`
90
93
  */
91
- getSubmissions(params: GetSymbolParams): Promise<{
94
+ getSubmissions(params: GetSymbolParams & {
95
+ includeOldFilings?: boolean;
96
+ }): Promise<{
92
97
  submissionList: SubmissionList;
93
98
  filings: FilingListItemTranslated[];
94
99
  }>;
@@ -51,6 +51,7 @@ var cik_by_symbol_1 = require("../../util/cik-by-symbol");
51
51
  var Client_1 = require("../Client");
52
52
  var DocumentParser_1 = require("../DocumentParser");
53
53
  var ReportParser_1 = require("../ReportParser");
54
+ var FilingMapper_1 = require("./FilingMapper");
54
55
  var RequestWrapper_1 = require("./RequestWrapper");
55
56
  var Throttler_1 = require("./Throttler");
56
57
  /**
@@ -66,13 +67,15 @@ var SecEdgarApi = /** @class */ (function () {
66
67
  cikBySymbol: cik_by_symbol_1.default,
67
68
  reportParser: new ReportParser_1.default(),
68
69
  documentParser: new DocumentParser_1.default(),
70
+ filingMapper: new FilingMapper_1.default(),
69
71
  }; }
70
- var client = args.client, throttler = args.throttler, cikBySymbol = args.cikBySymbol, reportParser = args.reportParser, documentParser = args.documentParser;
72
+ var client = args.client, throttler = args.throttler, cikBySymbol = args.cikBySymbol, reportParser = args.reportParser, documentParser = args.documentParser, _a = args.filingMapper, filingMapper = _a === void 0 ? new FilingMapper_1.default() : _a;
71
73
  this.client = client;
72
74
  this.throttler = throttler;
73
75
  this.cikBySymbol = cikBySymbol;
74
76
  this.reportParser = reportParser;
75
77
  this.documentParser = documentParser;
78
+ this.filingMapper = filingMapper;
76
79
  this.baseUrlEdgar = 'https://data.sec.gov';
77
80
  this.baseUrlSec = 'https://www.sec.gov';
78
81
  }
@@ -81,61 +84,40 @@ var SecEdgarApi = /** @class */ (function () {
81
84
  return __awaiter(this, void 0, void 0, function () {
82
85
  var _this = this;
83
86
  return __generator(this, function (_a) {
84
- return [2 /*return*/, new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
85
- var _this = this;
86
- return __generator(this, function (_a) {
87
- this.throttler.add(function () { return __awaiter(_this, void 0, void 0, function () {
88
- var response, responseData, e_1;
89
- var _a, _b;
90
- return __generator(this, function (_c) {
91
- switch (_c.label) {
92
- case 0:
93
- _c.trys.push([0, 2, , 3]);
94
- return [4 /*yield*/, this.client.request({
95
- url: url,
96
- onError: function (err) { return reject(err); },
97
- })];
98
- case 1:
99
- response = _c.sent();
100
- responseData = (_b = (_a = response.data) === null || _a === void 0 ? void 0 : _a.toString('utf-8')) !== null && _b !== void 0 ? _b : null;
101
- if (response.statusCode >= 400 || typeof responseData !== 'string') {
102
- reject("Request failed with status ".concat(response.statusCode, " ").concat(response.message));
103
- }
104
- resolve((isText ? responseData : JSON.parse(responseData)));
105
- return [3 /*break*/, 3];
106
- case 2:
107
- e_1 = _c.sent();
108
- reject(e_1);
109
- return [3 /*break*/, 3];
110
- case 3: return [2 /*return*/];
111
- }
112
- });
113
- }); });
114
- return [2 /*return*/];
115
- });
116
- }); })];
87
+ return [2 /*return*/, new Promise(function (resolve, reject) {
88
+ _this.throttler.add(function () { return __awaiter(_this, void 0, void 0, function () {
89
+ var response, responseData, e_1;
90
+ var _a, _b;
91
+ return __generator(this, function (_c) {
92
+ switch (_c.label) {
93
+ case 0:
94
+ _c.trys.push([0, 2, , 3]);
95
+ return [4 /*yield*/, this.client.request({
96
+ url: url,
97
+ onError: function (err) { return reject(err); },
98
+ })];
99
+ case 1:
100
+ response = _c.sent();
101
+ responseData = (_b = (_a = response.data) === null || _a === void 0 ? void 0 : _a.toString('utf-8')) !== null && _b !== void 0 ? _b : null;
102
+ if (response.statusCode >= 400 || typeof responseData !== 'string') {
103
+ reject("Request failed with status ".concat(response.statusCode, " ").concat(response.message));
104
+ }
105
+ resolve((isText ? responseData : JSON.parse(responseData)));
106
+ return [3 /*break*/, 3];
107
+ case 2:
108
+ e_1 = _c.sent();
109
+ reject(e_1);
110
+ return [3 /*break*/, 3];
111
+ case 3: return [2 /*return*/];
112
+ }
113
+ });
114
+ }); });
115
+ })];
117
116
  });
118
117
  });
119
118
  };
120
119
  SecEdgarApi.prototype.mapFilingListDetails = function (cik, filingListDetails) {
121
- var _a;
122
- var filings = [];
123
- for (var key in filingListDetails) {
124
- var k = key;
125
- var dataArr = filingListDetails[k];
126
- for (var i = 0; i < dataArr.length; i++) {
127
- filings[i] = (_a = filings[i]) !== null && _a !== void 0 ? _a : {};
128
- var filing = filings[i];
129
- filing[k] = dataArr[i];
130
- }
131
- }
132
- for (var _i = 0, filings_1 = filings; _i < filings_1.length; _i++) {
133
- var filing = filings_1[_i];
134
- var accessionStr = filing.accessionNumber.replace(/-/g, '');
135
- var primaryDocument = filing.primaryDocument;
136
- filing.url = "https://www.sec.gov/Archives/edgar/data/".concat(Number(cik), "/").concat(accessionStr, "/").concat(primaryDocument);
137
- }
138
- return filings;
120
+ return this.filingMapper.mapFilingListDetails(cik, filingListDetails);
139
121
  };
140
122
  SecEdgarApi.prototype.getCreateRequestSubmissions = function (params, forms) {
141
123
  var symbol = params.symbol, filings = params.filings, _a = params.cutoffDate, cutoffDate = _a === void 0 ? new Date('1970-01-01') : _a;
@@ -168,19 +150,39 @@ var SecEdgarApi = /** @class */ (function () {
168
150
  * endpoint: `/submissions/CIK${cik}.json`
169
151
  */
170
152
  SecEdgarApi.prototype.getSubmissions = function (params) {
171
- var _a;
172
153
  return __awaiter(this, void 0, void 0, function () {
173
- var symbol, cik, submissionList;
174
- return __generator(this, function (_b) {
175
- switch (_b.label) {
154
+ var symbol, includeOldFilings, cik, submissionList, additionalFilings, filings;
155
+ var _this = this;
156
+ return __generator(this, function (_a) {
157
+ switch (_a.label) {
176
158
  case 0:
177
- symbol = params.symbol;
159
+ symbol = params.symbol, includeOldFilings = params.includeOldFilings;
178
160
  cik = this.getCikString(symbol);
179
161
  return [4 /*yield*/, this.request("".concat(this.baseUrlEdgar, "/submissions/CIK").concat(cik, ".json"))];
180
162
  case 1:
181
- submissionList = _b.sent();
163
+ submissionList = _a.sent();
164
+ if (!includeOldFilings) return [3 /*break*/, 3];
165
+ return [4 /*yield*/, Promise.all(submissionList.filings.files.map(function (file) {
166
+ return _this.request("".concat(_this.baseUrlEdgar, "/submissions/").concat(file.name));
167
+ }))];
168
+ case 2:
169
+ additionalFilings = _a.sent();
170
+ additionalFilings.forEach(function (data) {
171
+ var _loop_1 = function (key) {
172
+ var k = key;
173
+ var valuesCurrent = submissionList.filings.recent[k];
174
+ var values = data[k];
175
+ values.forEach(function (v) { return valuesCurrent.push(v); });
176
+ };
177
+ for (var key in data) {
178
+ _loop_1(key);
179
+ }
180
+ });
181
+ _a.label = 3;
182
+ case 3:
182
183
  submissionList.cik = Number(submissionList.cik);
183
- return [2 /*return*/, { submissionList: submissionList, filings: this.mapFilingListDetails(cik, (_a = submissionList === null || submissionList === void 0 ? void 0 : submissionList.filings) === null || _a === void 0 ? void 0 : _a.recent) }];
184
+ filings = this.mapFilingListDetails(cik, submissionList.filings.recent);
185
+ return [2 /*return*/, { submissionList: submissionList, filings: filings }];
184
186
  }
185
187
  });
186
188
  });
@@ -260,7 +262,7 @@ var SecEdgarApi = /** @class */ (function () {
260
262
  */
261
263
  SecEdgarApi.prototype.getReports = function (params) {
262
264
  return __awaiter(this, void 0, void 0, function () {
263
- var _a, withWrapper, _b, usePropertyResolver, reportsRaw, reports;
265
+ var _a, withWrapper, _b, usePropertyResolver, reportsRaw, reportsWithWrapper, reports;
264
266
  return __generator(this, function (_c) {
265
267
  switch (_c.label) {
266
268
  case 0:
@@ -268,8 +270,9 @@ var SecEdgarApi = /** @class */ (function () {
268
270
  return [4 /*yield*/, this.getReportsRaw(__assign(__assign({}, params), { includeNamePrefix: false }))];
269
271
  case 1:
270
272
  reportsRaw = _c.sent();
271
- reports = this.reportParser.parseReportsFromRaw({ reportsRaw: reportsRaw, usePropertyResolver: usePropertyResolver });
272
- return [2 /*return*/, withWrapper ? reports : reports.map(function (report) { return report.getReport(); })];
273
+ reportsWithWrapper = this.reportParser.parseReportsFromRaw({ reportsRaw: reportsRaw, usePropertyResolver: usePropertyResolver });
274
+ reports = withWrapper ? reportsWithWrapper : reportsWithWrapper.map(function (report) { return report.getReport(); });
275
+ return [2 /*return*/, reports];
273
276
  }
274
277
  });
275
278
  });
@@ -402,7 +405,12 @@ var SecEdgarApi = /** @class */ (function () {
402
405
  }
403
406
  });
404
407
  }); };
405
- return new RequestWrapper_1.default({ submissions: submissions, options: options, sendRequest: sendRequest });
408
+ return new RequestWrapper_1.default({
409
+ submissions: submissions,
410
+ options: options,
411
+ sendRequest: sendRequest,
412
+ usePrimaryDocument: true,
413
+ });
406
414
  };
407
415
  /**
408
416
  * Used for getting institutional holders. extracts holders urls from submission list response, and parses the xml doc.
@@ -432,7 +440,12 @@ var SecEdgarApi = /** @class */ (function () {
432
440
  }
433
441
  });
434
442
  }); };
435
- return new RequestWrapper_1.default({ submissions: submissions, options: options, sendRequest: sendRequest });
443
+ return new RequestWrapper_1.default({
444
+ submissions: submissions,
445
+ options: options,
446
+ sendRequest: sendRequest,
447
+ usePrimaryDocument: true,
448
+ });
436
449
  };
437
450
  /**
438
451
  * Used for getting earnings report tables from submission files.
@@ -462,7 +475,12 @@ var SecEdgarApi = /** @class */ (function () {
462
475
  }
463
476
  });
464
477
  }); };
465
- return new RequestWrapper_1.default({ submissions: submissions, options: options, sendRequest: sendRequest });
478
+ return new RequestWrapper_1.default({
479
+ submissions: submissions,
480
+ options: options,
481
+ sendRequest: sendRequest,
482
+ usePrimaryDocument: true,
483
+ });
466
484
  };
467
485
  /**
468
486
  * Proxy statement includes list of holders, executiveCompensation, and other tables. returns FormDef14aData
@@ -491,7 +509,12 @@ var SecEdgarApi = /** @class */ (function () {
491
509
  }
492
510
  });
493
511
  }); };
494
- return new RequestWrapper_1.default({ submissions: submissions, options: options, sendRequest: sendRequest });
512
+ return new RequestWrapper_1.default({
513
+ submissions: submissions,
514
+ options: options,
515
+ sendRequest: sendRequest,
516
+ usePrimaryDocument: true,
517
+ });
495
518
  };
496
519
  /**
497
520
  * Gets list of latest filings.
@@ -2,17 +2,18 @@ interface OnProgressData {
2
2
  queueLength: number;
3
3
  countRunning: number;
4
4
  }
5
+ type ResolveValue = any;
5
6
  interface ThrottlerArgs {
6
7
  maxConcurrent?: number;
7
8
  delayMs?: number;
8
9
  onProgress?: (data: OnProgressData) => void;
9
- onResult?: (result: any) => void;
10
- onError?: (err: any) => void;
11
- onEnd?: (results: any[], errors: any[]) => void;
10
+ onResult?: (result: ResolveValue) => void;
11
+ onError?: (err: ResolveValue) => void;
12
+ onEnd?: (results: ResolveValue[], errors: ResolveValue[]) => void;
12
13
  }
13
14
  export interface IThrottler {
14
15
  setDelayMs(delayMs: number): void;
15
- add: (fn: () => Promise<any>) => void;
16
+ add: (fn: () => Promise<ResolveValue>) => void;
16
17
  }
17
18
  export default class Throttler implements IThrottler {
18
19
  private readonly decrementTimeouts;
@@ -22,12 +23,12 @@ export default class Throttler implements IThrottler {
22
23
  private maxConcurrent;
23
24
  private delayMs;
24
25
  onProgress?: (data: OnProgressData) => void;
25
- onResult?: (result: any) => void;
26
- onError?: (err: any) => void;
27
- onEnd?: (results: any[], errors: any[]) => void;
26
+ onResult?: (result: ResolveValue) => void;
27
+ onError?: (err: ResolveValue) => void;
28
+ onEnd?: (results: ResolveValue[], errors: ResolveValue[]) => void;
28
29
  constructor(args?: ThrottlerArgs);
29
30
  setDelayMs(delayMs: number): void;
30
- add(fn: () => Promise<any>): void;
31
+ add(fn: () => Promise<ResolveValue>): void;
31
32
  private run;
32
33
  }
33
34
  export {};
@@ -29,18 +29,18 @@ export interface FactGroup {
29
29
  filedLast: string;
30
30
  endFirst: string;
31
31
  endLast: string;
32
- values: number[];
32
+ values: (number | string)[];
33
33
  fiscalYear: number;
34
34
  quarter: number;
35
35
  facts: FactItem[];
36
- valueSplitAdjustedPeriod: number | null;
37
- valueSplitAdjustedTrailing: number | null;
38
- valuePeriodResolved: number | null;
39
- valueTrailingResolved: number | null;
40
- valuePeriodFirst: number | null;
41
- valuePeriodLast: number | null;
42
- valueTrailingFirst: number | null;
43
- valueTrailingLast: number | null;
36
+ valueSplitAdjustedPeriod: number | string | null;
37
+ valueSplitAdjustedTrailing: number | string | null;
38
+ valuePeriodResolved: number | string | null;
39
+ valueTrailingResolved: number | string | null;
40
+ valuePeriodFirst: number | string | null;
41
+ valuePeriodLast: number | string | null;
42
+ valueTrailingFirst: number | string | null;
43
+ valueTrailingLast: number | string | null;
44
44
  }
45
45
  export interface FactItemExtended extends FactItem {
46
46
  period: number;
@@ -53,6 +53,7 @@ export interface FilingListItemTranslated {
53
53
  primaryDocument: string;
54
54
  primaryDocDescription: string;
55
55
  url: string;
56
+ urlPrimaryDocument: string;
56
57
  }
57
58
  interface FilingList {
58
59
  recent: FilingListDetails;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sec-edgar-api",
3
- "version": "0.3.2",
3
+ "version": "0.3.4",
4
4
  "description": "Fetch and parse SEC earnings reports and other filings. Useful for financial analysis.",
5
5
  "main": "build/index.js",
6
6
  "author": "Andrew Evers (https://github.com/andyevers)",
@@ -13,7 +13,8 @@
13
13
  "scripts": {
14
14
  "test": "jest test",
15
15
  "build": "tsc",
16
- "publish": "npm run build && npm publish"
16
+ "publish": "npm run build && npm publish",
17
+ "lint": "npx eslint src"
17
18
  },
18
19
  "keywords": [
19
20
  "sec",
@@ -26,11 +27,15 @@
26
27
  "reports"
27
28
  ],
28
29
  "devDependencies": {
30
+ "@eslint/js": "^9.11.1",
31
+ "@types/eslint__js": "^8.42.3",
29
32
  "@types/jest": "^29.5.2",
33
+ "eslint": "^9.11.1",
30
34
  "jest": "^29.5.0",
31
35
  "prettier": "^2.8.8",
32
36
  "ts-jest": "^29.1.0",
33
- "typescript": "^5.1.3"
37
+ "typescript": "5.1.3",
38
+ "typescript-eslint": "^8.8.0"
34
39
  },
35
40
  "files": [
36
41
  "build/**/*"