sec-edgar-api 0.2.2 → 0.2.3

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 (58) hide show
  1. package/README.md +5 -3
  2. package/build/services/DocumentParser/XMLParser.d.ts +5 -20
  3. package/build/services/DocumentParser/XMLParser.js +118 -122
  4. package/build/services/DocumentParser/parsers/index.d.ts +3 -5
  5. package/build/services/DocumentParser/parsers/index.js +3 -5
  6. package/build/services/DocumentParser/parsers/parse-form-13g.js +2 -2
  7. package/build/services/DocumentParser/parsers/parse-form-4.d.ts +1 -6
  8. package/build/services/DocumentParser/parsers/parse-form-4.js +204 -134
  9. package/build/services/DocumentParser/parsers/parse-form-def14a.d.ts +2 -1
  10. package/build/services/DocumentParser/parsers/parse-form-def14a.js +106 -157
  11. package/build/services/ReportBuilder/FactFiscalCalculator.d.ts +4 -0
  12. package/build/services/ReportBuilder/FactFiscalCalculator.js +4 -0
  13. package/build/services/ReportBuilder/FactPeriodResolver.d.ts +6 -2
  14. package/build/services/ReportBuilder/FactPeriodResolver.js +6 -1
  15. package/build/services/ReportBuilder/FactRecordBuilder.d.ts +4 -1
  16. package/build/services/ReportBuilder/FactRecordBuilder.js +26 -4
  17. package/build/services/ReportBuilder/FactSplitAdjuster.d.ts +7 -0
  18. package/build/services/ReportBuilder/FactSplitAdjuster.js +19 -8
  19. package/build/services/ReportBuilder/ReportBuilder.d.ts +3 -0
  20. package/build/services/ReportBuilder/ReportBuilder.js +15 -9
  21. package/build/services/ReportParser/ReportParser.d.ts +3 -3
  22. package/build/services/ReportParser/ReportParser.js +7 -4
  23. package/build/services/ReportParser/ReportRawParser.d.ts +3 -9
  24. package/build/services/ReportParser/ReportRawParser.js +5 -33
  25. package/build/services/ReportParser/ReportWrapper.js +2 -0
  26. package/build/services/ReportParser/resolvers/resolve-fiscal-year-cumulative-properties.js +2 -1
  27. package/build/services/SecEdgarApi/SecEdgarApi.d.ts +45 -84
  28. package/build/services/SecEdgarApi/SecEdgarApi.js +108 -246
  29. package/build/types/index.d.ts +2 -2
  30. package/build/types/index.js +2 -2
  31. package/build/types/parsed-filings.type.d.ts +5 -144
  32. package/build/types/report-raw.type.d.ts +3 -1
  33. package/build/types/report-translated.type.d.ts +4 -1
  34. package/build/types/submission.type.d.ts +2 -3
  35. package/build/util/key-translations.js +5 -1
  36. package/package.json +2 -5
  37. package/build/services/DocumentParser/HtmlTableExtractor.d.ts +0 -41
  38. package/build/services/DocumentParser/HtmlTableExtractor.js +0 -408
  39. package/build/services/DocumentParser/parsers/parse-current-filings.d.ts +0 -3
  40. package/build/services/DocumentParser/parsers/parse-current-filings.js +0 -98
  41. package/build/services/DocumentParser/parsers/parse-form-13f.d.ts +0 -6
  42. package/build/services/DocumentParser/parsers/parse-form-13f.js +0 -91
  43. package/build/services/ReportParser/FactItem.d.ts +0 -66
  44. package/build/services/ReportParser/FactItem.js +0 -50
  45. package/build/services/ReportParser/FactItemFactory.d.ts +0 -22
  46. package/build/services/ReportParser/FactItemFactory.js +0 -150
  47. package/build/services/ReportParser/FactIterator.d.ts +0 -18
  48. package/build/services/ReportParser/FactIterator.js +0 -35
  49. package/build/services/ReportParser/FactSplitMap.d.ts +0 -16
  50. package/build/services/ReportParser/FactSplitMap.js +0 -101
  51. package/build/types/current-filings-xml.type.d.ts +0 -74
  52. package/build/types/current-filings-xml.type.js +0 -6
  53. package/build/types/current-filings.type.d.ts +0 -44
  54. package/build/types/current-filings.type.js +0 -2
  55. package/build/types/form-13f-xml.type.d.ts +0 -105
  56. package/build/types/form-13f-xml.type.js +0 -2
  57. package/build/types/form-4-xml.type.d.ts +0 -132
  58. package/build/types/form-4-xml.type.js +0 -2
@@ -3,148 +3,218 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.parseForm4 = void 0;
4
4
  var XMLParser_1 = require("../XMLParser");
5
5
  /**
6
- * Form 4 and form 5 - Insider Transactions
7
- *
8
- * TODO: sometimes not working. keys not consistently coming back objects vs arrays:
9
- *
10
- * here reporting owner is array, so not being extracted correctly
11
- * https://www.sec.gov/Archives/edgar/data/1067983/000095017024044198/0000950170-24-044198.txt
6
+ * Form 4 - Insider Transactions
12
7
  *
13
8
  * example at https://www.sec.gov/Archives/edgar/data/320193/000032019323000079/xslF345X05/wk-form4_1691533817.xml
14
9
  */
15
10
  function parseForm4(params, xmlParser) {
11
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
16
12
  if (xmlParser === void 0) { xmlParser = new XMLParser_1.default(); }
17
- var json = xmlParser.parse(params.xml);
18
- var form4 = xmlParser.extractJsonKey(json, 'ownershipDocument');
19
- var toArray = function (value) { return (Array.isArray(value) ? value : [value]).filter(Boolean); };
20
- var mapTransaction = function (transaction) {
21
- var deemedExecutionDate = transaction.deemedExecutionDate, ownershipNature = transaction.ownershipNature, postTransactionAmounts = transaction.postTransactionAmounts, securityTitle = transaction.securityTitle, transactionAmounts = transaction.transactionAmounts, transactionCoding = transaction.transactionCoding, transactionDate = transaction.transactionDate, transactionTimeliness = transaction.transactionTimeliness;
22
- var _a = transactionAmounts !== null && transactionAmounts !== void 0 ? transactionAmounts : {}, transactionAcquiredDisposedCode = _a.transactionAcquiredDisposedCode, transactionPricePerShare = _a.transactionPricePerShare, transactionShares = _a.transactionShares;
23
- var _b = ownershipNature !== null && ownershipNature !== void 0 ? ownershipNature : {}, directOrIndirectOwnership = _b.directOrIndirectOwnership, natureOfOwnership = _b.natureOfOwnership;
24
- var _c = transactionCoding !== null && transactionCoding !== void 0 ? transactionCoding : {}, equitySwapInvolved = _c.equitySwapInvolved, transactionCode = _c.transactionCode, transactionFormType = _c.transactionFormType;
25
- var sharesOwnedFollowingTransaction = (postTransactionAmounts !== null && postTransactionAmounts !== void 0 ? postTransactionAmounts : {}).sharesOwnedFollowingTransaction;
26
- return {
27
- securityTitle: String((securityTitle === null || securityTitle === void 0 ? void 0 : securityTitle.value) || ''),
28
- directOrIndirectOwnership: String((directOrIndirectOwnership === null || directOrIndirectOwnership === void 0 ? void 0 : directOrIndirectOwnership.value) || ''),
29
- natureOfOwnership: String((natureOfOwnership === null || natureOfOwnership === void 0 ? void 0 : natureOfOwnership.value) || '') || null,
30
- sharesOwnedFollowingTransaction: Number(sharesOwnedFollowingTransaction === null || sharesOwnedFollowingTransaction === void 0 ? void 0 : sharesOwnedFollowingTransaction.value) || 0,
31
- deemedExecutionDate: String(deemedExecutionDate || '') || null,
32
- equitySwapInvolved: Boolean(equitySwapInvolved),
33
- transactionShares: Number(transactionShares === null || transactionShares === void 0 ? void 0 : transactionShares.value) || 0,
34
- transactionCode: String(transactionCode || ''),
35
- transactionFormType: String(transactionFormType || ''),
36
- transactionDate: (transactionDate === null || transactionDate === void 0 ? void 0 : transactionDate.value) || null,
37
- transactionTimeliness: String((transactionTimeliness === null || transactionTimeliness === void 0 ? void 0 : transactionTimeliness.value) || '') || null,
38
- transactionPricePerShare: Number((transactionPricePerShare === null || transactionPricePerShare === void 0 ? void 0 : transactionPricePerShare.value) || 0) || null,
39
- transactionAcquiredDisposedCode: String((transactionAcquiredDisposedCode === null || transactionAcquiredDisposedCode === void 0 ? void 0 : transactionAcquiredDisposedCode.value) || ''),
40
- };
41
- };
42
- var mapDerivativeTransaction = function (transaction) {
43
- var conversionOrExercisePrice = transaction.conversionOrExercisePrice, deemedExecutionDate = transaction.deemedExecutionDate, exerciseDate = transaction.exerciseDate, expirationDate = transaction.expirationDate, ownershipNature = transaction.ownershipNature, postTransactionAmounts = transaction.postTransactionAmounts, securityTitle = transaction.securityTitle, transactionAmounts = transaction.transactionAmounts, transactionCoding = transaction.transactionCoding, transactionDate = transaction.transactionDate, transactionTimeliness = transaction.transactionTimeliness, underlyingSecurity = transaction.underlyingSecurity;
44
- var _a = transactionAmounts !== null && transactionAmounts !== void 0 ? transactionAmounts : {}, transactionAcquiredDisposedCode = _a.transactionAcquiredDisposedCode, transactionPricePerShare = _a.transactionPricePerShare, transactionShares = _a.transactionShares;
45
- var _b = ownershipNature !== null && ownershipNature !== void 0 ? ownershipNature : {}, directOrIndirectOwnership = _b.directOrIndirectOwnership, natureOfOwnership = _b.natureOfOwnership;
46
- var _c = transactionCoding !== null && transactionCoding !== void 0 ? transactionCoding : {}, equitySwapInvolved = _c.equitySwapInvolved, transactionCode = _c.transactionCode, transactionFormType = _c.transactionFormType;
47
- var sharesOwnedFollowingTransaction = (postTransactionAmounts !== null && postTransactionAmounts !== void 0 ? postTransactionAmounts : {}).sharesOwnedFollowingTransaction;
48
- var _d = underlyingSecurity !== null && underlyingSecurity !== void 0 ? underlyingSecurity : {}, underlyingSecurityShares = _d.underlyingSecurityShares, underlyingSecurityTitle = _d.underlyingSecurityTitle;
49
- // const
50
- return {
51
- // non-derivative holding data
52
- securityTitle: String((securityTitle === null || securityTitle === void 0 ? void 0 : securityTitle.value) || ''),
53
- directOrIndirectOwnership: String((directOrIndirectOwnership === null || directOrIndirectOwnership === void 0 ? void 0 : directOrIndirectOwnership.value) || ''),
54
- natureOfOwnership: String((natureOfOwnership === null || natureOfOwnership === void 0 ? void 0 : natureOfOwnership.value) || '') || null,
55
- sharesOwnedFollowingTransaction: Number(sharesOwnedFollowingTransaction === null || sharesOwnedFollowingTransaction === void 0 ? void 0 : sharesOwnedFollowingTransaction.value) || 0,
56
- // transaction data
57
- deemedExecutionDate: String(deemedExecutionDate || '') || null,
58
- equitySwapInvolved: Boolean(equitySwapInvolved),
59
- transactionShares: Number(transactionShares === null || transactionShares === void 0 ? void 0 : transactionShares.value) || 0,
60
- transactionCode: String(transactionCode || ''),
61
- transactionFormType: String(transactionFormType || ''),
62
- transactionDate: (transactionDate === null || transactionDate === void 0 ? void 0 : transactionDate.value) || null,
63
- transactionTimeliness: String((transactionTimeliness === null || transactionTimeliness === void 0 ? void 0 : transactionTimeliness.value) || '') || null,
64
- transactionPricePerShare: Number((transactionPricePerShare === null || transactionPricePerShare === void 0 ? void 0 : transactionPricePerShare.value) || 0) || null,
65
- transactionAcquiredDisposedCode: String((transactionAcquiredDisposedCode === null || transactionAcquiredDisposedCode === void 0 ? void 0 : transactionAcquiredDisposedCode.value) || ''),
66
- // derivative holding data
67
- conversionOrExercisePrice: Number(conversionOrExercisePrice === null || conversionOrExercisePrice === void 0 ? void 0 : conversionOrExercisePrice.value) || null,
68
- exerciseDate: String((exerciseDate === null || exerciseDate === void 0 ? void 0 : exerciseDate.value) || '') || null,
69
- expirationDate: String((expirationDate === null || expirationDate === void 0 ? void 0 : expirationDate.value) || '') || null,
70
- underlyingSecurityShares: Number(underlyingSecurityShares === null || underlyingSecurityShares === void 0 ? void 0 : underlyingSecurityShares.value) || null,
71
- underlyingSecurityTitle: String((underlyingSecurityTitle === null || underlyingSecurityTitle === void 0 ? void 0 : underlyingSecurityTitle.value) || '') || null,
72
- };
73
- };
74
- var mapNonDerivativeHolding = function (holding) {
75
- var ownershipNature = holding.ownershipNature, postTransactionAmounts = holding.postTransactionAmounts, securityTitle = holding.securityTitle;
76
- var _a = ownershipNature !== null && ownershipNature !== void 0 ? ownershipNature : {}, directOrIndirectOwnership = _a.directOrIndirectOwnership, natureOfOwnership = _a.natureOfOwnership;
77
- var sharesOwnedFollowingTransaction = (postTransactionAmounts !== null && postTransactionAmounts !== void 0 ? postTransactionAmounts : {}).sharesOwnedFollowingTransaction;
78
- return {
79
- securityTitle: String((securityTitle === null || securityTitle === void 0 ? void 0 : securityTitle.value) || ''),
80
- directOrIndirectOwnership: String((directOrIndirectOwnership === null || directOrIndirectOwnership === void 0 ? void 0 : directOrIndirectOwnership.value) || ''),
81
- natureOfOwnership: String((natureOfOwnership === null || natureOfOwnership === void 0 ? void 0 : natureOfOwnership.value) || '') || null,
82
- sharesOwnedFollowingTransaction: Number(sharesOwnedFollowingTransaction === null || sharesOwnedFollowingTransaction === void 0 ? void 0 : sharesOwnedFollowingTransaction.value) || 0,
83
- };
13
+ var xml = params.xml;
14
+ var textMap = xmlParser.getTableTextMap({ xml: xml, parentPath: 'html.body' });
15
+ var getTextBetween = function (text, before, after) {
16
+ var indexBefore = text.indexOf(before);
17
+ var indexAfter = after ? text.indexOf(after, indexBefore) : text.length;
18
+ return text.substring(indexBefore + before.length, indexAfter).trim();
84
19
  };
85
- var mapDerivativeHolding = function (holding) {
86
- var conversionOrExercisePrice = holding.conversionOrExercisePrice, exerciseDate = holding.exerciseDate, expirationDate = holding.expirationDate, ownershipNature = holding.ownershipNature, postTransactionAmounts = holding.postTransactionAmounts, securityTitle = holding.securityTitle, underlyingSecurity = holding.underlyingSecurity;
87
- var _a = ownershipNature !== null && ownershipNature !== void 0 ? ownershipNature : {}, directOrIndirectOwnership = _a.directOrIndirectOwnership, natureOfOwnership = _a.natureOfOwnership;
88
- var sharesOwnedFollowingTransaction = (postTransactionAmounts !== null && postTransactionAmounts !== void 0 ? postTransactionAmounts : {}).sharesOwnedFollowingTransaction;
89
- var _b = underlyingSecurity !== null && underlyingSecurity !== void 0 ? underlyingSecurity : {}, underlyingSecurityShares = _b.underlyingSecurityShares, underlyingSecurityTitle = _b.underlyingSecurityTitle;
90
- return {
91
- // non-derivative holding data
92
- securityTitle: String((securityTitle === null || securityTitle === void 0 ? void 0 : securityTitle.value) || ''),
93
- directOrIndirectOwnership: String((directOrIndirectOwnership === null || directOrIndirectOwnership === void 0 ? void 0 : directOrIndirectOwnership.value) || ''),
94
- natureOfOwnership: String((natureOfOwnership === null || natureOfOwnership === void 0 ? void 0 : natureOfOwnership.value) || '') || null,
95
- sharesOwnedFollowingTransaction: Number(sharesOwnedFollowingTransaction === null || sharesOwnedFollowingTransaction === void 0 ? void 0 : sharesOwnedFollowingTransaction.value) || 0,
96
- // derivative holding data
97
- conversionOrExercisePrice: Number(conversionOrExercisePrice === null || conversionOrExercisePrice === void 0 ? void 0 : conversionOrExercisePrice.value) || null,
98
- exerciseDate: String((exerciseDate === null || exerciseDate === void 0 ? void 0 : exerciseDate.value) || '') || null,
99
- expirationDate: String((expirationDate === null || expirationDate === void 0 ? void 0 : expirationDate.value) || '') || null,
100
- underlyingSecurityShares: Number(underlyingSecurityShares === null || underlyingSecurityShares === void 0 ? void 0 : underlyingSecurityShares.value) || null,
101
- underlyingSecurityTitle: String((underlyingSecurityTitle === null || underlyingSecurityTitle === void 0 ? void 0 : underlyingSecurityTitle.value) || '') || null,
102
- };
20
+ var relationText = (_a = textMap.get('2.1.3')) !== null && _a !== void 0 ? _a : '';
21
+ var filerNameText = (_b = textMap.get('2.1.1')) !== null && _b !== void 0 ? _b : '';
22
+ var filterNameText = getTextBetween(filerNameText, '1. Name and Address of Reporting Person*', '(Last)');
23
+ var isDirector = relationText.substring(0, relationText.indexOf('Director')).includes('X');
24
+ var isOwner10 = getTextBetween(relationText, 'Director', '10% Owner').includes('X');
25
+ var isOfficer = getTextBetween(relationText, '10% Owner', 'Officer (give title below)').includes('X');
26
+ var isOther = getTextBetween(relationText, 'Officer (give title below)', 'Other (specify below)').includes('X');
27
+ var position = getTextBetween(relationText, 'Other (specify below)');
28
+ var filerPositionTypes = [];
29
+ if (isDirector)
30
+ filerPositionTypes.push('Director');
31
+ if (isOwner10)
32
+ filerPositionTypes.push('10% Owner');
33
+ if (isOfficer)
34
+ filerPositionTypes.push('Officer');
35
+ if (isOther)
36
+ filerPositionTypes.push('Other');
37
+ var codeTranslations = {
38
+ P: 'Purchase',
39
+ S: 'Sale',
40
+ V: 'Voluntary Reporting',
41
+ A: 'Grant',
42
+ D: 'Sale to Issuer',
43
+ F: 'Payment of Exercise Price',
44
+ I: 'Discretionary Transaction',
45
+ M: 'Conversion of Derivative Exempt',
46
+ C: 'Conversion of Derivative',
47
+ E: 'Expiration of Short Derivative Position',
48
+ H: 'Expiration of Long Derivative Position',
49
+ O: 'Exercise of out-of-the-money Derivative',
50
+ X: 'Exercise of in-the-money Derivative',
51
+ G: 'Gift',
52
+ L: 'Small Acquisition',
53
+ W: 'Acquisition or Disposition By Will or Laws',
54
+ Z: 'Voting Trust Deposit or Withdrawal',
55
+ J: 'Other Acquisition or Disposition',
56
+ K: 'Equity Swap',
57
+ U: 'Disposition Change in Control',
103
58
  };
104
- var mapReportingOwner = function (reportingOwner) {
105
- var _a = reportingOwner !== null && reportingOwner !== void 0 ? reportingOwner : {}, reportingOwnerAddress = _a.reportingOwnerAddress, reportingOwnerId = _a.reportingOwnerId, reportingOwnerRelationship = _a.reportingOwnerRelationship;
106
- var _b = reportingOwnerAddress !== null && reportingOwnerAddress !== void 0 ? reportingOwnerAddress : {}, _c = _b.rptOwnerCity, rptOwnerCity = _c === void 0 ? '' : _c, _d = _b.rptOwnerState, rptOwnerState = _d === void 0 ? '' : _d, _e = _b.rptOwnerStateDescription, rptOwnerStateDescription = _e === void 0 ? '' : _e, _f = _b.rptOwnerStreet1, rptOwnerStreet1 = _f === void 0 ? '' : _f, _g = _b.rptOwnerStreet2, rptOwnerStreet2 = _g === void 0 ? '' : _g, _h = _b.rptOwnerZipCode, rptOwnerZipCode = _h === void 0 ? '' : _h;
107
- var _j = reportingOwnerId !== null && reportingOwnerId !== void 0 ? reportingOwnerId : {}, _k = _j.rptOwnerCik, rptOwnerCik = _k === void 0 ? 0 : _k, _l = _j.rptOwnerName, rptOwnerName = _l === void 0 ? '' : _l;
108
- var _m = reportingOwnerRelationship !== null && reportingOwnerRelationship !== void 0 ? reportingOwnerRelationship : {}, _o = _m.isDirector, isDirector = _o === void 0 ? 0 : _o, _p = _m.isOfficer, isOfficer = _p === void 0 ? 0 : _p, _q = _m.isOther, isOther = _q === void 0 ? 0 : _q, _r = _m.isTenPercentOwner, isTenPercentOwner = _r === void 0 ? 0 : _r;
109
- return {
110
- rptOwnerCity: String(rptOwnerCity || ''),
111
- rptOwnerState: String(rptOwnerState || ''),
112
- rptOwnerStateDescription: String(rptOwnerStateDescription || ''),
113
- rptOwnerStreet1: String(rptOwnerStreet1 || ''),
114
- rptOwnerStreet2: String(rptOwnerStreet2 || ''),
115
- rptOwnerZipCode: String(rptOwnerZipCode || ''),
116
- rptOwnerCik: Number(rptOwnerCik),
117
- rptOwnerName: String(rptOwnerName || ''),
118
- isDirector: Boolean(isDirector),
119
- isOfficer: Boolean(isOfficer),
120
- isTenPercentOwner: Boolean(isTenPercentOwner),
121
- isOther: Boolean(isOther),
122
- };
59
+ var toDate = function (str) {
60
+ if (str === '')
61
+ return '';
62
+ var _a = str.split('/'), month = _a[0], day = _a[1], year = _a[2];
63
+ return [month, day, year].some(function (x) { return x === undefined; }) ? '' : "".concat(year, "-").concat(month, "-").concat(day);
123
64
  };
124
- var _a = form4 !== null && form4 !== void 0 ? form4 : {}, aff10b5One = _a.aff10b5One, derivativeTable = _a.derivativeTable, _b = _a.documentType, documentType = _b === void 0 ? '' : _b, footnotes = _a.footnotes, issuer = _a.issuer, nonDerivativeTable = _a.nonDerivativeTable, notSubjectToSection16 = _a.notSubjectToSection16, ownerSignature = _a.ownerSignature, _c = _a.periodOfReport, periodOfReport = _c === void 0 ? '' : _c, _d = _a.remarks, remarks = _d === void 0 ? '' : _d, reportingOwner = _a.reportingOwner, schemaVersion = _a.schemaVersion;
125
- var _e = (footnotes !== null && footnotes !== void 0 ? footnotes : {}).footnote, footnote = _e === void 0 ? [] : _e;
126
- var _f = derivativeTable !== null && derivativeTable !== void 0 ? derivativeTable : {}, _g = _f.derivativeHolding, derivativeHolding = _g === void 0 ? [] : _g, _h = _f.derivativeTransaction, derivativeTransaction = _h === void 0 ? [] : _h;
127
- var _j = nonDerivativeTable !== null && nonDerivativeTable !== void 0 ? nonDerivativeTable : {}, _k = _j.nonDerivativeHolding, nonDerivativeHolding = _k === void 0 ? [] : _k, _l = _j.nonDerivativeTransaction, nonDerivativeTransaction = _l === void 0 ? [] : _l;
128
- var _m = issuer !== null && issuer !== void 0 ? issuer : {}, _o = _m.issuerCik, issuerCik = _o === void 0 ? 0 : _o, _p = _m.issuerName, issuerName = _p === void 0 ? '' : _p, _q = _m.issuerTradingSymbol, issuerTradingSymbol = _q === void 0 ? '' : _q;
129
- var _r = ownerSignature !== null && ownerSignature !== void 0 ? ownerSignature : {}, signatureDate = _r.signatureDate, signatureName = _r.signatureName;
130
- return {
131
- schemaVersion: String(schemaVersion),
132
- documentType: String(documentType),
133
- periodOfReport: String(periodOfReport),
134
- notSubjectToSection16: Boolean(notSubjectToSection16),
135
- issuerCik: Number(issuerCik),
136
- issuerName: String(issuerName),
137
- issuerTradingSymbol: String(issuerTradingSymbol),
138
- reportingOwners: toArray(reportingOwner).map(mapReportingOwner),
139
- aff10b5One: Boolean(aff10b5One),
140
- nonDerivativeHolding: toArray(nonDerivativeHolding).map(mapNonDerivativeHolding),
141
- nonDerivativeTransaction: toArray(nonDerivativeTransaction).map(mapTransaction),
142
- derivativeHolding: toArray(derivativeHolding).map(mapDerivativeHolding),
143
- derivativeTransaction: toArray(derivativeTransaction).map(mapDerivativeTransaction),
144
- footnotes: toArray(footnote),
145
- remarks: String(remarks),
146
- signatureName: String(signatureName),
147
- signatureDate: String(signatureDate),
65
+ var createTransaction = function () { return ({
66
+ filerName: filterNameText,
67
+ filerPosition: position,
68
+ filerPositionTypes: filerPositionTypes,
69
+ category: 'Non-Derivative',
70
+ securityType: '',
71
+ securityTypeUnderlying: null,
72
+ date: '',
73
+ dateExecuted: null,
74
+ dateExpiration: null,
75
+ dateExercisable: null,
76
+ transactionType: null,
77
+ transactionCode: null,
78
+ transactionDescription: null,
79
+ price: null,
80
+ priceExcercised: null,
81
+ shares: null,
82
+ sharesUnderlying: null,
83
+ sharesEnding: null,
84
+ ownership: '',
85
+ explainationByKey: {},
86
+ }); };
87
+ var getColText = function (colKey) {
88
+ var _a, _b;
89
+ var text = (_a = textMap.get(colKey)) === null || _a === void 0 ? void 0 : _a.replace(/\(\d+\)|\$/g, '');
90
+ return (_b = text === null || text === void 0 ? void 0 : text.trim()) !== null && _b !== void 0 ? _b : '';
148
91
  };
92
+ var headingNonDerivative = [
93
+ 'securityType',
94
+ 'date',
95
+ 'dateExecuted',
96
+ 'transactionCode',
97
+ '',
98
+ 'shares',
99
+ 'transactionType',
100
+ 'price',
101
+ 'sharesEnding',
102
+ 'ownership',
103
+ ];
104
+ var headingDerivative = [
105
+ 'securityType',
106
+ 'priceExcercised',
107
+ 'date',
108
+ 'dateExecuted',
109
+ 'transactionCode',
110
+ '',
111
+ 'shares',
112
+ 'shares',
113
+ 'dateExercisable',
114
+ 'dateExpiration',
115
+ 'securityTypeUnderlying',
116
+ 'sharesUnderlying',
117
+ 'price',
118
+ 'sharesEnding',
119
+ 'ownership',
120
+ ];
121
+ var maxIterations = 10000;
122
+ var transactions = [];
123
+ transactionsNonDerivative: for (var row = 4; row < maxIterations; row++) {
124
+ var transaction = createTransaction();
125
+ transaction.category = 'Non-Derivative';
126
+ // get all non-derivative transactions
127
+ for (var col = 1; col < 11; col++) {
128
+ var colName = ((_c = headingNonDerivative[col - 1]) !== null && _c !== void 0 ? _c : '');
129
+ var colKey = "3.".concat(row, ".").concat(col);
130
+ var text = getColText(colKey);
131
+ var explanationNum = (_f = (_e = ((_d = textMap.get(colKey)) !== null && _d !== void 0 ? _d : '').match(/(?<=\()\d+(?=\))/g)) === null || _e === void 0 ? void 0 : _e[0]) !== null && _f !== void 0 ? _f : null;
132
+ var explanationText = explanationNum ? (_g = textMap.get("5.".concat(Number(explanationNum) + 1, ".1"))) !== null && _g !== void 0 ? _g : '' : null;
133
+ if (colName === '')
134
+ continue;
135
+ if (explanationText !== null)
136
+ transaction.explainationByKey[colName] = explanationText.trim();
137
+ if (!textMap.has(colKey))
138
+ break transactionsNonDerivative;
139
+ switch (colName) {
140
+ case 'transactionType':
141
+ transaction.transactionType = text === 'A' ? 'Acquire' : 'Dispose';
142
+ continue;
143
+ case 'transactionCode':
144
+ transaction.transactionDescription = (_h = codeTranslations[text]) !== null && _h !== void 0 ? _h : '';
145
+ transaction.transactionCode = text;
146
+ continue;
147
+ case 'date':
148
+ transaction.date = toDate(text);
149
+ continue;
150
+ case 'dateExecuted':
151
+ case 'dateExercisable':
152
+ case 'dateExpiration':
153
+ transaction[colName] = toDate(text) || null;
154
+ continue;
155
+ case 'price':
156
+ case 'shares':
157
+ case 'sharesEnding':
158
+ var valueNum = Number(text.replace(/,/g, ''));
159
+ transaction[colName] = text === '' || isNaN(valueNum) ? null : valueNum;
160
+ continue;
161
+ default:
162
+ transaction[colName] = text;
163
+ }
164
+ }
165
+ transactions.push(transaction);
166
+ }
167
+ transactionsDerivative: for (var row = 4; row < maxIterations; row++) {
168
+ var transaction = createTransaction();
169
+ transaction.category = 'Derivative';
170
+ var textSharesAcquired = getColText("4.".concat(row, ".6"));
171
+ var textSharesDisposed = getColText("4.".concat(row, ".7"));
172
+ var sharesAcquired = Number(textSharesAcquired);
173
+ var sharesDisposed = Number(textSharesDisposed);
174
+ if (textSharesAcquired !== '' || textSharesDisposed !== '') {
175
+ transaction.transactionType = sharesAcquired - sharesDisposed > 0 ? 'Acquire' : 'Dispose';
176
+ }
177
+ for (var col = 1; col < 16; col++) {
178
+ var colName = ((_j = headingDerivative[col - 1]) !== null && _j !== void 0 ? _j : '');
179
+ var colKey = "4.".concat(row, ".").concat(col);
180
+ var text = ((_k = textMap.get(colKey)) !== null && _k !== void 0 ? _k : '').replace(/\(\d+\)|\$/g, '').trim();
181
+ var explanationNum = (_o = (_m = ((_l = textMap.get(colKey)) !== null && _l !== void 0 ? _l : '').match(/(?<=\()\d+(?=\))/g)) === null || _m === void 0 ? void 0 : _m[0]) !== null && _o !== void 0 ? _o : null;
182
+ var explanationText = explanationNum ? (_p = textMap.get("5.".concat(Number(explanationNum) + 1, ".1"))) !== null && _p !== void 0 ? _p : '' : null;
183
+ if (colName === '')
184
+ continue;
185
+ if (explanationText !== null)
186
+ transaction.explainationByKey[colName] = explanationText.trim();
187
+ if (!textMap.has(colKey))
188
+ break transactionsDerivative;
189
+ switch (colName) {
190
+ case 'transactionType':
191
+ transaction.transactionType = text === 'A' ? 'Acquire' : 'Dispose';
192
+ continue;
193
+ case 'transactionCode':
194
+ transaction.transactionDescription = (_q = codeTranslations[text]) !== null && _q !== void 0 ? _q : '';
195
+ transaction.transactionCode = text;
196
+ continue;
197
+ case 'dateExecuted':
198
+ case 'dateExercisable':
199
+ case 'dateExpiration':
200
+ transaction[colName] = toDate(text) || null;
201
+ continue;
202
+ case 'price':
203
+ case 'shares':
204
+ case 'sharesUnderlying':
205
+ case 'priceExcercised':
206
+ case 'sharesEnding':
207
+ if (colName === 'shares' && transaction.shares !== null)
208
+ continue;
209
+ var valueNum = Number(text.replace(/,/g, ''));
210
+ transaction[colName] = text === '' || isNaN(valueNum) ? null : valueNum;
211
+ continue;
212
+ default:
213
+ transaction[colName] = text;
214
+ }
215
+ }
216
+ transactions.push(transaction);
217
+ }
218
+ return { transactions: transactions };
149
219
  }
150
220
  exports.parseForm4 = parseForm4;
@@ -1,7 +1,8 @@
1
1
  import { FormDef14aData, XMLParams } from '../../../types';
2
+ import XMLParser from '../XMLParser';
2
3
  /**
3
4
  * Form DEF 14a - Proxy Statement
4
5
  *
5
6
  * example at https://www.sec.gov/Archives/edgar/data/320193/000130817923000019/laap2023_def14a.htm
6
7
  */
7
- export declare function parseFormDef14a(params: XMLParams): FormDef14aData;
8
+ export declare function parseFormDef14a(params: XMLParams, xmlParser?: XMLParser): FormDef14aData;