@robosystems/report-components 0.1.4 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/index.d.ts +1 -1
- package/dist/adapters/index.js +1 -1
- package/dist/chunk-DGP4KRWF.js +721 -0
- package/dist/chunk-DGP4KRWF.js.map +1 -0
- package/dist/index-WkjE6dZu.d.ts +427 -0
- package/dist/index.d.ts +108 -21
- package/dist/index.js +832 -198
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-JTTICHPF.js +0 -273
- package/dist/chunk-JTTICHPF.js.map +0 -1
- package/dist/index-DDFpPfUd.d.ts +0 -208
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/constants.ts","../src/format.ts","../src/adapters/sec.ts","../src/adapters/cypher.ts","../src/adapters/store.ts","../src/adapters/jsonld.ts"],"names":["qname","periodType","Store"],"mappings":";;;;AAQO,IAAM,EAAA,GAAK;AAAA,EAChB,GAAA,EAAK,6CAAA;AAAA,EACL,EAAA,EAAI,+BAAA;AAAA,EACJ,MAAA,EAAQ,6CAAA;AAAA,EACR,IAAA,EAAM,sCAAA;AAAA,EACN,KAAA,EAAO,+BAAA;AAAA,EACP,KAAA,EAAO,oCAAA;AAAA,EACP,IAAA,EAAM,oCAAA;AAAA,EACN,OAAA,EAAS;AACX;AAGO,IAAM,GAAA,GAAM;AAAA,EACjB,IAAA,EAAM,GAAG,GAAA,GAAM,MAAA;AAAA;AAAA,EAEf,MAAA,EAAQ,GAAG,EAAA,GAAK,QAAA;AAAA,EAChB,IAAA,EAAM,GAAG,EAAA,GAAK,MAAA;AAAA,EACd,gBAAA,EAAkB,GAAG,EAAA,GAAK,kBAAA;AAAA,EAC1B,SAAA,EAAW,GAAG,EAAA,GAAK,WAAA;AAAA,EACnB,WAAA,EAAa,GAAG,EAAA,GAAK,aAAA;AAAA,EACrB,OAAA,EAAS,GAAG,EAAA,GAAK,SAAA;AAA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AA;AAAA,IACA,SAAA;AAAA,IACA,MAAA;AAAA,IACA,iBAAA;AAAA,IACA,UAAA;AAAA,IACA,KAAA;AAAA,IACA,QAAA;AAAA,IACA,OAAA;AAAA,IACA,KAAA;AAAA,IACA,gBAAA;AAAA,IACA;AAAA,GACF;AACF;ACzLA,eAAsB,YAAY,GAAA,EAAiD;AACjF,EAAA,MAAM,OAAQ,OAAO,GAAA,KAAQ,WAAW,IAAA,CAAK,KAAA,CAAM,GAAG,CAAA,GAAI,GAAA;AAG1D,EAAA,MAAM,MAAA,GAAU,MAAM,MAAA,CAAO,KAAA,CAAM,MAAM,EAAE,MAAA,EAAQ,uBAAuB,CAAA;AAC1E,EAAA,MAAM,KAAA,GAAQ,IAAIC,KAAAA,CAAM,IAAI,MAAA,CAAO,EAAE,MAAA,EAAQ,qBAAA,EAAuB,CAAA,CAAE,KAAA,CAAM,MAAM,CAAC,CAAA;AACnF,EAAA,OAAO,WAAW,KAAK,CAAA;AACzB;AAGO,SAAS,iBAAA,CAAkB,GAAA,EAAsB,MAAA,GAAS,cAAA,EAA+B;AAC9F,EAAA,OAAO;AAAA,IACL,MAAA;AAAA,IACA,IAAA,EAAM,MAAM,WAAA,CAAY,GAAG;AAAA,GAC7B;AACF","file":"chunk-DGP4KRWF.js","sourcesContent":["/**\n * RDF vocabulary and display helpers shared across adapters and projection.\n *\n * A report holon mixes several vocabularies: `rs:` for structure, `skos:` for\n * human labels, and the XBRL family (`xlink:` / `xbrli:` / `link:`) for the\n * networks. These constants are the single source of truth for the full IRIs.\n */\n\nexport const NS = {\n rdf: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',\n rs: 'https://robosystems.ai/vocab/',\n rsgaap: 'https://robosystems.ai/taxonomy/rs-gaap/v1/',\n skos: 'http://www.w3.org/2004/02/skos/core#',\n xlink: 'http://www.w3.org/1999/xlink#',\n xbrli: 'http://www.xbrl.org/2003/instance#',\n link: 'http://www.xbrl.org/2003/linkbase#',\n iso4217: 'http://www.xbrl.org/2003/iso4217#',\n} as const\n\n/** Frequently-referenced full IRIs, pre-concatenated for terseness. */\nexport const IRI = {\n type: NS.rdf + 'type',\n // rs: classes\n Report: NS.rs + 'Report',\n Fact: NS.rs + 'Fact',\n InformationBlock: NS.rs + 'InformationBlock',\n Structure: NS.rs + 'Structure',\n Association: NS.rs + 'Association',\n Element: NS.rs + 'Element',\n Period: NS.rs + 'Period',\n Unit: NS.rs + 'Unit',\n Entity: NS.rs + 'Entity',\n // rs: predicates\n element: NS.rs + 'element',\n period: NS.rs + 'period',\n unit: NS.rs + 'unit',\n entity: NS.rs + 'entity',\n factSet: NS.rs + 'factSet',\n numericValue: NS.rs + 'numericValue',\n decimals: NS.rs + 'decimals',\n blockType: NS.rs + 'blockType',\n associationType: NS.rs + 'associationType',\n hasAssociation: NS.rs + 'hasAssociation',\n roleUri: NS.rs + 'roleUri',\n structureName: NS.rs + 'structureName',\n abstract: NS.rs + 'abstract',\n monetary: NS.rs + 'monetary',\n legalName: NS.rs + 'legalName',\n country: NS.rs + 'country',\n // skos:\n prefLabel: NS.skos + 'prefLabel',\n // xlink:\n from: NS.xlink + 'from',\n to: NS.xlink + 'to',\n role: NS.xlink + 'role',\n // xbrli:\n instant: NS.xbrli + 'instant',\n startDate: NS.xbrli + 'startDate',\n endDate: NS.xbrli + 'endDate',\n periodType: NS.xbrli + 'periodType',\n balance: NS.xbrli + 'balance',\n measure: NS.xbrli + 'measure',\n // link:\n order: NS.link + 'order',\n weight: NS.link + 'weight',\n} as const\n\n/**\n * Prefixes for compacting concept IRIs to `prefix:Local`. Order matters — the\n * most specific namespace must come first so `rs-gaap:` wins over `rs:`.\n */\nconst PREFIXES: ReadonlyArray<readonly [string, string]> = [\n ['rs-gaap', NS.rsgaap],\n ['disclosures', 'https://robosystems.ai/taxonomy/rs-gaap/disclosures/v1/'],\n ['us-gaap', 'http://fasb.org/us-gaap/'],\n ['dei', 'http://xbrl.sec.gov/dei/'],\n ['rs', NS.rs],\n ['skos', NS.skos],\n ['xbrli', NS.xbrli],\n ['xlink', NS.xlink],\n ['link', NS.link],\n ['iso4217', NS.iso4217],\n]\n\n/** Compact a concept IRI to `prefix:Local` (e.g. `rs-gaap:Assets`). */\nexport function qname(iri: string): string {\n for (const [prefix, ns] of PREFIXES) {\n if (iri.startsWith(ns)) {\n return `${prefix}:${iri.slice(ns.length)}`\n }\n }\n const slash = iri.lastIndexOf('/')\n const hash = iri.lastIndexOf('#')\n return iri.slice(Math.max(slash, hash) + 1)\n}\n\n/**\n * Readable concept name from a local name when no `skos:prefLabel` is present —\n * splits CamelCase into words (`AssetsCurrent` → `Assets Current`). A graceful\n * fallback for bundles that predate label emit.\n */\nexport function humanize(iri: string): string {\n const local = qname(iri).split(':').pop() ?? iri\n return local.replace(/(?<=[a-z0-9])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])/g, ' ')\n}\n\n/**\n * A large text-block / policy fact whose HTML (or plain-text) body is too big to\n * store inline, so the platform externalizes it to the public CDN and the fact's\n * value is the URL (`…/fact_<hash>.html` or `.txt`). The renderer fetches and\n * embeds these instead of printing the raw link.\n */\nexport function isExternalFactUrl(value: string | null | undefined): boolean {\n return !!value && /^https?:\\/\\/\\S+\\/fact_[0-9a-f]+\\.(html|txt)$/i.test(value)\n}\n\n/** Stable display order for the canonical statement blocks; others fall after. */\nexport const BLOCK_ORDER: Record<string, number> = {\n balance_sheet: 0,\n income_statement: 1,\n cash_flow_statement: 2,\n equity_statement: 3,\n}\n\n/** Friendly section headings keyed by block type. */\nexport const BLOCK_TITLES: Record<string, string> = {\n balance_sheet: 'Balance Sheet',\n income_statement: 'Income Statement',\n cash_flow_statement: 'Cash Flow Statement',\n equity_statement: 'Statement of Changes in Equity',\n}\n","/**\n * Pure formatting helpers shared by the projection and the components. No React\n * here, so the projection can depend on it without pulling in a renderer.\n */\nimport type { ElementInfo, NumericKind, PeriodInfo } from './model'\n\n/**\n * Accounting-style money: negatives in parentheses, no sign, an em-dash for\n * absent values. Matches the RoboLedger statement renderer.\n */\nexport function formatMoney(\n value: number | null | undefined,\n opts: { currencySymbol?: string } = {}\n): string {\n if (value === null || value === undefined || Number.isNaN(value)) return '—'\n const symbol = opts.currencySymbol ?? '$'\n const abs = Math.abs(value).toLocaleString('en-US', {\n minimumFractionDigits: 2,\n maximumFractionDigits: 2,\n })\n return value < 0 ? `${symbol}(${abs})` : `${symbol}${abs}`\n}\n\nconst MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']\n\n/** `2024-03-31` → `Mar 31, 2024`. Falls back to the raw string if unparseable. */\nexport function formatDate(iso: string | null | undefined): string {\n if (!iso) return ''\n const m = /^(\\d{4})-(\\d{2})-(\\d{2})/.exec(iso)\n if (!m) return iso\n const [, year, month, day] = m\n const idx = Number(month) - 1\n return `${MONTHS[idx] ?? month} ${Number(day)}, ${year}`\n}\n\n/**\n * Humanize an ISO-8601 duration value (`P10Y` → \"10 years\", `P1Y6M` → \"1 year 6\n * months\", `P30D` → \"30 days\"), or null when the string is not a duration — so a\n * non-numeric fact that happens to start with \"P\" (a company name) is untouched.\n * XBRL `durationItemType` facts (debt maturities, lease terms) arrive as these\n * strings in the text path.\n */\nexport function humanizeDuration(value: string | null | undefined): string | null {\n if (!value) return null\n const m =\n /^(-)?P(?:(\\d+)Y)?(?:(\\d+)M)?(?:(\\d+)W)?(?:(\\d+)D)?(?:T(?:(\\d+)H)?(?:(\\d+)M)?(?:(\\d+(?:\\.\\d+)?)S)?)?$/.exec(\n value.trim()\n )\n if (!m) return null\n const [, sign, y, mo, w, d, h, min, s] = m\n const parts: string[] = []\n const push = (n: string | undefined, unit: string): void => {\n if (n) parts.push(`${n} ${unit}${Number(n) === 1 ? '' : 's'}`)\n }\n push(y, 'year')\n push(mo, 'month')\n push(w, 'week')\n push(d, 'day')\n push(h, 'hour')\n push(min, 'minute')\n push(s, 'second')\n if (!parts.length) return null\n return `${sign ?? ''}${parts.join(' ')}`\n}\n\n/** A human description of a period — \"As of …\" for instants, a span for durations. */\nexport function formatPeriod(period: PeriodInfo): string {\n if (period.type === 'instant') {\n return `As of ${formatDate(period.instant ?? period.end)}`\n }\n return `${formatDate(period.startDate)} – ${formatDate(period.endDate ?? period.end)}`\n}\n\n/** The effective numeric kind of an element (explicit, else derived from monetary). */\nexport function numericKindOf(el: ElementInfo): NumericKind {\n return el.numericKind ?? (el.monetary ? 'monetary' : 'other')\n}\n\n/** Common currency symbols by ISO-4217 code; null for a non-currency unit. */\nconst CURRENCY_SYMBOLS: Record<string, string> = {\n USD: '$',\n EUR: '€',\n GBP: '£',\n JPY: '¥',\n CNY: '¥',\n CHF: 'CHF ',\n CAD: 'CA$',\n AUD: 'A$',\n HKD: 'HK$',\n INR: '₹',\n KRW: '₩',\n}\n\n/**\n * A display prefix for a monetary unit measure (`iso4217:USD` → `$`), else null.\n * Unknown currencies fall back to their code (`CHF `, `SEK `) rather than a wrong\n * dollar sign — this is what fixes non-USD facts rendering as `$`.\n */\nexport function currencySymbolFor(measure: string | null | undefined): string | null {\n if (!measure) return null\n const code = (measure.includes(':') ? measure.split(':').pop()! : measure).toUpperCase()\n if (CURRENCY_SYMBOLS[code]) return CURRENCY_SYMBOLS[code]\n // A currency-shaped code (3 letters) we don't have a glyph for → code prefix.\n return /^[A-Z]{3}$/.test(code) ? `${code} ` : null\n}\n\nexport interface ValueFormat {\n /** Drives symbol, scaling opt-out, and decimal places. Defaults to `monetary`. */\n numericKind?: NumericKind\n /** Currency symbol for monetary/per-share values (from the fact's unit). */\n symbol?: string | null\n /** Divide monetary values by this (e.g. 1e6 to show millions); default 1. */\n scaleFactor?: number\n}\n\n/**\n * Format a fact value for display: accounting style (negatives in parentheses,\n * em-dash for absent), the fact's own currency symbol (never a hard-coded `$`),\n * and the section scale — with per-share amounts and share counts never rescaled\n * (an EPS of 4.93 stays 4.93 under \"in millions\"). A `percent` fact stores a\n * decimal fraction, so it is scaled ×100 and suffixed with `%` (0.10 → 10%); a\n * `pure` fact is a bare ratio, shown as a plain decimal (no `%`).\n */\nexport function formatValue(value: number | null | undefined, fmt: ValueFormat = {}): string {\n if (value === null || value === undefined || Number.isNaN(value)) return '—'\n const kind = fmt.numericKind ?? 'monetary'\n const scale = kind === 'monetary' ? (fmt.scaleFactor ?? 1) : 1\n const scaled = kind === 'percent' ? value * 100 : value / scale\n\n let minFrac = 0\n let maxFrac = 0\n if (kind === 'perShare') {\n minFrac = maxFrac = 2\n } else if (kind === 'monetary') {\n minFrac = maxFrac = scale > 1 ? 0 : 2\n } else if (kind === 'percent') {\n maxFrac = 2\n } else if (kind === 'pure') {\n maxFrac = 4\n }\n\n const abs = Math.abs(scaled).toLocaleString('en-US', {\n minimumFractionDigits: minFrac,\n maximumFractionDigits: maxFrac,\n })\n const symbol = kind === 'monetary' || kind === 'perShare' ? (fmt.symbol ?? '') : ''\n const suffix = kind === 'percent' ? '%' : ''\n return scaled < 0 ? `${symbol}(${abs}${suffix})` : `${symbol}${abs}${suffix}`\n}\n","/**\n * The SEC adapter — reconstructs a report from the live SEC EDGAR graph\n * (`graph_id = \"sec\"`) via read-only Cypher, one section at a time.\n *\n * A single SEC filing is a large graph: a 10-K is ~90 `Structure`s (the 5 core\n * statements plus dozens of disclosure/document networks), thousands of facts.\n * Loading the whole thing up front is slow, so this module splits the work:\n *\n * - `fetchSecReportShell` — one fast pass that returns the entity + the ordered\n * **section list** (each `Structure` with its title, kind, and factset ids).\n * - `fetchSecSection` — on demand, the facts + presentation/calculation network\n * for **one** section, assembled into a single-section `NormalizedReport` the\n * shared projection/components render unchanged.\n *\n * The library stays transport-agnostic: the caller injects a `SecQuery` (a thin\n * wrapper over `POST /v1/graphs/sec/query`); this module owns only the Cypher and\n * the row → model mapping.\n *\n * ── Query rules (load-bearing; verified against the live graph) ────────────────\n * These are not stylistic — violating them turns a ~120 ms query into a ~14 s one:\n * 1. **Anchor on a primary key.** Lead per-section queries with a direct\n * `{identifier: $id}` match on `FactSet`/`Structure` (indexed). Never expand a\n * whole `Report`'s facts, and never use `WHERE x.identifier IN [list]` (a scan,\n * not an index probe) — issue one query per factset instead.\n * 3. **Always carry a `WHERE f.value IS NOT NULL` predicate** on the fact scan and\n * **always `LIMIT`.** Both flip the planner onto the fast path (~120 ms vs ~7 s).\n * `value` (the raw string) is present on every fact, so this keeps numeric and\n * text facts alike.\n * 4. **No `OPTIONAL MATCH`.** An optional unit join alone cost ~12 s; units come\n * from a separate required-join query, merged client-side.\n * 5. Aggregations must `ORDER BY <alias>` (not `s.number`); `end` is reserved, so\n * alias every `p.end_date AS end_date`.\n */\nimport { humanize, qname as toQname } from '../constants'\nimport { currencySymbolFor } from '../format'\nimport type {\n CalcAssociation,\n DimensionQualifier,\n ElementInfo,\n EntityInfo,\n Fact,\n InformationBlock,\n NormalizedReport,\n NumericKind,\n PeriodInfo,\n PeriodType,\n PresAssociation,\n StructureInfo,\n UnitInfo,\n} from '../model'\n\n/** Injected transport — runs a read-only Cypher query and returns its rows. */\nexport type SecQuery = (\n cypher: string,\n params?: Record<string, unknown>\n) => Promise<Array<Record<string, unknown>>>\n\n/** One navigable section of a filing (a `Structure` + its facts). */\nexport interface SecSection {\n /** `Structure.identifier` — the section id + the anchor for its associations. */\n id: string\n /** Human title, e.g. \"Consolidated Balance Sheets\" (definition prefix stripped). */\n title: string\n /** Coarse grouping for the table of contents. */\n kind: 'Statement' | 'Disclosure' | 'Document' | 'Cover' | 'Other'\n /** `canonical_type` when the section is a recognized core statement, else null. */\n canonicalType: string | null\n /** Filing sequence (position in the ordered section list). */\n order: number\n /** `FactSet.identifier`s whose facts belong to this section. */\n factsetIds: string[]\n}\n\n/** The fast first read: entity + the ordered section list, no fact bodies. */\nexport interface SecReportShell {\n reportId: string\n entity: EntityInfo | null\n sections: SecSection[]\n}\n\n// ── Cypher ────────────────────────────────────────────────────────────────────\n\nconst ENTITY_META_Q = `\nMATCH (ent:Entity)-[:ENTITY_HAS_REPORT]->(r:Report {identifier: $rid})\nRETURN ent.identifier AS entity_id, ent.name AS entity_name,\n ent.legal_name AS legal_name, ent.cik AS cik, ent.ticker AS ticker,\n r.form AS form, r.report_date AS report_date`\n\n// Structures reachable from this report's facts, with their factsets. Dimensional\n// facts belong to the same factsets as their consolidated totals, so no\n// `has_dimensions` filter is needed — dropping it also surfaces sections whose\n// content is entirely dimensional (e.g. Schedule II). ORDER BY the alias (Kùzu\n// requires it once `collect` aggregates).\nconst SECTIONS_Q = `\nMATCH (r:Report {identifier: $rid})-[:REPORT_HAS_FACT]->(f:Fact)<-[:FACT_SET_CONTAINS_FACT]-(fs:FactSet)<-[:STRUCTURE_HAS_FACT_SET]-(s:Structure)\nRETURN s.identifier AS sid, s.canonical_type AS canonical_type,\n s.definition AS definition, s.number AS number,\n collect(DISTINCT fs.identifier) AS factsets\nORDER BY number`\n\n// Facts for one factset. Anchored on the factset PK; dimensional and consolidated\n// facts alike come through — the pivot engine keys cells by the full aspect\n// signature (element + period + dimensional coordinate), so segment/component\n// breakdowns no longer collide with the total. Element type signals\n// (`item_type`, `is_shares`) drive the value's numeric kind (monetary / per-share\n// / shares). `WHERE f.value IS NOT NULL` + `LIMIT` keep it on the fast path and\n// retain text facts (Cover Page etc.).\nconst FACTS_Q = `\nMATCH (fs:FactSet {identifier: $fsid})-[:FACT_SET_CONTAINS_FACT]->(f:Fact)-[:FACT_HAS_ELEMENT]->(e:Element),\n (f)-[:FACT_HAS_PERIOD]->(p:Period)\nWHERE f.value IS NOT NULL\nRETURN f.identifier AS fid, e.qname AS qname, e.name AS ename, e.balance AS balance,\n e.period_type AS e_period_type, e.is_abstract AS is_abstract, e.is_numeric AS is_numeric,\n e.item_type AS item_type, e.is_shares AS is_shares,\n f.numeric_value AS numeric_value, f.value AS raw_value, f.decimals AS decimals,\n p.identifier AS pid, p.period_type AS period_type,\n p.start_date AS start_date, p.end_date AS end_date\nLIMIT 2000`\n\n// Unit measures for the same factset, as a separate required-join query — an\n// OPTIONAL unit join on the facts query alone cost ~12 s.\nconst UNITS_Q = `\nMATCH (fs:FactSet {identifier: $fsid})-[:FACT_SET_CONTAINS_FACT]->(f:Fact)-[:FACT_HAS_UNIT]->(u:Unit)\nWHERE f.value IS NOT NULL\nRETURN f.identifier AS fid, u.measure AS unit\nLIMIT 2000`\n\n// Dimensional qualifiers for the same factset — again a separate required-join\n// query (never OPTIONAL) so a fact with no dimensions simply contributes no rows.\n// One row per (fact, axis); a multi-axis fact yields several, merged client-side.\nconst DIMS_Q = `\nMATCH (fs:FactSet {identifier: $fsid})-[:FACT_SET_CONTAINS_FACT]->(f:Fact)-[:FACT_HAS_DIMENSION]->(d:Dimension)\nWHERE f.value IS NOT NULL\nRETURN f.identifier AS fid, d.axis AS axis, d.member AS member,\n d.axis_uri AS axis_uri, d.member_uri AS member_uri,\n d.is_explicit AS is_explicit, d.is_typed AS is_typed\nLIMIT 4000`\n\n// The presentation + calculation networks for one section, anchored on the\n// Structure PK. `association_type` is `Presentation` / `Calculation`. Element\n// names + `is_abstract` come along so presentation-only nodes (abstract section\n// headers, which carry no facts) can be registered — without them the projection\n// can't tell a header from a concrete line and mis-orders it.\nconst ASSOC_Q = `\nMATCH (s:Structure {identifier: $sid})-[:STRUCTURE_HAS_ASSOCIATION]->(a:Association),\n (a)-[:ASSOCIATION_HAS_FROM_ELEMENT]->(pe:Element),\n (a)-[:ASSOCIATION_HAS_TO_ELEMENT]->(ce:Element)\nRETURN a.association_type AS association_type, a.order_value AS order_value, a.weight AS weight,\n pe.qname AS parent, pe.name AS parent_name, pe.is_abstract AS parent_abstract,\n ce.qname AS child, ce.name AS child_name, ce.is_abstract AS child_abstract`\n\n// ── Row helpers ────────────────────────────────────────────────────────────────\n\nfunction str(row: Record<string, unknown>, key: string): string | null {\n const v = row[key]\n return typeof v === 'string' && v !== '' ? v : v == null ? null : String(v)\n}\n\nfunction num(row: Record<string, unknown>, key: string): number | null {\n const v = row[key]\n if (v === null || v === undefined || v === '') return null\n const n = typeof v === 'number' ? v : Number(v)\n return Number.isNaN(n) ? null : n\n}\n\nfunction bool(row: Record<string, unknown>, key: string): boolean {\n const v = row[key]\n return v === true || v === 'true'\n}\n\nfunction periodType(raw: string | null): PeriodType | null {\n return raw === 'instant' || raw === 'duration' ? raw : null\n}\n\n/**\n * A prefixed qname for a dimension axis/member from its versioned XBRL IRI + local\n * name (`http://fasb.org/us-gaap/2025#…Member` + `…Member` → `us-gaap:…Member`).\n * The graph gives axis/member as bare local names; this keeps them consistent with\n * the `Element.qname`s used in the presentation network (so member ordering lines\n * up), and cell matching is internally consistent regardless (row + column derive\n * from the same mapping).\n */\nfunction xbrlQname(uri: string | null, local: string | null): string {\n if (local) {\n const ns = (uri ?? '').split('#')[0]\n if (/fasb\\.org\\/us-gaap/.test(ns)) return `us-gaap:${local}`\n if (/fasb\\.org\\/srt/.test(ns)) return `srt:${local}`\n if (/xbrl\\.sec\\.gov\\/dei/.test(ns)) return `dei:${local}`\n if (/robosystems\\.ai\\/taxonomy\\/rs-gaap/.test(ns)) return `rs-gaap:${local}`\n return local\n }\n return uri ? toQname(uri) : ''\n}\n\n/** Humanize an axis/member local name, dropping the XBRL `Axis`/`Member`/`Domain` suffix. */\nfunction dimLabel(local: string | null): string {\n if (!local) return ''\n return humanize(local.replace(/(Axis|Member|Domain)$/, '')) || humanize(local)\n}\n\n/**\n * Classify an element's numeric kind from its XBRL `item_type` (+ `is_shares`).\n * Per-share and share counts opt out of monetary rescaling; strings/text are not\n * numeric. Checked before monetary because share/per-share types are also numeric.\n */\nfunction deriveNumericKind(row: Record<string, unknown>): NumericKind | undefined {\n const itemType = str(row, 'item_type') ?? ''\n if (/perShareItemType/i.test(itemType)) return 'perShare'\n if (/sharesItemType/i.test(itemType) || bool(row, 'is_shares')) return 'shares'\n // A percentItemType stores a decimal fraction (0.10 → 10%); a pureItemType is a\n // bare dimensionless ratio (2.5 debt-to-equity), NOT a percentage.\n if (/percentItemType/i.test(itemType)) return 'percent'\n if (/pureItemType/i.test(itemType)) return 'pure'\n if (/monetaryItemType/i.test(itemType)) return 'monetary'\n if (/integerItemType/i.test(itemType)) return 'integer'\n if (!bool(row, 'is_numeric')) return undefined\n // No item_type (older captures): a debit/credit balance marks a monetary item.\n const balance = str(row, 'balance')\n return balance === 'debit' || balance === 'credit' ? 'monetary' : 'other'\n}\n\n/**\n * The primary financial statements. Only these `canonical_type`s belong in the\n * TOC's \"Financial Statements\" group — other canonical types (rollforwards,\n * hierarchies, `(Details)` networks) are disclosures, classified by their\n * definition's type word instead.\n */\nconst CORE_STATEMENT_TYPES = new Set([\n 'balance_sheet',\n 'income_statement',\n 'cash_flow_statement',\n 'equity_statement',\n 'comprehensive_income',\n])\n\n/**\n * Split an XBRL `Structure.definition` into a human title + a coarse kind.\n * Definitions look like `\"9952153 - Statement - Consolidated Balance Sheets\"` or\n * `\"0000001 - Document - Cover Page\"` — a `\"NNNN - <Type> - <Title>\"` shape whose\n * middle word (Statement / Disclosure / Document) drives the kind. A core\n * canonical statement always reads as a Statement so the primaries group cleanly.\n */\nexport function parseStructureDefinition(\n definition: string | null,\n canonicalType: string | null\n): { title: string; kind: SecSection['kind'] } {\n const raw = (definition ?? '').trim()\n const parts = raw.split(' - ')\n let type = ''\n let title = raw\n if (parts.length >= 3) {\n type = parts[1].trim()\n title = parts.slice(2).join(' - ').trim()\n } else if (parts.length === 2) {\n title = parts[1].trim()\n }\n\n let kind: SecSection['kind'] = 'Other'\n if (/cover/i.test(title)) kind = 'Cover'\n else if (type === 'Statement') kind = 'Statement'\n else if (type === 'Disclosure') kind = 'Disclosure'\n else if (type === 'Document') kind = 'Document'\n // A core statement is always a Statement; a non-core canonical type (e.g.\n // GoodwillRollForward) stays whatever its definition type word made it.\n if (canonicalType && CORE_STATEMENT_TYPES.has(canonicalType)) kind = 'Statement'\n\n return { title: title || raw || canonicalType || 'Section', kind }\n}\n\n// ── Shell ───────────────────────────────────────────────────────────────────\n\nfunction mapEntity(row: Record<string, unknown> | undefined): EntityInfo | null {\n if (!row) return null\n const id = str(row, 'entity_id')\n if (!id) return null\n return {\n id,\n name: str(row, 'entity_name') ?? str(row, 'legal_name') ?? 'Entity',\n legalName: str(row, 'legal_name'),\n country: null,\n }\n}\n\n/** Fetch the entity + ordered section list for a report (the fast first read). */\nexport async function fetchSecReportShell(\n query: SecQuery,\n reportId: string\n): Promise<SecReportShell> {\n const [entityRows, sectionRows] = await Promise.all([\n query(ENTITY_META_Q, { rid: reportId }),\n query(SECTIONS_Q, { rid: reportId }),\n ])\n\n const sections: SecSection[] = sectionRows\n .map((row, order): SecSection => {\n const { title, kind } = parseStructureDefinition(\n str(row, 'definition'),\n str(row, 'canonical_type')\n )\n const factsets = Array.isArray(row.factsets)\n ? (row.factsets as unknown[]).filter((v): v is string => typeof v === 'string')\n : []\n return {\n id: str(row, 'sid') ?? '',\n title,\n kind,\n canonicalType: str(row, 'canonical_type'),\n order,\n factsetIds: factsets,\n }\n })\n .filter((s) => s.id && s.factsetIds.length > 0)\n\n return { reportId, entity: mapEntity(entityRows[0]), sections }\n}\n\n// ── Single section ────────────────────────────────────────────────────────────\n\nfunction accumulateElement(elements: Record<string, ElementInfo>, row: Record<string, unknown>) {\n const q = str(row, 'qname')\n if (!q || elements[q]) return\n const balance = str(row, 'balance')\n elements[q] = {\n id: q,\n qname: q,\n label: str(row, 'ename') ? humanize(str(row, 'ename') as string) : humanize(q),\n balance: balance === 'debit' || balance === 'credit' ? balance : null,\n periodType: periodType(str(row, 'e_period_type')),\n abstract: bool(row, 'is_abstract'),\n monetary: bool(row, 'is_numeric'),\n numericKind: deriveNumericKind(row),\n }\n}\n\n/**\n * Register a presentation-network element that has no facts of its own — chiefly\n * an abstract section header. Fact-bearing elements are already registered from\n * the facts query and take precedence (this no-ops on existing keys); this fills\n * in the abstract headers so the projection renders them as headers above their\n * section rather than as empty concrete rows below it. Abstract labels drop the\n * XBRL `Abstract` suffix (`OperatingExpensesAbstract` → `Operating Expenses`).\n */\nfunction registerPresentationElement(\n elements: Record<string, ElementInfo>,\n qname: string | null,\n name: string | null,\n isAbstract: boolean\n): void {\n if (!qname || elements[qname]) return\n elements[qname] = {\n id: qname,\n qname,\n label: name ? humanize(isAbstract ? name.replace(/Abstract$/, '') : name) : humanize(qname),\n balance: null,\n periodType: null,\n abstract: isAbstract,\n monetary: false,\n }\n}\n\nfunction accumulatePeriod(periods: Record<string, PeriodInfo>, row: Record<string, unknown>) {\n const id = str(row, 'pid')\n if (!id || periods[id]) return\n const type = periodType(str(row, 'period_type')) ?? 'duration'\n const startDate = str(row, 'start_date')\n const endDate = str(row, 'end_date')\n periods[id] = {\n id,\n type,\n instant: type === 'instant' ? endDate : null,\n startDate,\n endDate,\n end: endDate ?? '',\n }\n}\n\n/**\n * Load one section into a single-section `NormalizedReport`. All of the\n * section's facts are re-keyed to the structure id as their `factSet`, so the\n * projection groups them as one Information Block regardless of how many raw\n * FactSets the filing split them across.\n */\nexport async function fetchSecSection(\n query: SecQuery,\n shell: SecReportShell,\n section: SecSection\n): Promise<NormalizedReport> {\n const [factRowGroups, unitRowGroups, dimRowGroups, assocRows] = await Promise.all([\n Promise.all(section.factsetIds.map((fsid) => query(FACTS_Q, { fsid }))),\n Promise.all(section.factsetIds.map((fsid) => query(UNITS_Q, { fsid }))),\n Promise.all(section.factsetIds.map((fsid) => query(DIMS_Q, { fsid }))),\n query(ASSOC_Q, { sid: section.id }),\n ])\n\n const unitByFid = new Map<string, string>()\n for (const row of unitRowGroups.flat()) {\n const fid = str(row, 'fid')\n const measure = str(row, 'unit')\n if (fid && measure) unitByFid.set(fid, measure)\n }\n\n // One fact can carry several axes; collect its qualifiers (ordered by axis).\n const dimsByFid = new Map<string, DimensionQualifier[]>()\n for (const row of dimRowGroups.flat()) {\n const fid = str(row, 'fid')\n if (!fid) continue\n const memberLocal = str(row, 'member')\n const qual: DimensionQualifier = {\n axis: xbrlQname(str(row, 'axis_uri'), str(row, 'axis')),\n member: memberLocal ? xbrlQname(str(row, 'member_uri'), memberLocal) : null,\n axisLabel: dimLabel(str(row, 'axis')),\n memberLabel: dimLabel(memberLocal),\n explicit: bool(row, 'is_explicit'),\n typedValue: bool(row, 'is_typed') ? str(row, 'member') : null,\n }\n const list = dimsByFid.get(fid) ?? []\n list.push(qual)\n dimsByFid.set(fid, list)\n }\n for (const list of dimsByFid.values()) list.sort((a, b) => a.axis.localeCompare(b.axis))\n\n const elements: Record<string, ElementInfo> = {}\n const periods: Record<string, PeriodInfo> = {}\n const units: Record<string, UnitInfo> = {}\n const facts: Fact[] = []\n const seenFacts = new Set<string>()\n\n for (const row of factRowGroups.flat()) {\n const fid = str(row, 'fid')\n const element = str(row, 'qname')\n const period = str(row, 'pid')\n if (!fid || !element || !period || seenFacts.has(fid)) continue\n seenFacts.add(fid)\n\n accumulateElement(elements, row)\n accumulatePeriod(periods, row)\n\n const measure = unitByFid.get(fid) ?? null\n if (measure && !units[measure]) {\n const compact = toQname(measure)\n units[measure] = {\n id: measure,\n measure: compact,\n label: compact.includes(':') ? (compact.split(':').pop() as string) : compact,\n symbol: currencySymbolFor(compact),\n }\n }\n\n const value = num(row, 'numeric_value')\n facts.push({\n id: fid,\n element,\n period,\n unit: measure,\n entity: shell.entity?.id ?? null,\n factSet: section.id,\n value,\n decimals: str(row, 'decimals'),\n textValue: value === null ? str(row, 'raw_value') : null,\n dimensions: dimsByFid.get(fid),\n })\n }\n\n const calcAssociations: CalcAssociation[] = []\n const presAssociations: PresAssociation[] = []\n for (const row of assocRows) {\n const parent = str(row, 'parent')\n const child = str(row, 'child')\n if (!parent || !child) continue\n // Register presentation-only elements (abstract section headers carry no\n // facts, so the facts query never saw them). Fact-bearing elements are\n // already registered and unaffected — registration no-ops on existing keys.\n registerPresentationElement(\n elements,\n parent,\n str(row, 'parent_name'),\n bool(row, 'parent_abstract')\n )\n registerPresentationElement(\n elements,\n child,\n str(row, 'child_name'),\n bool(row, 'child_abstract')\n )\n const order = num(row, 'order_value') ?? 0\n const type = str(row, 'association_type')?.toLowerCase()\n if (type === 'calculation') {\n calcAssociations.push({\n parent,\n child,\n weight: num(row, 'weight') ?? 1,\n order,\n role: null,\n structure: section.id,\n })\n } else if (type === 'presentation') {\n presAssociations.push({ parent, child, order, role: null, structure: section.id })\n }\n }\n\n const informationBlock: InformationBlock = {\n id: section.id,\n blockType: section.canonicalType ?? '',\n factSet: section.id,\n label: section.title,\n structureId: section.id,\n }\n const structure: StructureInfo = {\n id: section.id,\n blockType: section.canonicalType ?? '',\n roleUri: null,\n structureName: section.title,\n order: section.order,\n }\n\n return {\n reportId: shell.reportId,\n reportIri: null,\n entity: shell.entity,\n informationBlocks: [informationBlock],\n structures: [structure],\n facts,\n elements,\n periods,\n units,\n calcAssociations,\n presAssociations,\n }\n}\n\n/** Merge single-section reports into one whole-report model (order preserved). */\nexport function mergeSecSections(\n shell: SecReportShell,\n sections: NormalizedReport[]\n): NormalizedReport {\n const elements: Record<string, ElementInfo> = {}\n const periods: Record<string, PeriodInfo> = {}\n const units: Record<string, UnitInfo> = {}\n const informationBlocks: InformationBlock[] = []\n const structures: StructureInfo[] = []\n const facts: Fact[] = []\n const calcAssociations: CalcAssociation[] = []\n const presAssociations: PresAssociation[] = []\n\n for (const part of sections) {\n Object.assign(elements, part.elements)\n Object.assign(periods, part.periods)\n Object.assign(units, part.units)\n informationBlocks.push(...part.informationBlocks)\n structures.push(...part.structures)\n facts.push(...part.facts)\n calcAssociations.push(...part.calcAssociations)\n presAssociations.push(...part.presAssociations)\n }\n\n return {\n reportId: shell.reportId,\n reportIri: null,\n entity: shell.entity,\n informationBlocks,\n structures,\n facts,\n elements,\n periods,\n units,\n calcAssociations,\n presAssociations,\n }\n}\n","/**\n * The cypher adapter — a whole-report `ReportAdapter` over the live SEC graph.\n *\n * This is a convenience wrapper: it loads the section list, then every section,\n * and merges them into one `NormalizedReport`. Apps that want responsive,\n * lazy-per-section loading should call `fetchSecReportShell` + `fetchSecSection`\n * directly (see `./sec`) rather than materializing a whole filing up front.\n */\nimport type { SecQuery } from './sec'\nimport { fetchSecReportShell, fetchSecSection, mergeSecSections } from './sec'\nimport type { ReportAdapter } from './types'\n\nexport interface CypherAdapterConfig {\n /** Injected transport over `POST /v1/graphs/{graphId}/query` (auth lives here). */\n query: SecQuery\n /** The report to materialize — a `Report.identifier`. */\n reportId: string\n}\n\nexport function cypherAdapter(config: CypherAdapterConfig): ReportAdapter {\n return {\n source: `sec:${config.reportId}`,\n load: async () => {\n const shell = await fetchSecReportShell(config.query, config.reportId)\n const sections = await Promise.all(\n shell.sections.map((section) => fetchSecSection(config.query, shell, section))\n )\n return mergeSecSections(shell, sections)\n },\n }\n}\n","/**\n * The shared quad-store → `NormalizedReport` traversal.\n *\n * An adapter fills an N3 quad `Store` from its source, then hands it here. The\n * store is read as a **union** across its graphs (`graph = null`) — the\n * scene/boundary/projection partition is a publication concern, not a rendering\n * one, so the join is identical however the quads arrived (a dataset-form\n * JSON-LD holon, a flat graph, …). No SPARQL engine is required; only store\n * traversal. The only per-source code is how the store gets filled.\n */\nimport { DataFactory, Store } from 'n3'\nimport { IRI, humanize, qname } from '../constants'\nimport type {\n CalcAssociation,\n ElementInfo,\n EntityInfo,\n Fact,\n InformationBlock,\n NormalizedReport,\n PeriodInfo,\n PeriodType,\n PresAssociation,\n StructureInfo,\n UnitInfo,\n} from '../model'\n\nconst { namedNode } = DataFactory\n\nfunction makeReaders(store: Store) {\n const objects = (s: string, p: string) => store.getObjects(namedNode(s), namedNode(p), null)\n const firstValue = (s: string, p: string): string | null => {\n const os = objects(s, p)\n return os.length ? os[0].value : null\n }\n const subjectsOfType = (type: string): string[] =>\n store.getSubjects(namedNode(IRI.type), namedNode(type), null).map((t) => t.value)\n return { objects, firstValue, subjectsOfType }\n}\n\nfunction toNumber(raw: string | null): number | null {\n if (raw === null || raw === '') return null\n const n = Number(raw)\n return Number.isNaN(n) ? null : n\n}\n\n/** Traverse a populated quad `Store` into the normalized report model. */\nexport function parseStore(store: Store): NormalizedReport {\n const { objects, firstValue, subjectsOfType } = makeReaders(store)\n\n // ── Elements ──\n const elements: Record<string, ElementInfo> = {}\n for (const id of subjectsOfType(IRI.Element)) {\n const balance = firstValue(id, IRI.balance)\n const periodType = firstValue(id, IRI.periodType)\n elements[id] = {\n id,\n qname: qname(id),\n label: firstValue(id, IRI.prefLabel) ?? humanize(id),\n balance: balance === 'debit' || balance === 'credit' ? balance : null,\n periodType: periodType === 'instant' || periodType === 'duration' ? periodType : null,\n abstract: firstValue(id, IRI.abstract) === 'true',\n monetary: firstValue(id, IRI.monetary) === 'true',\n }\n }\n\n // ── Periods ──\n const periods: Record<string, PeriodInfo> = {}\n for (const id of subjectsOfType(IRI.Period)) {\n const declared = firstValue(id, IRI.periodType)\n const instant = firstValue(id, IRI.instant)\n const startDate = firstValue(id, IRI.startDate)\n const endDate = firstValue(id, IRI.endDate)\n const type: PeriodType =\n declared === 'instant'\n ? 'instant'\n : declared === 'duration'\n ? 'duration'\n : instant\n ? 'instant'\n : 'duration'\n const end = (type === 'instant' ? instant : endDate) ?? instant ?? endDate ?? ''\n periods[id] = { id, type, instant, startDate, endDate, end }\n }\n\n // ── Units ──\n const units: Record<string, UnitInfo> = {}\n for (const id of subjectsOfType(IRI.Unit)) {\n const measureTerm = objects(id, IRI.measure)[0]\n const measure = measureTerm ? qname(measureTerm.value) : 'unknown'\n units[id] = {\n id,\n measure,\n label: measure.includes(':') ? (measure.split(':').pop() as string) : measure,\n }\n }\n\n // ── Entity ──\n let entity: EntityInfo | null = null\n const entityIds = subjectsOfType(IRI.Entity)\n if (entityIds.length) {\n const id = entityIds[0]\n entity = {\n id,\n name: firstValue(id, IRI.prefLabel) ?? firstValue(id, IRI.legalName) ?? 'Entity',\n legalName: firstValue(id, IRI.legalName),\n country: firstValue(id, IRI.country),\n }\n }\n\n // ── Facts ──\n const facts: Fact[] = []\n for (const id of subjectsOfType(IRI.Fact)) {\n facts.push({\n id,\n element: firstValue(id, IRI.element) ?? '',\n period: firstValue(id, IRI.period) ?? '',\n unit: firstValue(id, IRI.unit),\n entity: firstValue(id, IRI.entity),\n factSet: firstValue(id, IRI.factSet),\n value: toNumber(firstValue(id, IRI.numericValue)),\n decimals: firstValue(id, IRI.decimals),\n })\n }\n\n // ── Information Blocks ──\n const informationBlocks: InformationBlock[] = []\n for (const id of subjectsOfType(IRI.InformationBlock)) {\n informationBlocks.push({\n id,\n blockType: firstValue(id, IRI.blockType) ?? '',\n factSet: firstValue(id, IRI.factSet),\n label: firstValue(id, IRI.prefLabel),\n })\n }\n\n // ── Structures + association → structure membership ──\n const structures: StructureInfo[] = []\n const assocStructure = new Map<string, string>()\n for (const id of subjectsOfType(IRI.Structure)) {\n structures.push({\n id,\n blockType: firstValue(id, IRI.blockType) ?? '',\n roleUri: firstValue(id, IRI.roleUri),\n structureName: firstValue(id, IRI.structureName),\n })\n for (const assoc of objects(id, IRI.hasAssociation)) {\n assocStructure.set(assoc.value, id)\n }\n }\n\n // ── Associations ──\n const calcAssociations: CalcAssociation[] = []\n const presAssociations: PresAssociation[] = []\n for (const id of subjectsOfType(IRI.Association)) {\n const parent = firstValue(id, IRI.from)\n const child = firstValue(id, IRI.to)\n if (!parent || !child) continue\n const type = firstValue(id, IRI.associationType)\n const order = toNumber(firstValue(id, IRI.order)) ?? 0\n const role = firstValue(id, IRI.role)\n const structure = assocStructure.get(id) ?? null\n if (type === 'calculation') {\n calcAssociations.push({\n parent,\n child,\n weight: toNumber(firstValue(id, IRI.weight)) ?? 1,\n order,\n role,\n structure,\n })\n } else if (type === 'presentation') {\n presAssociations.push({ parent, child, order, role, structure })\n }\n }\n\n // ── Report IRI / id ──\n // Prefer the named-graph name (`<report>#scene` → `<report>`) — present in a\n // dataset-form holon. Fall back to the `rs:Report` subject so a flat,\n // single-graph document still resolves its identity.\n let reportIri: string | null = null\n for (const graph of store.getGraphs(null, null, null)) {\n const hash = graph.value.indexOf('#')\n if (hash > 0) {\n reportIri = graph.value.slice(0, hash)\n break\n }\n }\n if (!reportIri) {\n const reports = subjectsOfType(IRI.Report)\n reportIri = reports.length ? reports[0] : null\n }\n const reportId = reportIri ? (reportIri.split('/').pop() ?? null) : null\n\n return {\n reportId,\n reportIri,\n entity,\n informationBlocks,\n structures,\n facts,\n elements,\n periods,\n units,\n calcAssociations,\n presAssociations,\n }\n}\n","/**\n * The `holon.jsonld` adapter — offline, no backend, no auth.\n *\n * The canonical, API-native holon: **dataset-form JSON-LD** carrying the three\n * named graphs (`#scene`, `#boundary`, `#projection`) as `@id` + nested\n * `@graph`. JSON is native to the RoboSystems JSON API, so this is the one\n * holon file format.\n *\n * N3.js doesn't parse JSON-LD, so this adapter uses the `jsonld` processor to\n * expand the document to N-Quads (which preserves the named-graph labels),\n * parses those into an N3 quad `Store`, and delegates to the shared\n * `parseStore` traversal (`store.ts`).\n */\nimport type { JsonLdDocument } from 'jsonld'\nimport jsonld from 'jsonld'\nimport { Parser, Store } from 'n3'\nimport type { NormalizedReport } from '../model'\nimport { parseStore } from './store'\nimport type { ReportAdapter } from './types'\n\n/** Parse a `holon.jsonld` document (string or parsed object) into the model. */\nexport async function parseJsonld(doc: string | object): Promise<NormalizedReport> {\n const json = (typeof doc === 'string' ? JSON.parse(doc) : doc) as JsonLdDocument\n // `toRDF` with the n-quads format returns a serialized string; each quad\n // carries its graph label, so the holon's named graphs survive the expansion.\n const nquads = (await jsonld.toRDF(json, { format: 'application/n-quads' })) as string\n const store = new Store(new Parser({ format: 'application/n-quads' }).parse(nquads))\n return parseStore(store)\n}\n\n/** A `ReportAdapter` over an in-memory `holon.jsonld` document. */\nexport function jsonldFileAdapter(doc: string | object, source = 'holon.jsonld'): ReportAdapter {\n return {\n source,\n load: () => parseJsonld(doc),\n }\n}\n"]}
|
|
@@ -0,0 +1,427 @@
|
|
|
1
|
+
import { Store } from 'n3';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The normalized report model — the load-bearing seam of the library.
|
|
5
|
+
*
|
|
6
|
+
* An **adapter** turns its source (a `holon.jsonld` file, a cypher endpoint, a
|
|
7
|
+
* live ledger) into a `NormalizedReport`: the raw facts, Information Blocks,
|
|
8
|
+
* elements / periods / units / entity, and the calculation + presentation
|
|
9
|
+
* association networks. Nothing more.
|
|
10
|
+
*
|
|
11
|
+
* The **projection** (`project.ts`) and **components** turn that normalized
|
|
12
|
+
* model into rendered statements — the presentation-order walk, the calculation
|
|
13
|
+
* subtotals, the table layout. That work is identical for every adapter, which
|
|
14
|
+
* is what makes the rendering source-agnostic.
|
|
15
|
+
*/
|
|
16
|
+
type PeriodType = 'instant' | 'duration';
|
|
17
|
+
type BalanceType = 'debit' | 'credit';
|
|
18
|
+
/**
|
|
19
|
+
* How a numeric fact is formatted and whether it may be rescaled. Monetary values
|
|
20
|
+
* take the unit's currency symbol and honor the section scale; per-share amounts
|
|
21
|
+
* and share counts are never rescaled (an EPS of 4.93 stays 4.93 under "in
|
|
22
|
+
* millions"); percentages render with a `%` suffix. Absent → the formatter falls
|
|
23
|
+
* back to `monetary ? 'monetary' : 'other'`.
|
|
24
|
+
*/
|
|
25
|
+
type NumericKind = 'monetary' | 'perShare' | 'shares' | 'percent' | 'pure' | 'integer' | 'other';
|
|
26
|
+
/** A reportable concept (a taxonomy element). */
|
|
27
|
+
interface ElementInfo {
|
|
28
|
+
/** Full element IRI — the join key used everywhere. */
|
|
29
|
+
id: string;
|
|
30
|
+
/** Compacted name, e.g. `rs-gaap:Assets`. */
|
|
31
|
+
qname: string;
|
|
32
|
+
/** Human label (`skos:prefLabel`, else a humanized local name). */
|
|
33
|
+
label: string;
|
|
34
|
+
balance: BalanceType | null;
|
|
35
|
+
periodType: PeriodType | null;
|
|
36
|
+
abstract: boolean;
|
|
37
|
+
monetary: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Finer numeric classification driving format + scale (per-share and share
|
|
40
|
+
* counts opt out of rescaling). Optional; when absent the formatter falls back
|
|
41
|
+
* to `monetary ? 'monetary' : 'other'`.
|
|
42
|
+
*/
|
|
43
|
+
numericKind?: NumericKind;
|
|
44
|
+
}
|
|
45
|
+
/** A reporting period — an instant (balance sheet) or a duration (flows). */
|
|
46
|
+
interface PeriodInfo {
|
|
47
|
+
id: string;
|
|
48
|
+
type: PeriodType;
|
|
49
|
+
instant: string | null;
|
|
50
|
+
startDate: string | null;
|
|
51
|
+
endDate: string | null;
|
|
52
|
+
/** The date a fact lands on: `instant` for instants, `endDate` for durations. */
|
|
53
|
+
end: string;
|
|
54
|
+
}
|
|
55
|
+
/** A unit of measure, e.g. USD. */
|
|
56
|
+
interface UnitInfo {
|
|
57
|
+
id: string;
|
|
58
|
+
/** Compacted measure, e.g. `iso4217:USD`. */
|
|
59
|
+
measure: string;
|
|
60
|
+
/** Short display label, e.g. `USD`. */
|
|
61
|
+
label: string;
|
|
62
|
+
/**
|
|
63
|
+
* Currency symbol for a monetary unit (`$`, `€`, `£`, `¥`), else null — a share
|
|
64
|
+
* or pure unit has none. Lets the renderer stop hard-coding `$` for non-USD.
|
|
65
|
+
* Optional; when absent the formatter derives it from `measure`.
|
|
66
|
+
*/
|
|
67
|
+
symbol?: string | null;
|
|
68
|
+
}
|
|
69
|
+
/** The reporting entity. */
|
|
70
|
+
interface EntityInfo {
|
|
71
|
+
id: string;
|
|
72
|
+
name: string;
|
|
73
|
+
legalName: string | null;
|
|
74
|
+
country: string | null;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* One dimensional qualifier on a fact: an axis pinned to a member. A fact's full
|
|
78
|
+
* dimensional coordinate is an ordered list of these (one per axis); an empty
|
|
79
|
+
* list is the consolidated total. Explicit dimensions name a `member`; typed
|
|
80
|
+
* dimensions carry a `typedValue` instead. This is the only multi-valued fact
|
|
81
|
+
* aspect, and it is what separates otherwise-identical facts (same element +
|
|
82
|
+
* period) into distinct pivot cells — so it is part of a fact's identity.
|
|
83
|
+
*/
|
|
84
|
+
interface DimensionQualifier {
|
|
85
|
+
/** Axis element IRI/qname, e.g. `us-gaap:StatementEquityComponentsAxis`. */
|
|
86
|
+
axis: string;
|
|
87
|
+
/** Member element IRI/qname (explicit), or null for a typed dimension. */
|
|
88
|
+
member: string | null;
|
|
89
|
+
/** Human axis label, e.g. `Equity Components`. */
|
|
90
|
+
axisLabel: string;
|
|
91
|
+
/** Human member label, e.g. `Common Stock`. */
|
|
92
|
+
memberLabel: string;
|
|
93
|
+
/** Explicit (member drawn from a domain) vs typed (an arbitrary value). */
|
|
94
|
+
explicit: boolean;
|
|
95
|
+
/** The typed-dimension value, present when `!explicit`. */
|
|
96
|
+
typedValue?: string | null;
|
|
97
|
+
}
|
|
98
|
+
/** A single reported value. */
|
|
99
|
+
interface Fact {
|
|
100
|
+
id: string;
|
|
101
|
+
/** Element IRI. */
|
|
102
|
+
element: string;
|
|
103
|
+
/** Period IRI. */
|
|
104
|
+
period: string;
|
|
105
|
+
/** Unit IRI, when monetary/numeric. */
|
|
106
|
+
unit: string | null;
|
|
107
|
+
/** Entity IRI. */
|
|
108
|
+
entity: string | null;
|
|
109
|
+
/** FactSet IRI — the grouping key shared with an Information Block. */
|
|
110
|
+
factSet: string | null;
|
|
111
|
+
value: number | null;
|
|
112
|
+
decimals: string | null;
|
|
113
|
+
/**
|
|
114
|
+
* Raw string value for non-numeric facts (e.g. a Cover Page's entity name,
|
|
115
|
+
* or a yes/no flag) — present when `value` is null. Lets text-bearing sections
|
|
116
|
+
* (the cover, narrative disclosures) render their content instead of a blank.
|
|
117
|
+
*/
|
|
118
|
+
textValue?: string | null;
|
|
119
|
+
/**
|
|
120
|
+
* The fact's dimensional coordinate — one qualifier per axis, ordered by axis.
|
|
121
|
+
* Absent/empty means a consolidated (undimensioned) fact. Part of the fact's
|
|
122
|
+
* identity: the pivot engine keys cells by `(element, period, dimensions)`, so
|
|
123
|
+
* segment/component breakdowns no longer overwrite the consolidated total.
|
|
124
|
+
*/
|
|
125
|
+
dimensions?: DimensionQualifier[];
|
|
126
|
+
}
|
|
127
|
+
/** A calculation arc: `parent` (subtotal) rolls up `child * weight`. */
|
|
128
|
+
interface CalcAssociation {
|
|
129
|
+
parent: string;
|
|
130
|
+
child: string;
|
|
131
|
+
weight: number;
|
|
132
|
+
order: number;
|
|
133
|
+
role: string | null;
|
|
134
|
+
structure: string | null;
|
|
135
|
+
}
|
|
136
|
+
/** A presentation arc: `parent` shows `child` at the given order. */
|
|
137
|
+
interface PresAssociation {
|
|
138
|
+
parent: string;
|
|
139
|
+
child: string;
|
|
140
|
+
order: number;
|
|
141
|
+
role: string | null;
|
|
142
|
+
structure: string | null;
|
|
143
|
+
}
|
|
144
|
+
/** A network root — groups associations under one role / block type. */
|
|
145
|
+
interface StructureInfo {
|
|
146
|
+
id: string;
|
|
147
|
+
blockType: string;
|
|
148
|
+
roleUri: string | null;
|
|
149
|
+
structureName: string | null;
|
|
150
|
+
/**
|
|
151
|
+
* Filing sequence for ordering sections (SEC `Structure.number`). When present,
|
|
152
|
+
* `buildStatements` orders by it instead of the canonical `BLOCK_ORDER` — a real
|
|
153
|
+
* filing has dozens of sections whose order is the filer's, not a fixed four.
|
|
154
|
+
*/
|
|
155
|
+
order?: number;
|
|
156
|
+
}
|
|
157
|
+
/** An Information Block — groups a statement's facts via a shared `factSet`. */
|
|
158
|
+
interface InformationBlock {
|
|
159
|
+
id: string;
|
|
160
|
+
blockType: string;
|
|
161
|
+
factSet: string | null;
|
|
162
|
+
label: string | null;
|
|
163
|
+
/**
|
|
164
|
+
* Direct link to the `StructureInfo` that supplies this block's presentation +
|
|
165
|
+
* calculation networks. When set (SEC adapter), the projection matches block →
|
|
166
|
+
* structure by this id, so a filing with many structures sharing one `blockType`
|
|
167
|
+
* (e.g. balance sheet main + parenthetical) resolves each to its own structure.
|
|
168
|
+
* Left undefined by the holon/file path, which matches by `blockType`.
|
|
169
|
+
*/
|
|
170
|
+
structureId?: string;
|
|
171
|
+
}
|
|
172
|
+
/** The full normalized report — the adapter's output and projection's input. */
|
|
173
|
+
interface NormalizedReport {
|
|
174
|
+
reportId: string | null;
|
|
175
|
+
reportIri: string | null;
|
|
176
|
+
entity: EntityInfo | null;
|
|
177
|
+
informationBlocks: InformationBlock[];
|
|
178
|
+
structures: StructureInfo[];
|
|
179
|
+
facts: Fact[];
|
|
180
|
+
elements: Record<string, ElementInfo>;
|
|
181
|
+
periods: Record<string, PeriodInfo>;
|
|
182
|
+
units: Record<string, UnitInfo>;
|
|
183
|
+
calcAssociations: CalcAssociation[];
|
|
184
|
+
presAssociations: PresAssociation[];
|
|
185
|
+
}
|
|
186
|
+
/** A statement column, keyed by the period end date facts are matched against. */
|
|
187
|
+
interface StatementColumn {
|
|
188
|
+
/** The period end date used to match facts into this column. */
|
|
189
|
+
key: string;
|
|
190
|
+
/** Human header label. */
|
|
191
|
+
label: string;
|
|
192
|
+
/** A representative period for this column (for tooltips / fact inspection). */
|
|
193
|
+
period: PeriodInfo;
|
|
194
|
+
}
|
|
195
|
+
/** One value in a row, plus the fact behind it (for inspection / footing). */
|
|
196
|
+
interface RowCell {
|
|
197
|
+
value: number | null;
|
|
198
|
+
fact: Fact | null;
|
|
199
|
+
/** Raw string for a non-numeric fact (from `Fact.textValue`), when `value` is null. */
|
|
200
|
+
textValue?: string | null;
|
|
201
|
+
}
|
|
202
|
+
/** A rendered statement line. */
|
|
203
|
+
interface StatementRow {
|
|
204
|
+
element: ElementInfo;
|
|
205
|
+
/** Tree depth — drives indentation. */
|
|
206
|
+
depth: number;
|
|
207
|
+
/** True when the element is a calculation parent (rendered bold). */
|
|
208
|
+
isSubtotal: boolean;
|
|
209
|
+
cells: RowCell[];
|
|
210
|
+
}
|
|
211
|
+
/** A fully reconstructed statement, ready to render. */
|
|
212
|
+
interface Statement {
|
|
213
|
+
ib: InformationBlock;
|
|
214
|
+
blockType: string;
|
|
215
|
+
/** Friendly heading, e.g. "Balance Sheet". */
|
|
216
|
+
title: string;
|
|
217
|
+
structureName: string | null;
|
|
218
|
+
columns: StatementColumn[];
|
|
219
|
+
rows: StatementRow[];
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* A reference to one fact aspect, for assigning it a pivot role. `concept`,
|
|
223
|
+
* `period`, `entity`, `unit` are the single-valued builtins; `dim:<axisIri>`
|
|
224
|
+
* names a dimensional axis. String-form so a config round-trips through JSON or
|
|
225
|
+
* a UI control (e.g. `dim:us-gaap:StatementEquityComponentsAxis`).
|
|
226
|
+
*/
|
|
227
|
+
type AspectKey = 'concept' | 'period' | 'entity' | 'unit' | `dim:${string}`;
|
|
228
|
+
/** Display scale for monetary values; `auto` infers from the facts' decimals. */
|
|
229
|
+
type Scale = 'auto' | 'ones' | 'thousands' | 'millions' | 'billions';
|
|
230
|
+
/**
|
|
231
|
+
* A pivot configuration: which aspects lay out as rows, which as columns, and
|
|
232
|
+
* which are held fixed as slicers. `defaultPivotConfig` derives one per section
|
|
233
|
+
* (concept→rows, period + multi-member dimensions→columns, entity + single-member
|
|
234
|
+
* dimensions→slicers); a caller may override any of it.
|
|
235
|
+
*/
|
|
236
|
+
interface PivotConfig {
|
|
237
|
+
rows: AspectKey[];
|
|
238
|
+
columns: AspectKey[];
|
|
239
|
+
slicers: AspectKey[];
|
|
240
|
+
scale: Scale;
|
|
241
|
+
/** Emit abstract concept rows as group headers (default true). */
|
|
242
|
+
showAbstracts: boolean;
|
|
243
|
+
/**
|
|
244
|
+
* Drop a period column with fewer than two populated facts when the densest
|
|
245
|
+
* period has several (default true). This removes lone stragglers — e.g. an
|
|
246
|
+
* equity opening balance that leaked into the balance-sheet factset — without
|
|
247
|
+
* ever touching a real comparative period (which repeats many line items).
|
|
248
|
+
* Metadata-safe: unlike the old fact filter, cells still own their own facts.
|
|
249
|
+
*/
|
|
250
|
+
dropSparsePeriods?: boolean;
|
|
251
|
+
}
|
|
252
|
+
/** An aspect held fixed for the whole table, rendered as a header bar. */
|
|
253
|
+
interface PivotSlicer {
|
|
254
|
+
aspect: AspectKey;
|
|
255
|
+
/** e.g. `Reporting Entity` or `Equity Components [Axis]`. */
|
|
256
|
+
label: string;
|
|
257
|
+
/** e.g. `NVIDIA CORP`, `Consolidated`, `USD`. */
|
|
258
|
+
valueLabel: string;
|
|
259
|
+
}
|
|
260
|
+
/** One leaf column — a single combination of the column aspects. */
|
|
261
|
+
interface PivotColumn {
|
|
262
|
+
/** Stable key: signature of this column's coordinate. */
|
|
263
|
+
key: string;
|
|
264
|
+
/** The period, when period is a column aspect (else null). */
|
|
265
|
+
period: PeriodInfo | null;
|
|
266
|
+
/** The member coordinate, when dimensions are column aspects (else empty). */
|
|
267
|
+
members: DimensionQualifier[];
|
|
268
|
+
/** Leaf header label (a date, a member name, …). */
|
|
269
|
+
label: string;
|
|
270
|
+
}
|
|
271
|
+
/** A column-header cell spanning one level of the (possibly nested) column tree. */
|
|
272
|
+
interface PivotColumnHeader {
|
|
273
|
+
label: string;
|
|
274
|
+
/** colspan across leaf columns. */
|
|
275
|
+
span: number;
|
|
276
|
+
}
|
|
277
|
+
/** One value in a pivot row, plus the fact behind it (for inspection / footing). */
|
|
278
|
+
interface PivotCell {
|
|
279
|
+
value: number | null;
|
|
280
|
+
fact: Fact | null;
|
|
281
|
+
/** Raw string for a non-numeric fact, when `value` is null. */
|
|
282
|
+
textValue?: string | null;
|
|
283
|
+
}
|
|
284
|
+
/** One rendered pivot line. */
|
|
285
|
+
interface PivotRow {
|
|
286
|
+
/** Stable key: element id + dimensional signature (when dims are on rows). */
|
|
287
|
+
key: string;
|
|
288
|
+
element: ElementInfo;
|
|
289
|
+
/** Indent depth in the concept tree — drives indentation. */
|
|
290
|
+
depth: number;
|
|
291
|
+
/** A concept header row (abstract) — carries no values. */
|
|
292
|
+
header: boolean;
|
|
293
|
+
/** A calculation parent (roll-up) — rendered emphasized. */
|
|
294
|
+
isSubtotal: boolean;
|
|
295
|
+
/** The member coordinate, when dimensions are row aspects (else empty). */
|
|
296
|
+
members: DimensionQualifier[];
|
|
297
|
+
/** One cell per leaf column, aligned by index (empty for header rows). */
|
|
298
|
+
cells: PivotCell[];
|
|
299
|
+
}
|
|
300
|
+
/** Resolved display scale + a caption for the section header. */
|
|
301
|
+
interface ResolvedScale {
|
|
302
|
+
/** Divide monetary values by this (1 for ones, 1e6 for millions). */
|
|
303
|
+
factor: number;
|
|
304
|
+
/** `millions`, `thousands`, `billions`, or '' when unscaled. */
|
|
305
|
+
label: string;
|
|
306
|
+
/** Header caption, e.g. `In millions, except per-share amounts`, or null. */
|
|
307
|
+
caption: string | null;
|
|
308
|
+
}
|
|
309
|
+
/** A fully pivoted section — the render input, and the raw fact table's source. */
|
|
310
|
+
interface PivotTable {
|
|
311
|
+
ib: InformationBlock;
|
|
312
|
+
blockType: string;
|
|
313
|
+
title: string;
|
|
314
|
+
structureName: string | null;
|
|
315
|
+
/** Aspects held fixed for the whole table, shown as header bars. */
|
|
316
|
+
slicers: PivotSlicer[];
|
|
317
|
+
/** Column header rows, outermost level first (period over members). */
|
|
318
|
+
columnHeaders: PivotColumnHeader[][];
|
|
319
|
+
/** Leaf columns; row cells align to these by index. */
|
|
320
|
+
columns: PivotColumn[];
|
|
321
|
+
rows: PivotRow[];
|
|
322
|
+
/** Resolved display scale (factor + caption). */
|
|
323
|
+
scale: ResolvedScale;
|
|
324
|
+
/** The configuration this table was built from (default, unless overridden). */
|
|
325
|
+
config: PivotConfig;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
/** Injected transport — runs a read-only Cypher query and returns its rows. */
|
|
329
|
+
type SecQuery = (cypher: string, params?: Record<string, unknown>) => Promise<Array<Record<string, unknown>>>;
|
|
330
|
+
/** One navigable section of a filing (a `Structure` + its facts). */
|
|
331
|
+
interface SecSection {
|
|
332
|
+
/** `Structure.identifier` — the section id + the anchor for its associations. */
|
|
333
|
+
id: string;
|
|
334
|
+
/** Human title, e.g. "Consolidated Balance Sheets" (definition prefix stripped). */
|
|
335
|
+
title: string;
|
|
336
|
+
/** Coarse grouping for the table of contents. */
|
|
337
|
+
kind: 'Statement' | 'Disclosure' | 'Document' | 'Cover' | 'Other';
|
|
338
|
+
/** `canonical_type` when the section is a recognized core statement, else null. */
|
|
339
|
+
canonicalType: string | null;
|
|
340
|
+
/** Filing sequence (position in the ordered section list). */
|
|
341
|
+
order: number;
|
|
342
|
+
/** `FactSet.identifier`s whose facts belong to this section. */
|
|
343
|
+
factsetIds: string[];
|
|
344
|
+
}
|
|
345
|
+
/** The fast first read: entity + the ordered section list, no fact bodies. */
|
|
346
|
+
interface SecReportShell {
|
|
347
|
+
reportId: string;
|
|
348
|
+
entity: EntityInfo | null;
|
|
349
|
+
sections: SecSection[];
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Split an XBRL `Structure.definition` into a human title + a coarse kind.
|
|
353
|
+
* Definitions look like `"9952153 - Statement - Consolidated Balance Sheets"` or
|
|
354
|
+
* `"0000001 - Document - Cover Page"` — a `"NNNN - <Type> - <Title>"` shape whose
|
|
355
|
+
* middle word (Statement / Disclosure / Document) drives the kind. A core
|
|
356
|
+
* canonical statement always reads as a Statement so the primaries group cleanly.
|
|
357
|
+
*/
|
|
358
|
+
declare function parseStructureDefinition(definition: string | null, canonicalType: string | null): {
|
|
359
|
+
title: string;
|
|
360
|
+
kind: SecSection['kind'];
|
|
361
|
+
};
|
|
362
|
+
/** Fetch the entity + ordered section list for a report (the fast first read). */
|
|
363
|
+
declare function fetchSecReportShell(query: SecQuery, reportId: string): Promise<SecReportShell>;
|
|
364
|
+
/**
|
|
365
|
+
* Load one section into a single-section `NormalizedReport`. All of the
|
|
366
|
+
* section's facts are re-keyed to the structure id as their `factSet`, so the
|
|
367
|
+
* projection groups them as one Information Block regardless of how many raw
|
|
368
|
+
* FactSets the filing split them across.
|
|
369
|
+
*/
|
|
370
|
+
declare function fetchSecSection(query: SecQuery, shell: SecReportShell, section: SecSection): Promise<NormalizedReport>;
|
|
371
|
+
/** Merge single-section reports into one whole-report model (order preserved). */
|
|
372
|
+
declare function mergeSecSections(shell: SecReportShell, sections: NormalizedReport[]): NormalizedReport;
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* The adapter seam. An adapter turns one source into a `NormalizedReport`; the
|
|
376
|
+
* projection + components do the rest, identically for every source.
|
|
377
|
+
*
|
|
378
|
+
* The package ships two read-only reference adapters — `jsonld` (offline file
|
|
379
|
+
* via the jsonld processor) and `cypher` (a live graph database). A consuming
|
|
380
|
+
* app with operational needs (a live ledger it also edits) supplies its own
|
|
381
|
+
* adapter in-app.
|
|
382
|
+
*/
|
|
383
|
+
|
|
384
|
+
interface ReportAdapter {
|
|
385
|
+
/** A short, human-readable description of the source (for the UI). */
|
|
386
|
+
readonly source: string;
|
|
387
|
+
/** Produce the normalized report model. */
|
|
388
|
+
load(): Promise<NormalizedReport>;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* The cypher adapter — a whole-report `ReportAdapter` over the live SEC graph.
|
|
393
|
+
*
|
|
394
|
+
* This is a convenience wrapper: it loads the section list, then every section,
|
|
395
|
+
* and merges them into one `NormalizedReport`. Apps that want responsive,
|
|
396
|
+
* lazy-per-section loading should call `fetchSecReportShell` + `fetchSecSection`
|
|
397
|
+
* directly (see `./sec`) rather than materializing a whole filing up front.
|
|
398
|
+
*/
|
|
399
|
+
|
|
400
|
+
interface CypherAdapterConfig {
|
|
401
|
+
/** Injected transport over `POST /v1/graphs/{graphId}/query` (auth lives here). */
|
|
402
|
+
query: SecQuery;
|
|
403
|
+
/** The report to materialize — a `Report.identifier`. */
|
|
404
|
+
reportId: string;
|
|
405
|
+
}
|
|
406
|
+
declare function cypherAdapter(config: CypherAdapterConfig): ReportAdapter;
|
|
407
|
+
|
|
408
|
+
/** Parse a `holon.jsonld` document (string or parsed object) into the model. */
|
|
409
|
+
declare function parseJsonld(doc: string | object): Promise<NormalizedReport>;
|
|
410
|
+
/** A `ReportAdapter` over an in-memory `holon.jsonld` document. */
|
|
411
|
+
declare function jsonldFileAdapter(doc: string | object, source?: string): ReportAdapter;
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* The shared quad-store → `NormalizedReport` traversal.
|
|
415
|
+
*
|
|
416
|
+
* An adapter fills an N3 quad `Store` from its source, then hands it here. The
|
|
417
|
+
* store is read as a **union** across its graphs (`graph = null`) — the
|
|
418
|
+
* scene/boundary/projection partition is a publication concern, not a rendering
|
|
419
|
+
* one, so the join is identical however the quads arrived (a dataset-form
|
|
420
|
+
* JSON-LD holon, a flat graph, …). No SPARQL engine is required; only store
|
|
421
|
+
* traversal. The only per-source code is how the store gets filled.
|
|
422
|
+
*/
|
|
423
|
+
|
|
424
|
+
/** Traverse a populated quad `Store` into the normalized report model. */
|
|
425
|
+
declare function parseStore(store: Store): NormalizedReport;
|
|
426
|
+
|
|
427
|
+
export { type AspectKey as A, type BalanceType as B, type CalcAssociation as C, type DimensionQualifier as D, type ElementInfo as E, type Fact as F, parseJsonld as G, parseStore as H, type InformationBlock as I, parseStructureDefinition as J, type NumericKind as N, type PeriodInfo as P, type ReportAdapter as R, type Scale as S, type UnitInfo as U, type NormalizedReport as a, type PivotConfig as b, type PivotTable as c, type PivotRow as d, type CypherAdapterConfig as e, type EntityInfo as f, type PeriodType as g, type PivotCell as h, type PivotColumn as i, type PivotColumnHeader as j, type PivotSlicer as k, type PresAssociation as l, type ResolvedScale as m, type RowCell as n, type SecQuery as o, type SecReportShell as p, type SecSection as q, type Statement as r, type StatementColumn as s, type StatementRow as t, type StructureInfo as u, cypherAdapter as v, fetchSecReportShell as w, fetchSecSection as x, jsonldFileAdapter as y, mergeSecSections as z };
|