@robosystems/client 0.2.42 → 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.
- package/extensions/LedgerClient.d.ts +88 -0
- package/extensions/LedgerClient.js +143 -0
- package/extensions/LedgerClient.ts +267 -0
- package/extensions/ReportClient.d.ts +14 -6
- package/extensions/ReportClient.js +19 -15
- package/extensions/ReportClient.ts +37 -21
- package/extensions/hooks.d.ts +1 -40
- package/extensions/hooks.js +0 -134
- package/extensions/hooks.ts +0 -156
- package/extensions/index.d.ts +2 -24
- package/extensions/index.js +1 -65
- package/extensions/index.test.ts +4 -38
- package/extensions/index.ts +0 -78
- package/index.ts +2 -2
- package/package.json +1 -1
- package/sdk/index.d.ts +2 -2
- package/sdk/index.js +11 -4
- package/sdk/index.ts +2 -2
- package/sdk/sdk.gen.d.ts +51 -9
- package/sdk/sdk.gen.js +105 -16
- package/sdk/sdk.gen.ts +101 -12
- package/sdk/types.gen.d.ts +812 -146
- package/sdk/types.gen.ts +844 -128
- package/sdk-extensions/LedgerClient.d.ts +88 -0
- package/sdk-extensions/LedgerClient.js +143 -0
- package/sdk-extensions/LedgerClient.ts +267 -0
- package/sdk-extensions/ReportClient.d.ts +14 -6
- package/sdk-extensions/ReportClient.js +19 -15
- package/sdk-extensions/ReportClient.ts +37 -21
- package/sdk-extensions/hooks.d.ts +1 -40
- package/sdk-extensions/hooks.js +0 -134
- package/sdk-extensions/hooks.ts +0 -156
- package/sdk-extensions/index.d.ts +2 -24
- package/sdk-extensions/index.js +1 -65
- package/sdk-extensions/index.test.ts +4 -38
- package/sdk-extensions/index.ts +0 -78
- package/sdk.gen.d.ts +51 -9
- package/sdk.gen.js +105 -16
- package/sdk.gen.ts +101 -12
- package/types.gen.d.ts +812 -146
- package/types.gen.ts +844 -128
- package/extensions/DocumentClient.d.ts +0 -77
- package/extensions/DocumentClient.js +0 -136
- package/extensions/DocumentClient.ts +0 -232
- package/extensions/FileClient.d.ts +0 -57
- package/extensions/FileClient.js +0 -246
- package/extensions/FileClient.ts +0 -330
- package/extensions/GraphClient.d.ts +0 -91
- package/extensions/GraphClient.js +0 -244
- package/extensions/GraphClient.test.ts +0 -455
- package/extensions/GraphClient.ts +0 -371
- package/extensions/MaterializationClient.d.ts +0 -61
- package/extensions/MaterializationClient.js +0 -157
- package/extensions/MaterializationClient.ts +0 -223
- package/extensions/TableClient.d.ts +0 -38
- package/extensions/TableClient.js +0 -92
- package/extensions/TableClient.ts +0 -132
- package/sdk-extensions/DocumentClient.d.ts +0 -77
- package/sdk-extensions/DocumentClient.js +0 -136
- package/sdk-extensions/DocumentClient.ts +0 -232
- package/sdk-extensions/FileClient.d.ts +0 -57
- package/sdk-extensions/FileClient.js +0 -246
- package/sdk-extensions/FileClient.ts +0 -330
- package/sdk-extensions/GraphClient.d.ts +0 -91
- package/sdk-extensions/GraphClient.js +0 -244
- package/sdk-extensions/GraphClient.test.ts +0 -455
- package/sdk-extensions/GraphClient.ts +0 -371
- package/sdk-extensions/MaterializationClient.d.ts +0 -61
- package/sdk-extensions/MaterializationClient.js +0 -157
- package/sdk-extensions/MaterializationClient.ts +0 -223
- package/sdk-extensions/TableClient.d.ts +0 -38
- package/sdk-extensions/TableClient.js +0 -92
- package/sdk-extensions/TableClient.ts +0 -132
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import type { BulkDocumentUploadResponse, DocumentListResponse, DocumentSection, DocumentUploadResponse, SearchResponse } from '../types.gen';
|
|
2
|
-
export interface DocumentSearchOptions {
|
|
3
|
-
/** Filter by source type (xbrl_textblock, narrative_section, ixbrl_disclosure, uploaded_doc, memory) */
|
|
4
|
-
sourceType?: string;
|
|
5
|
-
/** Filter by ticker, CIK, or entity name */
|
|
6
|
-
entity?: string;
|
|
7
|
-
/** Filter by SEC form type (10-K, 10-Q) */
|
|
8
|
-
formType?: string;
|
|
9
|
-
/** Filter by section ID (item_1, item_1a, item_7, etc.) */
|
|
10
|
-
section?: string;
|
|
11
|
-
/** Filter by XBRL element qname (e.g., us-gaap:Goodwill) */
|
|
12
|
-
element?: string;
|
|
13
|
-
/** Filter by fiscal year */
|
|
14
|
-
fiscalYear?: number;
|
|
15
|
-
/** Filter filings on or after date (YYYY-MM-DD) */
|
|
16
|
-
dateFrom?: string;
|
|
17
|
-
/** Filter filings on or before date (YYYY-MM-DD) */
|
|
18
|
-
dateTo?: string;
|
|
19
|
-
/** Max results to return (default: 10) */
|
|
20
|
-
size?: number;
|
|
21
|
-
/** Pagination offset */
|
|
22
|
-
offset?: number;
|
|
23
|
-
}
|
|
24
|
-
export interface DocumentUploadOptions {
|
|
25
|
-
/** Optional tags for filtering */
|
|
26
|
-
tags?: string[];
|
|
27
|
-
/** Optional folder/category */
|
|
28
|
-
folder?: string;
|
|
29
|
-
/** Optional external ID for upsert behavior */
|
|
30
|
-
externalId?: string;
|
|
31
|
-
}
|
|
32
|
-
export declare class DocumentClient {
|
|
33
|
-
private config;
|
|
34
|
-
constructor(config: {
|
|
35
|
-
baseUrl: string;
|
|
36
|
-
credentials?: 'include' | 'same-origin' | 'omit';
|
|
37
|
-
headers?: Record<string, string>;
|
|
38
|
-
token?: string;
|
|
39
|
-
});
|
|
40
|
-
/**
|
|
41
|
-
* Upload a markdown document for text indexing.
|
|
42
|
-
*
|
|
43
|
-
* The document is sectioned on headings, embedded, and indexed
|
|
44
|
-
* into OpenSearch for full-text and semantic search.
|
|
45
|
-
*/
|
|
46
|
-
upload(graphId: string, title: string, content: string, options?: DocumentUploadOptions): Promise<DocumentUploadResponse>;
|
|
47
|
-
/**
|
|
48
|
-
* Upload multiple markdown documents (max 50 per request).
|
|
49
|
-
*/
|
|
50
|
-
uploadBulk(graphId: string, documents: Array<{
|
|
51
|
-
title: string;
|
|
52
|
-
content: string;
|
|
53
|
-
tags?: string[];
|
|
54
|
-
folder?: string;
|
|
55
|
-
externalId?: string;
|
|
56
|
-
}>): Promise<BulkDocumentUploadResponse>;
|
|
57
|
-
/**
|
|
58
|
-
* Search documents with hybrid (BM25 + kNN) search.
|
|
59
|
-
*/
|
|
60
|
-
search(graphId: string, query: string, options?: DocumentSearchOptions): Promise<SearchResponse>;
|
|
61
|
-
/**
|
|
62
|
-
* Retrieve the full text of a document section by ID.
|
|
63
|
-
*
|
|
64
|
-
* @returns DocumentSection or null if not found.
|
|
65
|
-
*/
|
|
66
|
-
getSection(graphId: string, documentId: string): Promise<DocumentSection | null>;
|
|
67
|
-
/**
|
|
68
|
-
* List indexed documents for a graph.
|
|
69
|
-
*/
|
|
70
|
-
list(graphId: string, sourceType?: string): Promise<DocumentListResponse>;
|
|
71
|
-
/**
|
|
72
|
-
* Delete a document and all its sections.
|
|
73
|
-
*
|
|
74
|
-
* @returns true if deleted, false if not found.
|
|
75
|
-
*/
|
|
76
|
-
delete(graphId: string, documentId: string): Promise<boolean>;
|
|
77
|
-
}
|
|
@@ -1,136 +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.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
|
-
* Upload multiple markdown documents (max 50 per request).
|
|
41
|
-
*/
|
|
42
|
-
async uploadBulk(graphId, documents) {
|
|
43
|
-
const response = await (0, sdk_gen_1.uploadDocumentsBulk)({
|
|
44
|
-
path: { graph_id: graphId },
|
|
45
|
-
body: {
|
|
46
|
-
documents: documents.map((doc) => ({
|
|
47
|
-
title: doc.title,
|
|
48
|
-
content: doc.content,
|
|
49
|
-
tags: doc.tags ?? null,
|
|
50
|
-
folder: doc.folder ?? null,
|
|
51
|
-
external_id: doc.externalId ?? null,
|
|
52
|
-
})),
|
|
53
|
-
},
|
|
54
|
-
});
|
|
55
|
-
if (response.error) {
|
|
56
|
-
throw new Error(`Bulk upload failed: ${JSON.stringify(response.error)}`);
|
|
57
|
-
}
|
|
58
|
-
return response.data;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Search documents with hybrid (BM25 + kNN) search.
|
|
62
|
-
*/
|
|
63
|
-
async search(graphId, query, options = {}) {
|
|
64
|
-
const response = await (0, sdk_gen_1.searchDocuments)({
|
|
65
|
-
path: { graph_id: graphId },
|
|
66
|
-
body: {
|
|
67
|
-
query,
|
|
68
|
-
source_type: options.sourceType ?? null,
|
|
69
|
-
entity: options.entity ?? null,
|
|
70
|
-
form_type: options.formType ?? null,
|
|
71
|
-
section: options.section ?? null,
|
|
72
|
-
element: options.element ?? null,
|
|
73
|
-
fiscal_year: options.fiscalYear ?? null,
|
|
74
|
-
date_from: options.dateFrom ?? null,
|
|
75
|
-
date_to: options.dateTo ?? null,
|
|
76
|
-
size: options.size,
|
|
77
|
-
offset: options.offset,
|
|
78
|
-
},
|
|
79
|
-
});
|
|
80
|
-
if (response.error) {
|
|
81
|
-
throw new Error(`Document search failed: ${JSON.stringify(response.error)}`);
|
|
82
|
-
}
|
|
83
|
-
return response.data;
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Retrieve the full text of a document section by ID.
|
|
87
|
-
*
|
|
88
|
-
* @returns DocumentSection or null if not found.
|
|
89
|
-
*/
|
|
90
|
-
async getSection(graphId, documentId) {
|
|
91
|
-
const response = await (0, sdk_gen_1.getDocumentSection)({
|
|
92
|
-
path: { graph_id: graphId, document_id: documentId },
|
|
93
|
-
});
|
|
94
|
-
if (response.response.status === 404) {
|
|
95
|
-
return null;
|
|
96
|
-
}
|
|
97
|
-
if (response.error) {
|
|
98
|
-
throw new Error(`Get section failed: ${JSON.stringify(response.error)}`);
|
|
99
|
-
}
|
|
100
|
-
return response.data;
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* List indexed documents for a graph.
|
|
104
|
-
*/
|
|
105
|
-
async list(graphId, sourceType) {
|
|
106
|
-
const response = await (0, sdk_gen_1.listDocuments)({
|
|
107
|
-
path: { graph_id: graphId },
|
|
108
|
-
query: sourceType ? { source_type: sourceType } : undefined,
|
|
109
|
-
});
|
|
110
|
-
if (response.error) {
|
|
111
|
-
throw new Error(`List documents failed: ${JSON.stringify(response.error)}`);
|
|
112
|
-
}
|
|
113
|
-
return response.data;
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Delete a document and all its sections.
|
|
117
|
-
*
|
|
118
|
-
* @returns true if deleted, false if not found.
|
|
119
|
-
*/
|
|
120
|
-
async delete(graphId, documentId) {
|
|
121
|
-
const response = await (0, sdk_gen_1.deleteDocument)({
|
|
122
|
-
path: { graph_id: graphId, document_id: documentId },
|
|
123
|
-
});
|
|
124
|
-
if (response.response.status === 204) {
|
|
125
|
-
return true;
|
|
126
|
-
}
|
|
127
|
-
if (response.response.status === 404) {
|
|
128
|
-
return false;
|
|
129
|
-
}
|
|
130
|
-
if (response.error) {
|
|
131
|
-
throw new Error(`Delete document failed: ${JSON.stringify(response.error)}`);
|
|
132
|
-
}
|
|
133
|
-
return true;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
exports.DocumentClient = DocumentClient;
|
|
@@ -1,232 +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
|
-
getDocumentSection,
|
|
14
|
-
listDocuments,
|
|
15
|
-
searchDocuments,
|
|
16
|
-
uploadDocument,
|
|
17
|
-
uploadDocumentsBulk,
|
|
18
|
-
} from '../sdk.gen'
|
|
19
|
-
import type {
|
|
20
|
-
BulkDocumentUploadResponse,
|
|
21
|
-
DocumentListResponse,
|
|
22
|
-
DocumentSection,
|
|
23
|
-
DocumentUploadResponse,
|
|
24
|
-
SearchResponse,
|
|
25
|
-
} from '../types.gen'
|
|
26
|
-
|
|
27
|
-
export interface DocumentSearchOptions {
|
|
28
|
-
/** Filter by source type (xbrl_textblock, narrative_section, ixbrl_disclosure, uploaded_doc, memory) */
|
|
29
|
-
sourceType?: string
|
|
30
|
-
/** Filter by ticker, CIK, or entity name */
|
|
31
|
-
entity?: string
|
|
32
|
-
/** Filter by SEC form type (10-K, 10-Q) */
|
|
33
|
-
formType?: string
|
|
34
|
-
/** Filter by section ID (item_1, item_1a, item_7, etc.) */
|
|
35
|
-
section?: string
|
|
36
|
-
/** Filter by XBRL element qname (e.g., us-gaap:Goodwill) */
|
|
37
|
-
element?: string
|
|
38
|
-
/** Filter by fiscal year */
|
|
39
|
-
fiscalYear?: number
|
|
40
|
-
/** Filter filings on or after date (YYYY-MM-DD) */
|
|
41
|
-
dateFrom?: string
|
|
42
|
-
/** Filter filings on or before date (YYYY-MM-DD) */
|
|
43
|
-
dateTo?: string
|
|
44
|
-
/** Max results to return (default: 10) */
|
|
45
|
-
size?: number
|
|
46
|
-
/** Pagination offset */
|
|
47
|
-
offset?: number
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export interface DocumentUploadOptions {
|
|
51
|
-
/** Optional tags for filtering */
|
|
52
|
-
tags?: string[]
|
|
53
|
-
/** Optional folder/category */
|
|
54
|
-
folder?: string
|
|
55
|
-
/** Optional external ID for upsert behavior */
|
|
56
|
-
externalId?: string
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export class DocumentClient {
|
|
60
|
-
private config: {
|
|
61
|
-
baseUrl: string
|
|
62
|
-
credentials?: 'include' | 'same-origin' | 'omit'
|
|
63
|
-
headers?: Record<string, string>
|
|
64
|
-
token?: string
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
constructor(config: {
|
|
68
|
-
baseUrl: string
|
|
69
|
-
credentials?: 'include' | 'same-origin' | 'omit'
|
|
70
|
-
headers?: Record<string, string>
|
|
71
|
-
token?: string
|
|
72
|
-
}) {
|
|
73
|
-
this.config = config
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Upload a markdown document for text indexing.
|
|
78
|
-
*
|
|
79
|
-
* The document is sectioned on headings, embedded, and indexed
|
|
80
|
-
* into OpenSearch for full-text and semantic search.
|
|
81
|
-
*/
|
|
82
|
-
async upload(
|
|
83
|
-
graphId: string,
|
|
84
|
-
title: string,
|
|
85
|
-
content: string,
|
|
86
|
-
options: DocumentUploadOptions = {}
|
|
87
|
-
): Promise<DocumentUploadResponse> {
|
|
88
|
-
const response = await uploadDocument({
|
|
89
|
-
path: { graph_id: graphId },
|
|
90
|
-
body: {
|
|
91
|
-
title,
|
|
92
|
-
content,
|
|
93
|
-
tags: options.tags ?? null,
|
|
94
|
-
folder: options.folder ?? null,
|
|
95
|
-
external_id: options.externalId ?? null,
|
|
96
|
-
},
|
|
97
|
-
})
|
|
98
|
-
|
|
99
|
-
if (response.error) {
|
|
100
|
-
throw new Error(`Document upload failed: ${JSON.stringify(response.error)}`)
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
return response.data as DocumentUploadResponse
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Upload multiple markdown documents (max 50 per request).
|
|
108
|
-
*/
|
|
109
|
-
async uploadBulk(
|
|
110
|
-
graphId: string,
|
|
111
|
-
documents: Array<{
|
|
112
|
-
title: string
|
|
113
|
-
content: string
|
|
114
|
-
tags?: string[]
|
|
115
|
-
folder?: string
|
|
116
|
-
externalId?: string
|
|
117
|
-
}>
|
|
118
|
-
): Promise<BulkDocumentUploadResponse> {
|
|
119
|
-
const response = await uploadDocumentsBulk({
|
|
120
|
-
path: { graph_id: graphId },
|
|
121
|
-
body: {
|
|
122
|
-
documents: documents.map((doc) => ({
|
|
123
|
-
title: doc.title,
|
|
124
|
-
content: doc.content,
|
|
125
|
-
tags: doc.tags ?? null,
|
|
126
|
-
folder: doc.folder ?? null,
|
|
127
|
-
external_id: doc.externalId ?? null,
|
|
128
|
-
})),
|
|
129
|
-
},
|
|
130
|
-
})
|
|
131
|
-
|
|
132
|
-
if (response.error) {
|
|
133
|
-
throw new Error(`Bulk upload failed: ${JSON.stringify(response.error)}`)
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
return response.data as BulkDocumentUploadResponse
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Search documents with hybrid (BM25 + kNN) search.
|
|
141
|
-
*/
|
|
142
|
-
async search(
|
|
143
|
-
graphId: string,
|
|
144
|
-
query: string,
|
|
145
|
-
options: DocumentSearchOptions = {}
|
|
146
|
-
): Promise<SearchResponse> {
|
|
147
|
-
const response = await searchDocuments({
|
|
148
|
-
path: { graph_id: graphId },
|
|
149
|
-
body: {
|
|
150
|
-
query,
|
|
151
|
-
source_type: options.sourceType ?? null,
|
|
152
|
-
entity: options.entity ?? null,
|
|
153
|
-
form_type: options.formType ?? null,
|
|
154
|
-
section: options.section ?? null,
|
|
155
|
-
element: options.element ?? null,
|
|
156
|
-
fiscal_year: options.fiscalYear ?? null,
|
|
157
|
-
date_from: options.dateFrom ?? null,
|
|
158
|
-
date_to: options.dateTo ?? null,
|
|
159
|
-
size: options.size,
|
|
160
|
-
offset: options.offset,
|
|
161
|
-
},
|
|
162
|
-
})
|
|
163
|
-
|
|
164
|
-
if (response.error) {
|
|
165
|
-
throw new Error(`Document search failed: ${JSON.stringify(response.error)}`)
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
return response.data as SearchResponse
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* Retrieve the full text of a document section by ID.
|
|
173
|
-
*
|
|
174
|
-
* @returns DocumentSection or null if not found.
|
|
175
|
-
*/
|
|
176
|
-
async getSection(graphId: string, documentId: string): Promise<DocumentSection | null> {
|
|
177
|
-
const response = await getDocumentSection({
|
|
178
|
-
path: { graph_id: graphId, document_id: documentId },
|
|
179
|
-
})
|
|
180
|
-
|
|
181
|
-
if (response.response.status === 404) {
|
|
182
|
-
return null
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
if (response.error) {
|
|
186
|
-
throw new Error(`Get section failed: ${JSON.stringify(response.error)}`)
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
return response.data as DocumentSection
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
/**
|
|
193
|
-
* List indexed documents for a graph.
|
|
194
|
-
*/
|
|
195
|
-
async list(graphId: string, sourceType?: string): Promise<DocumentListResponse> {
|
|
196
|
-
const response = await listDocuments({
|
|
197
|
-
path: { graph_id: graphId },
|
|
198
|
-
query: sourceType ? { source_type: sourceType } : undefined,
|
|
199
|
-
})
|
|
200
|
-
|
|
201
|
-
if (response.error) {
|
|
202
|
-
throw new Error(`List documents failed: ${JSON.stringify(response.error)}`)
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
return response.data as DocumentListResponse
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
/**
|
|
209
|
-
* Delete a document and all its sections.
|
|
210
|
-
*
|
|
211
|
-
* @returns true if deleted, false if not found.
|
|
212
|
-
*/
|
|
213
|
-
async delete(graphId: string, documentId: string): Promise<boolean> {
|
|
214
|
-
const response = await deleteDocument({
|
|
215
|
-
path: { graph_id: graphId, document_id: documentId },
|
|
216
|
-
})
|
|
217
|
-
|
|
218
|
-
if (response.response.status === 204) {
|
|
219
|
-
return true
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
if (response.response.status === 404) {
|
|
223
|
-
return false
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
if (response.error) {
|
|
227
|
-
throw new Error(`Delete document failed: ${JSON.stringify(response.error)}`)
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
return true
|
|
231
|
-
}
|
|
232
|
-
}
|
|
@@ -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
|
-
}
|