@robosystems/report-components 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/adapters/index.d.ts +1 -5
  2. package/dist/adapters/index.js +2 -2
  3. package/dist/adapters/index.js.map +1 -1
  4. package/dist/chunk-K67BB5QI.js +264 -0
  5. package/dist/chunk-K67BB5QI.js.map +1 -0
  6. package/dist/{model.d.ts → index-2pOwdKOv.d.ts} +60 -17
  7. package/dist/index.d.ts +118 -23
  8. package/dist/index.js +491 -23
  9. package/dist/index.js.map +1 -1
  10. package/package.json +3 -2
  11. package/dist/adapters/cypher.d.ts +0 -21
  12. package/dist/adapters/cypher.d.ts.map +0 -1
  13. package/dist/adapters/cypher.js +0 -9
  14. package/dist/adapters/cypher.js.map +0 -1
  15. package/dist/adapters/index.d.ts.map +0 -1
  16. package/dist/adapters/trig.d.ts +0 -7
  17. package/dist/adapters/trig.d.ts.map +0 -1
  18. package/dist/adapters/trig.js +0 -183
  19. package/dist/adapters/trig.js.map +0 -1
  20. package/dist/adapters/types.d.ts +0 -16
  21. package/dist/adapters/types.d.ts.map +0 -1
  22. package/dist/adapters/types.js +0 -2
  23. package/dist/adapters/types.js.map +0 -1
  24. package/dist/components/FactInspector.d.ts +0 -11
  25. package/dist/components/FactInspector.d.ts.map +0 -1
  26. package/dist/components/FactInspector.js +0 -79
  27. package/dist/components/FactInspector.js.map +0 -1
  28. package/dist/components/ReportView.d.ts +0 -9
  29. package/dist/components/ReportView.d.ts.map +0 -1
  30. package/dist/components/ReportView.js +0 -51
  31. package/dist/components/ReportView.js.map +0 -1
  32. package/dist/components/StatementTable.d.ts +0 -15
  33. package/dist/components/StatementTable.d.ts.map +0 -1
  34. package/dist/components/StatementTable.js +0 -86
  35. package/dist/components/StatementTable.js.map +0 -1
  36. package/dist/constants.d.ts +0 -71
  37. package/dist/constants.d.ts.map +0 -1
  38. package/dist/constants.js +0 -115
  39. package/dist/constants.js.map +0 -1
  40. package/dist/format.d.ts +0 -17
  41. package/dist/format.d.ts.map +0 -1
  42. package/dist/format.js +0 -34
  43. package/dist/format.js.map +0 -1
  44. package/dist/index.d.ts.map +0 -1
  45. package/dist/model.d.ts.map +0 -1
  46. package/dist/model.js +0 -15
  47. package/dist/model.js.map +0 -1
  48. package/dist/project.d.ts +0 -39
  49. package/dist/project.d.ts.map +0 -1
  50. package/dist/project.js +0 -201
  51. package/dist/project.js.map +0 -1
@@ -1,71 +0,0 @@
1
- /**
2
- * RDF vocabulary and display helpers shared across adapters and projection.
3
- *
4
- * A `holon.trig` mixes several vocabularies: `rs:` for structure, `skos:` for
5
- * human labels, and the XBRL family (`xlink:` / `xbrli:` / `link:`) for the
6
- * networks. These constants are the single source of truth for the full IRIs.
7
- */
8
- export declare const NS: {
9
- readonly rdf: "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
10
- readonly rs: "https://robosystems.ai/vocab/";
11
- readonly rsgaap: "https://robosystems.ai/taxonomy/rs-gaap/v1/";
12
- readonly skos: "http://www.w3.org/2004/02/skos/core#";
13
- readonly xlink: "http://www.w3.org/1999/xlink#";
14
- readonly xbrli: "http://www.xbrl.org/2003/instance#";
15
- readonly link: "http://www.xbrl.org/2003/linkbase#";
16
- readonly iso4217: "http://www.xbrl.org/2003/iso4217#";
17
- };
18
- /** Frequently-referenced full IRIs, pre-concatenated for terseness. */
19
- export declare const IRI: {
20
- readonly type: string;
21
- readonly Report: string;
22
- readonly Fact: string;
23
- readonly InformationBlock: string;
24
- readonly Structure: string;
25
- readonly Association: string;
26
- readonly Element: string;
27
- readonly Period: string;
28
- readonly Unit: string;
29
- readonly Entity: string;
30
- readonly element: string;
31
- readonly period: string;
32
- readonly unit: string;
33
- readonly entity: string;
34
- readonly factSet: string;
35
- readonly numericValue: string;
36
- readonly decimals: string;
37
- readonly blockType: string;
38
- readonly associationType: string;
39
- readonly hasAssociation: string;
40
- readonly roleUri: string;
41
- readonly structureName: string;
42
- readonly abstract: string;
43
- readonly monetary: string;
44
- readonly legalName: string;
45
- readonly country: string;
46
- readonly prefLabel: string;
47
- readonly from: string;
48
- readonly to: string;
49
- readonly role: string;
50
- readonly instant: string;
51
- readonly startDate: string;
52
- readonly endDate: string;
53
- readonly periodType: string;
54
- readonly balance: string;
55
- readonly measure: string;
56
- readonly order: string;
57
- readonly weight: string;
58
- };
59
- /** Compact a concept IRI to `prefix:Local` (e.g. `rs-gaap:Assets`). */
60
- export declare function qname(iri: string): string;
61
- /**
62
- * Readable concept name from a local name when no `skos:prefLabel` is present —
63
- * splits CamelCase into words (`AssetsCurrent` → `Assets Current`). A graceful
64
- * fallback for bundles that predate label emit.
65
- */
66
- export declare function humanize(iri: string): string;
67
- /** Stable display order for the canonical statement blocks; others fall after. */
68
- export declare const BLOCK_ORDER: Record<string, number>;
69
- /** Friendly section headings keyed by block type. */
70
- export declare const BLOCK_TITLES: Record<string, string>;
71
- //# sourceMappingURL=constants.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,eAAO,MAAM,EAAE;;;;;;;;;CASL,CAAA;AAEV,uEAAuE;AACvE,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6CN,CAAA;AAmBV,uEAAuE;AACvE,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CASzC;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAG5C;AAED,kFAAkF;AAClF,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAK9C,CAAA;AAED,qDAAqD;AACrD,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAK/C,CAAA"}
package/dist/constants.js DELETED
@@ -1,115 +0,0 @@
1
- /**
2
- * RDF vocabulary and display helpers shared across adapters and projection.
3
- *
4
- * A `holon.trig` mixes several vocabularies: `rs:` for structure, `skos:` for
5
- * human labels, and the XBRL family (`xlink:` / `xbrli:` / `link:`) for the
6
- * networks. These constants are the single source of truth for the full IRIs.
7
- */
8
- export const NS = {
9
- rdf: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
10
- rs: 'https://robosystems.ai/vocab/',
11
- rsgaap: 'https://robosystems.ai/taxonomy/rs-gaap/v1/',
12
- skos: 'http://www.w3.org/2004/02/skos/core#',
13
- xlink: 'http://www.w3.org/1999/xlink#',
14
- xbrli: 'http://www.xbrl.org/2003/instance#',
15
- link: 'http://www.xbrl.org/2003/linkbase#',
16
- iso4217: 'http://www.xbrl.org/2003/iso4217#',
17
- };
18
- /** Frequently-referenced full IRIs, pre-concatenated for terseness. */
19
- export const IRI = {
20
- type: NS.rdf + 'type',
21
- // rs: classes
22
- Report: NS.rs + 'Report',
23
- Fact: NS.rs + 'Fact',
24
- InformationBlock: NS.rs + 'InformationBlock',
25
- Structure: NS.rs + 'Structure',
26
- Association: NS.rs + 'Association',
27
- Element: NS.rs + 'Element',
28
- Period: NS.rs + 'Period',
29
- Unit: NS.rs + 'Unit',
30
- Entity: NS.rs + 'Entity',
31
- // rs: predicates
32
- element: NS.rs + 'element',
33
- period: NS.rs + 'period',
34
- unit: NS.rs + 'unit',
35
- entity: NS.rs + 'entity',
36
- factSet: NS.rs + 'factSet',
37
- numericValue: NS.rs + 'numericValue',
38
- decimals: NS.rs + 'decimals',
39
- blockType: NS.rs + 'blockType',
40
- associationType: NS.rs + 'associationType',
41
- hasAssociation: NS.rs + 'hasAssociation',
42
- roleUri: NS.rs + 'roleUri',
43
- structureName: NS.rs + 'structureName',
44
- abstract: NS.rs + 'abstract',
45
- monetary: NS.rs + 'monetary',
46
- legalName: NS.rs + 'legalName',
47
- country: NS.rs + 'country',
48
- // skos:
49
- prefLabel: NS.skos + 'prefLabel',
50
- // xlink:
51
- from: NS.xlink + 'from',
52
- to: NS.xlink + 'to',
53
- role: NS.xlink + 'role',
54
- // xbrli:
55
- instant: NS.xbrli + 'instant',
56
- startDate: NS.xbrli + 'startDate',
57
- endDate: NS.xbrli + 'endDate',
58
- periodType: NS.xbrli + 'periodType',
59
- balance: NS.xbrli + 'balance',
60
- measure: NS.xbrli + 'measure',
61
- // link:
62
- order: NS.link + 'order',
63
- weight: NS.link + 'weight',
64
- };
65
- /**
66
- * Prefixes for compacting concept IRIs to `prefix:Local`. Order matters — the
67
- * most specific namespace must come first so `rs-gaap:` wins over `rs:`.
68
- */
69
- const PREFIXES = [
70
- ['rs-gaap', NS.rsgaap],
71
- ['disclosures', 'https://robosystems.ai/taxonomy/rs-gaap/disclosures/v1/'],
72
- ['us-gaap', 'http://fasb.org/us-gaap/'],
73
- ['dei', 'http://xbrl.sec.gov/dei/'],
74
- ['rs', NS.rs],
75
- ['skos', NS.skos],
76
- ['xbrli', NS.xbrli],
77
- ['xlink', NS.xlink],
78
- ['link', NS.link],
79
- ['iso4217', NS.iso4217],
80
- ];
81
- /** Compact a concept IRI to `prefix:Local` (e.g. `rs-gaap:Assets`). */
82
- export function qname(iri) {
83
- for (const [prefix, ns] of PREFIXES) {
84
- if (iri.startsWith(ns)) {
85
- return `${prefix}:${iri.slice(ns.length)}`;
86
- }
87
- }
88
- const slash = iri.lastIndexOf('/');
89
- const hash = iri.lastIndexOf('#');
90
- return iri.slice(Math.max(slash, hash) + 1);
91
- }
92
- /**
93
- * Readable concept name from a local name when no `skos:prefLabel` is present —
94
- * splits CamelCase into words (`AssetsCurrent` → `Assets Current`). A graceful
95
- * fallback for bundles that predate label emit.
96
- */
97
- export function humanize(iri) {
98
- const local = qname(iri).split(':').pop() ?? iri;
99
- return local.replace(/(?<=[a-z0-9])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])/g, ' ');
100
- }
101
- /** Stable display order for the canonical statement blocks; others fall after. */
102
- export const BLOCK_ORDER = {
103
- balance_sheet: 0,
104
- income_statement: 1,
105
- cash_flow_statement: 2,
106
- equity_statement: 3,
107
- };
108
- /** Friendly section headings keyed by block type. */
109
- export const BLOCK_TITLES = {
110
- balance_sheet: 'Balance Sheet',
111
- income_statement: 'Income Statement',
112
- cash_flow_statement: 'Cash Flow Statement',
113
- equity_statement: 'Statement of Changes in Equity',
114
- };
115
- //# sourceMappingURL=constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,CAAC,MAAM,EAAE,GAAG;IAChB,GAAG,EAAE,6CAA6C;IAClD,EAAE,EAAE,+BAA+B;IACnC,MAAM,EAAE,6CAA6C;IACrD,IAAI,EAAE,sCAAsC;IAC5C,KAAK,EAAE,+BAA+B;IACtC,KAAK,EAAE,oCAAoC;IAC3C,IAAI,EAAE,oCAAoC;IAC1C,OAAO,EAAE,mCAAmC;CACpC,CAAA;AAEV,uEAAuE;AACvE,MAAM,CAAC,MAAM,GAAG,GAAG;IACjB,IAAI,EAAE,EAAE,CAAC,GAAG,GAAG,MAAM;IACrB,cAAc;IACd,MAAM,EAAE,EAAE,CAAC,EAAE,GAAG,QAAQ;IACxB,IAAI,EAAE,EAAE,CAAC,EAAE,GAAG,MAAM;IACpB,gBAAgB,EAAE,EAAE,CAAC,EAAE,GAAG,kBAAkB;IAC5C,SAAS,EAAE,EAAE,CAAC,EAAE,GAAG,WAAW;IAC9B,WAAW,EAAE,EAAE,CAAC,EAAE,GAAG,aAAa;IAClC,OAAO,EAAE,EAAE,CAAC,EAAE,GAAG,SAAS;IAC1B,MAAM,EAAE,EAAE,CAAC,EAAE,GAAG,QAAQ;IACxB,IAAI,EAAE,EAAE,CAAC,EAAE,GAAG,MAAM;IACpB,MAAM,EAAE,EAAE,CAAC,EAAE,GAAG,QAAQ;IACxB,iBAAiB;IACjB,OAAO,EAAE,EAAE,CAAC,EAAE,GAAG,SAAS;IAC1B,MAAM,EAAE,EAAE,C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;IAClC,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,GAAG,CAAA;IAChD,OAAO,KAAK,CAAC,OAAO,CAAC,kDAAkD,EAAE,GAAG,CAAC,CAAA;AAC/E,CAAC;AAED,kFAAkF;AAClF,MAAM,CAAC,MAAM,WAAW,GAA2B;IACjD,aAAa,EAAE,CAAC;IAChB,gBAAgB,EAAE,CAAC;IACnB,mBAAmB,EAAE,CAAC;IACtB,gBAAgB,EAAE,CAAC;CACpB,CAAA;AAED,qDAAqD;AACrD,MAAM,CAAC,MAAM,YAAY,GAA2B;IAClD,aAAa,EAAE,eAAe;IAC9B,gBAAgB,EAAE,kBAAkB;IACpC,mBAAmB,EAAE,qBAAqB;IAC1C,gBAAgB,EAAE,gCAAgC;CACnD,CAAA"}
package/dist/format.d.ts DELETED
@@ -1,17 +0,0 @@
1
- /**
2
- * Pure formatting helpers shared by the projection and the components. No React
3
- * here, so the projection can depend on it without pulling in a renderer.
4
- */
5
- import type { PeriodInfo } from './model';
6
- /**
7
- * Accounting-style money: negatives in parentheses, no sign, an em-dash for
8
- * absent values. Matches the RoboLedger statement renderer.
9
- */
10
- export declare function formatMoney(value: number | null | undefined, opts?: {
11
- currencySymbol?: string;
12
- }): string;
13
- /** `2024-03-31` → `Mar 31, 2024`. Falls back to the raw string if unparseable. */
14
- export declare function formatDate(iso: string | null | undefined): string;
15
- /** A human description of a period — "As of …" for instants, a span for durations. */
16
- export declare function formatPeriod(period: PeriodInfo): string;
17
- //# sourceMappingURL=format.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../src/format.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAEzC;;;GAGG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAChC,IAAI,GAAE;IAAE,cAAc,CAAC,EAAE,MAAM,CAAA;CAAO,GACrC,MAAM,CAQR;AAID,kFAAkF;AAClF,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAOjE;AAED,sFAAsF;AACtF,wBAAgB,YAAY,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAKvD"}
package/dist/format.js DELETED
@@ -1,34 +0,0 @@
1
- /**
2
- * Accounting-style money: negatives in parentheses, no sign, an em-dash for
3
- * absent values. Matches the RoboLedger statement renderer.
4
- */
5
- export function formatMoney(value, opts = {}) {
6
- if (value === null || value === undefined || Number.isNaN(value))
7
- return '—';
8
- const symbol = opts.currencySymbol ?? '$';
9
- const abs = Math.abs(value).toLocaleString('en-US', {
10
- minimumFractionDigits: 2,
11
- maximumFractionDigits: 2,
12
- });
13
- return value < 0 ? `${symbol}(${abs})` : `${symbol}${abs}`;
14
- }
15
- const MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
16
- /** `2024-03-31` → `Mar 31, 2024`. Falls back to the raw string if unparseable. */
17
- export function formatDate(iso) {
18
- if (!iso)
19
- return '';
20
- const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(iso);
21
- if (!m)
22
- return iso;
23
- const [, year, month, day] = m;
24
- const idx = Number(month) - 1;
25
- return `${MONTHS[idx] ?? month} ${Number(day)}, ${year}`;
26
- }
27
- /** A human description of a period — "As of …" for instants, a span for durations. */
28
- export function formatPeriod(period) {
29
- if (period.type === 'instant') {
30
- return `As of ${formatDate(period.instant ?? period.end)}`;
31
- }
32
- return `${formatDate(period.startDate)} – ${formatDate(period.endDate ?? period.end)}`;
33
- }
34
- //# sourceMappingURL=format.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"format.js","sourceRoot":"","sources":["../src/format.ts"],"names":[],"mappings":"AAMA;;;GAGG;AAC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,UAAU,YAAY,CAAC,MAAkB;IAC7C,IAAI,MAAM,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAC9B,OAAO,SAAS,UAAU,CAAC,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,GAAG,CAAC,EAAE,CAAA;IAC5D,CAAC;IACD,OAAO,GAAG,UAAU,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,UAAU,CAAC,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,GAAG,CAAC,EAAE,CAAA;AACxF,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAC5E,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,WAAW,CAAA;AAGzB,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC1D,YAAY,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AACpD,YAAY,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAC5D,YAAY,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AAGtE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,YAAY,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AAC5D,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAC5D,YAAY,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AAAA;;;;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
- * The normalized report model — the load-bearing seam of the library.
3
- *
4
- * An **adapter** turns its source (a `holon.trig` file, a cypher endpoint, a
5
- * live ledger) into a `NormalizedReport`: the raw facts, Information Blocks,
6
- * elements / periods / units / entity, and the calculation + presentation
7
- * association networks. Nothing more.
8
- *
9
- * The **projection** (`project.ts`) and **components** turn that normalized
10
- * model into rendered statements — the presentation-order walk, the calculation
11
- * subtotals, the table layout. That work is identical for every adapter, which
12
- * is what makes the rendering source-agnostic.
13
- */
14
- export {};
15
- //# sourceMappingURL=model.js.map
package/dist/model.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"model.js","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG"}
package/dist/project.d.ts DELETED
@@ -1,39 +0,0 @@
1
- import type { ElementInfo, NormalizedReport, Statement } from './model';
2
- interface OrderEntry {
3
- order: number;
4
- depth: number;
5
- }
6
- /**
7
- * Post-order the presentation arcs of one structure → `{element: {order, depth}}`.
8
- * Roots (a `from` that is never a `to`) are visited by their subtree's leading
9
- * arc order, so a balance sheet's roots (Assets, then Liabilities and Equity)
10
- * come out in the right sequence.
11
- */
12
- export declare function presentationOrder(model: NormalizedReport, structureId: string): Map<string, OrderEntry>;
13
- /** Concepts that are calculation parents — the authoritative subtotal set. */
14
- export declare function calcSubtotals(model: NormalizedReport): Set<string>;
15
- /** Reconstruct every statement in the report, in canonical block order. */
16
- export declare function buildStatements(model: NormalizedReport): Statement[];
17
- export interface FootTerm {
18
- element: ElementInfo;
19
- weight: number;
20
- value: number | null;
21
- }
22
- export interface FootCheck {
23
- element: ElementInfo;
24
- columnIndex: number;
25
- terms: FootTerm[];
26
- /** Σ child·weight over the present terms, or null if none are present. */
27
- expected: number | null;
28
- /** The subtotal's own reported value in this column. */
29
- actual: number | null;
30
- ok: boolean;
31
- }
32
- /**
33
- * Foot a subtotal live: sum its calculation children (× weight) and compare to
34
- * its reported value, e.g. `13,550 + 900 = 14,450 ✓`. Returns `null` when the
35
- * element is not a calculation parent (nothing to foot).
36
- */
37
- export declare function footCheck(model: NormalizedReport, statement: Statement, elementId: string, columnIndex: number): FootCheck | null;
38
- export {};
39
- //# sourceMappingURL=project.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../src/project.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAEV,WAAW,EAGX,gBAAgB,EAGhB,SAAS,EAIV,MAAM,SAAS,CAAA;AAEhB,UAAU,UAAU;IAClB,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;CACd;AAcD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,gBAAgB,EACvB,WAAW,EAAE,MAAM,GAClB,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAuCzB;AAED,8EAA8E;AAC9E,wBAAgB,aAAa,CAAC,KAAK,EAAE,gBAAgB,GAAG,GAAG,CAAC,MAAM,CAAC,CAIlE;AAoFD,2EAA2E;AAC3E,wBAAgB,eAAe,CAAC,KAAK,EAAE,gBAAgB,GAAG,SAAS,EAAE,CASpE;AAID,MAAM,WAAW,QAAQ;IACvB,OAAO,EAAE,WAAW,CAAA;IACpB,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CACrB;AAED,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,WAAW,CAAA;IACpB,WAAW,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE,QAAQ,EAAE,CAAA;IACjB,0EAA0E;IAC1E,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,wDAAwD;IACxD,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,EAAE,EAAE,OAAO,CAAA;CACZ;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CACvB,KAAK,EAAE,gBAAgB,EACvB,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,GAClB,SAAS,GAAG,IAAI,CAiClB"}
package/dist/project.js DELETED
@@ -1,201 +0,0 @@
1
- /**
2
- * Reconstruction: a `NormalizedReport` → renderable `Statement`s.
3
- *
4
- * This is the source-agnostic half of the library — the part that is identical
5
- * for every adapter. It is a TypeScript port of the RoboSystems platform's
6
- * DataBook converter:
7
- *
8
- * - **presentation walk** — a post-order DFS of the presentation network, so a
9
- * total renders *after* its components (cash + receivables … then *Assets,
10
- * Current*; the section subtotals last). `order` is the flattened post-order
11
- * position; `depth` is the tree depth (drives indentation).
12
- * - **subtotal detection** — a concept is a subtotal iff it is a *calculation
13
- * parent*. A presentation leaf can still be a subtotal (Gross Profit is a
14
- * presentation sibling but a calculation parent), so bolding off the calc
15
- * tree marks exactly the right rows.
16
- * - **table projection** — collect a block's facts by `factSet`, key by
17
- * element, derive period columns from the facts themselves, lay rows out in
18
- * presentation order.
19
- */
20
- import { BLOCK_ORDER, BLOCK_TITLES, humanize, qname } from './constants';
21
- import { formatDate } from './format';
22
- function fallbackElement(id) {
23
- return {
24
- id,
25
- qname: qname(id),
26
- label: humanize(id),
27
- balance: null,
28
- periodType: null,
29
- abstract: false,
30
- monetary: false,
31
- };
32
- }
33
- /**
34
- * Post-order the presentation arcs of one structure → `{element: {order, depth}}`.
35
- * Roots (a `from` that is never a `to`) are visited by their subtree's leading
36
- * arc order, so a balance sheet's roots (Assets, then Liabilities and Equity)
37
- * come out in the right sequence.
38
- */
39
- export function presentationOrder(model, structureId) {
40
- const children = new Map();
41
- const froms = new Set();
42
- const tos = new Set();
43
- for (const assoc of model.presAssociations) {
44
- if (assoc.structure !== structureId)
45
- continue;
46
- const kids = children.get(assoc.parent) ?? [];
47
- kids.push([assoc.order, assoc.child]);
48
- children.set(assoc.parent, kids);
49
- froms.add(assoc.parent);
50
- tos.add(assoc.child);
51
- }
52
- for (const kids of children.values()) {
53
- kids.sort((a, b) => a[0] - b[0]);
54
- }
55
- const out = new Map();
56
- const seen = new Set();
57
- let counter = 0;
58
- const walk = (node, depth) => {
59
- if (seen.has(node))
60
- return;
61
- seen.add(node);
62
- for (const [, child] of children.get(node) ?? []) {
63
- walk(child, depth + 1);
64
- }
65
- out.set(node, { order: counter, depth });
66
- counter += 1;
67
- };
68
- const rootKey = (root) => {
69
- const kids = children.get(root);
70
- return kids && kids.length ? kids[0][0] : 0;
71
- };
72
- const roots = [...froms].filter((f) => !tos.has(f)).sort((a, b) => rootKey(a) - rootKey(b));
73
- for (const root of roots)
74
- walk(root, 0);
75
- return out;
76
- }
77
- /** Concepts that are calculation parents — the authoritative subtotal set. */
78
- export function calcSubtotals(model) {
79
- const out = new Set();
80
- for (const assoc of model.calcAssociations)
81
- out.add(assoc.parent);
82
- return out;
83
- }
84
- function structureForBlock(model, blockType) {
85
- return model.structures.find((s) => s.blockType === blockType) ?? null;
86
- }
87
- function columnLabel(period) {
88
- return formatDate(period.end);
89
- }
90
- /** Period columns derived from the facts in one block, keyed and sorted by end. */
91
- function deriveColumns(model, facts) {
92
- const byEnd = new Map();
93
- for (const fact of facts) {
94
- const period = model.periods[fact.period];
95
- if (!period || !period.end)
96
- continue;
97
- const existing = byEnd.get(period.end);
98
- // Prefer a duration as the column representative — it carries the span.
99
- if (!existing || (existing.type === 'instant' && period.type === 'duration')) {
100
- byEnd.set(period.end, period);
101
- }
102
- }
103
- return [...byEnd.values()]
104
- .sort((a, b) => {
105
- const aStart = a.startDate ?? a.end;
106
- const bStart = b.startDate ?? b.end;
107
- return aStart.localeCompare(bStart) || a.end.localeCompare(b.end);
108
- })
109
- .map((period) => ({ key: period.end, label: columnLabel(period), period }));
110
- }
111
- function buildStatement(model, ib, subtotals) {
112
- const structure = structureForBlock(model, ib.blockType);
113
- const order = structure ? presentationOrder(model, structure.id) : new Map();
114
- const facts = model.facts.filter((f) => f.factSet !== null && f.factSet === ib.factSet);
115
- const columns = deriveColumns(model, facts);
116
- const colIndex = new Map(columns.map((c, i) => [c.key, i]));
117
- const cellsByElement = new Map();
118
- for (const fact of facts) {
119
- const period = model.periods[fact.period];
120
- if (!period)
121
- continue;
122
- const idx = colIndex.get(period.end);
123
- if (idx === undefined)
124
- continue;
125
- let cells = cellsByElement.get(fact.element);
126
- if (!cells) {
127
- cells = columns.map(() => ({ value: null, fact: null }));
128
- cellsByElement.set(fact.element, cells);
129
- }
130
- cells[idx] = { value: fact.value, fact };
131
- }
132
- const rows = [...cellsByElement.keys()]
133
- .map((id) => {
134
- const entry = order.get(id);
135
- return {
136
- id,
137
- order: entry ? entry.order : Number.MAX_SAFE_INTEGER,
138
- depth: entry ? entry.depth : 0,
139
- };
140
- })
141
- .sort((a, b) => a.order - b.order || a.id.localeCompare(b.id))
142
- .map(({ id, depth }) => ({
143
- element: model.elements[id] ?? fallbackElement(id),
144
- depth,
145
- isSubtotal: subtotals.has(id),
146
- cells: cellsByElement.get(id),
147
- }));
148
- return {
149
- ib,
150
- blockType: ib.blockType,
151
- title: BLOCK_TITLES[ib.blockType] ?? ib.label ?? ib.blockType,
152
- structureName: structure?.structureName ?? ib.label ?? null,
153
- columns,
154
- rows,
155
- };
156
- }
157
- /** Reconstruct every statement in the report, in canonical block order. */
158
- export function buildStatements(model) {
159
- const subtotals = calcSubtotals(model);
160
- return [...model.informationBlocks]
161
- .sort((a, b) => (BLOCK_ORDER[a.blockType] ?? 99) - (BLOCK_ORDER[b.blockType] ?? 99) ||
162
- a.blockType.localeCompare(b.blockType))
163
- .map((ib) => buildStatement(model, ib, subtotals));
164
- }
165
- /**
166
- * Foot a subtotal live: sum its calculation children (× weight) and compare to
167
- * its reported value, e.g. `13,550 + 900 = 14,450 ✓`. Returns `null` when the
168
- * element is not a calculation parent (nothing to foot).
169
- */
170
- export function footCheck(model, statement, elementId, columnIndex) {
171
- const kids = model.calcAssociations.filter((a) => a.parent === elementId);
172
- if (!kids.length)
173
- return null;
174
- const valueOf = (id) => {
175
- const row = statement.rows.find((r) => r.element.id === id);
176
- return row ? (row.cells[columnIndex]?.value ?? null) : null;
177
- };
178
- const terms = kids
179
- .slice()
180
- .sort((a, b) => a.order - b.order)
181
- .map((a) => ({
182
- element: model.elements[a.child] ?? fallbackElement(a.child),
183
- weight: a.weight,
184
- value: valueOf(a.child),
185
- }));
186
- const present = terms.filter((t) => t.value !== null);
187
- const expected = present.length
188
- ? present.reduce((sum, t) => sum + t.value * t.weight, 0)
189
- : null;
190
- const actual = valueOf(elementId);
191
- const ok = expected !== null && actual !== null && Math.abs(expected - actual) < 0.005;
192
- return {
193
- element: model.elements[elementId] ?? fallbackElement(elementId),
194
- columnIndex,
195
- terms,
196
- expected,
197
- actual,
198
- ok,
199
- };
200
- }
201
- //# sourceMappingURL=project.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"project.js","sourceRoot":"","sources":["../src/project.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAoBrC,SAAS,eAAe,CAAC,EAAU;IACjC,OAAO;QACL,EAAE;QACF,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC;QAChB,KAAK,EAAE,QAAQ,CAAC,EAAE,CAAC;QACnB,OAAO,EAAE,IAAI;QACb,UAAU,EAAE,IAAI;QAChB,QAAQ,EAAE,KAAK;QACf,QAAQ,EAAE,KAAK;KAChB,CAAA;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAC/B,KAAuB,EACvB,WAAmB;IAEnB,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAmC,CAAA;IAC3D,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAA;IAC/B,MAAM,GAAG,GAAG,IAAI,GAAG,EAAU,CAAA;IAE7B,KAAK,MAAM,KAAK,IAAI,KAAK,CAAC,gBAAgB,EAAE,CAAC;QAC3C,IAAI,KAAK,CAAC,SAA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