@robosystems/client 0.2.43 → 0.2.44

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 (73) hide show
  1. package/extensions/LedgerClient.d.ts +88 -0
  2. package/extensions/LedgerClient.js +143 -0
  3. package/extensions/LedgerClient.ts +267 -0
  4. package/extensions/ReportClient.d.ts +14 -6
  5. package/extensions/ReportClient.js +19 -15
  6. package/extensions/ReportClient.ts +37 -21
  7. package/extensions/hooks.d.ts +1 -40
  8. package/extensions/hooks.js +0 -134
  9. package/extensions/hooks.ts +0 -156
  10. package/extensions/index.d.ts +2 -24
  11. package/extensions/index.js +1 -65
  12. package/extensions/index.test.ts +4 -38
  13. package/extensions/index.ts +0 -78
  14. package/index.ts +2 -2
  15. package/package.json +1 -1
  16. package/sdk/index.d.ts +2 -2
  17. package/sdk/index.js +9 -4
  18. package/sdk/index.ts +2 -2
  19. package/sdk/sdk.gen.d.ts +31 -1
  20. package/sdk/sdk.gen.js +65 -2
  21. package/sdk/sdk.gen.ts +64 -1
  22. package/sdk/types.gen.d.ts +601 -87
  23. package/sdk/types.gen.ts +640 -88
  24. package/sdk-extensions/LedgerClient.d.ts +88 -0
  25. package/sdk-extensions/LedgerClient.js +143 -0
  26. package/sdk-extensions/LedgerClient.ts +267 -0
  27. package/sdk-extensions/ReportClient.d.ts +14 -6
  28. package/sdk-extensions/ReportClient.js +19 -15
  29. package/sdk-extensions/ReportClient.ts +37 -21
  30. package/sdk-extensions/hooks.d.ts +1 -40
  31. package/sdk-extensions/hooks.js +0 -134
  32. package/sdk-extensions/hooks.ts +0 -156
  33. package/sdk-extensions/index.d.ts +2 -24
  34. package/sdk-extensions/index.js +1 -65
  35. package/sdk-extensions/index.test.ts +4 -38
  36. package/sdk-extensions/index.ts +0 -78
  37. package/sdk.gen.d.ts +31 -1
  38. package/sdk.gen.js +65 -2
  39. package/sdk.gen.ts +64 -1
  40. package/types.gen.d.ts +601 -87
  41. package/types.gen.ts +640 -88
  42. package/extensions/DocumentClient.d.ts +0 -102
  43. package/extensions/DocumentClient.js +0 -176
  44. package/extensions/DocumentClient.ts +0 -297
  45. package/extensions/FileClient.d.ts +0 -57
  46. package/extensions/FileClient.js +0 -246
  47. package/extensions/FileClient.ts +0 -330
  48. package/extensions/GraphClient.d.ts +0 -91
  49. package/extensions/GraphClient.js +0 -244
  50. package/extensions/GraphClient.test.ts +0 -455
  51. package/extensions/GraphClient.ts +0 -371
  52. package/extensions/MaterializationClient.d.ts +0 -61
  53. package/extensions/MaterializationClient.js +0 -157
  54. package/extensions/MaterializationClient.ts +0 -223
  55. package/extensions/TableClient.d.ts +0 -38
  56. package/extensions/TableClient.js +0 -92
  57. package/extensions/TableClient.ts +0 -132
  58. package/sdk-extensions/DocumentClient.d.ts +0 -102
  59. package/sdk-extensions/DocumentClient.js +0 -176
  60. package/sdk-extensions/DocumentClient.ts +0 -297
  61. package/sdk-extensions/FileClient.d.ts +0 -57
  62. package/sdk-extensions/FileClient.js +0 -246
  63. package/sdk-extensions/FileClient.ts +0 -330
  64. package/sdk-extensions/GraphClient.d.ts +0 -91
  65. package/sdk-extensions/GraphClient.js +0 -244
  66. package/sdk-extensions/GraphClient.test.ts +0 -455
  67. package/sdk-extensions/GraphClient.ts +0 -371
  68. package/sdk-extensions/MaterializationClient.d.ts +0 -61
  69. package/sdk-extensions/MaterializationClient.js +0 -157
  70. package/sdk-extensions/MaterializationClient.ts +0 -223
  71. package/sdk-extensions/TableClient.d.ts +0 -38
  72. package/sdk-extensions/TableClient.js +0 -92
  73. package/sdk-extensions/TableClient.ts +0 -132
@@ -1,176 +0,0 @@
1
- 'use client';
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.DocumentClient = void 0;
5
- /**
6
- * Document Client for RoboSystems API
7
- *
8
- * Upload, search, list, and delete text documents indexed in OpenSearch.
9
- * Documents are sectioned on markdown headings, embedded for semantic search,
10
- * and searchable alongside structured graph data.
11
- */
12
- const sdk_gen_1 = require("../sdk/sdk.gen");
13
- class DocumentClient {
14
- constructor(config) {
15
- this.config = config;
16
- }
17
- /**
18
- * Upload a markdown document for text indexing.
19
- *
20
- * The document is sectioned on headings, embedded, and indexed
21
- * into OpenSearch for full-text and semantic search.
22
- */
23
- async upload(graphId, title, content, options = {}) {
24
- const response = await (0, sdk_gen_1.uploadDocument)({
25
- path: { graph_id: graphId },
26
- body: {
27
- title,
28
- content,
29
- tags: options.tags ?? null,
30
- folder: options.folder ?? null,
31
- external_id: options.externalId ?? null,
32
- },
33
- });
34
- if (response.error) {
35
- throw new Error(`Document upload failed: ${JSON.stringify(response.error)}`);
36
- }
37
- return response.data;
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
- }
79
- /**
80
- * Upload multiple markdown documents (max 50 per request).
81
- */
82
- async uploadBulk(graphId, documents) {
83
- const response = await (0, sdk_gen_1.uploadDocumentsBulk)({
84
- path: { graph_id: graphId },
85
- body: {
86
- documents: documents.map((doc) => ({
87
- title: doc.title,
88
- content: doc.content,
89
- tags: doc.tags ?? null,
90
- folder: doc.folder ?? null,
91
- external_id: doc.externalId ?? null,
92
- })),
93
- },
94
- });
95
- if (response.error) {
96
- throw new Error(`Bulk upload failed: ${JSON.stringify(response.error)}`);
97
- }
98
- return response.data;
99
- }
100
- /**
101
- * Search documents with hybrid (BM25 + kNN) search.
102
- */
103
- async search(graphId, query, options = {}) {
104
- const response = await (0, sdk_gen_1.searchDocuments)({
105
- path: { graph_id: graphId },
106
- body: {
107
- query,
108
- source_type: options.sourceType ?? null,
109
- entity: options.entity ?? null,
110
- form_type: options.formType ?? null,
111
- section: options.section ?? null,
112
- element: options.element ?? null,
113
- fiscal_year: options.fiscalYear ?? null,
114
- date_from: options.dateFrom ?? null,
115
- date_to: options.dateTo ?? null,
116
- size: options.size,
117
- offset: options.offset,
118
- },
119
- });
120
- if (response.error) {
121
- throw new Error(`Document search failed: ${JSON.stringify(response.error)}`);
122
- }
123
- return response.data;
124
- }
125
- /**
126
- * Retrieve the full text of a document section by ID.
127
- *
128
- * @returns DocumentSection or null if not found.
129
- */
130
- async getSection(graphId, documentId) {
131
- const response = await (0, sdk_gen_1.getDocumentSection)({
132
- path: { graph_id: graphId, document_id: documentId },
133
- });
134
- if (response.response.status === 404) {
135
- return null;
136
- }
137
- if (response.error) {
138
- throw new Error(`Get section failed: ${JSON.stringify(response.error)}`);
139
- }
140
- return response.data;
141
- }
142
- /**
143
- * List indexed documents for a graph.
144
- */
145
- async list(graphId, sourceType) {
146
- const response = await (0, sdk_gen_1.listDocuments)({
147
- path: { graph_id: graphId },
148
- query: sourceType ? { source_type: sourceType } : undefined,
149
- });
150
- if (response.error) {
151
- throw new Error(`List documents failed: ${JSON.stringify(response.error)}`);
152
- }
153
- return response.data;
154
- }
155
- /**
156
- * Delete a document and all its sections.
157
- *
158
- * @returns true if deleted, false if not found.
159
- */
160
- async delete(graphId, documentId) {
161
- const response = await (0, sdk_gen_1.deleteDocument)({
162
- path: { graph_id: graphId, document_id: documentId },
163
- });
164
- if (response.response.status === 204) {
165
- return true;
166
- }
167
- if (response.response.status === 404) {
168
- return false;
169
- }
170
- if (response.error) {
171
- throw new Error(`Delete document failed: ${JSON.stringify(response.error)}`);
172
- }
173
- return true;
174
- }
175
- }
176
- exports.DocumentClient = DocumentClient;
@@ -1,297 +0,0 @@
1
- 'use client'
2
-
3
- /**
4
- * Document Client for RoboSystems API
5
- *
6
- * Upload, search, list, and delete text documents indexed in OpenSearch.
7
- * Documents are sectioned on markdown headings, embedded for semantic search,
8
- * and searchable alongside structured graph data.
9
- */
10
-
11
- import {
12
- deleteDocument,
13
- getDocument,
14
- getDocumentSection,
15
- listDocuments,
16
- searchDocuments,
17
- updateDocument,
18
- uploadDocument,
19
- uploadDocumentsBulk,
20
- } from '../sdk/sdk.gen'
21
- import type {
22
- BulkDocumentUploadResponse,
23
- DocumentDetailResponse,
24
- DocumentListResponse,
25
- DocumentSection,
26
- DocumentUploadResponse,
27
- SearchResponse,
28
- } from '../sdk/types.gen'
29
-
30
- export interface DocumentSearchOptions {
31
- /** Filter by source type (xbrl_textblock, narrative_section, ixbrl_disclosure, uploaded_doc, memory) */
32
- sourceType?: string
33
- /** Filter by ticker, CIK, or entity name */
34
- entity?: string
35
- /** Filter by SEC form type (10-K, 10-Q) */
36
- formType?: string
37
- /** Filter by section ID (item_1, item_1a, item_7, etc.) */
38
- section?: string
39
- /** Filter by XBRL element qname (e.g., us-gaap:Goodwill) */
40
- element?: string
41
- /** Filter by fiscal year */
42
- fiscalYear?: number
43
- /** Filter filings on or after date (YYYY-MM-DD) */
44
- dateFrom?: string
45
- /** Filter filings on or before date (YYYY-MM-DD) */
46
- dateTo?: string
47
- /** Max results to return (default: 10) */
48
- size?: number
49
- /** Pagination offset */
50
- offset?: number
51
- }
52
-
53
- export interface DocumentUploadOptions {
54
- /** Optional tags for filtering */
55
- tags?: string[]
56
- /** Optional folder/category */
57
- folder?: string
58
- /** Optional external ID for upsert behavior */
59
- externalId?: string
60
- }
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
-
73
- export class DocumentClient {
74
- private config: {
75
- baseUrl: string
76
- credentials?: 'include' | 'same-origin' | 'omit'
77
- headers?: Record<string, string>
78
- token?: string
79
- }
80
-
81
- constructor(config: {
82
- baseUrl: string
83
- credentials?: 'include' | 'same-origin' | 'omit'
84
- headers?: Record<string, string>
85
- token?: string
86
- }) {
87
- this.config = config
88
- }
89
-
90
- /**
91
- * Upload a markdown document for text indexing.
92
- *
93
- * The document is sectioned on headings, embedded, and indexed
94
- * into OpenSearch for full-text and semantic search.
95
- */
96
- async upload(
97
- graphId: string,
98
- title: string,
99
- content: string,
100
- options: DocumentUploadOptions = {}
101
- ): Promise<DocumentUploadResponse> {
102
- const response = await uploadDocument({
103
- path: { graph_id: graphId },
104
- body: {
105
- title,
106
- content,
107
- tags: options.tags ?? null,
108
- folder: options.folder ?? null,
109
- external_id: options.externalId ?? null,
110
- },
111
- })
112
-
113
- if (response.error) {
114
- throw new Error(`Document upload failed: ${JSON.stringify(response.error)}`)
115
- }
116
-
117
- return response.data as DocumentUploadResponse
118
- }
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
-
171
- /**
172
- * Upload multiple markdown documents (max 50 per request).
173
- */
174
- async uploadBulk(
175
- graphId: string,
176
- documents: Array<{
177
- title: string
178
- content: string
179
- tags?: string[]
180
- folder?: string
181
- externalId?: string
182
- }>
183
- ): Promise<BulkDocumentUploadResponse> {
184
- const response = await uploadDocumentsBulk({
185
- path: { graph_id: graphId },
186
- body: {
187
- documents: documents.map((doc) => ({
188
- title: doc.title,
189
- content: doc.content,
190
- tags: doc.tags ?? null,
191
- folder: doc.folder ?? null,
192
- external_id: doc.externalId ?? null,
193
- })),
194
- },
195
- })
196
-
197
- if (response.error) {
198
- throw new Error(`Bulk upload failed: ${JSON.stringify(response.error)}`)
199
- }
200
-
201
- return response.data as BulkDocumentUploadResponse
202
- }
203
-
204
- /**
205
- * Search documents with hybrid (BM25 + kNN) search.
206
- */
207
- async search(
208
- graphId: string,
209
- query: string,
210
- options: DocumentSearchOptions = {}
211
- ): Promise<SearchResponse> {
212
- const response = await searchDocuments({
213
- path: { graph_id: graphId },
214
- body: {
215
- query,
216
- source_type: options.sourceType ?? null,
217
- entity: options.entity ?? null,
218
- form_type: options.formType ?? null,
219
- section: options.section ?? null,
220
- element: options.element ?? null,
221
- fiscal_year: options.fiscalYear ?? null,
222
- date_from: options.dateFrom ?? null,
223
- date_to: options.dateTo ?? null,
224
- size: options.size,
225
- offset: options.offset,
226
- },
227
- })
228
-
229
- if (response.error) {
230
- throw new Error(`Document search failed: ${JSON.stringify(response.error)}`)
231
- }
232
-
233
- return response.data as SearchResponse
234
- }
235
-
236
- /**
237
- * Retrieve the full text of a document section by ID.
238
- *
239
- * @returns DocumentSection or null if not found.
240
- */
241
- async getSection(graphId: string, documentId: string): Promise<DocumentSection | null> {
242
- const response = await getDocumentSection({
243
- path: { graph_id: graphId, document_id: documentId },
244
- })
245
-
246
- if (response.response.status === 404) {
247
- return null
248
- }
249
-
250
- if (response.error) {
251
- throw new Error(`Get section failed: ${JSON.stringify(response.error)}`)
252
- }
253
-
254
- return response.data as DocumentSection
255
- }
256
-
257
- /**
258
- * List indexed documents for a graph.
259
- */
260
- async list(graphId: string, sourceType?: string): Promise<DocumentListResponse> {
261
- const response = await listDocuments({
262
- path: { graph_id: graphId },
263
- query: sourceType ? { source_type: sourceType } : undefined,
264
- })
265
-
266
- if (response.error) {
267
- throw new Error(`List documents failed: ${JSON.stringify(response.error)}`)
268
- }
269
-
270
- return response.data as DocumentListResponse
271
- }
272
-
273
- /**
274
- * Delete a document and all its sections.
275
- *
276
- * @returns true if deleted, false if not found.
277
- */
278
- async delete(graphId: string, documentId: string): Promise<boolean> {
279
- const response = await deleteDocument({
280
- path: { graph_id: graphId, document_id: documentId },
281
- })
282
-
283
- if (response.response.status === 204) {
284
- return true
285
- }
286
-
287
- if (response.response.status === 404) {
288
- return false
289
- }
290
-
291
- if (response.error) {
292
- throw new Error(`Delete document failed: ${JSON.stringify(response.error)}`)
293
- }
294
-
295
- return true
296
- }
297
- }
@@ -1,57 +0,0 @@
1
- export interface FileUploadOptions {
2
- onProgress?: (message: string) => void;
3
- fileName?: string;
4
- ingestToGraph?: boolean;
5
- }
6
- export interface FileUploadResult {
7
- fileId: string;
8
- fileSize: number;
9
- rowCount: number;
10
- tableName: string;
11
- fileName: string;
12
- success: boolean;
13
- error?: string;
14
- }
15
- export interface FileInfo {
16
- fileId: string;
17
- fileName: string;
18
- tableName: string;
19
- status: string;
20
- fileSize: number;
21
- rowCount: number;
22
- createdAt: string;
23
- }
24
- export type FileInput = File | Blob | Buffer | ReadableStream<Uint8Array>;
25
- export declare class FileClient {
26
- private config;
27
- constructor(config: {
28
- baseUrl: string;
29
- credentials?: 'include' | 'same-origin' | 'omit';
30
- headers?: Record<string, string>;
31
- token?: string;
32
- s3EndpointUrl?: string;
33
- });
34
- /**
35
- * Upload a Parquet file to staging
36
- *
37
- * Handles the complete 3-step upload process:
38
- * 1. Get presigned upload URL
39
- * 2. Upload file to S3
40
- * 3. Mark file as 'uploaded' (backend validates, calculates size/row count)
41
- */
42
- upload(graphId: string, tableName: string, fileOrBuffer: FileInput, options?: FileUploadOptions): Promise<FileUploadResult>;
43
- /**
44
- * List files in a graph
45
- */
46
- list(graphId: string, tableName?: string, status?: string): Promise<FileInfo[]>;
47
- /**
48
- * Get file information
49
- */
50
- get(graphId: string, fileId: string): Promise<FileInfo | null>;
51
- /**
52
- * Delete a file
53
- */
54
- delete(graphId: string, fileId: string, cascade?: boolean): Promise<boolean>;
55
- private getFileName;
56
- private getFileContent;
57
- }