@robosystems/client 0.2.41 → 0.2.43

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.
@@ -1,4 +1,4 @@
1
- import type { BulkDocumentUploadResponse, DocumentListResponse, DocumentSection, DocumentUploadResponse, SearchResponse } from '../types.gen';
1
+ import type { BulkDocumentUploadResponse, DocumentDetailResponse, DocumentListResponse, DocumentSection, DocumentUploadResponse, SearchResponse } from '../types.gen';
2
2
  export interface DocumentSearchOptions {
3
3
  /** Filter by source type (xbrl_textblock, narrative_section, ixbrl_disclosure, uploaded_doc, memory) */
4
4
  sourceType?: string;
@@ -29,6 +29,16 @@ export interface DocumentUploadOptions {
29
29
  /** Optional external ID for upsert behavior */
30
30
  externalId?: string;
31
31
  }
32
+ export interface DocumentUpdateOptions {
33
+ /** Updated title */
34
+ title?: string;
35
+ /** Updated markdown content */
36
+ content?: string;
37
+ /** Updated tags (null to clear) */
38
+ tags?: string[] | null;
39
+ /** Updated folder (null to clear) */
40
+ folder?: string | null;
41
+ }
32
42
  export declare class DocumentClient {
33
43
  private config;
34
44
  constructor(config: {
@@ -44,6 +54,21 @@ export declare class DocumentClient {
44
54
  * into OpenSearch for full-text and semantic search.
45
55
  */
46
56
  upload(graphId: string, title: string, content: string, options?: DocumentUploadOptions): Promise<DocumentUploadResponse>;
57
+ /**
58
+ * Get a document with full content by ID.
59
+ *
60
+ * Returns the raw markdown content and metadata from PostgreSQL.
61
+ *
62
+ * @returns DocumentDetailResponse or null if not found.
63
+ */
64
+ get(graphId: string, documentId: string): Promise<DocumentDetailResponse | null>;
65
+ /**
66
+ * Update a document's content and/or metadata.
67
+ *
68
+ * Only provided fields are updated. Content is re-sectioned,
69
+ * re-embedded, and re-indexed in OpenSearch.
70
+ */
71
+ update(graphId: string, documentId: string, options: DocumentUpdateOptions): Promise<DocumentUploadResponse>;
47
72
  /**
48
73
  * Upload multiple markdown documents (max 50 per request).
49
74
  */
@@ -36,6 +36,46 @@ class DocumentClient {
36
36
  }
37
37
  return response.data;
38
38
  }
39
+ /**
40
+ * Get a document with full content by ID.
41
+ *
42
+ * Returns the raw markdown content and metadata from PostgreSQL.
43
+ *
44
+ * @returns DocumentDetailResponse or null if not found.
45
+ */
46
+ async get(graphId, documentId) {
47
+ const response = await (0, sdk_gen_1.getDocument)({
48
+ path: { graph_id: graphId, document_id: documentId },
49
+ });
50
+ if (response.response.status === 404) {
51
+ return null;
52
+ }
53
+ if (response.error) {
54
+ throw new Error(`Get document failed: ${JSON.stringify(response.error)}`);
55
+ }
56
+ return response.data;
57
+ }
58
+ /**
59
+ * Update a document's content and/or metadata.
60
+ *
61
+ * Only provided fields are updated. Content is re-sectioned,
62
+ * re-embedded, and re-indexed in OpenSearch.
63
+ */
64
+ async update(graphId, documentId, options) {
65
+ const response = await (0, sdk_gen_1.updateDocument)({
66
+ path: { graph_id: graphId, document_id: documentId },
67
+ body: {
68
+ title: options.title ?? undefined,
69
+ content: options.content ?? undefined,
70
+ tags: options.tags !== undefined ? options.tags : undefined,
71
+ folder: options.folder !== undefined ? options.folder : undefined,
72
+ },
73
+ });
74
+ if (response.error) {
75
+ throw new Error(`Update document failed: ${JSON.stringify(response.error)}`);
76
+ }
77
+ return response.data;
78
+ }
39
79
  /**
40
80
  * Upload multiple markdown documents (max 50 per request).
41
81
  */
@@ -10,14 +10,17 @@
10
10
 
11
11
  import {
12
12
  deleteDocument,
13
+ getDocument,
13
14
  getDocumentSection,
14
15
  listDocuments,
15
16
  searchDocuments,
17
+ updateDocument,
16
18
  uploadDocument,
17
19
  uploadDocumentsBulk,
18
20
  } from '../sdk.gen'
19
21
  import type {
20
22
  BulkDocumentUploadResponse,
23
+ DocumentDetailResponse,
21
24
  DocumentListResponse,
22
25
  DocumentSection,
23
26
  DocumentUploadResponse,
@@ -56,6 +59,17 @@ export interface DocumentUploadOptions {
56
59
  externalId?: string
57
60
  }
58
61
 
62
+ export interface DocumentUpdateOptions {
63
+ /** Updated title */
64
+ title?: string
65
+ /** Updated markdown content */
66
+ content?: string
67
+ /** Updated tags (null to clear) */
68
+ tags?: string[] | null
69
+ /** Updated folder (null to clear) */
70
+ folder?: string | null
71
+ }
72
+
59
73
  export class DocumentClient {
60
74
  private config: {
61
75
  baseUrl: string
@@ -103,6 +117,57 @@ export class DocumentClient {
103
117
  return response.data as DocumentUploadResponse
104
118
  }
105
119
 
120
+ /**
121
+ * Get a document with full content by ID.
122
+ *
123
+ * Returns the raw markdown content and metadata from PostgreSQL.
124
+ *
125
+ * @returns DocumentDetailResponse or null if not found.
126
+ */
127
+ async get(graphId: string, documentId: string): Promise<DocumentDetailResponse | null> {
128
+ const response = await getDocument({
129
+ path: { graph_id: graphId, document_id: documentId },
130
+ })
131
+
132
+ if (response.response.status === 404) {
133
+ return null
134
+ }
135
+
136
+ if (response.error) {
137
+ throw new Error(`Get document failed: ${JSON.stringify(response.error)}`)
138
+ }
139
+
140
+ return response.data as DocumentDetailResponse
141
+ }
142
+
143
+ /**
144
+ * Update a document's content and/or metadata.
145
+ *
146
+ * Only provided fields are updated. Content is re-sectioned,
147
+ * re-embedded, and re-indexed in OpenSearch.
148
+ */
149
+ async update(
150
+ graphId: string,
151
+ documentId: string,
152
+ options: DocumentUpdateOptions
153
+ ): Promise<DocumentUploadResponse> {
154
+ const response = await updateDocument({
155
+ path: { graph_id: graphId, document_id: documentId },
156
+ body: {
157
+ title: options.title ?? undefined,
158
+ content: options.content ?? undefined,
159
+ tags: options.tags !== undefined ? options.tags : undefined,
160
+ folder: options.folder !== undefined ? options.folder : undefined,
161
+ },
162
+ })
163
+
164
+ if (response.error) {
165
+ throw new Error(`Update document failed: ${JSON.stringify(response.error)}`)
166
+ }
167
+
168
+ return response.data as DocumentUploadResponse
169
+ }
170
+
106
171
  /**
107
172
  * Upload multiple markdown documents (max 50 per request).
108
173
  */
@@ -12,6 +12,8 @@ export interface Report {
12
12
  createdAt: string;
13
13
  lastGenerated: string | null;
14
14
  structures: Structure[];
15
+ /** Entity name (source company for shared reports, own entity for native) */
16
+ entityName: string | null;
15
17
  /** Non-null when this report was shared from another graph */
16
18
  sourceGraphId: string | null;
17
19
  sourceReportId: string | null;
@@ -56,6 +58,26 @@ export interface ShareResult {
56
58
  factCount: number;
57
59
  }>;
58
60
  }
61
+ export interface PublishList {
62
+ id: string;
63
+ name: string;
64
+ description: string | null;
65
+ memberCount: number;
66
+ createdBy: string;
67
+ createdAt: string;
68
+ updatedAt: string;
69
+ }
70
+ export interface PublishListDetail extends PublishList {
71
+ members: PublishListMember[];
72
+ }
73
+ export interface PublishListMember {
74
+ id: string;
75
+ targetGraphId: string;
76
+ targetGraphName: string | null;
77
+ targetOrgName: string | null;
78
+ addedBy: string;
79
+ addedAt: string;
80
+ }
59
81
  export interface CreateReportOptions {
60
82
  name: string;
61
83
  mappingId: string;
@@ -100,10 +122,22 @@ export declare class ReportClient {
100
122
  */
101
123
  delete(graphId: string, reportId: string): Promise<void>;
102
124
  /**
103
- * Share a published report to other graphs (snapshot copy).
125
+ * Share a published report to all members of a publish list (snapshot copy).
104
126
  */
105
- share(graphId: string, reportId: string, targetGraphIds: string[]): Promise<ShareResult>;
127
+ share(graphId: string, reportId: string, publishListId: string): Promise<ShareResult>;
106
128
  /** Check if a report was received via sharing (vs locally created). */
107
129
  isSharedReport(report: Report): boolean;
130
+ listPublishLists(graphId: string): Promise<PublishList[]>;
131
+ createPublishList(graphId: string, name: string, description?: string): Promise<PublishList>;
132
+ getPublishList(graphId: string, listId: string): Promise<PublishListDetail>;
133
+ updatePublishList(graphId: string, listId: string, updates: {
134
+ name?: string;
135
+ description?: string;
136
+ }): Promise<PublishList>;
137
+ deletePublishList(graphId: string, listId: string): Promise<void>;
138
+ addMembers(graphId: string, listId: string, targetGraphIds: string[]): Promise<PublishListMember[]>;
139
+ removeMember(graphId: string, listId: string, memberId: string): Promise<void>;
140
+ private _toPublishList;
141
+ private _toMember;
108
142
  private _toReport;
109
143
  }
@@ -129,12 +129,12 @@ class ReportClient {
129
129
  }
130
130
  }
131
131
  /**
132
- * Share a published report to other graphs (snapshot copy).
132
+ * Share a published report to all members of a publish list (snapshot copy).
133
133
  */
134
- async share(graphId, reportId, targetGraphIds) {
134
+ async share(graphId, reportId, publishListId) {
135
135
  const response = await (0, sdk_gen_1.shareReport)({
136
136
  path: { graph_id: graphId, report_id: reportId },
137
- body: { target_graph_ids: targetGraphIds },
137
+ body: { publish_list_id: publishListId },
138
138
  });
139
139
  if (response.error) {
140
140
  throw new Error(`Share report failed: ${JSON.stringify(response.error)}`);
@@ -154,6 +154,97 @@ class ReportClient {
154
154
  isSharedReport(report) {
155
155
  return report.sourceGraphId !== null;
156
156
  }
157
+ // ── Publish Lists ────────────────────────────────────────────────────
158
+ async listPublishLists(graphId) {
159
+ const response = await (0, sdk_gen_1.listPublishLists)({
160
+ path: { graph_id: graphId },
161
+ });
162
+ if (response.error) {
163
+ throw new Error(`List publish lists failed: ${JSON.stringify(response.error)}`);
164
+ }
165
+ const data = response.data;
166
+ return (data.publish_lists ?? []).map((pl) => this._toPublishList(pl));
167
+ }
168
+ async createPublishList(graphId, name, description) {
169
+ const response = await (0, sdk_gen_1.createPublishList)({
170
+ path: { graph_id: graphId },
171
+ body: { name, description: description ?? null },
172
+ });
173
+ if (response.error) {
174
+ throw new Error(`Create publish list failed: ${JSON.stringify(response.error)}`);
175
+ }
176
+ return this._toPublishList(response.data);
177
+ }
178
+ async getPublishList(graphId, listId) {
179
+ const response = await (0, sdk_gen_1.getPublishList)({
180
+ path: { graph_id: graphId, list_id: listId },
181
+ });
182
+ if (response.error) {
183
+ throw new Error(`Get publish list failed: ${JSON.stringify(response.error)}`);
184
+ }
185
+ const data = response.data;
186
+ return {
187
+ ...this._toPublishList(data),
188
+ members: (data.members ?? []).map((m) => this._toMember(m)),
189
+ };
190
+ }
191
+ async updatePublishList(graphId, listId, updates) {
192
+ const response = await (0, sdk_gen_1.updatePublishList)({
193
+ path: { graph_id: graphId, list_id: listId },
194
+ body: updates,
195
+ });
196
+ if (response.error) {
197
+ throw new Error(`Update publish list failed: ${JSON.stringify(response.error)}`);
198
+ }
199
+ return this._toPublishList(response.data);
200
+ }
201
+ async deletePublishList(graphId, listId) {
202
+ const response = await (0, sdk_gen_1.deletePublishList)({
203
+ path: { graph_id: graphId, list_id: listId },
204
+ });
205
+ if (response.error) {
206
+ throw new Error(`Delete publish list failed: ${JSON.stringify(response.error)}`);
207
+ }
208
+ }
209
+ async addMembers(graphId, listId, targetGraphIds) {
210
+ const response = await (0, sdk_gen_1.addPublishListMembers)({
211
+ path: { graph_id: graphId, list_id: listId },
212
+ body: { target_graph_ids: targetGraphIds },
213
+ });
214
+ if (response.error) {
215
+ throw new Error(`Add members failed: ${JSON.stringify(response.error)}`);
216
+ }
217
+ return (response.data ?? []).map((m) => this._toMember(m));
218
+ }
219
+ async removeMember(graphId, listId, memberId) {
220
+ const response = await (0, sdk_gen_1.removePublishListMember)({
221
+ path: { graph_id: graphId, list_id: listId, member_id: memberId },
222
+ });
223
+ if (response.error) {
224
+ throw new Error(`Remove member failed: ${JSON.stringify(response.error)}`);
225
+ }
226
+ }
227
+ _toPublishList(pl) {
228
+ return {
229
+ id: pl.id,
230
+ name: pl.name,
231
+ description: pl.description ?? null,
232
+ memberCount: pl.member_count ?? 0,
233
+ createdBy: pl.created_by,
234
+ createdAt: pl.created_at,
235
+ updatedAt: pl.updated_at,
236
+ };
237
+ }
238
+ _toMember(m) {
239
+ return {
240
+ id: m.id,
241
+ targetGraphId: m.target_graph_id,
242
+ targetGraphName: m.target_graph_name ?? null,
243
+ targetOrgName: m.target_org_name ?? null,
244
+ addedBy: m.added_by,
245
+ addedAt: m.added_at,
246
+ };
247
+ }
157
248
  _toReport(r) {
158
249
  return {
159
250
  id: r.id,
@@ -173,6 +264,7 @@ class ReportClient {
173
264
  name: s.name,
174
265
  structureType: s.structure_type,
175
266
  })),
267
+ entityName: r.entity_name ?? null,
176
268
  sourceGraphId: r.source_graph_id ?? null,
177
269
  sourceReportId: r.source_report_id ?? null,
178
270
  sharedAt: r.shared_at ?? null,
@@ -9,17 +9,28 @@
9
9
  */
10
10
 
11
11
  import {
12
+ addPublishListMembers,
13
+ createPublishList,
12
14
  createReport,
15
+ deletePublishList,
13
16
  deleteReport,
17
+ getPublishList,
14
18
  getReport,
15
19
  getStatement,
20
+ listPublishLists,
16
21
  listReports,
17
22
  regenerateReport,
23
+ removePublishListMember,
18
24
  shareReport,
25
+ updatePublishList,
19
26
  } from '../sdk.gen'
20
27
  import type {
21
28
  CreateReportRequest,
22
29
  FactRowResponse,
30
+ PublishListDetailResponse,
31
+ PublishListListResponse,
32
+ PublishListMemberResponse,
33
+ PublishListResponse,
23
34
  RegenerateReportRequest,
24
35
  ReportListResponse,
25
36
  ReportResponse,
@@ -45,6 +56,8 @@ export interface Report {
45
56
  createdAt: string
46
57
  lastGenerated: string | null
47
58
  structures: Structure[]
59
+ /** Entity name (source company for shared reports, own entity for native) */
60
+ entityName: string | null
48
61
  /** Non-null when this report was shared from another graph */
49
62
  sourceGraphId: string | null
50
63
  sourceReportId: string | null
@@ -95,6 +108,29 @@ export interface ShareResult {
95
108
  }>
96
109
  }
97
110
 
111
+ export interface PublishList {
112
+ id: string
113
+ name: string
114
+ description: string | null
115
+ memberCount: number
116
+ createdBy: string
117
+ createdAt: string
118
+ updatedAt: string
119
+ }
120
+
121
+ export interface PublishListDetail extends PublishList {
122
+ members: PublishListMember[]
123
+ }
124
+
125
+ export interface PublishListMember {
126
+ id: string
127
+ targetGraphId: string
128
+ targetGraphName: string | null
129
+ targetOrgName: string | null
130
+ addedBy: string
131
+ addedAt: string
132
+ }
133
+
98
134
  export interface CreateReportOptions {
99
135
  name: string
100
136
  mappingId: string
@@ -264,12 +300,12 @@ export class ReportClient {
264
300
  }
265
301
 
266
302
  /**
267
- * Share a published report to other graphs (snapshot copy).
303
+ * Share a published report to all members of a publish list (snapshot copy).
268
304
  */
269
- async share(graphId: string, reportId: string, targetGraphIds: string[]): Promise<ShareResult> {
305
+ async share(graphId: string, reportId: string, publishListId: string): Promise<ShareResult> {
270
306
  const response = await shareReport({
271
307
  path: { graph_id: graphId, report_id: reportId },
272
- body: { target_graph_ids: targetGraphIds },
308
+ body: { publish_list_id: publishListId },
273
309
  })
274
310
 
275
311
  if (response.error) {
@@ -293,6 +329,119 @@ export class ReportClient {
293
329
  return report.sourceGraphId !== null
294
330
  }
295
331
 
332
+ // ── Publish Lists ────────────────────────────────────────────────────
333
+
334
+ async listPublishLists(graphId: string): Promise<PublishList[]> {
335
+ const response = await listPublishLists({
336
+ path: { graph_id: graphId },
337
+ })
338
+ if (response.error) {
339
+ throw new Error(`List publish lists failed: ${JSON.stringify(response.error)}`)
340
+ }
341
+ const data = response.data as PublishListListResponse
342
+ return (data.publish_lists ?? []).map((pl) => this._toPublishList(pl))
343
+ }
344
+
345
+ async createPublishList(
346
+ graphId: string,
347
+ name: string,
348
+ description?: string
349
+ ): Promise<PublishList> {
350
+ const response = await createPublishList({
351
+ path: { graph_id: graphId },
352
+ body: { name, description: description ?? null },
353
+ })
354
+ if (response.error) {
355
+ throw new Error(`Create publish list failed: ${JSON.stringify(response.error)}`)
356
+ }
357
+ return this._toPublishList(response.data as PublishListResponse)
358
+ }
359
+
360
+ async getPublishList(graphId: string, listId: string): Promise<PublishListDetail> {
361
+ const response = await getPublishList({
362
+ path: { graph_id: graphId, list_id: listId },
363
+ })
364
+ if (response.error) {
365
+ throw new Error(`Get publish list failed: ${JSON.stringify(response.error)}`)
366
+ }
367
+ const data = response.data as PublishListDetailResponse
368
+ return {
369
+ ...this._toPublishList(data),
370
+ members: (data.members ?? []).map((m) => this._toMember(m)),
371
+ }
372
+ }
373
+
374
+ async updatePublishList(
375
+ graphId: string,
376
+ listId: string,
377
+ updates: { name?: string; description?: string }
378
+ ): Promise<PublishList> {
379
+ const response = await updatePublishList({
380
+ path: { graph_id: graphId, list_id: listId },
381
+ body: updates,
382
+ })
383
+ if (response.error) {
384
+ throw new Error(`Update publish list failed: ${JSON.stringify(response.error)}`)
385
+ }
386
+ return this._toPublishList(response.data as PublishListResponse)
387
+ }
388
+
389
+ async deletePublishList(graphId: string, listId: string): Promise<void> {
390
+ const response = await deletePublishList({
391
+ path: { graph_id: graphId, list_id: listId },
392
+ })
393
+ if (response.error) {
394
+ throw new Error(`Delete publish list failed: ${JSON.stringify(response.error)}`)
395
+ }
396
+ }
397
+
398
+ async addMembers(
399
+ graphId: string,
400
+ listId: string,
401
+ targetGraphIds: string[]
402
+ ): Promise<PublishListMember[]> {
403
+ const response = await addPublishListMembers({
404
+ path: { graph_id: graphId, list_id: listId },
405
+ body: { target_graph_ids: targetGraphIds },
406
+ })
407
+ if (response.error) {
408
+ throw new Error(`Add members failed: ${JSON.stringify(response.error)}`)
409
+ }
410
+ return ((response.data as PublishListMemberResponse[]) ?? []).map((m) => this._toMember(m))
411
+ }
412
+
413
+ async removeMember(graphId: string, listId: string, memberId: string): Promise<void> {
414
+ const response = await removePublishListMember({
415
+ path: { graph_id: graphId, list_id: listId, member_id: memberId },
416
+ })
417
+ if (response.error) {
418
+ throw new Error(`Remove member failed: ${JSON.stringify(response.error)}`)
419
+ }
420
+ }
421
+
422
+ private _toPublishList(pl: PublishListResponse): PublishList {
423
+ return {
424
+ id: pl.id,
425
+ name: pl.name,
426
+ description: pl.description ?? null,
427
+ memberCount: pl.member_count ?? 0,
428
+ createdBy: pl.created_by,
429
+ createdAt: pl.created_at,
430
+ updatedAt: pl.updated_at,
431
+ }
432
+ }
433
+
434
+ private _toMember(m: PublishListMemberResponse): PublishListMember {
435
+ return {
436
+ id: m.id,
437
+ targetGraphId: m.target_graph_id,
438
+ targetGraphName: m.target_graph_name ?? null,
439
+ targetOrgName: m.target_org_name ?? null,
440
+ addedBy: m.added_by,
441
+ addedAt: m.added_at,
442
+ }
443
+ }
444
+
296
445
  private _toReport(r: ReportResponse): Report {
297
446
  return {
298
447
  id: r.id,
@@ -312,6 +461,7 @@ export class ReportClient {
312
461
  name: s.name,
313
462
  structureType: s.structure_type,
314
463
  })),
464
+ entityName: r.entity_name ?? null,
315
465
  sourceGraphId: r.source_graph_id ?? null,
316
466
  sourceReportId: r.source_report_id ?? null,
317
467
  sharedAt: r.shared_at ?? null,