@robosystems/client 0.2.38 → 0.2.40
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/extensions/LedgerClient.d.ts +139 -0
- package/extensions/LedgerClient.js +320 -0
- package/extensions/LedgerClient.ts +486 -0
- package/extensions/ReportClient.d.ts +109 -0
- package/extensions/ReportClient.js +182 -0
- package/extensions/ReportClient.ts +320 -0
- package/extensions/index.d.ts +9 -1
- package/extensions/index.js +25 -1
- package/extensions/index.ts +28 -0
- package/index.ts +2 -2
- package/package.json +1 -1
- package/sdk/index.d.ts +2 -2
- package/sdk/index.js +24 -3
- package/sdk/index.ts +2 -2
- package/sdk/sdk.gen.d.ts +138 -3
- package/sdk/sdk.gen.js +267 -3
- package/sdk/sdk.gen.ts +267 -3
- package/sdk/types.gen.d.ts +1530 -93
- package/sdk/types.gen.ts +1644 -79
- package/sdk-extensions/LedgerClient.d.ts +139 -0
- package/sdk-extensions/LedgerClient.js +320 -0
- package/sdk-extensions/LedgerClient.ts +486 -0
- package/sdk-extensions/ReportClient.d.ts +109 -0
- package/sdk-extensions/ReportClient.js +182 -0
- package/sdk-extensions/ReportClient.ts +320 -0
- package/sdk-extensions/index.d.ts +9 -1
- package/sdk-extensions/index.js +25 -1
- package/sdk-extensions/index.ts +28 -0
- package/sdk.gen.d.ts +138 -3
- package/sdk.gen.js +267 -3
- package/sdk.gen.ts +267 -3
- package/types.gen.d.ts +1530 -93
- package/types.gen.ts +1644 -79
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.ReportClient = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* Report Client for RoboSystems API
|
|
7
|
+
*
|
|
8
|
+
* High-level client for report lifecycle: create, list, view statements,
|
|
9
|
+
* regenerate, share, and delete. Reports consume ledger data (mappings,
|
|
10
|
+
* trial balance) as inputs — use LedgerClient for those concerns.
|
|
11
|
+
*/
|
|
12
|
+
const sdk_gen_1 = require("../sdk/sdk.gen");
|
|
13
|
+
// ── Client ──────────────────────────────────────────────────────────────
|
|
14
|
+
class ReportClient {
|
|
15
|
+
constructor(config) {
|
|
16
|
+
this.config = config;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Create a report — generates facts for all structures in the taxonomy.
|
|
20
|
+
*/
|
|
21
|
+
async create(graphId, options) {
|
|
22
|
+
const response = await (0, sdk_gen_1.createReport)({
|
|
23
|
+
path: { graph_id: graphId },
|
|
24
|
+
body: {
|
|
25
|
+
name: options.name,
|
|
26
|
+
mapping_id: options.mappingId,
|
|
27
|
+
period_start: options.periodStart,
|
|
28
|
+
period_end: options.periodEnd,
|
|
29
|
+
taxonomy_id: options.taxonomyId ?? 'tax_usgaap_reporting',
|
|
30
|
+
period_type: options.periodType ?? 'quarterly',
|
|
31
|
+
comparative: options.comparative ?? true,
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
if (response.error) {
|
|
35
|
+
throw new Error(`Create report failed: ${JSON.stringify(response.error)}`);
|
|
36
|
+
}
|
|
37
|
+
return this._toReport(response.data);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* List all reports for a graph (includes received shared reports).
|
|
41
|
+
*/
|
|
42
|
+
async list(graphId) {
|
|
43
|
+
const response = await (0, sdk_gen_1.listReports)({
|
|
44
|
+
path: { graph_id: graphId },
|
|
45
|
+
});
|
|
46
|
+
if (response.error) {
|
|
47
|
+
throw new Error(`List reports failed: ${JSON.stringify(response.error)}`);
|
|
48
|
+
}
|
|
49
|
+
const data = response.data;
|
|
50
|
+
return (data.reports ?? []).map((r) => this._toReport(r));
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Get a report with its available structures.
|
|
54
|
+
*/
|
|
55
|
+
async get(graphId, reportId) {
|
|
56
|
+
const response = await (0, sdk_gen_1.getReport)({
|
|
57
|
+
path: { graph_id: graphId, report_id: reportId },
|
|
58
|
+
});
|
|
59
|
+
if (response.error) {
|
|
60
|
+
throw new Error(`Get report failed: ${JSON.stringify(response.error)}`);
|
|
61
|
+
}
|
|
62
|
+
return this._toReport(response.data);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Render a financial statement — facts viewed through a structure.
|
|
66
|
+
*
|
|
67
|
+
* @param structureType - income_statement, balance_sheet, cash_flow_statement
|
|
68
|
+
*/
|
|
69
|
+
async statement(graphId, reportId, structureType) {
|
|
70
|
+
const response = await (0, sdk_gen_1.getStatement)({
|
|
71
|
+
path: { graph_id: graphId, report_id: reportId, structure_type: structureType },
|
|
72
|
+
});
|
|
73
|
+
if (response.error) {
|
|
74
|
+
throw new Error(`Get statement failed: ${JSON.stringify(response.error)}`);
|
|
75
|
+
}
|
|
76
|
+
const data = response.data;
|
|
77
|
+
return {
|
|
78
|
+
reportId: data.report_id,
|
|
79
|
+
structureId: data.structure_id,
|
|
80
|
+
structureName: data.structure_name,
|
|
81
|
+
structureType: data.structure_type,
|
|
82
|
+
periodStart: data.period_start,
|
|
83
|
+
periodEnd: data.period_end,
|
|
84
|
+
comparativePeriodStart: data.comparative_period_start ?? null,
|
|
85
|
+
comparativePeriodEnd: data.comparative_period_end ?? null,
|
|
86
|
+
rows: (data.rows ?? []).map((r) => ({
|
|
87
|
+
elementId: r.element_id,
|
|
88
|
+
elementQname: r.element_qname,
|
|
89
|
+
elementName: r.element_name,
|
|
90
|
+
classification: r.classification,
|
|
91
|
+
currentValue: r.current_value,
|
|
92
|
+
priorValue: r.prior_value ?? null,
|
|
93
|
+
isSubtotal: r.is_subtotal ?? false,
|
|
94
|
+
depth: r.depth ?? 0,
|
|
95
|
+
})),
|
|
96
|
+
validation: data.validation
|
|
97
|
+
? {
|
|
98
|
+
passed: data.validation.passed,
|
|
99
|
+
checks: data.validation.checks,
|
|
100
|
+
failures: data.validation.failures,
|
|
101
|
+
warnings: data.validation.warnings,
|
|
102
|
+
}
|
|
103
|
+
: null,
|
|
104
|
+
unmappedCount: data.unmapped_count ?? 0,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Regenerate a report with new period dates.
|
|
109
|
+
*/
|
|
110
|
+
async regenerate(graphId, reportId, periodStart, periodEnd) {
|
|
111
|
+
const response = await (0, sdk_gen_1.regenerateReport)({
|
|
112
|
+
path: { graph_id: graphId, report_id: reportId },
|
|
113
|
+
body: { period_start: periodStart, period_end: periodEnd },
|
|
114
|
+
});
|
|
115
|
+
if (response.error) {
|
|
116
|
+
throw new Error(`Regenerate report failed: ${JSON.stringify(response.error)}`);
|
|
117
|
+
}
|
|
118
|
+
return this._toReport(response.data);
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Delete a report and its generated facts.
|
|
122
|
+
*/
|
|
123
|
+
async delete(graphId, reportId) {
|
|
124
|
+
const response = await (0, sdk_gen_1.deleteReport)({
|
|
125
|
+
path: { graph_id: graphId, report_id: reportId },
|
|
126
|
+
});
|
|
127
|
+
if (response.error) {
|
|
128
|
+
throw new Error(`Delete report failed: ${JSON.stringify(response.error)}`);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Share a published report to other graphs (snapshot copy).
|
|
133
|
+
*/
|
|
134
|
+
async share(graphId, reportId, targetGraphIds) {
|
|
135
|
+
const response = await (0, sdk_gen_1.shareReport)({
|
|
136
|
+
path: { graph_id: graphId, report_id: reportId },
|
|
137
|
+
body: { target_graph_ids: targetGraphIds },
|
|
138
|
+
});
|
|
139
|
+
if (response.error) {
|
|
140
|
+
throw new Error(`Share report failed: ${JSON.stringify(response.error)}`);
|
|
141
|
+
}
|
|
142
|
+
const data = response.data;
|
|
143
|
+
return {
|
|
144
|
+
reportId: data.report_id,
|
|
145
|
+
results: (data.results ?? []).map((r) => ({
|
|
146
|
+
targetGraphId: r.target_graph_id,
|
|
147
|
+
status: r.status,
|
|
148
|
+
error: r.error ?? null,
|
|
149
|
+
factCount: r.fact_count ?? 0,
|
|
150
|
+
})),
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
/** Check if a report was received via sharing (vs locally created). */
|
|
154
|
+
isSharedReport(report) {
|
|
155
|
+
return report.sourceGraphId !== null;
|
|
156
|
+
}
|
|
157
|
+
_toReport(r) {
|
|
158
|
+
return {
|
|
159
|
+
id: r.id,
|
|
160
|
+
name: r.name,
|
|
161
|
+
taxonomyId: r.taxonomy_id,
|
|
162
|
+
generationStatus: r.generation_status,
|
|
163
|
+
periodType: r.period_type,
|
|
164
|
+
periodStart: r.period_start ?? null,
|
|
165
|
+
periodEnd: r.period_end ?? null,
|
|
166
|
+
comparative: r.comparative,
|
|
167
|
+
mappingId: r.mapping_id ?? null,
|
|
168
|
+
aiGenerated: r.ai_generated ?? false,
|
|
169
|
+
createdAt: r.created_at,
|
|
170
|
+
lastGenerated: r.last_generated ?? null,
|
|
171
|
+
structures: (r.structures ?? []).map((s) => ({
|
|
172
|
+
id: s.id,
|
|
173
|
+
name: s.name,
|
|
174
|
+
structureType: s.structure_type,
|
|
175
|
+
})),
|
|
176
|
+
sourceGraphId: r.source_graph_id ?? null,
|
|
177
|
+
sourceReportId: r.source_report_id ?? null,
|
|
178
|
+
sharedAt: r.shared_at ?? null,
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
exports.ReportClient = ReportClient;
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Report Client for RoboSystems API
|
|
5
|
+
*
|
|
6
|
+
* High-level client for report lifecycle: create, list, view statements,
|
|
7
|
+
* regenerate, share, and delete. Reports consume ledger data (mappings,
|
|
8
|
+
* trial balance) as inputs — use LedgerClient for those concerns.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import {
|
|
12
|
+
createReport,
|
|
13
|
+
deleteReport,
|
|
14
|
+
getReport,
|
|
15
|
+
getStatement,
|
|
16
|
+
listReports,
|
|
17
|
+
regenerateReport,
|
|
18
|
+
shareReport,
|
|
19
|
+
} from '../sdk/sdk.gen'
|
|
20
|
+
import type {
|
|
21
|
+
CreateReportRequest,
|
|
22
|
+
FactRowResponse,
|
|
23
|
+
RegenerateReportRequest,
|
|
24
|
+
ReportListResponse,
|
|
25
|
+
ReportResponse,
|
|
26
|
+
ShareReportResponse,
|
|
27
|
+
StatementResponse,
|
|
28
|
+
StructureSummary,
|
|
29
|
+
ValidationCheckResponse,
|
|
30
|
+
} from '../sdk/types.gen'
|
|
31
|
+
|
|
32
|
+
// ── Friendly types ──────────────────────────────────────────────────────
|
|
33
|
+
|
|
34
|
+
export interface Report {
|
|
35
|
+
id: string
|
|
36
|
+
name: string
|
|
37
|
+
taxonomyId: string
|
|
38
|
+
generationStatus: string
|
|
39
|
+
periodType: string
|
|
40
|
+
periodStart: string | null
|
|
41
|
+
periodEnd: string | null
|
|
42
|
+
comparative: boolean
|
|
43
|
+
mappingId: string | null
|
|
44
|
+
aiGenerated: boolean
|
|
45
|
+
createdAt: string
|
|
46
|
+
lastGenerated: string | null
|
|
47
|
+
structures: Structure[]
|
|
48
|
+
/** Non-null when this report was shared from another graph */
|
|
49
|
+
sourceGraphId: string | null
|
|
50
|
+
sourceReportId: string | null
|
|
51
|
+
sharedAt: string | null
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Structure type re-exported from LedgerClient
|
|
55
|
+
import type { Structure } from './LedgerClient'
|
|
56
|
+
export type { Structure } from './LedgerClient'
|
|
57
|
+
|
|
58
|
+
export interface StatementRow {
|
|
59
|
+
elementId: string
|
|
60
|
+
elementQname: string
|
|
61
|
+
elementName: string
|
|
62
|
+
classification: string
|
|
63
|
+
currentValue: number
|
|
64
|
+
priorValue: number | null
|
|
65
|
+
isSubtotal: boolean
|
|
66
|
+
depth: number
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface StatementData {
|
|
70
|
+
reportId: string
|
|
71
|
+
structureId: string
|
|
72
|
+
structureName: string
|
|
73
|
+
structureType: string
|
|
74
|
+
periodStart: string
|
|
75
|
+
periodEnd: string
|
|
76
|
+
comparativePeriodStart: string | null
|
|
77
|
+
comparativePeriodEnd: string | null
|
|
78
|
+
rows: StatementRow[]
|
|
79
|
+
validation: {
|
|
80
|
+
passed: boolean
|
|
81
|
+
checks: string[]
|
|
82
|
+
failures: string[]
|
|
83
|
+
warnings: string[]
|
|
84
|
+
} | null
|
|
85
|
+
unmappedCount: number
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export interface ShareResult {
|
|
89
|
+
reportId: string
|
|
90
|
+
results: Array<{
|
|
91
|
+
targetGraphId: string
|
|
92
|
+
status: 'shared' | 'error'
|
|
93
|
+
error: string | null
|
|
94
|
+
factCount: number
|
|
95
|
+
}>
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export interface CreateReportOptions {
|
|
99
|
+
name: string
|
|
100
|
+
mappingId: string
|
|
101
|
+
periodStart: string
|
|
102
|
+
periodEnd: string
|
|
103
|
+
taxonomyId?: string
|
|
104
|
+
periodType?: string
|
|
105
|
+
comparative?: boolean
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// ── Client ──────────────────────────────────────────────────────────────
|
|
109
|
+
|
|
110
|
+
export class ReportClient {
|
|
111
|
+
private config: {
|
|
112
|
+
baseUrl: string
|
|
113
|
+
credentials?: 'include' | 'same-origin' | 'omit'
|
|
114
|
+
headers?: Record<string, string>
|
|
115
|
+
token?: string
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
constructor(config: {
|
|
119
|
+
baseUrl: string
|
|
120
|
+
credentials?: 'include' | 'same-origin' | 'omit'
|
|
121
|
+
headers?: Record<string, string>
|
|
122
|
+
token?: string
|
|
123
|
+
}) {
|
|
124
|
+
this.config = config
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Create a report — generates facts for all structures in the taxonomy.
|
|
129
|
+
*/
|
|
130
|
+
async create(graphId: string, options: CreateReportOptions): Promise<Report> {
|
|
131
|
+
const response = await createReport({
|
|
132
|
+
path: { graph_id: graphId },
|
|
133
|
+
body: {
|
|
134
|
+
name: options.name,
|
|
135
|
+
mapping_id: options.mappingId,
|
|
136
|
+
period_start: options.periodStart,
|
|
137
|
+
period_end: options.periodEnd,
|
|
138
|
+
taxonomy_id: options.taxonomyId ?? 'tax_usgaap_reporting',
|
|
139
|
+
period_type: options.periodType ?? 'quarterly',
|
|
140
|
+
comparative: options.comparative ?? true,
|
|
141
|
+
} as CreateReportRequest,
|
|
142
|
+
})
|
|
143
|
+
|
|
144
|
+
if (response.error) {
|
|
145
|
+
throw new Error(`Create report failed: ${JSON.stringify(response.error)}`)
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
return this._toReport(response.data as ReportResponse)
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* List all reports for a graph (includes received shared reports).
|
|
153
|
+
*/
|
|
154
|
+
async list(graphId: string): Promise<Report[]> {
|
|
155
|
+
const response = await listReports({
|
|
156
|
+
path: { graph_id: graphId },
|
|
157
|
+
})
|
|
158
|
+
|
|
159
|
+
if (response.error) {
|
|
160
|
+
throw new Error(`List reports failed: ${JSON.stringify(response.error)}`)
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
const data = response.data as ReportListResponse
|
|
164
|
+
return (data.reports ?? []).map((r) => this._toReport(r))
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Get a report with its available structures.
|
|
169
|
+
*/
|
|
170
|
+
async get(graphId: string, reportId: string): Promise<Report> {
|
|
171
|
+
const response = await getReport({
|
|
172
|
+
path: { graph_id: graphId, report_id: reportId },
|
|
173
|
+
})
|
|
174
|
+
|
|
175
|
+
if (response.error) {
|
|
176
|
+
throw new Error(`Get report failed: ${JSON.stringify(response.error)}`)
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
return this._toReport(response.data as ReportResponse)
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Render a financial statement — facts viewed through a structure.
|
|
184
|
+
*
|
|
185
|
+
* @param structureType - income_statement, balance_sheet, cash_flow_statement
|
|
186
|
+
*/
|
|
187
|
+
async statement(
|
|
188
|
+
graphId: string,
|
|
189
|
+
reportId: string,
|
|
190
|
+
structureType: string
|
|
191
|
+
): Promise<StatementData> {
|
|
192
|
+
const response = await getStatement({
|
|
193
|
+
path: { graph_id: graphId, report_id: reportId, structure_type: structureType },
|
|
194
|
+
})
|
|
195
|
+
|
|
196
|
+
if (response.error) {
|
|
197
|
+
throw new Error(`Get statement failed: ${JSON.stringify(response.error)}`)
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
const data = response.data as StatementResponse
|
|
201
|
+
return {
|
|
202
|
+
reportId: data.report_id,
|
|
203
|
+
structureId: data.structure_id,
|
|
204
|
+
structureName: data.structure_name,
|
|
205
|
+
structureType: data.structure_type,
|
|
206
|
+
periodStart: data.period_start,
|
|
207
|
+
periodEnd: data.period_end,
|
|
208
|
+
comparativePeriodStart: data.comparative_period_start ?? null,
|
|
209
|
+
comparativePeriodEnd: data.comparative_period_end ?? null,
|
|
210
|
+
rows: (data.rows ?? []).map((r: FactRowResponse) => ({
|
|
211
|
+
elementId: r.element_id,
|
|
212
|
+
elementQname: r.element_qname,
|
|
213
|
+
elementName: r.element_name,
|
|
214
|
+
classification: r.classification,
|
|
215
|
+
currentValue: r.current_value,
|
|
216
|
+
priorValue: r.prior_value ?? null,
|
|
217
|
+
isSubtotal: r.is_subtotal ?? false,
|
|
218
|
+
depth: r.depth ?? 0,
|
|
219
|
+
})),
|
|
220
|
+
validation: data.validation
|
|
221
|
+
? {
|
|
222
|
+
passed: (data.validation as ValidationCheckResponse).passed,
|
|
223
|
+
checks: (data.validation as ValidationCheckResponse).checks,
|
|
224
|
+
failures: (data.validation as ValidationCheckResponse).failures,
|
|
225
|
+
warnings: (data.validation as ValidationCheckResponse).warnings,
|
|
226
|
+
}
|
|
227
|
+
: null,
|
|
228
|
+
unmappedCount: data.unmapped_count ?? 0,
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Regenerate a report with new period dates.
|
|
234
|
+
*/
|
|
235
|
+
async regenerate(
|
|
236
|
+
graphId: string,
|
|
237
|
+
reportId: string,
|
|
238
|
+
periodStart: string,
|
|
239
|
+
periodEnd: string
|
|
240
|
+
): Promise<Report> {
|
|
241
|
+
const response = await regenerateReport({
|
|
242
|
+
path: { graph_id: graphId, report_id: reportId },
|
|
243
|
+
body: { period_start: periodStart, period_end: periodEnd } as RegenerateReportRequest,
|
|
244
|
+
})
|
|
245
|
+
|
|
246
|
+
if (response.error) {
|
|
247
|
+
throw new Error(`Regenerate report failed: ${JSON.stringify(response.error)}`)
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
return this._toReport(response.data as ReportResponse)
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Delete a report and its generated facts.
|
|
255
|
+
*/
|
|
256
|
+
async delete(graphId: string, reportId: string): Promise<void> {
|
|
257
|
+
const response = await deleteReport({
|
|
258
|
+
path: { graph_id: graphId, report_id: reportId },
|
|
259
|
+
})
|
|
260
|
+
|
|
261
|
+
if (response.error) {
|
|
262
|
+
throw new Error(`Delete report failed: ${JSON.stringify(response.error)}`)
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Share a published report to other graphs (snapshot copy).
|
|
268
|
+
*/
|
|
269
|
+
async share(graphId: string, reportId: string, targetGraphIds: string[]): Promise<ShareResult> {
|
|
270
|
+
const response = await shareReport({
|
|
271
|
+
path: { graph_id: graphId, report_id: reportId },
|
|
272
|
+
body: { target_graph_ids: targetGraphIds },
|
|
273
|
+
})
|
|
274
|
+
|
|
275
|
+
if (response.error) {
|
|
276
|
+
throw new Error(`Share report failed: ${JSON.stringify(response.error)}`)
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
const data = response.data as ShareReportResponse
|
|
280
|
+
return {
|
|
281
|
+
reportId: data.report_id,
|
|
282
|
+
results: (data.results ?? []).map((r) => ({
|
|
283
|
+
targetGraphId: r.target_graph_id,
|
|
284
|
+
status: r.status as 'shared' | 'error',
|
|
285
|
+
error: r.error ?? null,
|
|
286
|
+
factCount: r.fact_count ?? 0,
|
|
287
|
+
})),
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/** Check if a report was received via sharing (vs locally created). */
|
|
292
|
+
isSharedReport(report: Report): boolean {
|
|
293
|
+
return report.sourceGraphId !== null
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
private _toReport(r: ReportResponse): Report {
|
|
297
|
+
return {
|
|
298
|
+
id: r.id,
|
|
299
|
+
name: r.name,
|
|
300
|
+
taxonomyId: r.taxonomy_id,
|
|
301
|
+
generationStatus: r.generation_status,
|
|
302
|
+
periodType: r.period_type,
|
|
303
|
+
periodStart: r.period_start ?? null,
|
|
304
|
+
periodEnd: r.period_end ?? null,
|
|
305
|
+
comparative: r.comparative,
|
|
306
|
+
mappingId: r.mapping_id ?? null,
|
|
307
|
+
aiGenerated: r.ai_generated ?? false,
|
|
308
|
+
createdAt: r.created_at,
|
|
309
|
+
lastGenerated: r.last_generated ?? null,
|
|
310
|
+
structures: (r.structures ?? []).map((s: StructureSummary) => ({
|
|
311
|
+
id: s.id,
|
|
312
|
+
name: s.name,
|
|
313
|
+
structureType: s.structure_type,
|
|
314
|
+
})),
|
|
315
|
+
sourceGraphId: r.source_graph_id ?? null,
|
|
316
|
+
sourceReportId: r.source_report_id ?? null,
|
|
317
|
+
sharedAt: r.shared_at ?? null,
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}
|
|
@@ -11,6 +11,8 @@ import { MaterializationClient } from './MaterializationClient';
|
|
|
11
11
|
import { TableClient } from './TableClient';
|
|
12
12
|
import { GraphClient } from './GraphClient';
|
|
13
13
|
import { DocumentClient } from './DocumentClient';
|
|
14
|
+
import { LedgerClient } from './LedgerClient';
|
|
15
|
+
import { ReportClient } from './ReportClient';
|
|
14
16
|
export interface RoboSystemsExtensionConfig {
|
|
15
17
|
baseUrl?: string;
|
|
16
18
|
credentials?: 'include' | 'same-origin' | 'omit';
|
|
@@ -29,6 +31,8 @@ export declare class RoboSystemsExtensions {
|
|
|
29
31
|
readonly tables: TableClient;
|
|
30
32
|
readonly graphs: GraphClient;
|
|
31
33
|
readonly documents: DocumentClient;
|
|
34
|
+
readonly ledger: LedgerClient;
|
|
35
|
+
readonly reports: ReportClient;
|
|
32
36
|
private config;
|
|
33
37
|
constructor(config?: RoboSystemsExtensionConfig);
|
|
34
38
|
/**
|
|
@@ -52,10 +56,12 @@ export * from './FileClient';
|
|
|
52
56
|
export * from './MaterializationClient';
|
|
53
57
|
export * from './GraphClient';
|
|
54
58
|
export * from './DocumentClient';
|
|
59
|
+
export * from './LedgerClient';
|
|
60
|
+
export * from './ReportClient';
|
|
55
61
|
export * from './config';
|
|
56
62
|
export type { TableInfo, TableQueryResult } from './TableClient';
|
|
57
63
|
export { TableClient } from './TableClient';
|
|
58
|
-
export { OperationClient, QueryClient, AgentClient, SSEClient, FileClient, MaterializationClient, GraphClient, DocumentClient, };
|
|
64
|
+
export { OperationClient, QueryClient, AgentClient, SSEClient, FileClient, MaterializationClient, GraphClient, DocumentClient, LedgerClient, ReportClient, };
|
|
59
65
|
export { useMultipleOperations, useOperation, useQuery, useSDKClients, useStreamingQuery, useTableUpload, } from './hooks';
|
|
60
66
|
export declare const extensions: {
|
|
61
67
|
readonly query: QueryClient;
|
|
@@ -66,6 +72,8 @@ export declare const extensions: {
|
|
|
66
72
|
readonly tables: TableClient;
|
|
67
73
|
readonly graphs: GraphClient;
|
|
68
74
|
readonly documents: DocumentClient;
|
|
75
|
+
readonly ledger: LedgerClient;
|
|
76
|
+
readonly reports: ReportClient;
|
|
69
77
|
monitorOperation: (operationId: string, onProgress?: (progress: any) => void) => Promise<any>;
|
|
70
78
|
createSSEClient: () => SSEClient;
|
|
71
79
|
close: () => void;
|
package/sdk-extensions/index.js
CHANGED
|
@@ -18,7 +18,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
18
18
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
19
19
|
};
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.analyzeFinancials = exports.agentQuery = exports.streamQuery = exports.executeQuery = exports.monitorOperation = exports.extensions = exports.useTableUpload = exports.useStreamingQuery = exports.useSDKClients = exports.useQuery = exports.useOperation = exports.useMultipleOperations = exports.DocumentClient = exports.GraphClient = exports.MaterializationClient = exports.FileClient = exports.SSEClient = exports.AgentClient = exports.QueryClient = exports.OperationClient = exports.TableClient = exports.RoboSystemsExtensions = void 0;
|
|
21
|
+
exports.analyzeFinancials = exports.agentQuery = exports.streamQuery = exports.executeQuery = exports.monitorOperation = exports.extensions = exports.useTableUpload = exports.useStreamingQuery = exports.useSDKClients = exports.useQuery = exports.useOperation = exports.useMultipleOperations = exports.ReportClient = exports.LedgerClient = exports.DocumentClient = exports.GraphClient = exports.MaterializationClient = exports.FileClient = exports.SSEClient = exports.AgentClient = exports.QueryClient = exports.OperationClient = exports.TableClient = exports.RoboSystemsExtensions = void 0;
|
|
22
22
|
const client_gen_1 = require("../sdk/client.gen");
|
|
23
23
|
const config_1 = require("./config");
|
|
24
24
|
const OperationClient_1 = require("./OperationClient");
|
|
@@ -38,6 +38,10 @@ const GraphClient_1 = require("./GraphClient");
|
|
|
38
38
|
Object.defineProperty(exports, "GraphClient", { enumerable: true, get: function () { return GraphClient_1.GraphClient; } });
|
|
39
39
|
const DocumentClient_1 = require("./DocumentClient");
|
|
40
40
|
Object.defineProperty(exports, "DocumentClient", { enumerable: true, get: function () { return DocumentClient_1.DocumentClient; } });
|
|
41
|
+
const LedgerClient_1 = require("./LedgerClient");
|
|
42
|
+
Object.defineProperty(exports, "LedgerClient", { enumerable: true, get: function () { return LedgerClient_1.LedgerClient; } });
|
|
43
|
+
const ReportClient_1 = require("./ReportClient");
|
|
44
|
+
Object.defineProperty(exports, "ReportClient", { enumerable: true, get: function () { return ReportClient_1.ReportClient; } });
|
|
41
45
|
class RoboSystemsExtensions {
|
|
42
46
|
constructor(config = {}) {
|
|
43
47
|
// Get base URL from SDK client config or use provided/default
|
|
@@ -103,6 +107,18 @@ class RoboSystemsExtensions {
|
|
|
103
107
|
token: this.config.token,
|
|
104
108
|
headers: this.config.headers,
|
|
105
109
|
});
|
|
110
|
+
this.ledger = new LedgerClient_1.LedgerClient({
|
|
111
|
+
baseUrl: this.config.baseUrl,
|
|
112
|
+
credentials: this.config.credentials,
|
|
113
|
+
token: this.config.token,
|
|
114
|
+
headers: this.config.headers,
|
|
115
|
+
});
|
|
116
|
+
this.reports = new ReportClient_1.ReportClient({
|
|
117
|
+
baseUrl: this.config.baseUrl,
|
|
118
|
+
credentials: this.config.credentials,
|
|
119
|
+
token: this.config.token,
|
|
120
|
+
headers: this.config.headers,
|
|
121
|
+
});
|
|
106
122
|
}
|
|
107
123
|
/**
|
|
108
124
|
* Convenience method to monitor any operation
|
|
@@ -143,6 +159,8 @@ __exportStar(require("./FileClient"), exports);
|
|
|
143
159
|
__exportStar(require("./MaterializationClient"), exports);
|
|
144
160
|
__exportStar(require("./GraphClient"), exports);
|
|
145
161
|
__exportStar(require("./DocumentClient"), exports);
|
|
162
|
+
__exportStar(require("./LedgerClient"), exports);
|
|
163
|
+
__exportStar(require("./ReportClient"), exports);
|
|
146
164
|
__exportStar(require("./config"), exports);
|
|
147
165
|
var TableClient_2 = require("./TableClient");
|
|
148
166
|
Object.defineProperty(exports, "TableClient", { enumerable: true, get: function () { return TableClient_2.TableClient; } });
|
|
@@ -187,6 +205,12 @@ exports.extensions = {
|
|
|
187
205
|
get documents() {
|
|
188
206
|
return getExtensions().documents;
|
|
189
207
|
},
|
|
208
|
+
get ledger() {
|
|
209
|
+
return getExtensions().ledger;
|
|
210
|
+
},
|
|
211
|
+
get reports() {
|
|
212
|
+
return getExtensions().reports;
|
|
213
|
+
},
|
|
190
214
|
monitorOperation: (operationId, onProgress) => getExtensions().monitorOperation(operationId, onProgress),
|
|
191
215
|
createSSEClient: () => getExtensions().createSSEClient(),
|
|
192
216
|
close: () => getExtensions().close(),
|
package/sdk-extensions/index.ts
CHANGED
|
@@ -14,6 +14,8 @@ import { MaterializationClient } from './MaterializationClient'
|
|
|
14
14
|
import { TableClient } from './TableClient'
|
|
15
15
|
import { GraphClient } from './GraphClient'
|
|
16
16
|
import { DocumentClient } from './DocumentClient'
|
|
17
|
+
import { LedgerClient } from './LedgerClient'
|
|
18
|
+
import { ReportClient } from './ReportClient'
|
|
17
19
|
|
|
18
20
|
export interface RoboSystemsExtensionConfig {
|
|
19
21
|
baseUrl?: string
|
|
@@ -45,6 +47,8 @@ export class RoboSystemsExtensions {
|
|
|
45
47
|
public readonly tables: TableClient
|
|
46
48
|
public readonly graphs: GraphClient
|
|
47
49
|
public readonly documents: DocumentClient
|
|
50
|
+
public readonly ledger: LedgerClient
|
|
51
|
+
public readonly reports: ReportClient
|
|
48
52
|
private config: ResolvedConfig
|
|
49
53
|
|
|
50
54
|
constructor(config: RoboSystemsExtensionConfig = {}) {
|
|
@@ -121,6 +125,20 @@ export class RoboSystemsExtensions {
|
|
|
121
125
|
token: this.config.token,
|
|
122
126
|
headers: this.config.headers,
|
|
123
127
|
})
|
|
128
|
+
|
|
129
|
+
this.ledger = new LedgerClient({
|
|
130
|
+
baseUrl: this.config.baseUrl,
|
|
131
|
+
credentials: this.config.credentials,
|
|
132
|
+
token: this.config.token,
|
|
133
|
+
headers: this.config.headers,
|
|
134
|
+
})
|
|
135
|
+
|
|
136
|
+
this.reports = new ReportClient({
|
|
137
|
+
baseUrl: this.config.baseUrl,
|
|
138
|
+
credentials: this.config.credentials,
|
|
139
|
+
token: this.config.token,
|
|
140
|
+
headers: this.config.headers,
|
|
141
|
+
})
|
|
124
142
|
}
|
|
125
143
|
|
|
126
144
|
/**
|
|
@@ -164,6 +182,8 @@ export * from './FileClient'
|
|
|
164
182
|
export * from './MaterializationClient'
|
|
165
183
|
export * from './GraphClient'
|
|
166
184
|
export * from './DocumentClient'
|
|
185
|
+
export * from './LedgerClient'
|
|
186
|
+
export * from './ReportClient'
|
|
167
187
|
export * from './config'
|
|
168
188
|
|
|
169
189
|
// Export TableClient types individually to avoid conflicts with QueryClient's QueryResult
|
|
@@ -179,6 +199,8 @@ export {
|
|
|
179
199
|
MaterializationClient,
|
|
180
200
|
GraphClient,
|
|
181
201
|
DocumentClient,
|
|
202
|
+
LedgerClient,
|
|
203
|
+
ReportClient,
|
|
182
204
|
}
|
|
183
205
|
|
|
184
206
|
// Export React hooks
|
|
@@ -226,6 +248,12 @@ export const extensions = {
|
|
|
226
248
|
get documents() {
|
|
227
249
|
return getExtensions().documents
|
|
228
250
|
},
|
|
251
|
+
get ledger() {
|
|
252
|
+
return getExtensions().ledger
|
|
253
|
+
},
|
|
254
|
+
get reports() {
|
|
255
|
+
return getExtensions().reports
|
|
256
|
+
},
|
|
229
257
|
monitorOperation: (operationId: string, onProgress?: (progress: any) => void) =>
|
|
230
258
|
getExtensions().monitorOperation(operationId, onProgress),
|
|
231
259
|
createSSEClient: () => getExtensions().createSSEClient(),
|