@robosystems/client 0.2.15 → 0.2.16

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 (37) hide show
  1. package/extensions/FileClient.d.ts +57 -0
  2. package/extensions/{TableIngestClient.js → FileClient.js} +55 -77
  3. package/extensions/{TableIngestClient.ts → FileClient.ts} +67 -122
  4. package/extensions/MaterializationClient.d.ts +51 -0
  5. package/extensions/MaterializationClient.js +107 -0
  6. package/extensions/MaterializationClient.ts +163 -0
  7. package/extensions/TableClient.d.ts +38 -0
  8. package/extensions/TableClient.js +92 -0
  9. package/extensions/TableClient.ts +132 -0
  10. package/extensions/hooks.d.ts +9 -11
  11. package/extensions/hooks.js +21 -56
  12. package/extensions/hooks.ts +30 -79
  13. package/extensions/index.d.ts +14 -4
  14. package/extensions/index.js +32 -5
  15. package/extensions/index.test.ts +10 -2
  16. package/extensions/index.ts +46 -5
  17. package/package.json +1 -1
  18. package/sdk-extensions/FileClient.d.ts +57 -0
  19. package/sdk-extensions/{TableIngestClient.js → FileClient.js} +55 -77
  20. package/sdk-extensions/{TableIngestClient.ts → FileClient.ts} +67 -122
  21. package/sdk-extensions/MaterializationClient.d.ts +51 -0
  22. package/sdk-extensions/MaterializationClient.js +107 -0
  23. package/sdk-extensions/MaterializationClient.ts +163 -0
  24. package/sdk-extensions/TableClient.d.ts +38 -0
  25. package/sdk-extensions/TableClient.js +92 -0
  26. package/sdk-extensions/TableClient.ts +132 -0
  27. package/sdk-extensions/hooks.d.ts +9 -11
  28. package/sdk-extensions/hooks.js +21 -56
  29. package/sdk-extensions/hooks.ts +30 -79
  30. package/sdk-extensions/index.d.ts +14 -4
  31. package/sdk-extensions/index.js +32 -5
  32. package/sdk-extensions/index.test.ts +10 -2
  33. package/sdk-extensions/index.ts +46 -5
  34. package/extensions/TableIngestClient.d.ts +0 -75
  35. package/extensions/TableIngestClient.test.ts +0 -304
  36. package/sdk-extensions/TableIngestClient.d.ts +0 -75
  37. package/sdk-extensions/TableIngestClient.test.ts +0 -304
@@ -14,9 +14,11 @@ exports.useTableUpload = useTableUpload;
14
14
  const react_1 = require("react");
15
15
  const client_gen_1 = require("../sdk/client.gen");
16
16
  const config_1 = require("./config");
17
+ const FileClient_1 = require("./FileClient");
18
+ const MaterializationClient_1 = require("./MaterializationClient");
17
19
  const OperationClient_1 = require("./OperationClient");
18
20
  const QueryClient_1 = require("./QueryClient");
19
- const TableIngestClient_1 = require("./TableIngestClient");
21
+ const TableClient_1 = require("./TableClient");
20
22
  /**
21
23
  * Hook for executing Cypher queries with loading states and error handling
22
24
  *
@@ -385,11 +387,11 @@ function useSDKClients() {
385
387
  return clients;
386
388
  }
387
389
  /**
388
- * Hook for uploading Parquet files to staging tables
390
+ * Hook for uploading Parquet files to staging and materializing graphs
389
391
  *
390
392
  * @example
391
393
  * ```tsx
392
- * const { upload, uploadAndIngest, loading, error, progress } = useTableUpload('graph_123')
394
+ * const { upload, listTables, materialize, loading, error, progress } = useTableUpload('graph_123')
393
395
  *
394
396
  * const handleFileUpload = async (file: File) => {
395
397
  * const result = await upload('Entity', file, {
@@ -408,28 +410,32 @@ function useTableUpload(graphId) {
408
410
  const [error, setError] = (0, react_1.useState)(null);
409
411
  const [progress, setProgress] = (0, react_1.useState)(null);
410
412
  const [uploadResult, setUploadResult] = (0, react_1.useState)(null);
411
- const clientRef = (0, react_1.useRef)(null);
413
+ const fileClientRef = (0, react_1.useRef)(null);
414
+ const materializationClientRef = (0, react_1.useRef)(null);
415
+ const tableClientRef = (0, react_1.useRef)(null);
412
416
  (0, react_1.useEffect)(() => {
413
417
  const sdkConfig = (0, config_1.getSDKExtensionsConfig)();
414
418
  const clientConfig = client_gen_1.client.getConfig();
415
- // Extract JWT token (uses centralized logic)
416
419
  const token = (0, config_1.extractTokenFromSDKClient)();
417
- clientRef.current = new TableIngestClient_1.TableIngestClient({
420
+ const baseConfig = {
418
421
  baseUrl: sdkConfig.baseUrl || clientConfig.baseUrl || 'http://localhost:8000',
419
422
  credentials: sdkConfig.credentials,
420
423
  token,
421
424
  headers: sdkConfig.headers,
422
- });
425
+ };
426
+ fileClientRef.current = new FileClient_1.FileClient(baseConfig);
427
+ materializationClientRef.current = new MaterializationClient_1.MaterializationClient(baseConfig);
428
+ tableClientRef.current = new TableClient_1.TableClient(baseConfig);
423
429
  }, []);
424
430
  const upload = (0, react_1.useCallback)(async (tableName, fileOrBuffer, options) => {
425
- if (!clientRef.current)
431
+ if (!fileClientRef.current)
426
432
  return null;
427
433
  setLoading(true);
428
434
  setError(null);
429
435
  setUploadResult(null);
430
436
  setProgress(null);
431
437
  try {
432
- const result = await clientRef.current.uploadParquetFile(graphId, tableName, fileOrBuffer, {
438
+ const result = await fileClientRef.current.upload(graphId, tableName, fileOrBuffer, {
433
439
  ...options,
434
440
  onProgress: (msg) => {
435
441
  setProgress(msg);
@@ -452,65 +458,25 @@ function useTableUpload(graphId) {
452
458
  setProgress(null);
453
459
  }
454
460
  }, [graphId]);
455
- const uploadAndIngest = (0, react_1.useCallback)(async (tableName, fileOrBuffer, uploadOptions, ingestOptions) => {
456
- if (!clientRef.current)
457
- return null;
458
- setLoading(true);
459
- setError(null);
460
- setUploadResult(null);
461
- setProgress(null);
462
- try {
463
- const result = await clientRef.current.uploadAndIngest(graphId, tableName, fileOrBuffer, {
464
- ...uploadOptions,
465
- onProgress: (msg) => {
466
- setProgress(msg);
467
- uploadOptions?.onProgress?.(msg);
468
- },
469
- }, {
470
- ...ingestOptions,
471
- onProgress: (msg) => {
472
- setProgress(msg);
473
- ingestOptions?.onProgress?.(msg);
474
- },
475
- });
476
- setUploadResult(result.upload);
477
- if (!result.upload.success && result.upload.error) {
478
- setError(new Error(result.upload.error));
479
- }
480
- else if (result.ingest && !result.ingest.success && result.ingest.error) {
481
- setError(new Error(result.ingest.error));
482
- }
483
- return result;
484
- }
485
- catch (err) {
486
- const error = err;
487
- setError(error);
488
- return null;
489
- }
490
- finally {
491
- setLoading(false);
492
- setProgress(null);
493
- }
494
- }, [graphId]);
495
461
  const listTables = (0, react_1.useCallback)(async () => {
496
- if (!clientRef.current)
462
+ if (!tableClientRef.current)
497
463
  return [];
498
464
  try {
499
- return await clientRef.current.listStagingTables(graphId);
465
+ return await tableClientRef.current.list(graphId);
500
466
  }
501
467
  catch (err) {
502
468
  setError(err);
503
469
  return [];
504
470
  }
505
471
  }, [graphId]);
506
- const ingestAllTables = (0, react_1.useCallback)(async (options) => {
507
- if (!clientRef.current)
472
+ const materialize = (0, react_1.useCallback)(async (options) => {
473
+ if (!materializationClientRef.current)
508
474
  return null;
509
475
  setLoading(true);
510
476
  setError(null);
511
477
  setProgress(null);
512
478
  try {
513
- const result = await clientRef.current.ingestAllTables(graphId, {
479
+ const result = await materializationClientRef.current.materialize(graphId, {
514
480
  ...options,
515
481
  onProgress: (msg) => {
516
482
  setProgress(msg);
@@ -534,9 +500,8 @@ function useTableUpload(graphId) {
534
500
  }, [graphId]);
535
501
  return {
536
502
  upload,
537
- uploadAndIngest,
538
503
  listTables,
539
- ingestAllTables,
504
+ materialize,
540
505
  loading,
541
506
  error,
542
507
  progress,
@@ -8,12 +8,16 @@
8
8
  import { useCallback, useEffect, useRef, useState } from 'react'
9
9
  import { client } from '../sdk/client.gen'
10
10
  import { extractTokenFromSDKClient, getSDKExtensionsConfig } from './config'
11
+ import type { FileInput, FileUploadOptions, FileUploadResult } from './FileClient'
12
+ import { FileClient } from './FileClient'
13
+ import type { MaterializationOptions } from './MaterializationClient'
14
+ import { MaterializationClient } from './MaterializationClient'
11
15
  import type { OperationProgress, OperationResult } from './OperationClient'
12
16
  import { OperationClient } from './OperationClient'
13
17
  import type { QueryOptions, QueryResult } from './QueryClient'
14
18
  import { QueryClient } from './QueryClient'
15
- import type { FileInput, IngestOptions, UploadOptions, UploadResult } from './TableIngestClient'
16
- import { TableIngestClient } from './TableIngestClient'
19
+ import type { TableInfo } from './TableClient'
20
+ import { TableClient } from './TableClient'
17
21
 
18
22
  /**
19
23
  * Hook for executing Cypher queries with loading states and error handling
@@ -461,11 +465,11 @@ export function useSDKClients() {
461
465
  }
462
466
 
463
467
  /**
464
- * Hook for uploading Parquet files to staging tables
468
+ * Hook for uploading Parquet files to staging and materializing graphs
465
469
  *
466
470
  * @example
467
471
  * ```tsx
468
- * const { upload, uploadAndIngest, loading, error, progress } = useTableUpload('graph_123')
472
+ * const { upload, listTables, materialize, loading, error, progress } = useTableUpload('graph_123')
469
473
  *
470
474
  * const handleFileUpload = async (file: File) => {
471
475
  * const result = await upload('Entity', file, {
@@ -483,31 +487,35 @@ export function useTableUpload(graphId: string) {
483
487
  const [loading, setLoading] = useState(false)
484
488
  const [error, setError] = useState<Error | null>(null)
485
489
  const [progress, setProgress] = useState<string | null>(null)
486
- const [uploadResult, setUploadResult] = useState<UploadResult | null>(null)
487
- const clientRef = useRef<TableIngestClient>(null)
490
+ const [uploadResult, setUploadResult] = useState<FileUploadResult | null>(null)
491
+ const fileClientRef = useRef<FileClient | null>(null)
492
+ const materializationClientRef = useRef<MaterializationClient | null>(null)
493
+ const tableClientRef = useRef<TableClient | null>(null)
488
494
 
489
495
  useEffect(() => {
490
496
  const sdkConfig = getSDKExtensionsConfig()
491
497
  const clientConfig = client.getConfig()
492
-
493
- // Extract JWT token (uses centralized logic)
494
498
  const token = extractTokenFromSDKClient()
495
499
 
496
- clientRef.current = new TableIngestClient({
500
+ const baseConfig = {
497
501
  baseUrl: sdkConfig.baseUrl || clientConfig.baseUrl || 'http://localhost:8000',
498
502
  credentials: sdkConfig.credentials,
499
503
  token,
500
504
  headers: sdkConfig.headers,
501
- })
505
+ }
506
+
507
+ fileClientRef.current = new FileClient(baseConfig)
508
+ materializationClientRef.current = new MaterializationClient(baseConfig)
509
+ tableClientRef.current = new TableClient(baseConfig)
502
510
  }, [])
503
511
 
504
512
  const upload = useCallback(
505
513
  async (
506
514
  tableName: string,
507
515
  fileOrBuffer: FileInput,
508
- options?: UploadOptions
509
- ): Promise<UploadResult | null> => {
510
- if (!clientRef.current) return null
516
+ options?: FileUploadOptions
517
+ ): Promise<FileUploadResult | null> => {
518
+ if (!fileClientRef.current) return null
511
519
 
512
520
  setLoading(true)
513
521
  setError(null)
@@ -515,7 +523,7 @@ export function useTableUpload(graphId: string) {
515
523
  setProgress(null)
516
524
 
517
525
  try {
518
- const result = await clientRef.current.uploadParquetFile(graphId, tableName, fileOrBuffer, {
526
+ const result = await fileClientRef.current.upload(graphId, tableName, fileOrBuffer, {
519
527
  ...options,
520
528
  onProgress: (msg) => {
521
529
  setProgress(msg)
@@ -542,83 +550,27 @@ export function useTableUpload(graphId: string) {
542
550
  [graphId]
543
551
  )
544
552
 
545
- const uploadAndIngest = useCallback(
546
- async (
547
- tableName: string,
548
- fileOrBuffer: FileInput,
549
- uploadOptions?: UploadOptions,
550
- ingestOptions?: IngestOptions
551
- ): Promise<{ upload: UploadResult; ingest: any } | null> => {
552
- if (!clientRef.current) return null
553
-
554
- setLoading(true)
555
- setError(null)
556
- setUploadResult(null)
557
- setProgress(null)
558
-
559
- try {
560
- const result = await clientRef.current.uploadAndIngest(
561
- graphId,
562
- tableName,
563
- fileOrBuffer,
564
- {
565
- ...uploadOptions,
566
- onProgress: (msg) => {
567
- setProgress(msg)
568
- uploadOptions?.onProgress?.(msg)
569
- },
570
- },
571
- {
572
- ...ingestOptions,
573
- onProgress: (msg) => {
574
- setProgress(msg)
575
- ingestOptions?.onProgress?.(msg)
576
- },
577
- }
578
- )
579
-
580
- setUploadResult(result.upload)
581
-
582
- if (!result.upload.success && result.upload.error) {
583
- setError(new Error(result.upload.error))
584
- } else if (result.ingest && !result.ingest.success && result.ingest.error) {
585
- setError(new Error(result.ingest.error))
586
- }
587
-
588
- return result
589
- } catch (err) {
590
- const error = err as Error
591
- setError(error)
592
- return null
593
- } finally {
594
- setLoading(false)
595
- setProgress(null)
596
- }
597
- },
598
- [graphId]
599
- )
600
-
601
- const listTables = useCallback(async () => {
602
- if (!clientRef.current) return []
553
+ const listTables = useCallback(async (): Promise<TableInfo[]> => {
554
+ if (!tableClientRef.current) return []
603
555
 
604
556
  try {
605
- return await clientRef.current.listStagingTables(graphId)
557
+ return await tableClientRef.current.list(graphId)
606
558
  } catch (err) {
607
559
  setError(err as Error)
608
560
  return []
609
561
  }
610
562
  }, [graphId])
611
563
 
612
- const ingestAllTables = useCallback(
613
- async (options?: IngestOptions) => {
614
- if (!clientRef.current) return null
564
+ const materialize = useCallback(
565
+ async (options?: MaterializationOptions) => {
566
+ if (!materializationClientRef.current) return null
615
567
 
616
568
  setLoading(true)
617
569
  setError(null)
618
570
  setProgress(null)
619
571
 
620
572
  try {
621
- const result = await clientRef.current.ingestAllTables(graphId, {
573
+ const result = await materializationClientRef.current.materialize(graphId, {
622
574
  ...options,
623
575
  onProgress: (msg) => {
624
576
  setProgress(msg)
@@ -645,9 +597,8 @@ export function useTableUpload(graphId: string) {
645
597
 
646
598
  return {
647
599
  upload,
648
- uploadAndIngest,
649
600
  listTables,
650
- ingestAllTables,
601
+ materialize,
651
602
  loading,
652
603
  error,
653
604
  progress,
@@ -6,7 +6,9 @@ import { OperationClient } from './OperationClient';
6
6
  import { QueryClient } from './QueryClient';
7
7
  import { AgentClient } from './AgentClient';
8
8
  import { SSEClient } from './SSEClient';
9
- import { TableIngestClient } from './TableIngestClient';
9
+ import { FileClient } from './FileClient';
10
+ import { MaterializationClient } from './MaterializationClient';
11
+ import { TableClient } from './TableClient';
10
12
  import { GraphClient } from './GraphClient';
11
13
  export interface RoboSystemsExtensionConfig {
12
14
  baseUrl?: string;
@@ -20,7 +22,9 @@ export declare class RoboSystemsExtensions {
20
22
  readonly query: QueryClient;
21
23
  readonly agent: AgentClient;
22
24
  readonly operations: OperationClient;
23
- readonly tables: TableIngestClient;
25
+ readonly files: FileClient;
26
+ readonly materialization: MaterializationClient;
27
+ readonly tables: TableClient;
24
28
  readonly graphs: GraphClient;
25
29
  private config;
26
30
  constructor(config?: RoboSystemsExtensionConfig);
@@ -41,15 +45,21 @@ export * from './OperationClient';
41
45
  export * from './QueryClient';
42
46
  export * from './AgentClient';
43
47
  export * from './SSEClient';
44
- export * from './TableIngestClient';
48
+ export * from './FileClient';
49
+ export * from './MaterializationClient';
45
50
  export * from './GraphClient';
46
51
  export * from './config';
47
- export { OperationClient, QueryClient, AgentClient, SSEClient, TableIngestClient, GraphClient };
52
+ export type { TableInfo, TableQueryResult } from './TableClient';
53
+ export { TableClient } from './TableClient';
54
+ export { OperationClient, QueryClient, AgentClient, SSEClient, FileClient, MaterializationClient, GraphClient, };
48
55
  export { useMultipleOperations, useOperation, useQuery, useSDKClients, useStreamingQuery, useTableUpload, } from './hooks';
49
56
  export declare const extensions: {
50
57
  readonly query: QueryClient;
51
58
  readonly agent: AgentClient;
52
59
  readonly operations: OperationClient;
60
+ readonly files: FileClient;
61
+ readonly materialization: MaterializationClient;
62
+ readonly tables: TableClient;
53
63
  readonly graphs: GraphClient;
54
64
  monitorOperation: (operationId: string, onProgress?: (progress: any) => void) => Promise<any>;
55
65
  createSSEClient: () => SSEClient;
@@ -18,7 +18,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
18
18
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
19
19
  };
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.analyzeFinancials = exports.agentQuery = exports.streamQuery = exports.executeQuery = exports.monitorOperation = exports.extensions = exports.useTableUpload = exports.useStreamingQuery = exports.useSDKClients = exports.useQuery = exports.useOperation = exports.useMultipleOperations = exports.GraphClient = exports.TableIngestClient = exports.SSEClient = exports.AgentClient = exports.QueryClient = exports.OperationClient = exports.RoboSystemsExtensions = void 0;
21
+ exports.analyzeFinancials = exports.agentQuery = exports.streamQuery = exports.executeQuery = exports.monitorOperation = exports.extensions = exports.useTableUpload = exports.useStreamingQuery = exports.useSDKClients = exports.useQuery = exports.useOperation = exports.useMultipleOperations = exports.GraphClient = exports.MaterializationClient = exports.FileClient = exports.SSEClient = exports.AgentClient = exports.QueryClient = exports.OperationClient = exports.TableClient = exports.RoboSystemsExtensions = void 0;
22
22
  const client_gen_1 = require("../sdk/client.gen");
23
23
  const config_1 = require("./config");
24
24
  const OperationClient_1 = require("./OperationClient");
@@ -29,8 +29,11 @@ const AgentClient_1 = require("./AgentClient");
29
29
  Object.defineProperty(exports, "AgentClient", { enumerable: true, get: function () { return AgentClient_1.AgentClient; } });
30
30
  const SSEClient_1 = require("./SSEClient");
31
31
  Object.defineProperty(exports, "SSEClient", { enumerable: true, get: function () { return SSEClient_1.SSEClient; } });
32
- const TableIngestClient_1 = require("./TableIngestClient");
33
- Object.defineProperty(exports, "TableIngestClient", { enumerable: true, get: function () { return TableIngestClient_1.TableIngestClient; } });
32
+ const FileClient_1 = require("./FileClient");
33
+ Object.defineProperty(exports, "FileClient", { enumerable: true, get: function () { return FileClient_1.FileClient; } });
34
+ const MaterializationClient_1 = require("./MaterializationClient");
35
+ Object.defineProperty(exports, "MaterializationClient", { enumerable: true, get: function () { return MaterializationClient_1.MaterializationClient; } });
36
+ const TableClient_1 = require("./TableClient");
34
37
  const GraphClient_1 = require("./GraphClient");
35
38
  Object.defineProperty(exports, "GraphClient", { enumerable: true, get: function () { return GraphClient_1.GraphClient; } });
36
39
  class RoboSystemsExtensions {
@@ -66,7 +69,19 @@ class RoboSystemsExtensions {
66
69
  maxRetries: this.config.maxRetries,
67
70
  retryDelay: this.config.retryDelay,
68
71
  });
69
- this.tables = new TableIngestClient_1.TableIngestClient({
72
+ this.files = new FileClient_1.FileClient({
73
+ baseUrl: this.config.baseUrl,
74
+ credentials: this.config.credentials,
75
+ token: this.config.token,
76
+ headers: this.config.headers,
77
+ });
78
+ this.materialization = new MaterializationClient_1.MaterializationClient({
79
+ baseUrl: this.config.baseUrl,
80
+ credentials: this.config.credentials,
81
+ token: this.config.token,
82
+ headers: this.config.headers,
83
+ });
84
+ this.tables = new TableClient_1.TableClient({
70
85
  baseUrl: this.config.baseUrl,
71
86
  credentials: this.config.credentials,
72
87
  token: this.config.token,
@@ -114,9 +129,12 @@ __exportStar(require("./OperationClient"), exports);
114
129
  __exportStar(require("./QueryClient"), exports);
115
130
  __exportStar(require("./AgentClient"), exports);
116
131
  __exportStar(require("./SSEClient"), exports);
117
- __exportStar(require("./TableIngestClient"), exports);
132
+ __exportStar(require("./FileClient"), exports);
133
+ __exportStar(require("./MaterializationClient"), exports);
118
134
  __exportStar(require("./GraphClient"), exports);
119
135
  __exportStar(require("./config"), exports);
136
+ var TableClient_2 = require("./TableClient");
137
+ Object.defineProperty(exports, "TableClient", { enumerable: true, get: function () { return TableClient_2.TableClient; } });
120
138
  // Export React hooks
121
139
  var hooks_1 = require("./hooks");
122
140
  Object.defineProperty(exports, "useMultipleOperations", { enumerable: true, get: function () { return hooks_1.useMultipleOperations; } });
@@ -143,6 +161,15 @@ exports.extensions = {
143
161
  get operations() {
144
162
  return getExtensions().operations;
145
163
  },
164
+ get files() {
165
+ return getExtensions().files;
166
+ },
167
+ get materialization() {
168
+ return getExtensions().materialization;
169
+ },
170
+ get tables() {
171
+ return getExtensions().tables;
172
+ },
146
173
  get graphs() {
147
174
  return getExtensions().graphs;
148
175
  },
@@ -23,12 +23,16 @@ describe('RoboSystemsExtensions', () => {
23
23
  expect(extensions).toBeDefined()
24
24
  expect(extensions.query).toBeDefined()
25
25
  expect(extensions.operations).toBeDefined()
26
+ expect(extensions.files).toBeDefined()
27
+ expect(extensions.materialization).toBeDefined()
26
28
  expect(extensions.tables).toBeDefined()
27
29
  expect(extensions.graphs).toBeDefined()
28
30
  // Verify clients have expected methods
29
31
  expect(typeof extensions.query.executeQuery).toBe('function')
30
32
  expect(typeof extensions.operations.monitorOperation).toBe('function')
31
- expect(typeof extensions.tables.uploadParquetFile).toBe('function')
33
+ expect(typeof extensions.files.upload).toBe('function')
34
+ expect(typeof extensions.materialization.materialize).toBe('function')
35
+ expect(typeof extensions.tables.list).toBe('function')
32
36
  expect(typeof extensions.graphs.createGraphAndWait).toBe('function')
33
37
  })
34
38
 
@@ -193,11 +197,15 @@ describe('RoboSystemsExtensions', () => {
193
197
 
194
198
  expect(extensions.query).toBeDefined()
195
199
  expect(extensions.operations).toBeDefined()
200
+ expect(extensions.files).toBeDefined()
201
+ expect(extensions.materialization).toBeDefined()
196
202
  expect(extensions.tables).toBeDefined()
197
203
  expect(extensions.graphs).toBeDefined()
198
204
  expect(typeof extensions.query.executeQuery).toBe('function')
199
205
  expect(typeof extensions.operations.monitorOperation).toBe('function')
200
- expect(typeof extensions.tables.uploadParquetFile).toBe('function')
206
+ expect(typeof extensions.files.upload).toBe('function')
207
+ expect(typeof extensions.materialization.materialize).toBe('function')
208
+ expect(typeof extensions.tables.list).toBe('function')
201
209
  expect(typeof extensions.graphs.createGraphAndWait).toBe('function')
202
210
  })
203
211
 
@@ -9,7 +9,9 @@ import { OperationClient } from './OperationClient'
9
9
  import { QueryClient } from './QueryClient'
10
10
  import { AgentClient } from './AgentClient'
11
11
  import { SSEClient } from './SSEClient'
12
- import { TableIngestClient } from './TableIngestClient'
12
+ import { FileClient } from './FileClient'
13
+ import { MaterializationClient } from './MaterializationClient'
14
+ import { TableClient } from './TableClient'
13
15
  import { GraphClient } from './GraphClient'
14
16
 
15
17
  export interface RoboSystemsExtensionConfig {
@@ -35,7 +37,9 @@ export class RoboSystemsExtensions {
35
37
  public readonly query: QueryClient
36
38
  public readonly agent: AgentClient
37
39
  public readonly operations: OperationClient
38
- public readonly tables: TableIngestClient
40
+ public readonly files: FileClient
41
+ public readonly materialization: MaterializationClient
42
+ public readonly tables: TableClient
39
43
  public readonly graphs: GraphClient
40
44
  private config: ResolvedConfig
41
45
 
@@ -77,7 +81,21 @@ export class RoboSystemsExtensions {
77
81
  retryDelay: this.config.retryDelay,
78
82
  })
79
83
 
80
- this.tables = new TableIngestClient({
84
+ this.files = new FileClient({
85
+ baseUrl: this.config.baseUrl,
86
+ credentials: this.config.credentials,
87
+ token: this.config.token,
88
+ headers: this.config.headers,
89
+ })
90
+
91
+ this.materialization = new MaterializationClient({
92
+ baseUrl: this.config.baseUrl,
93
+ credentials: this.config.credentials,
94
+ token: this.config.token,
95
+ headers: this.config.headers,
96
+ })
97
+
98
+ this.tables = new TableClient({
81
99
  baseUrl: this.config.baseUrl,
82
100
  credentials: this.config.credentials,
83
101
  token: this.config.token,
@@ -129,10 +147,24 @@ export * from './OperationClient'
129
147
  export * from './QueryClient'
130
148
  export * from './AgentClient'
131
149
  export * from './SSEClient'
132
- export * from './TableIngestClient'
150
+ export * from './FileClient'
151
+ export * from './MaterializationClient'
133
152
  export * from './GraphClient'
134
153
  export * from './config'
135
- export { OperationClient, QueryClient, AgentClient, SSEClient, TableIngestClient, GraphClient }
154
+
155
+ // Export TableClient types individually to avoid conflicts with QueryClient's QueryResult
156
+ export type { TableInfo, TableQueryResult } from './TableClient'
157
+ export { TableClient } from './TableClient'
158
+
159
+ export {
160
+ OperationClient,
161
+ QueryClient,
162
+ AgentClient,
163
+ SSEClient,
164
+ FileClient,
165
+ MaterializationClient,
166
+ GraphClient,
167
+ }
136
168
 
137
169
  // Export React hooks
138
170
  export {
@@ -164,6 +196,15 @@ export const extensions = {
164
196
  get operations() {
165
197
  return getExtensions().operations
166
198
  },
199
+ get files() {
200
+ return getExtensions().files
201
+ },
202
+ get materialization() {
203
+ return getExtensions().materialization
204
+ },
205
+ get tables() {
206
+ return getExtensions().tables
207
+ },
167
208
  get graphs() {
168
209
  return getExtensions().graphs
169
210
  },
@@ -1,75 +0,0 @@
1
- export interface UploadOptions {
2
- onProgress?: (message: string) => void;
3
- fixLocalStackUrl?: boolean;
4
- fileName?: string;
5
- }
6
- export interface IngestOptions {
7
- ignoreErrors?: boolean;
8
- rebuild?: boolean;
9
- onProgress?: (message: string) => void;
10
- }
11
- export interface UploadResult {
12
- fileId: string;
13
- fileSize: number;
14
- rowCount: number;
15
- tableName: string;
16
- fileName: string;
17
- success: boolean;
18
- error?: string;
19
- }
20
- export interface TableInfo {
21
- tableName: string;
22
- rowCount: number;
23
- fileCount: number;
24
- totalSizeBytes: number;
25
- }
26
- export interface IngestResult {
27
- success: boolean;
28
- operationId?: string;
29
- message?: string;
30
- error?: string;
31
- }
32
- export type FileInput = File | Blob | Buffer | ReadableStream<Uint8Array>;
33
- export declare class TableIngestClient {
34
- private config;
35
- constructor(config: {
36
- baseUrl: string;
37
- credentials?: 'include' | 'same-origin' | 'omit';
38
- headers?: Record<string, string>;
39
- token?: string;
40
- });
41
- /**
42
- * Upload a Parquet file to a staging table
43
- *
44
- * This method handles the complete 3-step upload process:
45
- * 1. Get presigned upload URL
46
- * 2. Upload file to S3
47
- * 3. Mark file as 'uploaded' (backend validates, calculates size/row count)
48
- *
49
- * Supports File (browser), Blob (browser), Buffer (Node.js), and ReadableStream.
50
- */
51
- uploadParquetFile(graphId: string, tableName: string, fileOrBuffer: FileInput, options?: UploadOptions): Promise<UploadResult>;
52
- /**
53
- * List all staging tables in a graph
54
- */
55
- listStagingTables(graphId: string): Promise<TableInfo[]>;
56
- /**
57
- * Ingest all staging tables into the graph
58
- */
59
- ingestAllTables(graphId: string, options?: IngestOptions): Promise<IngestResult>;
60
- /**
61
- * Convenience method to upload a file and immediately ingest it
62
- */
63
- uploadAndIngest(graphId: string, tableName: string, fileOrBuffer: FileInput, uploadOptions?: UploadOptions, ingestOptions?: IngestOptions): Promise<{
64
- upload: UploadResult;
65
- ingest: IngestResult | null;
66
- }>;
67
- /**
68
- * Get file name from input or use provided override
69
- */
70
- private getFileName;
71
- /**
72
- * Convert various file inputs to ArrayBuffer for upload
73
- */
74
- private getFileContent;
75
- }