@robosystems/client 0.2.20 → 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.
@@ -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 (options.fixLocalStackUrl && uploadUrl.includes('localstack:4566')) {
52
- uploadUrl = uploadUrl.replace('localstack:4566', 'localhost:4566');
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);
@@ -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 (options.fixLocalStackUrl && uploadUrl.includes('localstack:4566')) {
106
- uploadUrl = uploadUrl.replace('localstack:4566', 'localhost:4566')
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...`)
@@ -17,6 +17,7 @@ export interface RoboSystemsExtensionConfig {
17
17
  headers?: Record<string, string>;
18
18
  maxRetries?: number;
19
19
  retryDelay?: number;
20
+ s3EndpointUrl?: string;
20
21
  }
21
22
  export declare class RoboSystemsExtensions {
22
23
  readonly query: QueryClient;
@@ -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,
@@ -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.20",
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",
@@ -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 (options.fixLocalStackUrl && uploadUrl.includes('localstack:4566')) {
52
- uploadUrl = uploadUrl.replace('localstack:4566', 'localhost:4566');
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);
@@ -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 (options.fixLocalStackUrl && uploadUrl.includes('localstack:4566')) {
106
- uploadUrl = uploadUrl.replace('localstack:4566', 'localhost:4566')
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...`)
@@ -17,6 +17,7 @@ export interface RoboSystemsExtensionConfig {
17
17
  headers?: Record<string, string>;
18
18
  maxRetries?: number;
19
19
  retryDelay?: number;
20
+ s3EndpointUrl?: string;
20
21
  }
21
22
  export declare class RoboSystemsExtensions {
22
23
  readonly query: QueryClient;
@@ -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,
@@ -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({