@robosystems/report-components 0.1.0 → 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.
Files changed (52) hide show
  1. package/README.md +7 -7
  2. package/dist/adapters/index.d.ts +2 -5
  3. package/dist/adapters/index.js +2 -2
  4. package/dist/adapters/index.js.map +1 -1
  5. package/dist/chunk-FNRQJVAH.js +284 -0
  6. package/dist/chunk-FNRQJVAH.js.map +1 -0
  7. package/dist/{model.d.ts → index-DlTmV_mJ.d.ts} +87 -17
  8. package/dist/index.d.ts +119 -23
  9. package/dist/index.js +491 -23
  10. package/dist/index.js.map +1 -1
  11. package/package.json +5 -2
  12. package/dist/adapters/cypher.d.ts +0 -21
  13. package/dist/adapters/cypher.d.ts.map +0 -1
  14. package/dist/adapters/cypher.js +0 -9
  15. package/dist/adapters/cypher.js.map +0 -1
  16. package/dist/adapters/index.d.ts.map +0 -1
  17. package/dist/adapters/trig.d.ts +0 -7
  18. package/dist/adapters/trig.d.ts.map +0 -1
  19. package/dist/adapters/trig.js +0 -183
  20. package/dist/adapters/trig.js.map +0 -1
  21. package/dist/adapters/types.d.ts +0 -16
  22. package/dist/adapters/types.d.ts.map +0 -1
  23. package/dist/adapters/types.js +0 -2
  24. package/dist/adapters/types.js.map +0 -1
  25. package/dist/components/FactInspector.d.ts +0 -11
  26. package/dist/components/FactInspector.d.ts.map +0 -1
  27. package/dist/components/FactInspector.js +0 -79
  28. package/dist/components/FactInspector.js.map +0 -1
  29. package/dist/components/ReportView.d.ts +0 -9
  30. package/dist/components/ReportView.d.ts.map +0 -1
  31. package/dist/components/ReportView.js +0 -51
  32. package/dist/components/ReportView.js.map +0 -1
  33. package/dist/components/StatementTable.d.ts +0 -15
  34. package/dist/components/StatementTable.d.ts.map +0 -1
  35. package/dist/components/StatementTable.js +0 -86
  36. package/dist/components/StatementTable.js.map +0 -1
  37. package/dist/constants.d.ts +0 -71
  38. package/dist/constants.d.ts.map +0 -1
  39. package/dist/constants.js +0 -115
  40. package/dist/constants.js.map +0 -1
  41. package/dist/format.d.ts +0 -17
  42. package/dist/format.d.ts.map +0 -1
  43. package/dist/format.js +0 -34
  44. package/dist/format.js.map +0 -1
  45. package/dist/index.d.ts.map +0 -1
  46. package/dist/model.d.ts.map +0 -1
  47. package/dist/model.js +0 -15
  48. package/dist/model.js.map +0 -1
  49. package/dist/project.d.ts +0 -39
  50. package/dist/project.d.ts.map +0 -1
  51. package/dist/project.js +0 -201
  52. package/dist/project.js.map +0 -1
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,5 +1,2 @@
1
- export { cypherAdapter } from './cypher';
2
- export type { CypherAdapterConfig } from './cypher';
3
- export { parseTrig, trigFileAdapter } from './trig';
4
- export type { ReportAdapter } from './types';
5
- //# sourceMappingURL=index.d.ts.map
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 } from './cypher';
2
- export { parseTrig, trigFileAdapter } from './trig';
1
+ export { cypherAdapter, jsonldFileAdapter, parseJsonld, parseStore, parseTrig, trigFileAdapter } from '../chunk-FNRQJVAH.js';
2
+ //# sourceMappingURL=index.js.map
3
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/adapters/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAA"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -0,0 +1,284 @@
1
+ import { DataFactory, Parser, Store } from 'n3';
2
+ import jsonld from 'jsonld';
3
+
4
+ // src/constants.ts
5
+ var NS = {
6
+ rdf: "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
7
+ rs: "https://robosystems.ai/vocab/",
8
+ rsgaap: "https://robosystems.ai/taxonomy/rs-gaap/v1/",
9
+ skos: "http://www.w3.org/2004/02/skos/core#",
10
+ xlink: "http://www.w3.org/1999/xlink#",
11
+ xbrli: "http://www.xbrl.org/2003/instance#",
12
+ link: "http://www.xbrl.org/2003/linkbase#",
13
+ iso4217: "http://www.xbrl.org/2003/iso4217#"
14
+ };
15
+ var IRI = {
16
+ type: NS.rdf + "type",
17
+ // rs: classes
18
+ Report: NS.rs + "Report",
19
+ Fact: NS.rs + "Fact",
20
+ InformationBlock: NS.rs + "InformationBlock",
21
+ Structure: NS.rs + "Structure",
22
+ Association: NS.rs + "Association",
23
+ Element: NS.rs + "Element",
24
+ Period: NS.rs + "Period",
25
+ Unit: NS.rs + "Unit",
26
+ Entity: NS.rs + "Entity",
27
+ // rs: predicates
28
+ element: NS.rs + "element",
29
+ period: NS.rs + "period",
30
+ unit: NS.rs + "unit",
31
+ entity: NS.rs + "entity",
32
+ factSet: NS.rs + "factSet",
33
+ numericValue: NS.rs + "numericValue",
34
+ decimals: NS.rs + "decimals",
35
+ blockType: NS.rs + "blockType",
36
+ associationType: NS.rs + "associationType",
37
+ hasAssociation: NS.rs + "hasAssociation",
38
+ roleUri: NS.rs + "roleUri",
39
+ structureName: NS.rs + "structureName",
40
+ abstract: NS.rs + "abstract",
41
+ monetary: NS.rs + "monetary",
42
+ legalName: NS.rs + "legalName",
43
+ country: NS.rs + "country",
44
+ // skos:
45
+ prefLabel: NS.skos + "prefLabel",
46
+ // xlink:
47
+ from: NS.xlink + "from",
48
+ to: NS.xlink + "to",
49
+ role: NS.xlink + "role",
50
+ // xbrli:
51
+ instant: NS.xbrli + "instant",
52
+ startDate: NS.xbrli + "startDate",
53
+ endDate: NS.xbrli + "endDate",
54
+ periodType: NS.xbrli + "periodType",
55
+ balance: NS.xbrli + "balance",
56
+ measure: NS.xbrli + "measure",
57
+ // link:
58
+ order: NS.link + "order",
59
+ weight: NS.link + "weight"
60
+ };
61
+ var PREFIXES = [
62
+ ["rs-gaap", NS.rsgaap],
63
+ ["disclosures", "https://robosystems.ai/taxonomy/rs-gaap/disclosures/v1/"],
64
+ ["us-gaap", "http://fasb.org/us-gaap/"],
65
+ ["dei", "http://xbrl.sec.gov/dei/"],
66
+ ["rs", NS.rs],
67
+ ["skos", NS.skos],
68
+ ["xbrli", NS.xbrli],
69
+ ["xlink", NS.xlink],
70
+ ["link", NS.link],
71
+ ["iso4217", NS.iso4217]
72
+ ];
73
+ function qname(iri) {
74
+ for (const [prefix, ns] of PREFIXES) {
75
+ if (iri.startsWith(ns)) {
76
+ return `${prefix}:${iri.slice(ns.length)}`;
77
+ }
78
+ }
79
+ const slash = iri.lastIndexOf("/");
80
+ const hash = iri.lastIndexOf("#");
81
+ return iri.slice(Math.max(slash, hash) + 1);
82
+ }
83
+ function humanize(iri) {
84
+ const local = qname(iri).split(":").pop() ?? iri;
85
+ return local.replace(/(?<=[a-z0-9])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])/g, " ");
86
+ }
87
+ var BLOCK_ORDER = {
88
+ balance_sheet: 0,
89
+ income_statement: 1,
90
+ cash_flow_statement: 2,
91
+ equity_statement: 3
92
+ };
93
+ var BLOCK_TITLES = {
94
+ balance_sheet: "Balance Sheet",
95
+ income_statement: "Income Statement",
96
+ cash_flow_statement: "Cash Flow Statement",
97
+ equity_statement: "Statement of Changes in Equity"
98
+ };
99
+
100
+ // src/adapters/cypher.ts
101
+ function cypherAdapter(config) {
102
+ return {
103
+ source: `cypher:${config.graphId}/${config.reportId}`,
104
+ load: async () => {
105
+ throw new Error(
106
+ "The cypher adapter is not implemented yet (phase 2 / Mode B \u2014 live SEC graph)."
107
+ );
108
+ }
109
+ };
110
+ }
111
+ var { namedNode } = DataFactory;
112
+ function makeReaders(store) {
113
+ const objects = (s, p) => store.getObjects(namedNode(s), namedNode(p), null);
114
+ const firstValue = (s, p) => {
115
+ const os = objects(s, p);
116
+ return os.length ? os[0].value : null;
117
+ };
118
+ const subjectsOfType = (type) => store.getSubjects(namedNode(IRI.type), namedNode(type), null).map((t) => t.value);
119
+ return { objects, firstValue, subjectsOfType };
120
+ }
121
+ function toNumber(raw) {
122
+ if (raw === null || raw === "") return null;
123
+ const n = Number(raw);
124
+ return Number.isNaN(n) ? null : n;
125
+ }
126
+ function parseStore(store) {
127
+ const { objects, firstValue, subjectsOfType } = makeReaders(store);
128
+ const elements = {};
129
+ for (const id of subjectsOfType(IRI.Element)) {
130
+ const balance = firstValue(id, IRI.balance);
131
+ const periodType = firstValue(id, IRI.periodType);
132
+ elements[id] = {
133
+ id,
134
+ qname: qname(id),
135
+ label: firstValue(id, IRI.prefLabel) ?? humanize(id),
136
+ balance: balance === "debit" || balance === "credit" ? balance : null,
137
+ periodType: periodType === "instant" || periodType === "duration" ? periodType : null,
138
+ abstract: firstValue(id, IRI.abstract) === "true",
139
+ monetary: firstValue(id, IRI.monetary) === "true"
140
+ };
141
+ }
142
+ const periods = {};
143
+ for (const id of subjectsOfType(IRI.Period)) {
144
+ const declared = firstValue(id, IRI.periodType);
145
+ const instant = firstValue(id, IRI.instant);
146
+ const startDate = firstValue(id, IRI.startDate);
147
+ const endDate = firstValue(id, IRI.endDate);
148
+ const type = declared === "instant" ? "instant" : declared === "duration" ? "duration" : instant ? "instant" : "duration";
149
+ const end = (type === "instant" ? instant : endDate) ?? instant ?? endDate ?? "";
150
+ periods[id] = { id, type, instant, startDate, endDate, end };
151
+ }
152
+ const units = {};
153
+ for (const id of subjectsOfType(IRI.Unit)) {
154
+ const measureTerm = objects(id, IRI.measure)[0];
155
+ const measure = measureTerm ? qname(measureTerm.value) : "unknown";
156
+ units[id] = {
157
+ id,
158
+ measure,
159
+ label: measure.includes(":") ? measure.split(":").pop() : measure
160
+ };
161
+ }
162
+ let entity = null;
163
+ const entityIds = subjectsOfType(IRI.Entity);
164
+ if (entityIds.length) {
165
+ const id = entityIds[0];
166
+ entity = {
167
+ id,
168
+ name: firstValue(id, IRI.prefLabel) ?? firstValue(id, IRI.legalName) ?? "Entity",
169
+ legalName: firstValue(id, IRI.legalName),
170
+ country: firstValue(id, IRI.country)
171
+ };
172
+ }
173
+ const facts = [];
174
+ for (const id of subjectsOfType(IRI.Fact)) {
175
+ facts.push({
176
+ id,
177
+ element: firstValue(id, IRI.element) ?? "",
178
+ period: firstValue(id, IRI.period) ?? "",
179
+ unit: firstValue(id, IRI.unit),
180
+ entity: firstValue(id, IRI.entity),
181
+ factSet: firstValue(id, IRI.factSet),
182
+ value: toNumber(firstValue(id, IRI.numericValue)),
183
+ decimals: firstValue(id, IRI.decimals)
184
+ });
185
+ }
186
+ const informationBlocks = [];
187
+ for (const id of subjectsOfType(IRI.InformationBlock)) {
188
+ informationBlocks.push({
189
+ id,
190
+ blockType: firstValue(id, IRI.blockType) ?? "",
191
+ factSet: firstValue(id, IRI.factSet),
192
+ label: firstValue(id, IRI.prefLabel)
193
+ });
194
+ }
195
+ const structures = [];
196
+ const assocStructure = /* @__PURE__ */ new Map();
197
+ for (const id of subjectsOfType(IRI.Structure)) {
198
+ structures.push({
199
+ id,
200
+ blockType: firstValue(id, IRI.blockType) ?? "",
201
+ roleUri: firstValue(id, IRI.roleUri),
202
+ structureName: firstValue(id, IRI.structureName)
203
+ });
204
+ for (const assoc of objects(id, IRI.hasAssociation)) {
205
+ assocStructure.set(assoc.value, id);
206
+ }
207
+ }
208
+ const calcAssociations = [];
209
+ const presAssociations = [];
210
+ for (const id of subjectsOfType(IRI.Association)) {
211
+ const parent = firstValue(id, IRI.from);
212
+ const child = firstValue(id, IRI.to);
213
+ if (!parent || !child) continue;
214
+ const type = firstValue(id, IRI.associationType);
215
+ const order = toNumber(firstValue(id, IRI.order)) ?? 0;
216
+ const role = firstValue(id, IRI.role);
217
+ const structure = assocStructure.get(id) ?? null;
218
+ if (type === "calculation") {
219
+ calcAssociations.push({
220
+ parent,
221
+ child,
222
+ weight: toNumber(firstValue(id, IRI.weight)) ?? 1,
223
+ order,
224
+ role,
225
+ structure
226
+ });
227
+ } else if (type === "presentation") {
228
+ presAssociations.push({ parent, child, order, role, structure });
229
+ }
230
+ }
231
+ let reportIri = null;
232
+ for (const graph of store.getGraphs(null, null, null)) {
233
+ const hash = graph.value.indexOf("#");
234
+ if (hash > 0) {
235
+ reportIri = graph.value.slice(0, hash);
236
+ break;
237
+ }
238
+ }
239
+ if (!reportIri) {
240
+ const reports = subjectsOfType(IRI.Report);
241
+ reportIri = reports.length ? reports[0] : null;
242
+ }
243
+ const reportId = reportIri ? reportIri.split("/").pop() ?? null : null;
244
+ return {
245
+ reportId,
246
+ reportIri,
247
+ entity,
248
+ informationBlocks,
249
+ structures,
250
+ facts,
251
+ elements,
252
+ periods,
253
+ units,
254
+ calcAssociations,
255
+ presAssociations
256
+ };
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
+ }
263
+ function trigFileAdapter(trig, source = "holon.trig") {
264
+ return {
265
+ source,
266
+ load: async () => parseTrig(trig)
267
+ };
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
+ }
281
+
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/c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AA,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
  *
@@ -11,10 +13,10 @@
11
13
  * subtotals, the table layout. That work is identical for every adapter, which
12
14
  * is what makes the rendering source-agnostic.
13
15
  */
14
- export type PeriodType = 'instant' | 'duration';
15
- export type BalanceType = 'debit' | 'credit';
16
+ type PeriodType = 'instant' | 'duration';
17
+ type BalanceType = 'debit' | 'credit';
16
18
  /** A reportable concept (a taxonomy element). */
17
- export interface ElementInfo {
19
+ interface ElementInfo {
18
20
  /** Full element IRI — the join key used everywhere. */
19
21
  id: string;
20
22
  /** Compacted name, e.g. `rs-gaap:Assets`. */
@@ -27,7 +29,7 @@ export interface ElementInfo {
27
29
  monetary: boolean;
28
30
  }
29
31
  /** A reporting period — an instant (balance sheet) or a duration (flows). */
30
- export interface PeriodInfo {
32
+ interface PeriodInfo {
31
33
  id: string;
32
34
  type: PeriodType;
33
35
  instant: string | null;
@@ -37,7 +39,7 @@ export interface PeriodInfo {
37
39
  end: string;
38
40
  }
39
41
  /** A unit of measure, e.g. USD. */
40
- export interface UnitInfo {
42
+ interface UnitInfo {
41
43
  id: string;
42
44
  /** Compacted measure, e.g. `iso4217:USD`. */
43
45
  measure: string;
@@ -45,14 +47,14 @@ export interface UnitInfo {
45
47
  label: string;
46
48
  }
47
49
  /** The reporting entity. */
48
- export interface EntityInfo {
50
+ interface EntityInfo {
49
51
  id: string;
50
52
  name: string;
51
53
  legalName: string | null;
52
54
  country: string | null;
53
55
  }
54
56
  /** A single reported value. */
55
- export interface Fact {
57
+ interface Fact {
56
58
  id: string;
57
59
  /** Element IRI. */
58
60
  element: string;
@@ -68,7 +70,7 @@ export interface Fact {
68
70
  decimals: string | null;
69
71
  }
70
72
  /** A calculation arc: `parent` (subtotal) rolls up `child * weight`. */
71
- export interface CalcAssociation {
73
+ interface CalcAssociation {
72
74
  parent: string;
73
75
  child: string;
74
76
  weight: number;
@@ -77,7 +79,7 @@ export interface CalcAssociation {
77
79
  structure: string | null;
78
80
  }
79
81
  /** A presentation arc: `parent` shows `child` at the given order. */
80
- export interface PresAssociation {
82
+ interface PresAssociation {
81
83
  parent: string;
82
84
  child: string;
83
85
  order: number;
@@ -85,21 +87,21 @@ export interface PresAssociation {
85
87
  structure: string | null;
86
88
  }
87
89
  /** A network root — groups associations under one role / block type. */
88
- export interface StructureInfo {
90
+ interface StructureInfo {
89
91
  id: string;
90
92
  blockType: string;
91
93
  roleUri: string | null;
92
94
  structureName: string | null;
93
95
  }
94
96
  /** An Information Block — groups a statement's facts via a shared `factSet`. */
95
- export interface InformationBlock {
97
+ interface InformationBlock {
96
98
  id: string;
97
99
  blockType: string;
98
100
  factSet: string | null;
99
101
  label: string | null;
100
102
  }
101
103
  /** The full normalized report — the adapter's output and projection's input. */
102
- export interface NormalizedReport {
104
+ interface NormalizedReport {
103
105
  reportId: string | null;
104
106
  reportIri: string | null;
105
107
  entity: EntityInfo | null;
@@ -113,7 +115,7 @@ export interface NormalizedReport {
113
115
  presAssociations: PresAssociation[];
114
116
  }
115
117
  /** A statement column, keyed by the period end date facts are matched against. */
116
- export interface StatementColumn {
118
+ interface StatementColumn {
117
119
  /** The period end date used to match facts into this column. */
118
120
  key: string;
119
121
  /** Human header label. */
@@ -122,12 +124,12 @@ export interface StatementColumn {
122
124
  period: PeriodInfo;
123
125
  }
124
126
  /** One value in a row, plus the fact behind it (for inspection / footing). */
125
- export interface RowCell {
127
+ interface RowCell {
126
128
  value: number | null;
127
129
  fact: Fact | null;
128
130
  }
129
131
  /** A rendered statement line. */
130
- export interface StatementRow {
132
+ interface StatementRow {
131
133
  element: ElementInfo;
132
134
  /** Tree depth — drives indentation. */
133
135
  depth: number;
@@ -136,7 +138,7 @@ export interface StatementRow {
136
138
  cells: RowCell[];
137
139
  }
138
140
  /** A fully reconstructed statement, ready to render. */
139
- export interface Statement {
141
+ interface Statement {
140
142
  ib: InformationBlock;
141
143
  blockType: string;
142
144
  /** Friendly heading, e.g. "Balance Sheet". */
@@ -145,4 +147,72 @@ export interface Statement {
145
147
  columns: StatementColumn[];
146
148
  rows: StatementRow[];
147
149
  }
148
- //# sourceMappingURL=model.d.ts.map
150
+
151
+ /**
152
+ * The adapter seam. An adapter turns one source into a `NormalizedReport`; the
153
+ * projection + components do the rest, identically for every source.
154
+ *
155
+ * The package ships two read-only reference adapters — `trig` (offline file via
156
+ * N3.js) and `cypher` (a live graph database). A consuming app with operational
157
+ * needs (a live ledger it also edits) supplies its own adapter in-app.
158
+ */
159
+
160
+ interface ReportAdapter {
161
+ /** A short, human-readable description of the source (for the UI). */
162
+ readonly source: string;
163
+ /** Produce the normalized report model. */
164
+ load(): Promise<NormalizedReport>;
165
+ }
166
+
167
+ /**
168
+ * The cypher / GraphQL adapter — a live graph database (an entity graph **or**
169
+ * the SEC repository) read read-only with an API key. One adapter for both:
170
+ * only the endpoint / `graphId` differ.
171
+ *
172
+ * Phase 2 (Mode B). Stubbed for now so the seam and the `./adapters` export
173
+ * surface are in place; the holon-viewer's SEC mode will drive its build-out.
174
+ */
175
+
176
+ interface CypherAdapterConfig {
177
+ /** GraphQL / cypher endpoint base URL. */
178
+ endpoint: string;
179
+ /** User-supplied API key (sent client-side; never app-managed). */
180
+ apiKey: string;
181
+ /** Target graph — an entity graph id or the SEC repository id. */
182
+ graphId: string;
183
+ /** The report to materialize. */
184
+ reportId: string;
185
+ }
186
+ declare function cypherAdapter(config: CypherAdapterConfig): ReportAdapter;
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;
213
+ /** Parse a `holon.trig` document into the normalized report model. */
214
+ declare function parseTrig(trig: string): NormalizedReport;
215
+ /** A `ReportAdapter` over an in-memory `holon.trig` document. */
216
+ declare function trigFileAdapter(trig: string, source?: string): ReportAdapter;
217
+
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 };