@robosystems/report-components 0.1.1 → 0.1.2

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/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
4
4
 
5
- A source-agnostic React library for rendering XBRL-grade financial statements. The same components render financial statements from **any** source — a live general ledger, a graph database (entity graph or the SEC repository), or a static `holon.trig` file — because the render logic is source-independent. The only thing that varies is a thin **data adapter** that turns its source into a normalized report model; the components handle the presentation-order walk, calculation-subtotal footing, and Information-Block table projection identically for every adapter.
5
+ A source-agnostic React library for rendering XBRL-grade financial statements. The same components render financial statements from **any** source — a static `holon.jsonld` file (a report's canonical dataset-form holon), a live general ledger, or a graph database (entity graph or the SEC repository) — because the render logic is source-independent. The only thing that varies is a thin **data adapter** that turns its source into a normalized report model; the components handle the presentation-order walk, calculation-subtotal footing, and Information-Block table projection identically for every adapter.
6
6
 
7
7
  React and react-dom are peer dependencies, and the components are plain React (no framework-specific imports) so the same package feeds a Next.js app or a lightweight Vite app.
8
8
 
@@ -14,17 +14,17 @@ npm install @robosystems/report-components
14
14
 
15
15
  ## Usage
16
16
 
17
- Render a statement by feeding a component a normalized report model produced by an adapter. The package ships two read-only reference adapters (a `holon.trig` file adapter via N3.js, and a cypher/GraphQL adapter) under `@robosystems/report-components/adapters`:
17
+ Render a statement by feeding `ReportView` a normalized report model produced by an adapter. The package ships read-only reference adapters under `@robosystems/report-components/adapters`: `parseJsonld` (the canonical `holon.jsonld`, via the `jsonld` processor) and `cypherAdapter` (a live graph over GraphQL).
18
18
 
19
19
  ```tsx
20
- import { FinancialStatement } from '@robosystems/report-components'
21
- import { createTrigFileAdapter } from '@robosystems/report-components/adapters'
20
+ import { ReportView } from '@robosystems/report-components'
21
+ import { parseJsonld } from '@robosystems/report-components/adapters'
22
22
 
23
- const adapter = createTrigFileAdapter({ source: trigText })
24
- const report = await adapter.load()
23
+ // `holonText` is a report's dataset-form holon.jsonld (scene / boundary / projection)
24
+ const report = await parseJsonld(holonText)
25
25
 
26
26
  export function Report() {
27
- return <FinancialStatement report={report} />
27
+ return <ReportView report={report} />
28
28
  }
29
29
  ```
30
30
 
@@ -1 +1,2 @@
1
- export { b as CypherAdapterConfig, R as ReportAdapter, i as cypherAdapter, p as parseTrig, t as trigFileAdapter } from '../index-2pOwdKOv.js';
1
+ export { b as CypherAdapterConfig, R as ReportAdapter, i as cypherAdapter, j as jsonldFileAdapter, p as parseJsonld, k as parseStore, l as parseTrig, t as trigFileAdapter } from '../index-DlTmV_mJ.js';
2
+ import 'n3';
@@ -1,3 +1,3 @@
1
- export { cypherAdapter, parseTrig, trigFileAdapter } from '../chunk-K67BB5QI.js';
1
+ export { cypherAdapter, jsonldFileAdapter, parseJsonld, parseStore, parseTrig, trigFileAdapter } from '../chunk-FNRQJVAH.js';
2
2
  //# sourceMappingURL=index.js.map
3
3
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,5 @@
1
1
  import { DataFactory, Parser, Store } from 'n3';
2
+ import jsonld from 'jsonld';
2
3
 
3
4
  // src/constants.ts
4
5
  var NS = {
@@ -122,9 +123,7 @@ function toNumber(raw) {
122
123
  const n = Number(raw);
123
124
  return Number.isNaN(n) ? null : n;
124
125
  }
125
- function parseTrig(trig) {
126
- const parser = new Parser({ format: "application/trig" });
127
- const store = new Store(parser.parse(trig));
126
+ function parseStore(store) {
128
127
  const { objects, firstValue, subjectsOfType } = makeReaders(store);
129
128
  const elements = {};
130
129
  for (const id of subjectsOfType(IRI.Element)) {
@@ -237,6 +236,10 @@ function parseTrig(trig) {
237
236
  break;
238
237
  }
239
238
  }
239
+ if (!reportIri) {
240
+ const reports = subjectsOfType(IRI.Report);
241
+ reportIri = reports.length ? reports[0] : null;
242
+ }
240
243
  const reportId = reportIri ? reportIri.split("/").pop() ?? null : null;
241
244
  return {
242
245
  reportId,
@@ -252,13 +255,30 @@ function parseTrig(trig) {
252
255
  presAssociations
253
256
  };
254
257
  }
258
+ function parseTrig(trig) {
259
+ const parser = new Parser({ format: "application/trig" });
260
+ const store = new Store(parser.parse(trig));
261
+ return parseStore(store);
262
+ }
255
263
  function trigFileAdapter(trig, source = "holon.trig") {
256
264
  return {
257
265
  source,
258
266
  load: async () => parseTrig(trig)
259
267
  };
260
268
  }
269
+ async function parseJsonld(doc) {
270
+ const json = typeof doc === "string" ? JSON.parse(doc) : doc;
271
+ const nquads = await jsonld.toRDF(json, { format: "application/n-quads" });
272
+ const store = new Store(new Parser({ format: "application/n-quads" }).parse(nquads));
273
+ return parseStore(store);
274
+ }
275
+ function jsonldFileAdapter(doc, source = "holon.jsonld") {
276
+ return {
277
+ source,
278
+ load: () => parseJsonld(doc)
279
+ };
280
+ }
261
281
 
262
- export { BLOCK_ORDER, BLOCK_TITLES, NS, cypherAdapter, humanize, parseTrig, qname, trigFileAdapter };
263
- //# sourceMappingURL=chunk-K67BB5QI.js.map
264
- //# sourceMappingURL=chunk-K67BB5QI.js.map
282
+ export { BLOCK_ORDER, BLOCK_TITLES, NS, cypherAdapter, humanize, jsonldFileAdapter, parseJsonld, parseStore, parseTrig, qname, trigFileAdapter };
283
+ //# sourceMappingURL=chunk-FNRQJVAH.js.map
284
+ //# sourceMappingURL=chunk-FNRQJVAH.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/constants.ts","../src/adapters/cypher.ts","../src/adapters/trig.ts","../src/adapters/jsonld.ts"],"names":["Store","Parser"],"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,IA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A,KAAA;AAAA,IACA,QAAA;AAAA,IACA,OAAA;AAAA,IACA,KAAA;AAAA,IACA,gBAAA;AAAA,IACA;AAAA,GACF;AACF;AAGO,SAAS,UAAU,IAAA,EAAgC;AACxD,EAAA,MAAM,SAAS,IAAI,MAAA,CAAO,EAAE,MAAA,EAAQ,oBAAoB,CAAA;AACxD,EAAA,MAAM,QAAQ,IAAI,KAAA,CAAM,MAAA,CAAO,KAAA,CAAM,IAAI,CAAC,CAAA;AAC1C,EAAA,OAAO,WAAW,KAAK,CAAA;AACzB;AAGO,SAAS,eAAA,CAAgB,IAAA,EAAc,MAAA,GAAS,YAAA,EAA6B;AAClF,EAAA,OAAO;AAAA,IACL,MAAA;AAAA,IACA,IAAA,EAAM,YAAY,SAAA,CAAU,IAAI;AAAA,GAClC;AACF;AChNA,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,IAAIA,KAAAA,CAAM,IAAIC,MAAAA,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-FNRQJVAH.js","sourcesContent":["/**\n * RDF vocabulary and display helpers shared across adapters and projection.\n *\n * A `holon.trig` 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/** 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 * The cypher / GraphQL adapter — a live graph database (an entity graph **or**\n * the SEC repository) read read-only with an API key. One adapter for both:\n * only the endpoint / `graphId` differ.\n *\n * Phase 2 (Mode B). Stubbed for now so the seam and the `./adapters` export\n * surface are in place; the holon-viewer's SEC mode will drive its build-out.\n */\nimport type { ReportAdapter } from './types'\n\nexport interface CypherAdapterConfig {\n /** GraphQL / cypher endpoint base URL. */\n endpoint: string\n /** User-supplied API key (sent client-side; never app-managed). */\n apiKey: string\n /** Target graph — an entity graph id or the SEC repository id. */\n graphId: string\n /** The report to materialize. */\n reportId: string\n}\n\nexport function cypherAdapter(config: CypherAdapterConfig): ReportAdapter {\n return {\n source: `cypher:${config.graphId}/${config.reportId}`,\n load: async () => {\n throw new Error(\n 'The cypher adapter is not implemented yet (phase 2 / Mode B — live SEC graph).'\n )\n },\n }\n}\n","/**\n * The `holon.trig` file adapter — offline, no backend, no auth.\n *\n * Parses TriG (three named graphs: `#scene`, `#boundary`, `#projection`) with\n * N3.js into a quad store, then traverses the store to emit a `NormalizedReport`.\n * The three graphs are queried as a union (graph = `null`) — exactly the join\n * the DataBook converter does on the flat graph. No SPARQL engine is required;\n * only store traversal.\n */\nimport { DataFactory, Parser, 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'\nimport type { ReportAdapter } from './types'\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/**\n * Traverse a populated quad `Store` into the normalized report model.\n *\n * The 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 whether the quads arrived from a TriG holon, a\n * dataset-form JSON-LD holon, or a flat graph. Shared by `parseTrig` and\n * `parseJsonld`; the only per-syntax code is how the store gets filled.\n */\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 // holon (TriG or dataset-form JSON-LD). Fall back to the `rs:Report` subject\n // so a flat, 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/** Parse a `holon.trig` document into the normalized report model. */\nexport function parseTrig(trig: string): NormalizedReport {\n const parser = new Parser({ format: 'application/trig' })\n const store = new Store(parser.parse(trig))\n return parseStore(store)\n}\n\n/** A `ReportAdapter` over an in-memory `holon.trig` document. */\nexport function trigFileAdapter(trig: string, source = 'holon.trig'): ReportAdapter {\n return {\n source,\n load: async () => parseTrig(trig),\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 default\n * export; TriG remains an optional RDF export handled by `trig.ts`.\n *\n * N3.js parses TriG/N-Quads but not JSON-LD, so this adapter uses the `jsonld`\n * processor to expand the document to N-Quads (which preserves the named-graph\n * labels), parses those into the same N3 quad `Store`, and delegates to the\n * shared `parseStore` traversal — identical to the trig path from there on.\n */\nimport type { JsonLdDocument } from 'jsonld'\nimport jsonld from 'jsonld'\nimport { Parser, Store } from 'n3'\nimport type { NormalizedReport } from '../model'\nimport { parseStore } from './trig'\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"]}
@@ -1,3 +1,5 @@
1
+ import { Store } from 'n3';
2
+
1
3
  /**
2
4
  * The normalized report model — the load-bearing seam of the library.
3
5
  *
@@ -183,9 +185,34 @@ interface CypherAdapterConfig {
183
185
  }
184
186
  declare function cypherAdapter(config: CypherAdapterConfig): ReportAdapter;
185
187
 
188
+ /** Parse a `holon.jsonld` document (string or parsed object) into the model. */
189
+ declare function parseJsonld(doc: string | object): Promise<NormalizedReport>;
190
+ /** A `ReportAdapter` over an in-memory `holon.jsonld` document. */
191
+ declare function jsonldFileAdapter(doc: string | object, source?: string): ReportAdapter;
192
+
193
+ /**
194
+ * The `holon.trig` file adapter — offline, no backend, no auth.
195
+ *
196
+ * Parses TriG (three named graphs: `#scene`, `#boundary`, `#projection`) with
197
+ * N3.js into a quad store, then traverses the store to emit a `NormalizedReport`.
198
+ * The three graphs are queried as a union (graph = `null`) — exactly the join
199
+ * the DataBook converter does on the flat graph. No SPARQL engine is required;
200
+ * only store traversal.
201
+ */
202
+
203
+ /**
204
+ * Traverse a populated quad `Store` into the normalized report model.
205
+ *
206
+ * The store is read as a **union** across its graphs (`graph = null`) — the
207
+ * scene/boundary/projection partition is a publication concern, not a rendering
208
+ * one, so the join is identical whether the quads arrived from a TriG holon, a
209
+ * dataset-form JSON-LD holon, or a flat graph. Shared by `parseTrig` and
210
+ * `parseJsonld`; the only per-syntax code is how the store gets filled.
211
+ */
212
+ declare function parseStore(store: Store): NormalizedReport;
186
213
  /** Parse a `holon.trig` document into the normalized report model. */
187
214
  declare function parseTrig(trig: string): NormalizedReport;
188
215
  /** A `ReportAdapter` over an in-memory `holon.trig` document. */
189
216
  declare function trigFileAdapter(trig: string, source?: string): ReportAdapter;
190
217
 
191
- export { type BalanceType as B, type CalcAssociation as C, type ElementInfo as E, type Fact as F, type InformationBlock as I, type NormalizedReport as N, type PeriodInfo as P, type ReportAdapter as R, type Statement as S, type UnitInfo as U, type StatementRow as a, type CypherAdapterConfig as b, type EntityInfo as c, type PeriodType as d, type PresAssociation as e, type RowCell as f, type StatementColumn as g, type StructureInfo as h, cypherAdapter as i, parseTrig as p, trigFileAdapter as t };
218
+ export { type BalanceType as B, type CalcAssociation as C, type ElementInfo as E, type Fact as F, type InformationBlock as I, type NormalizedReport as N, type PeriodInfo as P, type ReportAdapter as R, type Statement as S, type UnitInfo as U, type StatementRow as a, type CypherAdapterConfig as b, type EntityInfo as c, type PeriodType as d, type PresAssociation as e, type RowCell as f, type StatementColumn as g, type StructureInfo as h, cypherAdapter as i, jsonldFileAdapter as j, parseStore as k, parseTrig as l, parseJsonld as p, trigFileAdapter as t };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
- import { P as PeriodInfo, E as ElementInfo, N as NormalizedReport, S as Statement, a as StatementRow } from './index-2pOwdKOv.js';
2
- export { B as BalanceType, C as CalcAssociation, b as CypherAdapterConfig, c as EntityInfo, F as Fact, I as InformationBlock, d as PeriodType, e as PresAssociation, R as ReportAdapter, f as RowCell, g as StatementColumn, h as StructureInfo, U as UnitInfo, i as cypherAdapter, p as parseTrig, t as trigFileAdapter } from './index-2pOwdKOv.js';
1
+ import { P as PeriodInfo, E as ElementInfo, N as NormalizedReport, S as Statement, a as StatementRow } from './index-DlTmV_mJ.js';
2
+ export { B as BalanceType, C as CalcAssociation, b as CypherAdapterConfig, c as EntityInfo, F as Fact, I as InformationBlock, d as PeriodType, e as PresAssociation, R as ReportAdapter, f as RowCell, g as StatementColumn, h as StructureInfo, U as UnitInfo, i as cypherAdapter, j as jsonldFileAdapter, p as parseJsonld, k as parseStore, l as parseTrig, t as trigFileAdapter } from './index-DlTmV_mJ.js';
3
3
  import * as react from 'react';
4
+ import 'n3';
4
5
 
5
6
  /**
6
7
  * RDF vocabulary and display helpers shared across adapters and projection.
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { BLOCK_ORDER, BLOCK_TITLES, humanize, qname } from './chunk-K67BB5QI.js';
2
- export { BLOCK_ORDER, BLOCK_TITLES, NS, cypherAdapter, humanize, parseTrig, qname, trigFileAdapter } from './chunk-K67BB5QI.js';
1
+ import { BLOCK_ORDER, BLOCK_TITLES, humanize, qname } from './chunk-FNRQJVAH.js';
2
+ export { BLOCK_ORDER, BLOCK_TITLES, NS, cypherAdapter, humanize, jsonldFileAdapter, parseJsonld, parseStore, parseTrig, qname, trigFileAdapter } from './chunk-FNRQJVAH.js';
3
3
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
4
4
  import { useMemo, useState } from 'react';
5
5
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robosystems/report-components",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Source-agnostic React components for rendering XBRL-grade financial statements",
5
5
  "license": "MIT",
6
6
  "author": "RFS LLC",
@@ -51,11 +51,13 @@
51
51
  "react-dom": ">=18"
52
52
  },
53
53
  "dependencies": {
54
+ "jsonld": "^9.0.0",
54
55
  "n3": "^1.26.0"
55
56
  },
56
57
  "devDependencies": {
57
58
  "@eslint/js": "^9.39.2",
58
59
  "@testing-library/react": "^16.3.0",
60
+ "@types/jsonld": "^1.5.15",
59
61
  "@types/n3": "^1.26.0",
60
62
  "@types/node": "^22.0.0",
61
63
  "@types/react": "^19.1.9",
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/constants.ts","../src/adapters/cypher.ts","../src/adapters/trig.ts"],"names":[],"mappings":";;;AAQO,IAAM,EAAA,GAAK;AAAA,EAChB,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A,GAAW,YAAa,SAAA,CAAU,KAAA,CAAM,GAAG,CAAA,CAAE,GAAA,MAAS,IAAA,GAAQ,IAAA;AAEpE,EAAA,OAAO;AAAA,IACL,QAAA;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;AAGO,SAAS,eAAA,CAAgB,IAAA,EAAc,MAAA,GAAS,YAAA,EAA6B;AAClF,EAAA,OAAO;AAAA,IACL,MAAA;AAAA,IACA,IAAA,EAAM,YAAY,SAAA,CAAU,IAAI;AAAA,GAClC;AACF","file":"chunk-K67BB5QI.js","sourcesContent":["/**\n * RDF vocabulary and display helpers shared across adapters and projection.\n *\n * A `holon.trig` 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/** 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 * The cypher / GraphQL adapter — a live graph database (an entity graph **or**\n * the SEC repository) read read-only with an API key. One adapter for both:\n * only the endpoint / `graphId` differ.\n *\n * Phase 2 (Mode B). Stubbed for now so the seam and the `./adapters` export\n * surface are in place; the holon-viewer's SEC mode will drive its build-out.\n */\nimport type { ReportAdapter } from './types'\n\nexport interface CypherAdapterConfig {\n /** GraphQL / cypher endpoint base URL. */\n endpoint: string\n /** User-supplied API key (sent client-side; never app-managed). */\n apiKey: string\n /** Target graph — an entity graph id or the SEC repository id. */\n graphId: string\n /** The report to materialize. */\n reportId: string\n}\n\nexport function cypherAdapter(config: CypherAdapterConfig): ReportAdapter {\n return {\n source: `cypher:${config.graphId}/${config.reportId}`,\n load: async () => {\n throw new Error(\n 'The cypher adapter is not implemented yet (phase 2 / Mode B — live SEC graph).'\n )\n },\n }\n}\n","/**\n * The `holon.trig` file adapter — offline, no backend, no auth.\n *\n * Parses TriG (three named graphs: `#scene`, `#boundary`, `#projection`) with\n * N3.js into a quad store, then traverses the store to emit a `NormalizedReport`.\n * The three graphs are queried as a union (graph = `null`) — exactly the join\n * the DataBook converter does on the flat graph. No SPARQL engine is required;\n * only store traversal.\n */\nimport { DataFactory, Parser, 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'\nimport type { ReportAdapter } from './types'\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/** Parse a `holon.trig` document into the normalized report model. */\nexport function parseTrig(trig: string): NormalizedReport {\n const parser = new Parser({ format: 'application/trig' })\n const store = new Store(parser.parse(trig))\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 (from the named-graph names) ──\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 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/** A `ReportAdapter` over an in-memory `holon.trig` document. */\nexport function trigFileAdapter(trig: string, source = 'holon.trig'): ReportAdapter {\n return {\n source,\n load: async () => parseTrig(trig),\n }\n}\n"]}