@robosystems/client 0.2.48 → 0.3.0

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 (190) hide show
  1. package/extensions/InvestorClient.d.ts +91 -0
  2. package/extensions/InvestorClient.js +223 -0
  3. package/extensions/InvestorClient.ts +501 -0
  4. package/extensions/LedgerClient.d.ts +213 -165
  5. package/extensions/LedgerClient.js +315 -393
  6. package/extensions/LedgerClient.ts +887 -564
  7. package/extensions/ReportClient.d.ts +77 -115
  8. package/extensions/ReportClient.js +124 -211
  9. package/extensions/ReportClient.ts +298 -358
  10. package/extensions/config.js +1 -1
  11. package/extensions/config.ts +1 -1
  12. package/extensions/graphql/client.d.ts +46 -0
  13. package/extensions/graphql/client.js +75 -0
  14. package/extensions/graphql/client.ts +82 -0
  15. package/extensions/graphql/generated/graphql.d.ts +1786 -0
  16. package/extensions/graphql/generated/graphql.js +2671 -0
  17. package/extensions/graphql/generated/graphql.ts +4491 -0
  18. package/extensions/graphql/queries/investor/holdings.d.ts +8 -0
  19. package/extensions/graphql/queries/investor/holdings.js +36 -0
  20. package/extensions/graphql/queries/investor/holdings.ts +34 -0
  21. package/extensions/graphql/queries/investor/portfolio.d.ts +4 -0
  22. package/extensions/graphql/queries/investor/portfolio.js +21 -0
  23. package/extensions/graphql/queries/investor/portfolio.ts +19 -0
  24. package/extensions/graphql/queries/investor/portfolios.d.ts +4 -0
  25. package/extensions/graphql/queries/investor/portfolios.js +29 -0
  26. package/extensions/graphql/queries/investor/portfolios.ts +27 -0
  27. package/extensions/graphql/queries/investor/position.d.ts +4 -0
  28. package/extensions/graphql/queries/investor/position.js +33 -0
  29. package/extensions/graphql/queries/investor/position.ts +31 -0
  30. package/extensions/graphql/queries/investor/positions.d.ts +8 -0
  31. package/extensions/graphql/queries/investor/positions.js +57 -0
  32. package/extensions/graphql/queries/investor/positions.ts +55 -0
  33. package/extensions/graphql/queries/investor/securities.d.ts +8 -0
  34. package/extensions/graphql/queries/investor/securities.js +50 -0
  35. package/extensions/graphql/queries/investor/securities.ts +48 -0
  36. package/extensions/graphql/queries/investor/security.d.ts +4 -0
  37. package/extensions/graphql/queries/investor/security.js +26 -0
  38. package/extensions/graphql/queries/investor/security.ts +24 -0
  39. package/extensions/graphql/queries/ledger/accountRollups.d.ts +7 -0
  40. package/extensions/graphql/queries/ledger/accountRollups.js +36 -0
  41. package/extensions/graphql/queries/ledger/accountRollups.ts +34 -0
  42. package/extensions/graphql/queries/ledger/accountTree.d.ts +11 -0
  43. package/extensions/graphql/queries/ledger/accountTree.js +61 -0
  44. package/extensions/graphql/queries/ledger/accountTree.ts +59 -0
  45. package/extensions/graphql/queries/ledger/accounts.d.ts +8 -0
  46. package/extensions/graphql/queries/ledger/accounts.js +45 -0
  47. package/extensions/graphql/queries/ledger/accounts.ts +43 -0
  48. package/extensions/graphql/queries/ledger/closingBookStructures.d.ts +6 -0
  49. package/extensions/graphql/queries/ledger/closingBookStructures.js +27 -0
  50. package/extensions/graphql/queries/ledger/closingBookStructures.ts +25 -0
  51. package/extensions/graphql/queries/ledger/elements.d.ts +6 -0
  52. package/extensions/graphql/queries/ledger/elements.js +56 -0
  53. package/extensions/graphql/queries/ledger/elements.ts +54 -0
  54. package/extensions/graphql/queries/ledger/entities.d.ts +7 -0
  55. package/extensions/graphql/queries/ledger/entities.js +31 -0
  56. package/extensions/graphql/queries/ledger/entities.ts +29 -0
  57. package/extensions/graphql/queries/ledger/entity.d.ts +14 -0
  58. package/extensions/graphql/queries/ledger/entity.js +55 -0
  59. package/extensions/graphql/queries/ledger/entity.ts +54 -0
  60. package/extensions/graphql/queries/ledger/fiscalCalendar.d.ts +8 -0
  61. package/extensions/graphql/queries/ledger/fiscalCalendar.js +35 -0
  62. package/extensions/graphql/queries/ledger/fiscalCalendar.ts +33 -0
  63. package/extensions/graphql/queries/ledger/mappedTrialBalance.d.ts +9 -0
  64. package/extensions/graphql/queries/ledger/mappedTrialBalance.js +29 -0
  65. package/extensions/graphql/queries/ledger/mappedTrialBalance.ts +27 -0
  66. package/extensions/graphql/queries/ledger/mapping.d.ts +5 -0
  67. package/extensions/graphql/queries/ledger/mapping.js +35 -0
  68. package/extensions/graphql/queries/ledger/mapping.ts +33 -0
  69. package/extensions/graphql/queries/ledger/mappingCoverage.d.ts +5 -0
  70. package/extensions/graphql/queries/ledger/mappingCoverage.js +22 -0
  71. package/extensions/graphql/queries/ledger/mappingCoverage.ts +20 -0
  72. package/extensions/graphql/queries/ledger/mappings.d.ts +6 -0
  73. package/extensions/graphql/queries/ledger/mappings.js +23 -0
  74. package/extensions/graphql/queries/ledger/mappings.ts +21 -0
  75. package/extensions/graphql/queries/ledger/periodCloseStatus.d.ts +6 -0
  76. package/extensions/graphql/queries/ledger/periodCloseStatus.js +29 -0
  77. package/extensions/graphql/queries/ledger/periodCloseStatus.ts +27 -0
  78. package/extensions/graphql/queries/ledger/periodDrafts.d.ts +8 -0
  79. package/extensions/graphql/queries/ledger/periodDrafts.js +45 -0
  80. package/extensions/graphql/queries/ledger/periodDrafts.ts +43 -0
  81. package/extensions/graphql/queries/ledger/publishList.d.ts +5 -0
  82. package/extensions/graphql/queries/ledger/publishList.js +29 -0
  83. package/extensions/graphql/queries/ledger/publishList.ts +27 -0
  84. package/extensions/graphql/queries/ledger/publishLists.d.ts +5 -0
  85. package/extensions/graphql/queries/ledger/publishLists.js +29 -0
  86. package/extensions/graphql/queries/ledger/publishLists.ts +27 -0
  87. package/extensions/graphql/queries/ledger/report.d.ts +5 -0
  88. package/extensions/graphql/queries/ledger/report.js +40 -0
  89. package/extensions/graphql/queries/ledger/report.ts +38 -0
  90. package/extensions/graphql/queries/ledger/reportingTaxonomy.d.ts +6 -0
  91. package/extensions/graphql/queries/ledger/reportingTaxonomy.js +27 -0
  92. package/extensions/graphql/queries/ledger/reportingTaxonomy.ts +25 -0
  93. package/extensions/graphql/queries/ledger/reports.d.ts +8 -0
  94. package/extensions/graphql/queries/ledger/reports.js +45 -0
  95. package/extensions/graphql/queries/ledger/reports.ts +43 -0
  96. package/extensions/graphql/queries/ledger/scheduleFacts.d.ts +7 -0
  97. package/extensions/graphql/queries/ledger/scheduleFacts.js +24 -0
  98. package/extensions/graphql/queries/ledger/scheduleFacts.ts +22 -0
  99. package/extensions/graphql/queries/ledger/schedules.d.ts +6 -0
  100. package/extensions/graphql/queries/ledger/schedules.js +24 -0
  101. package/extensions/graphql/queries/ledger/schedules.ts +22 -0
  102. package/extensions/graphql/queries/ledger/statement.d.ts +9 -0
  103. package/extensions/graphql/queries/ledger/statement.js +43 -0
  104. package/extensions/graphql/queries/ledger/statement.ts +41 -0
  105. package/extensions/graphql/queries/ledger/structures.d.ts +5 -0
  106. package/extensions/graphql/queries/ledger/structures.js +22 -0
  107. package/extensions/graphql/queries/ledger/structures.ts +20 -0
  108. package/extensions/graphql/queries/ledger/summary.d.ts +7 -0
  109. package/extensions/graphql/queries/ledger/summary.js +25 -0
  110. package/extensions/graphql/queries/ledger/summary.ts +23 -0
  111. package/extensions/graphql/queries/ledger/taxonomies.d.ts +5 -0
  112. package/extensions/graphql/queries/ledger/taxonomies.js +28 -0
  113. package/extensions/graphql/queries/ledger/taxonomies.ts +26 -0
  114. package/extensions/graphql/queries/ledger/transaction.d.ts +6 -0
  115. package/extensions/graphql/queries/ledger/transaction.js +49 -0
  116. package/extensions/graphql/queries/ledger/transaction.ts +47 -0
  117. package/extensions/graphql/queries/ledger/transactions.d.ts +7 -0
  118. package/extensions/graphql/queries/ledger/transactions.js +49 -0
  119. package/extensions/graphql/queries/ledger/transactions.ts +47 -0
  120. package/extensions/graphql/queries/ledger/trialBalance.d.ts +7 -0
  121. package/extensions/graphql/queries/ledger/trialBalance.js +28 -0
  122. package/extensions/graphql/queries/ledger/trialBalance.ts +26 -0
  123. package/extensions/graphql/queries/ledger/unmappedElements.d.ts +8 -0
  124. package/extensions/graphql/queries/ledger/unmappedElements.js +29 -0
  125. package/extensions/graphql/queries/ledger/unmappedElements.ts +27 -0
  126. package/extensions/hooks.d.ts +1 -1
  127. package/extensions/index.d.ts +5 -1
  128. package/extensions/index.js +13 -1
  129. package/extensions/index.ts +14 -0
  130. package/index.ts +2 -2
  131. package/package.json +14 -5
  132. package/sdk/index.d.ts +2 -2
  133. package/sdk/index.js +38 -65
  134. package/sdk/index.ts +2 -2
  135. package/sdk/sdk.gen.d.ts +101 -220
  136. package/sdk/sdk.gen.js +251 -445
  137. package/sdk/sdk.gen.ts +216 -409
  138. package/sdk/types.gen.d.ts +4586 -7045
  139. package/sdk/types.gen.ts +4702 -7334
  140. package/sdk.gen.d.ts +101 -220
  141. package/sdk.gen.js +251 -445
  142. package/sdk.gen.ts +216 -409
  143. package/types.gen.d.ts +4586 -7045
  144. package/types.gen.ts +4702 -7334
  145. package/extensions/AgentClient.test.ts +0 -403
  146. package/extensions/LedgerClient.test.ts +0 -1138
  147. package/extensions/OperationClient.test.ts +0 -365
  148. package/extensions/QueryClient.test.ts +0 -432
  149. package/extensions/ReportClient.test.ts +0 -828
  150. package/extensions/SSEClient.test.ts +0 -375
  151. package/extensions/config.test.ts +0 -199
  152. package/extensions/hooks.test.ts +0 -373
  153. package/extensions/index.test.ts +0 -420
  154. package/sdk-extensions/AgentClient.d.ts +0 -82
  155. package/sdk-extensions/AgentClient.js +0 -218
  156. package/sdk-extensions/AgentClient.test.ts +0 -403
  157. package/sdk-extensions/AgentClient.ts +0 -321
  158. package/sdk-extensions/LedgerClient.d.ts +0 -242
  159. package/sdk-extensions/LedgerClient.js +0 -496
  160. package/sdk-extensions/LedgerClient.test.ts +0 -1138
  161. package/sdk-extensions/LedgerClient.ts +0 -800
  162. package/sdk-extensions/OperationClient.d.ts +0 -65
  163. package/sdk-extensions/OperationClient.js +0 -251
  164. package/sdk-extensions/OperationClient.test.ts +0 -365
  165. package/sdk-extensions/OperationClient.ts +0 -324
  166. package/sdk-extensions/QueryClient.d.ts +0 -52
  167. package/sdk-extensions/QueryClient.js +0 -313
  168. package/sdk-extensions/QueryClient.test.ts +0 -432
  169. package/sdk-extensions/QueryClient.ts +0 -420
  170. package/sdk-extensions/README.md +0 -901
  171. package/sdk-extensions/ReportClient.d.ts +0 -151
  172. package/sdk-extensions/ReportClient.js +0 -278
  173. package/sdk-extensions/ReportClient.test.ts +0 -828
  174. package/sdk-extensions/ReportClient.ts +0 -486
  175. package/sdk-extensions/SSEClient.d.ts +0 -62
  176. package/sdk-extensions/SSEClient.js +0 -154
  177. package/sdk-extensions/SSEClient.test.ts +0 -375
  178. package/sdk-extensions/SSEClient.ts +0 -210
  179. package/sdk-extensions/config.d.ts +0 -57
  180. package/sdk-extensions/config.js +0 -152
  181. package/sdk-extensions/config.test.ts +0 -199
  182. package/sdk-extensions/config.ts +0 -175
  183. package/sdk-extensions/hooks.d.ts +0 -110
  184. package/sdk-extensions/hooks.js +0 -384
  185. package/sdk-extensions/hooks.test.ts +0 -373
  186. package/sdk-extensions/hooks.ts +0 -459
  187. package/sdk-extensions/index.d.ts +0 -63
  188. package/sdk-extensions/index.js +0 -164
  189. package/sdk-extensions/index.test.ts +0 -420
  190. package/sdk-extensions/index.ts +0 -203
@@ -1,151 +0,0 @@
1
- export interface Report {
2
- id: string;
3
- name: string;
4
- taxonomyId: string;
5
- generationStatus: string;
6
- periodType: string;
7
- periodStart: string | null;
8
- periodEnd: string | null;
9
- comparative: boolean;
10
- mappingId: string | null;
11
- aiGenerated: boolean;
12
- createdAt: string;
13
- lastGenerated: string | null;
14
- structures: Structure[];
15
- /** Entity name (source company for shared reports, own entity for native) */
16
- entityName: string | null;
17
- /** Non-null when this report was shared from another graph */
18
- sourceGraphId: string | null;
19
- sourceReportId: string | null;
20
- sharedAt: string | null;
21
- }
22
- import type { Structure } from './LedgerClient';
23
- export type { Structure } from './LedgerClient';
24
- export interface StatementPeriod {
25
- start: string;
26
- end: string;
27
- label: string;
28
- }
29
- export interface StatementRow {
30
- elementId: string;
31
- elementQname: string;
32
- elementName: string;
33
- classification: string;
34
- values: (number | null)[];
35
- isSubtotal: boolean;
36
- depth: number;
37
- }
38
- export interface StatementData {
39
- reportId: string;
40
- structureId: string;
41
- structureName: string;
42
- structureType: string;
43
- periods: StatementPeriod[];
44
- rows: StatementRow[];
45
- validation: {
46
- passed: boolean;
47
- checks: string[];
48
- failures: string[];
49
- warnings: string[];
50
- } | null;
51
- unmappedCount: number;
52
- }
53
- export interface ShareResult {
54
- reportId: string;
55
- results: Array<{
56
- targetGraphId: string;
57
- status: 'shared' | 'error';
58
- error: string | null;
59
- factCount: number;
60
- }>;
61
- }
62
- export interface PublishList {
63
- id: string;
64
- name: string;
65
- description: string | null;
66
- memberCount: number;
67
- createdBy: string;
68
- createdAt: string;
69
- updatedAt: string;
70
- }
71
- export interface PublishListDetail extends PublishList {
72
- members: PublishListMember[];
73
- }
74
- export interface PublishListMember {
75
- id: string;
76
- targetGraphId: string;
77
- targetGraphName: string | null;
78
- targetOrgName: string | null;
79
- addedBy: string;
80
- addedAt: string;
81
- }
82
- export interface PeriodSpecInput {
83
- start: string;
84
- end: string;
85
- label: string;
86
- }
87
- export interface CreateReportOptions {
88
- name: string;
89
- mappingId: string;
90
- periodStart: string;
91
- periodEnd: string;
92
- taxonomyId?: string;
93
- periodType?: string;
94
- comparative?: boolean;
95
- /** When set, overrides periodStart/periodEnd/comparative with N explicit periods. */
96
- periods?: PeriodSpecInput[];
97
- }
98
- export declare class ReportClient {
99
- private config;
100
- constructor(config: {
101
- baseUrl: string;
102
- credentials?: 'include' | 'same-origin' | 'omit';
103
- headers?: Record<string, string>;
104
- token?: string;
105
- });
106
- /**
107
- * Create a report — generates facts for all structures in the taxonomy.
108
- */
109
- create(graphId: string, options: CreateReportOptions): Promise<Report>;
110
- /**
111
- * List all reports for a graph (includes received shared reports).
112
- */
113
- list(graphId: string): Promise<Report[]>;
114
- /**
115
- * Get a report with its available structures.
116
- */
117
- get(graphId: string, reportId: string): Promise<Report>;
118
- /**
119
- * Render a financial statement — facts viewed through a structure.
120
- *
121
- * @param structureType - income_statement, balance_sheet, cash_flow_statement
122
- */
123
- statement(graphId: string, reportId: string, structureType: string): Promise<StatementData>;
124
- /**
125
- * Regenerate a report with new period dates.
126
- */
127
- regenerate(graphId: string, reportId: string, periodStart: string, periodEnd: string): Promise<Report>;
128
- /**
129
- * Delete a report and its generated facts.
130
- */
131
- delete(graphId: string, reportId: string): Promise<void>;
132
- /**
133
- * Share a published report to all members of a publish list (snapshot copy).
134
- */
135
- share(graphId: string, reportId: string, publishListId: string): Promise<ShareResult>;
136
- /** Check if a report was received via sharing (vs locally created). */
137
- isSharedReport(report: Report): boolean;
138
- listPublishLists(graphId: string): Promise<PublishList[]>;
139
- createPublishList(graphId: string, name: string, description?: string): Promise<PublishList>;
140
- getPublishList(graphId: string, listId: string): Promise<PublishListDetail>;
141
- updatePublishList(graphId: string, listId: string, updates: {
142
- name?: string;
143
- description?: string;
144
- }): Promise<PublishList>;
145
- deletePublishList(graphId: string, listId: string): Promise<void>;
146
- addMembers(graphId: string, listId: string, targetGraphIds: string[]): Promise<PublishListMember[]>;
147
- removeMember(graphId: string, listId: string, memberId: string): Promise<void>;
148
- private _toPublishList;
149
- private _toMember;
150
- private _toReport;
151
- }
@@ -1,278 +0,0 @@
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 body = {
23
- name: options.name,
24
- mapping_id: options.mappingId,
25
- period_start: options.periodStart,
26
- period_end: options.periodEnd,
27
- taxonomy_id: options.taxonomyId ?? 'tax_usgaap_reporting',
28
- period_type: options.periodType ?? 'quarterly',
29
- comparative: options.comparative ?? true,
30
- };
31
- if (options.periods && options.periods.length > 0) {
32
- body.periods = options.periods;
33
- }
34
- const response = await (0, sdk_gen_1.createReport)({
35
- path: { graph_id: graphId },
36
- body,
37
- });
38
- if (response.error) {
39
- throw new Error(`Create report failed: ${JSON.stringify(response.error)}`);
40
- }
41
- return this._toReport(response.data);
42
- }
43
- /**
44
- * List all reports for a graph (includes received shared reports).
45
- */
46
- async list(graphId) {
47
- const response = await (0, sdk_gen_1.listReports)({
48
- path: { graph_id: graphId },
49
- });
50
- if (response.error) {
51
- throw new Error(`List reports failed: ${JSON.stringify(response.error)}`);
52
- }
53
- const data = response.data;
54
- return (data.reports ?? []).map((r) => this._toReport(r));
55
- }
56
- /**
57
- * Get a report with its available structures.
58
- */
59
- async get(graphId, reportId) {
60
- const response = await (0, sdk_gen_1.getReport)({
61
- path: { graph_id: graphId, report_id: reportId },
62
- });
63
- if (response.error) {
64
- throw new Error(`Get report failed: ${JSON.stringify(response.error)}`);
65
- }
66
- return this._toReport(response.data);
67
- }
68
- /**
69
- * Render a financial statement — facts viewed through a structure.
70
- *
71
- * @param structureType - income_statement, balance_sheet, cash_flow_statement
72
- */
73
- async statement(graphId, reportId, structureType) {
74
- const response = await (0, sdk_gen_1.getStatement)({
75
- path: { graph_id: graphId, report_id: reportId, structure_type: structureType },
76
- });
77
- if (response.error) {
78
- throw new Error(`Get statement failed: ${JSON.stringify(response.error)}`);
79
- }
80
- const data = response.data;
81
- return {
82
- reportId: data.report_id,
83
- structureId: data.structure_id,
84
- structureName: data.structure_name,
85
- structureType: data.structure_type,
86
- periods: (data.periods ?? []).map((p) => ({
87
- start: p.start,
88
- end: p.end,
89
- label: p.label,
90
- })),
91
- rows: (data.rows ?? []).map((r) => ({
92
- elementId: r.element_id,
93
- elementQname: r.element_qname,
94
- elementName: r.element_name,
95
- classification: r.classification,
96
- values: r.values ?? [],
97
- isSubtotal: r.is_subtotal ?? false,
98
- depth: r.depth ?? 0,
99
- })),
100
- validation: data.validation
101
- ? {
102
- passed: data.validation.passed,
103
- checks: data.validation.checks,
104
- failures: data.validation.failures,
105
- warnings: data.validation.warnings,
106
- }
107
- : null,
108
- unmappedCount: data.unmapped_count ?? 0,
109
- };
110
- }
111
- /**
112
- * Regenerate a report with new period dates.
113
- */
114
- async regenerate(graphId, reportId, periodStart, periodEnd) {
115
- const response = await (0, sdk_gen_1.regenerateReport)({
116
- path: { graph_id: graphId, report_id: reportId },
117
- body: { period_start: periodStart, period_end: periodEnd },
118
- });
119
- if (response.error) {
120
- throw new Error(`Regenerate report failed: ${JSON.stringify(response.error)}`);
121
- }
122
- return this._toReport(response.data);
123
- }
124
- /**
125
- * Delete a report and its generated facts.
126
- */
127
- async delete(graphId, reportId) {
128
- const response = await (0, sdk_gen_1.deleteReport)({
129
- path: { graph_id: graphId, report_id: reportId },
130
- });
131
- if (response.error) {
132
- throw new Error(`Delete report failed: ${JSON.stringify(response.error)}`);
133
- }
134
- }
135
- /**
136
- * Share a published report to all members of a publish list (snapshot copy).
137
- */
138
- async share(graphId, reportId, publishListId) {
139
- const response = await (0, sdk_gen_1.shareReport)({
140
- path: { graph_id: graphId, report_id: reportId },
141
- body: { publish_list_id: publishListId },
142
- });
143
- if (response.error) {
144
- throw new Error(`Share report failed: ${JSON.stringify(response.error)}`);
145
- }
146
- const data = response.data;
147
- return {
148
- reportId: data.report_id,
149
- results: (data.results ?? []).map((r) => ({
150
- targetGraphId: r.target_graph_id,
151
- status: r.status,
152
- error: r.error ?? null,
153
- factCount: r.fact_count ?? 0,
154
- })),
155
- };
156
- }
157
- /** Check if a report was received via sharing (vs locally created). */
158
- isSharedReport(report) {
159
- return report.sourceGraphId !== null;
160
- }
161
- // ── Publish Lists ────────────────────────────────────────────────────
162
- async listPublishLists(graphId) {
163
- const response = await (0, sdk_gen_1.listPublishLists)({
164
- path: { graph_id: graphId },
165
- });
166
- if (response.error) {
167
- throw new Error(`List publish lists failed: ${JSON.stringify(response.error)}`);
168
- }
169
- const data = response.data;
170
- return (data.publish_lists ?? []).map((pl) => this._toPublishList(pl));
171
- }
172
- async createPublishList(graphId, name, description) {
173
- const response = await (0, sdk_gen_1.createPublishList)({
174
- path: { graph_id: graphId },
175
- body: { name, description: description ?? null },
176
- });
177
- if (response.error) {
178
- throw new Error(`Create publish list failed: ${JSON.stringify(response.error)}`);
179
- }
180
- return this._toPublishList(response.data);
181
- }
182
- async getPublishList(graphId, listId) {
183
- const response = await (0, sdk_gen_1.getPublishList)({
184
- path: { graph_id: graphId, list_id: listId },
185
- });
186
- if (response.error) {
187
- throw new Error(`Get publish list failed: ${JSON.stringify(response.error)}`);
188
- }
189
- const data = response.data;
190
- return {
191
- ...this._toPublishList(data),
192
- members: (data.members ?? []).map((m) => this._toMember(m)),
193
- };
194
- }
195
- async updatePublishList(graphId, listId, updates) {
196
- const response = await (0, sdk_gen_1.updatePublishList)({
197
- path: { graph_id: graphId, list_id: listId },
198
- body: updates,
199
- });
200
- if (response.error) {
201
- throw new Error(`Update publish list failed: ${JSON.stringify(response.error)}`);
202
- }
203
- return this._toPublishList(response.data);
204
- }
205
- async deletePublishList(graphId, listId) {
206
- const response = await (0, sdk_gen_1.deletePublishList)({
207
- path: { graph_id: graphId, list_id: listId },
208
- });
209
- if (response.error) {
210
- throw new Error(`Delete publish list failed: ${JSON.stringify(response.error)}`);
211
- }
212
- }
213
- async addMembers(graphId, listId, targetGraphIds) {
214
- const response = await (0, sdk_gen_1.addPublishListMembers)({
215
- path: { graph_id: graphId, list_id: listId },
216
- body: { target_graph_ids: targetGraphIds },
217
- });
218
- if (response.error) {
219
- throw new Error(`Add members failed: ${JSON.stringify(response.error)}`);
220
- }
221
- return (response.data ?? []).map((m) => this._toMember(m));
222
- }
223
- async removeMember(graphId, listId, memberId) {
224
- const response = await (0, sdk_gen_1.removePublishListMember)({
225
- path: { graph_id: graphId, list_id: listId, member_id: memberId },
226
- });
227
- if (response.error) {
228
- throw new Error(`Remove member failed: ${JSON.stringify(response.error)}`);
229
- }
230
- }
231
- _toPublishList(pl) {
232
- return {
233
- id: pl.id,
234
- name: pl.name,
235
- description: pl.description ?? null,
236
- memberCount: pl.member_count ?? 0,
237
- createdBy: pl.created_by,
238
- createdAt: pl.created_at,
239
- updatedAt: pl.updated_at,
240
- };
241
- }
242
- _toMember(m) {
243
- return {
244
- id: m.id,
245
- targetGraphId: m.target_graph_id,
246
- targetGraphName: m.target_graph_name ?? null,
247
- targetOrgName: m.target_org_name ?? null,
248
- addedBy: m.added_by,
249
- addedAt: m.added_at,
250
- };
251
- }
252
- _toReport(r) {
253
- return {
254
- id: r.id,
255
- name: r.name,
256
- taxonomyId: r.taxonomy_id,
257
- generationStatus: r.generation_status,
258
- periodType: r.period_type,
259
- periodStart: r.period_start ?? null,
260
- periodEnd: r.period_end ?? null,
261
- comparative: r.comparative,
262
- mappingId: r.mapping_id ?? null,
263
- aiGenerated: r.ai_generated ?? false,
264
- createdAt: r.created_at,
265
- lastGenerated: r.last_generated ?? null,
266
- structures: (r.structures ?? []).map((s) => ({
267
- id: s.id,
268
- name: s.name,
269
- structureType: s.structure_type,
270
- })),
271
- entityName: r.entity_name ?? null,
272
- sourceGraphId: r.source_graph_id ?? null,
273
- sourceReportId: r.source_report_id ?? null,
274
- sharedAt: r.shared_at ?? null,
275
- };
276
- }
277
- }
278
- exports.ReportClient = ReportClient;