@robosystems/client 0.2.18 → 0.2.21
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/FileClient.d.ts +1 -1
- package/extensions/FileClient.js +17 -3
- package/extensions/FileClient.ts +19 -4
- package/extensions/index.d.ts +1 -0
- package/extensions/index.js +2 -0
- package/extensions/index.ts +4 -0
- package/package.json +4 -4
- package/sdk-extensions/FileClient.d.ts +1 -1
- package/sdk-extensions/FileClient.js +17 -3
- package/sdk-extensions/FileClient.ts +19 -4
- package/sdk-extensions/index.d.ts +1 -0
- package/sdk-extensions/index.js +2 -0
- package/sdk-extensions/index.ts +4 -0
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export interface FileUploadOptions {
|
|
2
2
|
onProgress?: (message: string) => void;
|
|
3
|
-
fixLocalStackUrl?: boolean;
|
|
4
3
|
fileName?: string;
|
|
5
4
|
ingestToGraph?: boolean;
|
|
6
5
|
}
|
|
@@ -30,6 +29,7 @@ export declare class FileClient {
|
|
|
30
29
|
credentials?: 'include' | 'same-origin' | 'omit';
|
|
31
30
|
headers?: Record<string, string>;
|
|
32
31
|
token?: string;
|
|
32
|
+
s3EndpointUrl?: string;
|
|
33
33
|
});
|
|
34
34
|
/**
|
|
35
35
|
* Upload a Parquet file to staging
|
package/extensions/FileClient.js
CHANGED
|
@@ -48,8 +48,14 @@ class FileClient {
|
|
|
48
48
|
const uploadData = uploadUrlResponse.data;
|
|
49
49
|
let uploadUrl = uploadData.upload_url;
|
|
50
50
|
const fileId = uploadData.file_id;
|
|
51
|
-
if (
|
|
52
|
-
|
|
51
|
+
// Override S3 endpoint if configured (e.g., for LocalStack)
|
|
52
|
+
if (this.config.s3EndpointUrl) {
|
|
53
|
+
const originalUrl = new URL(uploadUrl);
|
|
54
|
+
const overrideUrl = new URL(this.config.s3EndpointUrl);
|
|
55
|
+
// Replace scheme, host, and port with the override endpoint
|
|
56
|
+
originalUrl.protocol = overrideUrl.protocol;
|
|
57
|
+
originalUrl.host = overrideUrl.host;
|
|
58
|
+
uploadUrl = originalUrl.toString();
|
|
53
59
|
}
|
|
54
60
|
options.onProgress?.(`Uploading ${fileName} to S3...`);
|
|
55
61
|
const fileContent = await this.getFileContent(fileOrBuffer);
|
|
@@ -205,7 +211,15 @@ class FileClient {
|
|
|
205
211
|
return fileOrBuffer.arrayBuffer();
|
|
206
212
|
}
|
|
207
213
|
if (Buffer.isBuffer(fileOrBuffer)) {
|
|
208
|
-
|
|
214
|
+
const buffer = fileOrBuffer.buffer.slice(fileOrBuffer.byteOffset, fileOrBuffer.byteOffset + fileOrBuffer.byteLength);
|
|
215
|
+
// Convert SharedArrayBuffer to ArrayBuffer if needed
|
|
216
|
+
if (buffer instanceof ArrayBuffer) {
|
|
217
|
+
return buffer;
|
|
218
|
+
}
|
|
219
|
+
// Handle SharedArrayBuffer by copying to ArrayBuffer
|
|
220
|
+
const arrayBuffer = new ArrayBuffer(buffer.byteLength);
|
|
221
|
+
new Uint8Array(arrayBuffer).set(new Uint8Array(buffer));
|
|
222
|
+
return arrayBuffer;
|
|
209
223
|
}
|
|
210
224
|
if ('getReader' in fileOrBuffer) {
|
|
211
225
|
const reader = fileOrBuffer.getReader();
|
package/extensions/FileClient.ts
CHANGED
|
@@ -12,7 +12,6 @@ import type { FileStatusUpdate, FileUploadRequest, FileUploadResponse } from '..
|
|
|
12
12
|
|
|
13
13
|
export interface FileUploadOptions {
|
|
14
14
|
onProgress?: (message: string) => void
|
|
15
|
-
fixLocalStackUrl?: boolean
|
|
16
15
|
fileName?: string
|
|
17
16
|
ingestToGraph?: boolean
|
|
18
17
|
}
|
|
@@ -45,6 +44,7 @@ export class FileClient {
|
|
|
45
44
|
credentials?: 'include' | 'same-origin' | 'omit'
|
|
46
45
|
headers?: Record<string, string>
|
|
47
46
|
token?: string
|
|
47
|
+
s3EndpointUrl?: string // Override S3 endpoint (e.g., for LocalStack)
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
constructor(config: {
|
|
@@ -52,6 +52,7 @@ export class FileClient {
|
|
|
52
52
|
credentials?: 'include' | 'same-origin' | 'omit'
|
|
53
53
|
headers?: Record<string, string>
|
|
54
54
|
token?: string
|
|
55
|
+
s3EndpointUrl?: string
|
|
55
56
|
}) {
|
|
56
57
|
this.config = config
|
|
57
58
|
}
|
|
@@ -102,8 +103,14 @@ export class FileClient {
|
|
|
102
103
|
let uploadUrl = uploadData.upload_url
|
|
103
104
|
const fileId = uploadData.file_id
|
|
104
105
|
|
|
105
|
-
if (
|
|
106
|
-
|
|
106
|
+
// Override S3 endpoint if configured (e.g., for LocalStack)
|
|
107
|
+
if (this.config.s3EndpointUrl) {
|
|
108
|
+
const originalUrl = new URL(uploadUrl)
|
|
109
|
+
const overrideUrl = new URL(this.config.s3EndpointUrl)
|
|
110
|
+
// Replace scheme, host, and port with the override endpoint
|
|
111
|
+
originalUrl.protocol = overrideUrl.protocol
|
|
112
|
+
originalUrl.host = overrideUrl.host
|
|
113
|
+
uploadUrl = originalUrl.toString()
|
|
107
114
|
}
|
|
108
115
|
|
|
109
116
|
options.onProgress?.(`Uploading ${fileName} to S3...`)
|
|
@@ -284,10 +291,18 @@ export class FileClient {
|
|
|
284
291
|
}
|
|
285
292
|
|
|
286
293
|
if (Buffer.isBuffer(fileOrBuffer)) {
|
|
287
|
-
|
|
294
|
+
const buffer = fileOrBuffer.buffer.slice(
|
|
288
295
|
fileOrBuffer.byteOffset,
|
|
289
296
|
fileOrBuffer.byteOffset + fileOrBuffer.byteLength
|
|
290
297
|
)
|
|
298
|
+
// Convert SharedArrayBuffer to ArrayBuffer if needed
|
|
299
|
+
if (buffer instanceof ArrayBuffer) {
|
|
300
|
+
return buffer
|
|
301
|
+
}
|
|
302
|
+
// Handle SharedArrayBuffer by copying to ArrayBuffer
|
|
303
|
+
const arrayBuffer = new ArrayBuffer(buffer.byteLength)
|
|
304
|
+
new Uint8Array(arrayBuffer).set(new Uint8Array(buffer))
|
|
305
|
+
return arrayBuffer
|
|
291
306
|
}
|
|
292
307
|
|
|
293
308
|
if ('getReader' in fileOrBuffer) {
|
package/extensions/index.d.ts
CHANGED
package/extensions/index.js
CHANGED
|
@@ -49,6 +49,7 @@ class RoboSystemsExtensions {
|
|
|
49
49
|
headers: config.headers,
|
|
50
50
|
maxRetries: config.maxRetries || 5,
|
|
51
51
|
retryDelay: config.retryDelay || 1000,
|
|
52
|
+
s3EndpointUrl: config.s3EndpointUrl,
|
|
52
53
|
};
|
|
53
54
|
this.query = new QueryClient_1.QueryClient({
|
|
54
55
|
baseUrl: this.config.baseUrl,
|
|
@@ -74,6 +75,7 @@ class RoboSystemsExtensions {
|
|
|
74
75
|
credentials: this.config.credentials,
|
|
75
76
|
token: this.config.token,
|
|
76
77
|
headers: this.config.headers,
|
|
78
|
+
s3EndpointUrl: this.config.s3EndpointUrl,
|
|
77
79
|
});
|
|
78
80
|
this.materialization = new MaterializationClient_1.MaterializationClient({
|
|
79
81
|
baseUrl: this.config.baseUrl,
|
package/extensions/index.ts
CHANGED
|
@@ -21,6 +21,7 @@ export interface RoboSystemsExtensionConfig {
|
|
|
21
21
|
headers?: Record<string, string>
|
|
22
22
|
maxRetries?: number
|
|
23
23
|
retryDelay?: number
|
|
24
|
+
s3EndpointUrl?: string // Override S3 endpoint (e.g., for LocalStack)
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
// Properly typed configuration interface
|
|
@@ -31,6 +32,7 @@ interface ResolvedConfig {
|
|
|
31
32
|
headers?: Record<string, string>
|
|
32
33
|
maxRetries: number
|
|
33
34
|
retryDelay: number
|
|
35
|
+
s3EndpointUrl?: string
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
export class RoboSystemsExtensions {
|
|
@@ -57,6 +59,7 @@ export class RoboSystemsExtensions {
|
|
|
57
59
|
headers: config.headers,
|
|
58
60
|
maxRetries: config.maxRetries || 5,
|
|
59
61
|
retryDelay: config.retryDelay || 1000,
|
|
62
|
+
s3EndpointUrl: config.s3EndpointUrl,
|
|
60
63
|
}
|
|
61
64
|
|
|
62
65
|
this.query = new QueryClient({
|
|
@@ -86,6 +89,7 @@ export class RoboSystemsExtensions {
|
|
|
86
89
|
credentials: this.config.credentials,
|
|
87
90
|
token: this.config.token,
|
|
88
91
|
headers: this.config.headers,
|
|
92
|
+
s3EndpointUrl: this.config.s3EndpointUrl,
|
|
89
93
|
})
|
|
90
94
|
|
|
91
95
|
this.materialization = new MaterializationClient({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@robosystems/client",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.21",
|
|
4
4
|
"description": "TypeScript client library for RoboSystems Financial Knowledge Graph API",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -109,8 +109,8 @@
|
|
|
109
109
|
"@testing-library/react": "^16.3.0",
|
|
110
110
|
"@types/node": "^22.0.0",
|
|
111
111
|
"@types/react": "^19.1.9",
|
|
112
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
113
|
-
"@typescript-eslint/parser": "^
|
|
112
|
+
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
113
|
+
"@typescript-eslint/parser": "^8.0.0",
|
|
114
114
|
"eslint": "^8.0.0",
|
|
115
115
|
"eslint-config-prettier": "^10.0.0",
|
|
116
116
|
"eslint-plugin-prettier": "^5.0.0",
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
"prettier-plugin-organize-imports": "^4.0.0",
|
|
120
120
|
"react": "^19.2.0",
|
|
121
121
|
"react-dom": "^19.2.0",
|
|
122
|
-
"typescript": "5.
|
|
122
|
+
"typescript": "^5.7.2",
|
|
123
123
|
"vitest": "^4.0.3"
|
|
124
124
|
},
|
|
125
125
|
"publishConfig": {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export interface FileUploadOptions {
|
|
2
2
|
onProgress?: (message: string) => void;
|
|
3
|
-
fixLocalStackUrl?: boolean;
|
|
4
3
|
fileName?: string;
|
|
5
4
|
ingestToGraph?: boolean;
|
|
6
5
|
}
|
|
@@ -30,6 +29,7 @@ export declare class FileClient {
|
|
|
30
29
|
credentials?: 'include' | 'same-origin' | 'omit';
|
|
31
30
|
headers?: Record<string, string>;
|
|
32
31
|
token?: string;
|
|
32
|
+
s3EndpointUrl?: string;
|
|
33
33
|
});
|
|
34
34
|
/**
|
|
35
35
|
* Upload a Parquet file to staging
|
|
@@ -48,8 +48,14 @@ class FileClient {
|
|
|
48
48
|
const uploadData = uploadUrlResponse.data;
|
|
49
49
|
let uploadUrl = uploadData.upload_url;
|
|
50
50
|
const fileId = uploadData.file_id;
|
|
51
|
-
if (
|
|
52
|
-
|
|
51
|
+
// Override S3 endpoint if configured (e.g., for LocalStack)
|
|
52
|
+
if (this.config.s3EndpointUrl) {
|
|
53
|
+
const originalUrl = new URL(uploadUrl);
|
|
54
|
+
const overrideUrl = new URL(this.config.s3EndpointUrl);
|
|
55
|
+
// Replace scheme, host, and port with the override endpoint
|
|
56
|
+
originalUrl.protocol = overrideUrl.protocol;
|
|
57
|
+
originalUrl.host = overrideUrl.host;
|
|
58
|
+
uploadUrl = originalUrl.toString();
|
|
53
59
|
}
|
|
54
60
|
options.onProgress?.(`Uploading ${fileName} to S3...`);
|
|
55
61
|
const fileContent = await this.getFileContent(fileOrBuffer);
|
|
@@ -205,7 +211,15 @@ class FileClient {
|
|
|
205
211
|
return fileOrBuffer.arrayBuffer();
|
|
206
212
|
}
|
|
207
213
|
if (Buffer.isBuffer(fileOrBuffer)) {
|
|
208
|
-
|
|
214
|
+
const buffer = fileOrBuffer.buffer.slice(fileOrBuffer.byteOffset, fileOrBuffer.byteOffset + fileOrBuffer.byteLength);
|
|
215
|
+
// Convert SharedArrayBuffer to ArrayBuffer if needed
|
|
216
|
+
if (buffer instanceof ArrayBuffer) {
|
|
217
|
+
return buffer;
|
|
218
|
+
}
|
|
219
|
+
// Handle SharedArrayBuffer by copying to ArrayBuffer
|
|
220
|
+
const arrayBuffer = new ArrayBuffer(buffer.byteLength);
|
|
221
|
+
new Uint8Array(arrayBuffer).set(new Uint8Array(buffer));
|
|
222
|
+
return arrayBuffer;
|
|
209
223
|
}
|
|
210
224
|
if ('getReader' in fileOrBuffer) {
|
|
211
225
|
const reader = fileOrBuffer.getReader();
|
|
@@ -12,7 +12,6 @@ import type { FileStatusUpdate, FileUploadRequest, FileUploadResponse } from '..
|
|
|
12
12
|
|
|
13
13
|
export interface FileUploadOptions {
|
|
14
14
|
onProgress?: (message: string) => void
|
|
15
|
-
fixLocalStackUrl?: boolean
|
|
16
15
|
fileName?: string
|
|
17
16
|
ingestToGraph?: boolean
|
|
18
17
|
}
|
|
@@ -45,6 +44,7 @@ export class FileClient {
|
|
|
45
44
|
credentials?: 'include' | 'same-origin' | 'omit'
|
|
46
45
|
headers?: Record<string, string>
|
|
47
46
|
token?: string
|
|
47
|
+
s3EndpointUrl?: string // Override S3 endpoint (e.g., for LocalStack)
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
constructor(config: {
|
|
@@ -52,6 +52,7 @@ export class FileClient {
|
|
|
52
52
|
credentials?: 'include' | 'same-origin' | 'omit'
|
|
53
53
|
headers?: Record<string, string>
|
|
54
54
|
token?: string
|
|
55
|
+
s3EndpointUrl?: string
|
|
55
56
|
}) {
|
|
56
57
|
this.config = config
|
|
57
58
|
}
|
|
@@ -102,8 +103,14 @@ export class FileClient {
|
|
|
102
103
|
let uploadUrl = uploadData.upload_url
|
|
103
104
|
const fileId = uploadData.file_id
|
|
104
105
|
|
|
105
|
-
if (
|
|
106
|
-
|
|
106
|
+
// Override S3 endpoint if configured (e.g., for LocalStack)
|
|
107
|
+
if (this.config.s3EndpointUrl) {
|
|
108
|
+
const originalUrl = new URL(uploadUrl)
|
|
109
|
+
const overrideUrl = new URL(this.config.s3EndpointUrl)
|
|
110
|
+
// Replace scheme, host, and port with the override endpoint
|
|
111
|
+
originalUrl.protocol = overrideUrl.protocol
|
|
112
|
+
originalUrl.host = overrideUrl.host
|
|
113
|
+
uploadUrl = originalUrl.toString()
|
|
107
114
|
}
|
|
108
115
|
|
|
109
116
|
options.onProgress?.(`Uploading ${fileName} to S3...`)
|
|
@@ -284,10 +291,18 @@ export class FileClient {
|
|
|
284
291
|
}
|
|
285
292
|
|
|
286
293
|
if (Buffer.isBuffer(fileOrBuffer)) {
|
|
287
|
-
|
|
294
|
+
const buffer = fileOrBuffer.buffer.slice(
|
|
288
295
|
fileOrBuffer.byteOffset,
|
|
289
296
|
fileOrBuffer.byteOffset + fileOrBuffer.byteLength
|
|
290
297
|
)
|
|
298
|
+
// Convert SharedArrayBuffer to ArrayBuffer if needed
|
|
299
|
+
if (buffer instanceof ArrayBuffer) {
|
|
300
|
+
return buffer
|
|
301
|
+
}
|
|
302
|
+
// Handle SharedArrayBuffer by copying to ArrayBuffer
|
|
303
|
+
const arrayBuffer = new ArrayBuffer(buffer.byteLength)
|
|
304
|
+
new Uint8Array(arrayBuffer).set(new Uint8Array(buffer))
|
|
305
|
+
return arrayBuffer
|
|
291
306
|
}
|
|
292
307
|
|
|
293
308
|
if ('getReader' in fileOrBuffer) {
|
package/sdk-extensions/index.js
CHANGED
|
@@ -49,6 +49,7 @@ class RoboSystemsExtensions {
|
|
|
49
49
|
headers: config.headers,
|
|
50
50
|
maxRetries: config.maxRetries || 5,
|
|
51
51
|
retryDelay: config.retryDelay || 1000,
|
|
52
|
+
s3EndpointUrl: config.s3EndpointUrl,
|
|
52
53
|
};
|
|
53
54
|
this.query = new QueryClient_1.QueryClient({
|
|
54
55
|
baseUrl: this.config.baseUrl,
|
|
@@ -74,6 +75,7 @@ class RoboSystemsExtensions {
|
|
|
74
75
|
credentials: this.config.credentials,
|
|
75
76
|
token: this.config.token,
|
|
76
77
|
headers: this.config.headers,
|
|
78
|
+
s3EndpointUrl: this.config.s3EndpointUrl,
|
|
77
79
|
});
|
|
78
80
|
this.materialization = new MaterializationClient_1.MaterializationClient({
|
|
79
81
|
baseUrl: this.config.baseUrl,
|
package/sdk-extensions/index.ts
CHANGED
|
@@ -21,6 +21,7 @@ export interface RoboSystemsExtensionConfig {
|
|
|
21
21
|
headers?: Record<string, string>
|
|
22
22
|
maxRetries?: number
|
|
23
23
|
retryDelay?: number
|
|
24
|
+
s3EndpointUrl?: string // Override S3 endpoint (e.g., for LocalStack)
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
// Properly typed configuration interface
|
|
@@ -31,6 +32,7 @@ interface ResolvedConfig {
|
|
|
31
32
|
headers?: Record<string, string>
|
|
32
33
|
maxRetries: number
|
|
33
34
|
retryDelay: number
|
|
35
|
+
s3EndpointUrl?: string
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
export class RoboSystemsExtensions {
|
|
@@ -57,6 +59,7 @@ export class RoboSystemsExtensions {
|
|
|
57
59
|
headers: config.headers,
|
|
58
60
|
maxRetries: config.maxRetries || 5,
|
|
59
61
|
retryDelay: config.retryDelay || 1000,
|
|
62
|
+
s3EndpointUrl: config.s3EndpointUrl,
|
|
60
63
|
}
|
|
61
64
|
|
|
62
65
|
this.query = new QueryClient({
|
|
@@ -86,6 +89,7 @@ export class RoboSystemsExtensions {
|
|
|
86
89
|
credentials: this.config.credentials,
|
|
87
90
|
token: this.config.token,
|
|
88
91
|
headers: this.config.headers,
|
|
92
|
+
s3EndpointUrl: this.config.s3EndpointUrl,
|
|
89
93
|
})
|
|
90
94
|
|
|
91
95
|
this.materialization = new MaterializationClient({
|