@cyanheads/secedgar-mcp-server 0.12.5 → 0.13.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.
Files changed (56) hide show
  1. package/README.md +37 -5
  2. package/dist/index.js +5 -1
  3. package/dist/index.js.map +1 -1
  4. package/dist/mcp-server/resources/definitions/concepts.resource.d.ts.map +1 -1
  5. package/dist/mcp-server/resources/definitions/concepts.resource.js +6 -1
  6. package/dist/mcp-server/resources/definitions/concepts.resource.js.map +1 -1
  7. package/dist/mcp-server/tools/definitions/compare-companies.tool.d.ts +89 -0
  8. package/dist/mcp-server/tools/definitions/compare-companies.tool.d.ts.map +1 -0
  9. package/dist/mcp-server/tools/definitions/compare-companies.tool.js +451 -0
  10. package/dist/mcp-server/tools/definitions/compare-companies.tool.js.map +1 -0
  11. package/dist/mcp-server/tools/definitions/fetch-frames.tool.d.ts.map +1 -1
  12. package/dist/mcp-server/tools/definitions/fetch-frames.tool.js +1 -24
  13. package/dist/mcp-server/tools/definitions/fetch-frames.tool.js.map +1 -1
  14. package/dist/mcp-server/tools/definitions/get-filing.tool.d.ts +9 -0
  15. package/dist/mcp-server/tools/definitions/get-filing.tool.d.ts.map +1 -1
  16. package/dist/mcp-server/tools/definitions/get-filing.tool.js +91 -6
  17. package/dist/mcp-server/tools/definitions/get-filing.tool.js.map +1 -1
  18. package/dist/mcp-server/tools/definitions/get-financials.tool.d.ts +1 -0
  19. package/dist/mcp-server/tools/definitions/get-financials.tool.d.ts.map +1 -1
  20. package/dist/mcp-server/tools/definitions/get-financials.tool.js +44 -56
  21. package/dist/mcp-server/tools/definitions/get-financials.tool.js.map +1 -1
  22. package/dist/mcp-server/tools/definitions/get-snapshot.tool.d.ts +81 -0
  23. package/dist/mcp-server/tools/definitions/get-snapshot.tool.d.ts.map +1 -0
  24. package/dist/mcp-server/tools/definitions/get-snapshot.tool.js +262 -0
  25. package/dist/mcp-server/tools/definitions/get-snapshot.tool.js.map +1 -0
  26. package/dist/mcp-server/tools/definitions/search-concepts.tool.d.ts +1 -0
  27. package/dist/mcp-server/tools/definitions/search-concepts.tool.d.ts.map +1 -1
  28. package/dist/mcp-server/tools/definitions/search-concepts.tool.js +9 -1
  29. package/dist/mcp-server/tools/definitions/search-concepts.tool.js.map +1 -1
  30. package/dist/services/edgar/concept-map.d.ts +21 -1
  31. package/dist/services/edgar/concept-map.d.ts.map +1 -1
  32. package/dist/services/edgar/concept-map.js +143 -1
  33. package/dist/services/edgar/concept-map.js.map +1 -1
  34. package/dist/services/edgar/concept-series.d.ts +80 -0
  35. package/dist/services/edgar/concept-series.d.ts.map +1 -0
  36. package/dist/services/edgar/concept-series.js +120 -0
  37. package/dist/services/edgar/concept-series.js.map +1 -0
  38. package/dist/services/edgar/edgar-api-service.d.ts +8 -6
  39. package/dist/services/edgar/edgar-api-service.d.ts.map +1 -1
  40. package/dist/services/edgar/edgar-api-service.js +7 -3
  41. package/dist/services/edgar/edgar-api-service.js.map +1 -1
  42. package/dist/services/edgar/fiscal-periods.d.ts +42 -0
  43. package/dist/services/edgar/fiscal-periods.d.ts.map +1 -0
  44. package/dist/services/edgar/fiscal-periods.js +129 -0
  45. package/dist/services/edgar/fiscal-periods.js.map +1 -0
  46. package/dist/services/edgar/mirror/companyfacts-sync.d.ts +7 -10
  47. package/dist/services/edgar/mirror/companyfacts-sync.d.ts.map +1 -1
  48. package/dist/services/edgar/mirror/companyfacts-sync.js.map +1 -1
  49. package/dist/services/edgar/mirror/edgar-mirror.d.ts +10 -1
  50. package/dist/services/edgar/mirror/edgar-mirror.d.ts.map +1 -1
  51. package/dist/services/edgar/mirror/edgar-mirror.js +35 -1
  52. package/dist/services/edgar/mirror/edgar-mirror.js.map +1 -1
  53. package/dist/services/edgar/types.d.ts +20 -0
  54. package/dist/services/edgar/types.d.ts.map +1 -1
  55. package/package.json +1 -1
  56. package/server.json +3 -3
@@ -2,13 +2,40 @@
2
2
  * @fileoverview Static mapping of friendly financial concept names to XBRL tags.
3
3
  * @module services/edgar/concept-map
4
4
  */
5
- /** Friendly name → XBRL tag mapping. Tags are tried in order for companyconcept lookups. */
5
+ /**
6
+ * Friendly name → XBRL tag mapping. Tags are tried in order for companyconcept
7
+ * lookups, and index 0 is the preferred total when two tags report the same
8
+ * frame (#44).
9
+ *
10
+ * `ifrsTags` is the `ifrs-full` counterpart, used when a caller asks for that
11
+ * taxonomy. Every entry is confirmed present in the live companyfacts of at
12
+ * least one 20-F IFRS filer — an IFRS element existing in the taxonomy is not
13
+ * evidence that filers tag it. A concept with no confirmed IFRS element carries
14
+ * no `ifrsTags` and is reported as a gap rather than mapped to a guess.
15
+ */
6
16
  const CONCEPT_MAP = {
7
17
  revenue: {
8
18
  group: 'income_statement',
19
+ /**
20
+ * ASC 606 splits the top line by whether assessed sales/excise tax is included.
21
+ * The Including variant is the reported total for food, beverage, and tobacco
22
+ * filers, whose ASC 606 election presents revenue gross of tax; without it those
23
+ * filers fall through to the deprecated tags at the end of the array and return
24
+ * a series that stops in 2018 (#98).
25
+ *
26
+ * It sits behind `Revenues`, not ahead of it, because the two do not agree for
27
+ * every filer and `Revenues` was already winning those frames: a brewer tags
28
+ * gross sales under one element and net-of-excise sales under the other, so
29
+ * promoting the Including variant over `Revenues` swaps the definition partway
30
+ * back through the history and prints a year-over-year step that is a tag
31
+ * change, not a business fact. Behind `Revenues` it only fills frames no
32
+ * current tag covers, which is the case #98 is about. Excluding stays at index
33
+ * 0 so a filer reporting both variants still resolves to the net total (#44).
34
+ */
9
35
  tags: [
10
36
  'RevenueFromContractWithCustomerExcludingAssessedTax',
11
37
  'Revenues',
38
+ 'RevenueFromContractWithCustomerIncludingAssessedTax',
12
39
  'SalesRevenueNet',
13
40
  'SalesRevenueGoodsNet',
14
41
  ],
@@ -37,6 +64,7 @@ const CONCEPT_MAP = {
37
64
  operating_income: {
38
65
  group: 'income_statement',
39
66
  tags: ['OperatingIncomeLoss'],
67
+ ifrsTags: ['ProfitLossFromOperatingActivities'],
40
68
  taxonomy: 'us-gaap',
41
69
  unit: 'USD',
42
70
  label: 'Operating Income (Loss)',
@@ -44,6 +72,7 @@ const CONCEPT_MAP = {
44
72
  gross_profit: {
45
73
  group: 'income_statement',
46
74
  tags: ['GrossProfit'],
75
+ ifrsTags: ['GrossProfit'],
47
76
  taxonomy: 'us-gaap',
48
77
  unit: 'USD',
49
78
  label: 'Gross Profit',
@@ -51,6 +80,7 @@ const CONCEPT_MAP = {
51
80
  eps_basic: {
52
81
  group: 'per_share',
53
82
  tags: ['EarningsPerShareBasic'],
83
+ ifrsTags: ['BasicEarningsLossPerShare'],
54
84
  taxonomy: 'us-gaap',
55
85
  unit: 'USD/shares',
56
86
  label: 'Earnings Per Share (Basic)',
@@ -58,6 +88,7 @@ const CONCEPT_MAP = {
58
88
  eps_diluted: {
59
89
  group: 'per_share',
60
90
  tags: ['EarningsPerShareDiluted'],
91
+ ifrsTags: ['DilutedEarningsLossPerShare'],
61
92
  taxonomy: 'us-gaap',
62
93
  unit: 'USD/shares',
63
94
  label: 'Earnings Per Share (Diluted)',
@@ -74,6 +105,7 @@ const CONCEPT_MAP = {
74
105
  liabilities: {
75
106
  group: 'balance_sheet',
76
107
  tags: ['Liabilities'],
108
+ ifrsTags: ['Liabilities'],
77
109
  taxonomy: 'us-gaap',
78
110
  unit: 'USD',
79
111
  label: 'Total Liabilities',
@@ -87,6 +119,13 @@ const CONCEPT_MAP = {
87
119
  note: 'Total equity including noncontrolling interests; the primary line for filers with material minority interests.',
88
120
  },
89
121
  ],
122
+ /**
123
+ * Mirrors the us-gaap split: `EquityAttributableToOwnersOfParent` is the IFRS
124
+ * counterpart of `StockholdersEquity` (parent-attributable) and leads, with the
125
+ * `Equity` roll-up — which includes noncontrolling interests, the counterpart of
126
+ * the relatedTag above — as the fallback for filers that tag only the total.
127
+ */
128
+ ifrsTags: ['EquityAttributableToOwnersOfParent', 'Equity'],
90
129
  taxonomy: 'us-gaap',
91
130
  unit: 'USD',
92
131
  label: "Stockholders' Equity",
@@ -100,6 +139,7 @@ const CONCEPT_MAP = {
100
139
  note: 'Total including restricted cash (the ASU 2016-18 cash-flow reconciliation total); the primary line for many banks and filers with restricted cash.',
101
140
  },
102
141
  ],
142
+ ifrsTags: ['CashAndCashEquivalents'],
103
143
  taxonomy: 'us-gaap',
104
144
  unit: 'USD',
105
145
  label: 'Cash and Cash Equivalents',
@@ -107,6 +147,12 @@ const CONCEPT_MAP = {
107
147
  debt: {
108
148
  group: 'balance_sheet',
109
149
  tags: ['LongTermDebt', 'LongTermDebtNoncurrent'],
150
+ /**
151
+ * `LongtermBorrowings` only — the IFRS `Borrowings` element is total borrowings
152
+ * including the current portion, a different quantity from the long-term line
153
+ * this concept means, so it is not used as a fallback.
154
+ */
155
+ ifrsTags: ['LongtermBorrowings'],
110
156
  taxonomy: 'us-gaap',
111
157
  unit: 'USD',
112
158
  label: 'Long-Term Debt',
@@ -127,6 +173,7 @@ const CONCEPT_MAP = {
127
173
  note: 'Continuing operations only — excludes discontinued operations; some filers report only this variant.',
128
174
  },
129
175
  ],
176
+ ifrsTags: ['CashFlowsFromUsedInOperatingActivities'],
130
177
  taxonomy: 'us-gaap',
131
178
  unit: 'USD',
132
179
  label: 'Operating Cash Flow',
@@ -134,6 +181,7 @@ const CONCEPT_MAP = {
134
181
  capex: {
135
182
  group: 'cash_flow',
136
183
  tags: ['PaymentsToAcquirePropertyPlantAndEquipment'],
184
+ ifrsTags: ['PurchaseOfPropertyPlantAndEquipmentClassifiedAsInvestingActivities'],
137
185
  taxonomy: 'us-gaap',
138
186
  unit: 'USD',
139
187
  label: 'Capital Expenditures',
@@ -141,6 +189,20 @@ const CONCEPT_MAP = {
141
189
  depreciation_amortization: {
142
190
  group: 'cash_flow',
143
191
  tags: ['DepreciationDepletionAndAmortization', 'DepreciationAndAmortization', 'Depreciation'],
192
+ /**
193
+ * Exact counterpart first, approximations behind it: the combined D&A line
194
+ * matching `DepreciationDepletionAndAmortization` at index 0 above, then the
195
+ * variant that folds impairment in with it, then depreciation alone. The
196
+ * middle one runs wider than both its neighbours — it is a fallback for filers
197
+ * that report no separate D&A line, not a widest-first lead. IFRS filers split
198
+ * across all three rather than converging on one, so all three are needed for
199
+ * cross-filer coverage.
200
+ */
201
+ ifrsTags: [
202
+ 'DepreciationAndAmortisationExpense',
203
+ 'DepreciationAmortisationAndImpairmentLossReversalOfImpairmentLossRecognisedInProfitOrLoss',
204
+ 'DepreciationExpense',
205
+ ],
144
206
  taxonomy: 'us-gaap',
145
207
  unit: 'USD',
146
208
  label: 'Depreciation & Amortization',
@@ -148,6 +210,11 @@ const CONCEPT_MAP = {
148
210
  // Distinct from `debt` (which targets long-term debt directly). `notes_payable` prefers
149
211
  // the notes-specific tags and only falls back to LongTermDebt for filers that report it
150
212
  // there exclusively.
213
+ //
214
+ // No `ifrsTags`: IFRS presents borrowings as one caption and has no balance-sheet
215
+ // element for the notes/debt split this concept expresses. Left unmapped rather than
216
+ // pointed at a borrowings total that would silently answer a different question — the
217
+ // concept comes back as a gap under `ifrs-full`, which is the honest result.
151
218
  notes_payable: {
152
219
  group: 'balance_sheet',
153
220
  tags: ['LongTermNotesPayable', 'NotesPayable', 'LongTermDebt'],
@@ -158,7 +225,14 @@ const CONCEPT_MAP = {
158
225
  // Income statement
159
226
  cogs: {
160
227
  group: 'income_statement',
228
+ /**
229
+ * `CostOfGoodsSold` was deprecated in the 2018 taxonomy and survives only as
230
+ * the last fallback, for filers whose history predates the replacement tags.
231
+ * When it wins, the resolved series carries SEC's `(Deprecated …)` label and
232
+ * the reading tools raise a staleness caveat off it (#98).
233
+ */
161
234
  tags: ['CostOfGoodsAndServicesSold', 'CostOfRevenue', 'CostOfGoodsSold'],
235
+ ifrsTags: ['CostOfSales'],
162
236
  taxonomy: 'us-gaap',
163
237
  unit: 'USD',
164
238
  label: 'Cost of Goods Sold',
@@ -166,6 +240,9 @@ const CONCEPT_MAP = {
166
240
  rd_expense: {
167
241
  group: 'income_statement',
168
242
  tags: ['ResearchAndDevelopmentExpense'],
243
+ // The element name is identical in both taxonomies, but the lookup is
244
+ // namespace-scoped, so ifrs-full needs its own entry to resolve.
245
+ ifrsTags: ['ResearchAndDevelopmentExpense'],
169
246
  taxonomy: 'us-gaap',
170
247
  unit: 'USD',
171
248
  label: 'Research & Development Expense',
@@ -173,6 +250,10 @@ const CONCEPT_MAP = {
173
250
  sga_expense: {
174
251
  group: 'income_statement',
175
252
  tags: ['SellingGeneralAndAdministrativeExpense'],
253
+ // Same element name in ifrs-full, and IFRS filers do report the combined
254
+ // caption. The narrower `AdministrativeExpense` is deliberately not a
255
+ // fallback — it excludes selling costs and would understate the line.
256
+ ifrsTags: ['SellingGeneralAndAdministrativeExpense'],
176
257
  taxonomy: 'us-gaap',
177
258
  unit: 'USD',
178
259
  label: 'Selling, General & Administrative Expense',
@@ -180,6 +261,14 @@ const CONCEPT_MAP = {
180
261
  interest_expense: {
181
262
  group: 'income_statement',
182
263
  tags: ['InterestExpense', 'InterestExpenseDebt'],
264
+ /**
265
+ * `InterestExpense` leads because it is the exact counterpart of the us-gaap
266
+ * tag. `FinanceCosts` is the IAS 1 income-statement caption and is broader —
267
+ * it also carries discount unwinding and other financing charges — so it is
268
+ * the fallback for filers that report no separate interest line, not the
269
+ * preferred total. A filer reporting both resolves to the narrower, exact one.
270
+ */
271
+ ifrsTags: ['InterestExpense', 'FinanceCosts'],
183
272
  taxonomy: 'us-gaap',
184
273
  unit: 'USD',
185
274
  label: 'Interest Expense',
@@ -187,6 +276,13 @@ const CONCEPT_MAP = {
187
276
  tax_expense: {
188
277
  group: 'income_statement',
189
278
  tags: ['IncomeTaxExpenseBenefit'],
279
+ /**
280
+ * IFRS names its income-statement tax caption for continuing operations
281
+ * because IAS 1 presents discontinued operations net of tax on a separate
282
+ * line — so this element is the whole tax expense shown on the face of the
283
+ * statement, not a partial one. It is the only tax element IFRS filers tag.
284
+ */
285
+ ifrsTags: ['IncomeTaxExpenseContinuingOperations'],
190
286
  taxonomy: 'us-gaap',
191
287
  unit: 'USD',
192
288
  label: 'Income Tax Expense (Benefit)',
@@ -194,6 +290,7 @@ const CONCEPT_MAP = {
194
290
  stock_based_compensation: {
195
291
  group: 'income_statement',
196
292
  tags: ['ShareBasedCompensation', 'AllocatedShareBasedCompensationExpense'],
293
+ ifrsTags: ['ExpenseFromSharebasedPaymentTransactionsWithEmployees'],
197
294
  taxonomy: 'us-gaap',
198
295
  unit: 'USD',
199
296
  label: 'Stock-Based Compensation',
@@ -202,6 +299,7 @@ const CONCEPT_MAP = {
202
299
  current_assets: {
203
300
  group: 'balance_sheet',
204
301
  tags: ['AssetsCurrent'],
302
+ ifrsTags: ['CurrentAssets'],
205
303
  taxonomy: 'us-gaap',
206
304
  unit: 'USD',
207
305
  label: 'Current Assets',
@@ -209,6 +307,7 @@ const CONCEPT_MAP = {
209
307
  current_liabilities: {
210
308
  group: 'balance_sheet',
211
309
  tags: ['LiabilitiesCurrent'],
310
+ ifrsTags: ['CurrentLiabilities'],
212
311
  taxonomy: 'us-gaap',
213
312
  unit: 'USD',
214
313
  label: 'Current Liabilities',
@@ -216,6 +315,7 @@ const CONCEPT_MAP = {
216
315
  inventory: {
217
316
  group: 'balance_sheet',
218
317
  tags: ['InventoryNet', 'InventoryGross'],
318
+ ifrsTags: ['Inventories'],
219
319
  taxonomy: 'us-gaap',
220
320
  unit: 'USD',
221
321
  label: 'Inventory',
@@ -227,6 +327,16 @@ const CONCEPT_MAP = {
227
327
  'ReceivablesNetCurrent',
228
328
  'AccountsReceivableGrossCurrent',
229
329
  ],
330
+ /**
331
+ * IFRS filers split between a trade-only caption and the combined
332
+ * trade-and-other one; both are needed for cross-filer coverage.
333
+ * `CurrentTradeReceivables` leads because it is the counterpart of
334
+ * `AccountsReceivableNetCurrent` at index 0 above — the combined caption also
335
+ * carries prepayments, deposits, and tax receivables, and for a filer
336
+ * reporting both it runs roughly half again as large, so leading with it
337
+ * would answer the same concept with a different quantity under each taxonomy.
338
+ */
339
+ ifrsTags: ['CurrentTradeReceivables', 'TradeAndOtherCurrentReceivables'],
230
340
  taxonomy: 'us-gaap',
231
341
  unit: 'USD',
232
342
  label: 'Accounts Receivable (Net)',
@@ -234,6 +344,7 @@ const CONCEPT_MAP = {
234
344
  accounts_payable: {
235
345
  group: 'balance_sheet',
236
346
  tags: ['AccountsPayableCurrent'],
347
+ ifrsTags: ['TradeAndOtherCurrentPayables'],
237
348
  taxonomy: 'us-gaap',
238
349
  unit: 'USD',
239
350
  label: 'Accounts Payable',
@@ -241,6 +352,7 @@ const CONCEPT_MAP = {
241
352
  goodwill: {
242
353
  group: 'balance_sheet',
243
354
  tags: ['Goodwill'],
355
+ ifrsTags: ['Goodwill'],
244
356
  taxonomy: 'us-gaap',
245
357
  unit: 'USD',
246
358
  label: 'Goodwill',
@@ -248,6 +360,7 @@ const CONCEPT_MAP = {
248
360
  intangible_assets: {
249
361
  group: 'balance_sheet',
250
362
  tags: ['FiniteLivedIntangibleAssetsNet', 'IntangibleAssetsNetExcludingGoodwill'],
363
+ ifrsTags: ['IntangibleAssetsOtherThanGoodwill'],
251
364
  taxonomy: 'us-gaap',
252
365
  unit: 'USD',
253
366
  label: 'Intangible Assets (Net)',
@@ -256,6 +369,7 @@ const CONCEPT_MAP = {
256
369
  dividends_paid: {
257
370
  group: 'cash_flow',
258
371
  tags: ['PaymentsOfDividends', 'PaymentsOfDividendsCommonStock'],
372
+ ifrsTags: ['DividendsPaid', 'DividendsPaidClassifiedAsFinancingActivities'],
259
373
  taxonomy: 'us-gaap',
260
374
  unit: 'USD',
261
375
  label: 'Dividends Paid',
@@ -267,6 +381,16 @@ const CONCEPT_MAP = {
267
381
  'PaymentsForRepurchaseOfEquity',
268
382
  'StockRepurchasedAndRetiredDuringPeriodValue',
269
383
  ],
384
+ /**
385
+ * `PaymentsToAcquireOrRedeemEntitysShares` leads: it is the IAS 7 financing
386
+ * outflow for buying back own shares however they are then treated, the
387
+ * counterpart of `PaymentsForRepurchaseOfCommonStock` at index 0 above.
388
+ * `PurchaseOfTreasuryShares` counts only the shares a filer holds in treasury,
389
+ * so a filer that cancels repurchased shares tags it zero — or at the value of
390
+ * an employee-scheme purchase — while running a buyback of a wholly different
391
+ * size, and leading with it would report that zero as the buyback.
392
+ */
393
+ ifrsTags: ['PaymentsToAcquireOrRedeemEntitysShares', 'PurchaseOfTreasuryShares'],
270
394
  taxonomy: 'us-gaap',
271
395
  unit: 'USD',
272
396
  label: 'Share Repurchases',
@@ -280,6 +404,7 @@ const CONCEPT_MAP = {
280
404
  note: 'Continuing operations only — excludes discontinued operations; some filers report only this variant.',
281
405
  },
282
406
  ],
407
+ ifrsTags: ['CashFlowsFromUsedInInvestingActivities'],
283
408
  taxonomy: 'us-gaap',
284
409
  unit: 'USD',
285
410
  label: 'Investing Cash Flow',
@@ -293,6 +418,7 @@ const CONCEPT_MAP = {
293
418
  note: 'Continuing operations only — excludes discontinued operations; some filers report only this variant.',
294
419
  },
295
420
  ],
421
+ ifrsTags: ['CashFlowsFromUsedInFinancingActivities'],
296
422
  taxonomy: 'us-gaap',
297
423
  unit: 'USD',
298
424
  label: 'Financing Cash Flow',
@@ -306,6 +432,22 @@ export function resolveConcept(input) {
306
432
  const normalized = input.toLowerCase().replace(/[- ]/g, '_');
307
433
  return CONCEPT_MAP[normalized];
308
434
  }
435
+ /**
436
+ * Resolve a concept input plus a requested taxonomy into the taxonomy and tag
437
+ * list to query. A friendly name that prefers its own taxonomy (`dei` for
438
+ * shares_outstanding) keeps it unless the caller asked for something other than
439
+ * the `us-gaap` default; `ifrs-full` uses the mapping's confirmed IFRS variants
440
+ * when it has them and falls back to the standard tags otherwise. Unknown input
441
+ * passes through as a raw XBRL tag under the requested taxonomy.
442
+ */
443
+ export function resolveConceptTarget(input, requestedTaxonomy) {
444
+ const mapping = resolveConcept(input);
445
+ if (!mapping)
446
+ return { label: input, tags: [input], taxonomy: requestedTaxonomy };
447
+ const taxonomy = requestedTaxonomy === 'us-gaap' ? mapping.taxonomy : requestedTaxonomy;
448
+ const tags = taxonomy === 'ifrs-full' && mapping.ifrsTags?.length ? mapping.ifrsTags : mapping.tags;
449
+ return { label: mapping.label, tags, taxonomy, unit: mapping.unit };
450
+ }
309
451
  /** Get all concept mappings for reference resource generation. */
310
452
  export function getAllConcepts() {
311
453
  return CONCEPT_MAP;
@@ -1 +1 @@
1
- {"version":3,"file":"concept-map.js","sourceRoot":"","sources":["../../../src/services/edgar/concept-map.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,4FAA4F;AAC5F,MAAM,WAAW,GAAmC;IAClD,OAAO,EAAE;QACP,KAAK,EAAE,kBAAkB;QACzB,IAAI,EAAE;YACJ,qDAAqD;YACrD,UAAU;YACV,iBAAiB;YACjB,sBAAsB;SACvB;QACD;;;;;;;WAOG;QACH,QAAQ,EAAE,CAAC,SAAS,EAAE,mCAAmC,CAAC;QAC1D,QAAQ,EAAE,SAAS;QACnB,IAAI,EAAE,KAAK;QACX,KAAK,EAAE,SAAS;KACjB;IACD,UAAU,EAAE;QACV,KAAK,EAAE,kBAAkB;QACzB,IAAI,EAAE,CAAC,eAAe,CAAC;QACvB,6DAA6D;QAC7D,QAAQ,EAAE,CAAC,YAAY,CAAC;QACxB,QAAQ,EAAE,SAAS;QACnB,IAAI,EAAE,KAAK;QACX,KAAK,EAAE,mBAAmB;KAC3B;IACD,gBAAgB,EAAE;QAChB,KAAK,EAAE,kBAAkB;QACzB,IAAI,EAAE,CAAC,qBAAqB,CAAC;QAC7B,QAAQ,EAAE,SAAS;QACnB,IAAI,EAAE,KAAK;QACX,KAAK,EAAE,yBAAyB;KACjC;IACD,YAAY,EAAE;QACZ,KAAK,EAAE,kBAAkB;QACzB,IAAI,EAAE,CAAC,aAAa,CAAC;QACrB,QAAQ,EAAE,SAAS;QACnB,IAAI,EAAE,KAAK;QACX,KAAK,EAAE,cAAc;KACtB;IACD,SAAS,EAAE;QACT,KAAK,EAAE,WAAW;QAClB,IAAI,EAAE,CAAC,uBAAuB,CAAC;QAC/B,QAAQ,EAAE,SAAS;QACnB,IA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CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;QAC9B,MAAM,SAAS,GAAG;YAChB,kBAAkB,CAAC,KAAK,CAAC,IAAI,CAAC;YAC9B,kBAAkB,CAAC,KAAK,CAAC,KAAK,CAAC;YAC/B,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,kBAAkB,CAAC;YACrC,GAAG,CAAC,KAAK,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,kBAAkB,CAAC;YACjD,GAAG,CAAC,KAAK,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;SACnE,CAAC;QACF,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;IACnD,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,80 @@
1
+ /**
2
+ * @fileoverview Frame-aligned XBRL series resolution, shared by every tool that
3
+ * reads company facts. One value per standard calendar period: entries without a
4
+ * `frame` are dropped, same-frame collisions resolve by tag priority (index 0 =
5
+ * the preferred total), and ties within one tag resolve to the latest `filed`
6
+ * date so a restatement replaces the original. Extracted from `get_financials`
7
+ * so the snapshot and comparison tools produce numbers identical to it rather
8
+ * than re-implementing the rules.
9
+ * @module services/edgar/concept-series
10
+ */
11
+ import type { CompanyConceptUnit, CompanyFactsResponse } from './types.js';
12
+ /** A reported value carrying the priority index of the tag that produced it. */
13
+ export interface TagPrioritizedUnit extends CompanyConceptUnit {
14
+ /** Position of the source tag in the concept's tag array. Lower wins a collision. */
15
+ tagIndex: number;
16
+ }
17
+ /** A reported value guaranteed to carry a standard calendar-period frame. */
18
+ export interface FramedUnit extends CompanyConceptUnit {
19
+ frame: string;
20
+ }
21
+ /** Period filter applied to a resolved series. */
22
+ export type PeriodType = 'annual' | 'quarterly' | 'all';
23
+ /**
24
+ * Collapse a company's reported values to one per standard calendar period.
25
+ *
26
+ * Values with no `frame` are non-standard periods and are dropped. When two
27
+ * values share a frame, the one from the lower-priority-index tag wins (index 0
28
+ * is the preferred total, e.g. IFRS `Revenue` over the
29
+ * `RevenueFromContractsWithCustomers` sub-line); within one tag, the later
30
+ * `filed` date wins so an amended filing replaces the original. Returns an empty
31
+ * map when nothing carried a frame — the caller distinguishes that from "the
32
+ * concept is not reported at all".
33
+ */
34
+ export declare function resolveFrameSeries(units: readonly TagPrioritizedUnit[]): Map<string, FramedUnit>;
35
+ /**
36
+ * Caveat for a concept that resolved to a tag SEC has retired from the taxonomy.
37
+ *
38
+ * A friendly name is a priority-ordered list of tags, and the lookup walks it
39
+ * until one returns data. When every current tag comes back empty for a filer,
40
+ * a deprecated tag at the end of the list can still match and produce a series
41
+ * that looks complete but stops around the tag's retirement — the failure is
42
+ * otherwise silent, since nothing in the values themselves says the tag is dead.
43
+ * The signal is the taxonomy label SEC already ships with the payload, so this
44
+ * generalizes to any concept whose fallback chain reaches a retired tag rather
45
+ * than to one hard-coded pair.
46
+ *
47
+ * Returns an empty array for a current tag, which is the common case.
48
+ */
49
+ export declare function deprecatedTagCaveats(tag: string, label: string): string[];
50
+ /**
51
+ * Whether a frame belongs to the requested period type. `fp` reflects the source
52
+ * filing rather than the data point, so the frame label is the only reliable
53
+ * period key.
54
+ */
55
+ export declare function matchesPeriodType(frame: string, periodType: PeriodType): boolean;
56
+ /** One concept resolved out of a companyfacts payload. */
57
+ export interface ConceptSeries {
58
+ /** XBRL taxonomy description. Absent for company-extension and older tags. */
59
+ description?: string;
60
+ /** Human-readable label from the taxonomy. */
61
+ label: string;
62
+ /** Frame-aligned values, newest first. Empty when the tag reports no framed periods. */
63
+ series: FramedUnit[];
64
+ /** The tag that produced the values. */
65
+ tag: string;
66
+ /** Every tag attempted, in priority order. */
67
+ tagsTried: string[];
68
+ /** Taxonomy the values were read from. */
69
+ taxonomy: string;
70
+ /** Unit of measure key (e.g. `USD`, `USD/shares`, `shares`). */
71
+ unit: string;
72
+ }
73
+ /**
74
+ * Resolve one concept from a companyfacts payload, applying the same tag
75
+ * priority and frame dedup as {@link resolveFrameSeries}. Returns `undefined`
76
+ * when the filer reports none of the candidate tags under this taxonomy, which
77
+ * the caller surfaces as a gap alongside the tags it tried.
78
+ */
79
+ export declare function seriesFromCompanyFacts(facts: CompanyFactsResponse, taxonomy: string, tags: readonly string[]): ConceptSeries | undefined;
80
+ //# sourceMappingURL=concept-series.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"concept-series.d.ts","sourceRoot":"","sources":["../../../src/services/edgar/concept-series.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAE3E,gFAAgF;AAChF,MAAM,WAAW,kBAAmB,SAAQ,kBAAkB;IAC5D,qFAAqF;IACrF,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,6EAA6E;AAC7E,MAAM,WAAW,UAAW,SAAQ,kBAAkB;IACpD,KAAK,EAAE,MAAM,CAAC;CACf;AAED,kDAAkD;AAClD,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,WAAW,GAAG,KAAK,CAAC;AAgBxD;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,SAAS,kBAAkB,EAAE,GAAG,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAoBhG;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAMzE;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,GAAG,OAAO,CAIhF;AAED,0DAA0D;AAC1D,MAAM,WAAW,aAAa;IAC5B,8EAA8E;IAC9E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8CAA8C;IAC9C,KAAK,EAAE,MAAM,CAAC;IACd,wFAAwF;IACxF,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,wCAAwC;IACxC,GAAG,EAAE,MAAM,CAAC;IACZ,8CAA8C;IAC9C,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,0CAA0C;IAC1C,QAAQ,EAAE,MAAM,CAAC;IACjB,gEAAgE;IAChE,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,oBAAoB,EAC3B,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,SAAS,MAAM,EAAE,GACtB,aAAa,GAAG,SAAS,CA0B3B"}
@@ -0,0 +1,120 @@
1
+ /**
2
+ * @fileoverview Frame-aligned XBRL series resolution, shared by every tool that
3
+ * reads company facts. One value per standard calendar period: entries without a
4
+ * `frame` are dropped, same-frame collisions resolve by tag priority (index 0 =
5
+ * the preferred total), and ties within one tag resolve to the latest `filed`
6
+ * date so a restatement replaces the original. Extracted from `get_financials`
7
+ * so the snapshot and comparison tools produce numbers identical to it rather
8
+ * than re-implementing the rules.
9
+ * @module services/edgar/concept-series
10
+ */
11
+ /**
12
+ * SEC stamps a retired element's retirement date into the taxonomy label it
13
+ * serves with every companyconcept and companyfacts payload — e.g.
14
+ * `"Sales Revenue, Goods, Net (Deprecated 2018-01-31)"`. Matching it is the whole
15
+ * staleness signal; no extra upstream call is involved.
16
+ */
17
+ const DEPRECATED_LABEL = /\(Deprecated\s+(\d{4}-\d{2}-\d{2})\)/i;
18
+ /** Annual duration frame — `CY2023`. */
19
+ const ANNUAL_FRAME = /^CY\d{4}$/;
20
+ /** Quarterly frame — `CY2023Q3` (duration) or `CY2023Q3I` (instant). */
21
+ const QUARTERLY_FRAME = /^CY\d{4}Q\d/;
22
+ /**
23
+ * Collapse a company's reported values to one per standard calendar period.
24
+ *
25
+ * Values with no `frame` are non-standard periods and are dropped. When two
26
+ * values share a frame, the one from the lower-priority-index tag wins (index 0
27
+ * is the preferred total, e.g. IFRS `Revenue` over the
28
+ * `RevenueFromContractsWithCustomers` sub-line); within one tag, the later
29
+ * `filed` date wins so an amended filing replaces the original. Returns an empty
30
+ * map when nothing carried a frame — the caller distinguishes that from "the
31
+ * concept is not reported at all".
32
+ */
33
+ export function resolveFrameSeries(units) {
34
+ const byFrame = new Map();
35
+ for (const unit of units) {
36
+ const { frame } = unit;
37
+ if (!frame)
38
+ continue;
39
+ const existing = byFrame.get(frame);
40
+ if (!existing ||
41
+ unit.tagIndex < existing.tagIndex ||
42
+ (unit.tagIndex === existing.tagIndex && unit.filed > existing.filed)) {
43
+ byFrame.set(frame, { ...unit, frame });
44
+ }
45
+ }
46
+ const resolved = new Map();
47
+ for (const [frame, { tagIndex: _tagIndex, ...unit }] of byFrame) {
48
+ resolved.set(frame, unit);
49
+ }
50
+ return resolved;
51
+ }
52
+ /**
53
+ * Caveat for a concept that resolved to a tag SEC has retired from the taxonomy.
54
+ *
55
+ * A friendly name is a priority-ordered list of tags, and the lookup walks it
56
+ * until one returns data. When every current tag comes back empty for a filer,
57
+ * a deprecated tag at the end of the list can still match and produce a series
58
+ * that looks complete but stops around the tag's retirement — the failure is
59
+ * otherwise silent, since nothing in the values themselves says the tag is dead.
60
+ * The signal is the taxonomy label SEC already ships with the payload, so this
61
+ * generalizes to any concept whose fallback chain reaches a retired tag rather
62
+ * than to one hard-coded pair.
63
+ *
64
+ * Returns an empty array for a current tag, which is the common case.
65
+ */
66
+ export function deprecatedTagCaveats(tag, label) {
67
+ const match = DEPRECATED_LABEL.exec(label);
68
+ if (!match?.[1])
69
+ return [];
70
+ return [
71
+ `XBRL tag ${tag} was retired from the taxonomy on ${match[1]} — SEC labels it "${label}". It matched only because every current tag ahead of it in this concept's priority list reports nothing for this filer, so the series can end years before the filer's latest report. Check secedgar_search_concepts for the concept's full tag list, or pass the tag this filer reports today.`,
72
+ ];
73
+ }
74
+ /**
75
+ * Whether a frame belongs to the requested period type. `fp` reflects the source
76
+ * filing rather than the data point, so the frame label is the only reliable
77
+ * period key.
78
+ */
79
+ export function matchesPeriodType(frame, periodType) {
80
+ if (periodType === 'annual')
81
+ return ANNUAL_FRAME.test(frame);
82
+ if (periodType === 'quarterly')
83
+ return QUARTERLY_FRAME.test(frame);
84
+ return true;
85
+ }
86
+ /**
87
+ * Resolve one concept from a companyfacts payload, applying the same tag
88
+ * priority and frame dedup as {@link resolveFrameSeries}. Returns `undefined`
89
+ * when the filer reports none of the candidate tags under this taxonomy, which
90
+ * the caller surfaces as a gap alongside the tags it tried.
91
+ */
92
+ export function seriesFromCompanyFacts(facts, taxonomy, tags) {
93
+ const namespace = facts.facts[taxonomy];
94
+ if (!namespace)
95
+ return;
96
+ const units = [];
97
+ const tagsTried = [];
98
+ let resolved;
99
+ for (const [tagIndex, tag] of tags.entries()) {
100
+ tagsTried.push(tag);
101
+ const concept = namespace[tag];
102
+ if (!concept?.units)
103
+ continue;
104
+ for (const [unitKey, values] of Object.entries(concept.units)) {
105
+ resolved ??= {
106
+ tag,
107
+ label: concept.label ?? tag,
108
+ unit: unitKey,
109
+ ...(concept.description !== undefined ? { description: concept.description } : {}),
110
+ };
111
+ for (const value of values)
112
+ units.push({ ...value, tagIndex });
113
+ }
114
+ }
115
+ if (!resolved)
116
+ return;
117
+ const series = [...resolveFrameSeries(units).values()].sort((a, b) => b.end.localeCompare(a.end));
118
+ return { ...resolved, series, tagsTried, taxonomy };
119
+ }
120
+ //# sourceMappingURL=concept-series.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"concept-series.js","sourceRoot":"","sources":["../../../src/services/edgar/concept-series.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAkBH;;;;;GAKG;AACH,MAAM,gBAAgB,GAAG,uCAAuC,CAAC;AAEjE,wCAAwC;AACxC,MAAM,YAAY,GAAG,WAAW,CAAC;AAEjC,wEAAwE;AACxE,MAAM,eAAe,G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,KAAK,CAAC,IAAI,CAAC,EAAE,GAAG,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;QACjE,CAAC;IACH,CAAC;IACD,IAAI,CAAC,QAAQ;QAAE,OAAO;IAEtB,MAAM,MAAM,GAAG,CAAC,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAClG,OAAO,EAAE,GAAG,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC;AACtD,CAAC"}
@@ -5,7 +5,7 @@
5
5
  * @module services/edgar/edgar-api-service
6
6
  */
7
7
  import { type FilingDocumentHeader } from './filing-headers.js';
8
- import type { CikMatch, CompanyConceptResponse, EftsResponse, FilingIndex, FilingsRecent, FramesResponse, FullIndexEntry, SubmissionsResponse } from './types.js';
8
+ import type { CikMatch, CompanyConceptResponse, CompanyFactsResponse, EftsResponse, FilingIndex, FilingsRecent, FramesResponse, FullIndexEntry, SubmissionsResponse } from './types.js';
9
9
  /** A candidate suggestion from the trigram scan on no-result name search. */
10
10
  export interface CompanySuggestion {
11
11
  cik: string;
@@ -142,12 +142,14 @@ declare class EdgarApiService {
142
142
  reportDate: string;
143
143
  }>>;
144
144
  /**
145
- * Fetch all XBRL facts for a company. Returns `null` on 404.
146
- * Used on the no-data error path to surface which namespaces and tags a filer actually uses.
145
+ * Fetch every XBRL fact a company has reported. Returns `null` on 404.
146
+ * Backs the whole-company reads (`get_snapshot`, `compare_companies`) and the
147
+ * no-data error path, which surfaces the namespaces and tags a filer uses.
148
+ * Served from the local mirror when enabled and synced — the mirror stores one
149
+ * row per (cik, taxonomy, tag) and reassembles the API shape off a `cik` point
150
+ * lookup; the live API is the fallback.
147
151
  */
148
- tryGetCompanyFacts(cik: string): Promise<{
149
- facts: Record<string, Record<string, unknown>>;
150
- } | null>;
152
+ tryGetCompanyFacts(cik: string): Promise<CompanyFactsResponse | null>;
151
153
  /**
152
154
  * Fetch XBRL data for a concept. Returns `null` if the company does not report this tag.
153
155
  * Served from the local mirror when enabled and synced; the live API is the