@robosystems/client 0.1.17 → 0.1.19
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/bin/create-feature +91 -0
- package/extensions/CopyClient.d.ts +97 -0
- package/extensions/CopyClient.js +287 -0
- package/extensions/CopyClient.ts +438 -0
- package/extensions/hooks.d.ts +35 -0
- package/extensions/hooks.js +123 -0
- package/extensions/hooks.ts +139 -0
- package/extensions/index.d.ts +7 -2
- package/extensions/index.js +15 -1
- package/extensions/index.ts +23 -1
- package/package.json +7 -1
- package/sdk/sdk.gen.d.ts +36 -1
- package/sdk/sdk.gen.js +36 -1
- package/sdk/sdk.gen.ts +36 -1
- package/sdk/types.gen.d.ts +45 -4
- package/sdk/types.gen.ts +45 -4
- package/sdk-extensions/CopyClient.d.ts +97 -0
- package/sdk-extensions/CopyClient.js +287 -0
- package/sdk-extensions/CopyClient.ts +438 -0
- package/sdk-extensions/README.md +219 -0
- package/sdk-extensions/hooks.d.ts +35 -0
- package/sdk-extensions/hooks.js +123 -0
- package/sdk-extensions/hooks.ts +139 -0
- package/sdk-extensions/index.d.ts +7 -2
- package/sdk-extensions/index.js +15 -1
- package/sdk-extensions/index.ts +23 -1
- package/sdk.gen.d.ts +36 -1
- package/sdk.gen.js +36 -1
- package/sdk.gen.ts +36 -1
- package/types.gen.d.ts +45 -4
- package/types.gen.ts +45 -4
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import type { S3CopyRequest } from '../sdk/types.gen';
|
|
2
|
+
import type { CopyOptions, CopyResult } from './CopyClient';
|
|
3
|
+
import { CopyClient } from './CopyClient';
|
|
1
4
|
import type { OperationProgress, OperationResult } from './OperationClient';
|
|
2
5
|
import { OperationClient } from './OperationClient';
|
|
3
6
|
import type { QueryOptions, QueryResult } from './QueryClient';
|
|
@@ -105,6 +108,38 @@ export declare function useMultipleOperations<T = any>(): {
|
|
|
105
108
|
* ```
|
|
106
109
|
*/
|
|
107
110
|
export declare function useSDKClients(): {
|
|
111
|
+
copy: CopyClient | null;
|
|
108
112
|
query: QueryClient | null;
|
|
109
113
|
operations: OperationClient | null;
|
|
110
114
|
};
|
|
115
|
+
/**
|
|
116
|
+
* Hook for copying data from S3 to graph database with progress monitoring
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* ```tsx
|
|
120
|
+
* const { copyFromS3, loading, progress, error, result } = useCopy('graph_123')
|
|
121
|
+
*
|
|
122
|
+
* const handleImport = async () => {
|
|
123
|
+
* const result = await copyFromS3({
|
|
124
|
+
* table_name: 'companies',
|
|
125
|
+
* source_type: 's3',
|
|
126
|
+
* s3_uri: 's3://my-bucket/data.csv',
|
|
127
|
+
* aws_access_key_id: 'KEY',
|
|
128
|
+
* aws_secret_access_key: 'SECRET',
|
|
129
|
+
* })
|
|
130
|
+
* }
|
|
131
|
+
* ```
|
|
132
|
+
*/
|
|
133
|
+
export declare function useCopy(graphId: string): {
|
|
134
|
+
copyFromS3: (request: S3CopyRequest, options?: CopyOptions) => Promise<CopyResult | null>;
|
|
135
|
+
copyWithRetry: (request: S3CopyRequest, maxRetries?: number) => Promise<CopyResult | null>;
|
|
136
|
+
getStatistics: () => import("./CopyClient").CopyStatistics;
|
|
137
|
+
loading: boolean;
|
|
138
|
+
error: Error;
|
|
139
|
+
result: CopyResult;
|
|
140
|
+
progress: {
|
|
141
|
+
message: string;
|
|
142
|
+
percent?: number;
|
|
143
|
+
};
|
|
144
|
+
queuePosition: number;
|
|
145
|
+
};
|
package/sdk-extensions/hooks.js
CHANGED
|
@@ -6,6 +6,7 @@ exports.useStreamingQuery = useStreamingQuery;
|
|
|
6
6
|
exports.useOperation = useOperation;
|
|
7
7
|
exports.useMultipleOperations = useMultipleOperations;
|
|
8
8
|
exports.useSDKClients = useSDKClients;
|
|
9
|
+
exports.useCopy = useCopy;
|
|
9
10
|
/**
|
|
10
11
|
* React hooks for SDK extensions
|
|
11
12
|
* Provides easy-to-use hooks for Next.js/React applications
|
|
@@ -13,6 +14,7 @@ exports.useSDKClients = useSDKClients;
|
|
|
13
14
|
const react_1 = require("react");
|
|
14
15
|
const client_gen_1 = require("../sdk/client.gen");
|
|
15
16
|
const config_1 = require("./config");
|
|
17
|
+
const CopyClient_1 = require("./CopyClient");
|
|
16
18
|
const OperationClient_1 = require("./OperationClient");
|
|
17
19
|
const QueryClient_1 = require("./QueryClient");
|
|
18
20
|
/**
|
|
@@ -345,6 +347,7 @@ function useMultipleOperations() {
|
|
|
345
347
|
*/
|
|
346
348
|
function useSDKClients() {
|
|
347
349
|
const [clients, setClients] = (0, react_1.useState)({
|
|
350
|
+
copy: null,
|
|
348
351
|
query: null,
|
|
349
352
|
operations: null,
|
|
350
353
|
});
|
|
@@ -356,16 +359,136 @@ function useSDKClients() {
|
|
|
356
359
|
credentials: sdkConfig.credentials,
|
|
357
360
|
headers: sdkConfig.headers,
|
|
358
361
|
};
|
|
362
|
+
const copyClient = new CopyClient_1.CopyClient(baseConfig);
|
|
359
363
|
const queryClient = new QueryClient_1.QueryClient(baseConfig);
|
|
360
364
|
const operationsClient = new OperationClient_1.OperationClient(baseConfig);
|
|
361
365
|
setClients({
|
|
366
|
+
copy: copyClient,
|
|
362
367
|
query: queryClient,
|
|
363
368
|
operations: operationsClient,
|
|
364
369
|
});
|
|
365
370
|
return () => {
|
|
371
|
+
copyClient.close();
|
|
366
372
|
queryClient.close();
|
|
367
373
|
operationsClient.closeAll();
|
|
368
374
|
};
|
|
369
375
|
}, []);
|
|
370
376
|
return clients;
|
|
371
377
|
}
|
|
378
|
+
/**
|
|
379
|
+
* Hook for copying data from S3 to graph database with progress monitoring
|
|
380
|
+
*
|
|
381
|
+
* @example
|
|
382
|
+
* ```tsx
|
|
383
|
+
* const { copyFromS3, loading, progress, error, result } = useCopy('graph_123')
|
|
384
|
+
*
|
|
385
|
+
* const handleImport = async () => {
|
|
386
|
+
* const result = await copyFromS3({
|
|
387
|
+
* table_name: 'companies',
|
|
388
|
+
* source_type: 's3',
|
|
389
|
+
* s3_uri: 's3://my-bucket/data.csv',
|
|
390
|
+
* aws_access_key_id: 'KEY',
|
|
391
|
+
* aws_secret_access_key: 'SECRET',
|
|
392
|
+
* })
|
|
393
|
+
* }
|
|
394
|
+
* ```
|
|
395
|
+
*/
|
|
396
|
+
function useCopy(graphId) {
|
|
397
|
+
const [loading, setLoading] = (0, react_1.useState)(false);
|
|
398
|
+
const [error, setError] = (0, react_1.useState)(null);
|
|
399
|
+
const [result, setResult] = (0, react_1.useState)(null);
|
|
400
|
+
const [progress, setProgress] = (0, react_1.useState)(null);
|
|
401
|
+
const [queuePosition, setQueuePosition] = (0, react_1.useState)(null);
|
|
402
|
+
const clientRef = (0, react_1.useRef)(null);
|
|
403
|
+
// Initialize client
|
|
404
|
+
(0, react_1.useEffect)(() => {
|
|
405
|
+
const sdkConfig = (0, config_1.getSDKExtensionsConfig)();
|
|
406
|
+
const clientConfig = client_gen_1.client.getConfig();
|
|
407
|
+
clientRef.current = new CopyClient_1.CopyClient({
|
|
408
|
+
baseUrl: sdkConfig.baseUrl || clientConfig.baseUrl || 'http://localhost:8000',
|
|
409
|
+
credentials: sdkConfig.credentials,
|
|
410
|
+
headers: sdkConfig.headers,
|
|
411
|
+
});
|
|
412
|
+
return () => {
|
|
413
|
+
clientRef.current?.close();
|
|
414
|
+
};
|
|
415
|
+
}, []);
|
|
416
|
+
const copyFromS3 = (0, react_1.useCallback)(async (request, options) => {
|
|
417
|
+
if (!clientRef.current)
|
|
418
|
+
return null;
|
|
419
|
+
setLoading(true);
|
|
420
|
+
setError(null);
|
|
421
|
+
setResult(null);
|
|
422
|
+
setProgress(null);
|
|
423
|
+
setQueuePosition(null);
|
|
424
|
+
try {
|
|
425
|
+
const copyResult = await clientRef.current.copyFromS3(graphId, request, {
|
|
426
|
+
...options,
|
|
427
|
+
onProgress: (message, progressPercent) => {
|
|
428
|
+
setProgress({ message, percent: progressPercent });
|
|
429
|
+
setQueuePosition(null); // Clear queue position when executing
|
|
430
|
+
},
|
|
431
|
+
onQueueUpdate: (position, estimatedWait) => {
|
|
432
|
+
setQueuePosition(position);
|
|
433
|
+
setProgress({
|
|
434
|
+
message: `Queue position: ${position} (est. ${estimatedWait}s)`,
|
|
435
|
+
});
|
|
436
|
+
},
|
|
437
|
+
onWarning: (warning) => {
|
|
438
|
+
console.warn('Copy warning:', warning);
|
|
439
|
+
},
|
|
440
|
+
});
|
|
441
|
+
setResult(copyResult);
|
|
442
|
+
return copyResult;
|
|
443
|
+
}
|
|
444
|
+
catch (err) {
|
|
445
|
+
const error = err;
|
|
446
|
+
setError(error);
|
|
447
|
+
return null;
|
|
448
|
+
}
|
|
449
|
+
finally {
|
|
450
|
+
setLoading(false);
|
|
451
|
+
setQueuePosition(null);
|
|
452
|
+
}
|
|
453
|
+
}, [graphId]);
|
|
454
|
+
// Simple copy method with retry logic
|
|
455
|
+
const copyWithRetry = (0, react_1.useCallback)(async (request, maxRetries = 3) => {
|
|
456
|
+
if (!clientRef.current)
|
|
457
|
+
return null;
|
|
458
|
+
setLoading(true);
|
|
459
|
+
setError(null);
|
|
460
|
+
try {
|
|
461
|
+
const result = await clientRef.current.copyWithRetry(graphId, request, 's3', maxRetries, {
|
|
462
|
+
onProgress: (message, progressPercent) => {
|
|
463
|
+
setProgress({ message, percent: progressPercent });
|
|
464
|
+
},
|
|
465
|
+
});
|
|
466
|
+
setResult(result);
|
|
467
|
+
return result;
|
|
468
|
+
}
|
|
469
|
+
catch (err) {
|
|
470
|
+
const error = err;
|
|
471
|
+
setError(error);
|
|
472
|
+
return null;
|
|
473
|
+
}
|
|
474
|
+
finally {
|
|
475
|
+
setLoading(false);
|
|
476
|
+
}
|
|
477
|
+
}, [graphId]);
|
|
478
|
+
// Get statistics from the last copy operation
|
|
479
|
+
const getStatistics = (0, react_1.useCallback)(() => {
|
|
480
|
+
if (!clientRef.current || !result)
|
|
481
|
+
return null;
|
|
482
|
+
return clientRef.current.calculateStatistics(result);
|
|
483
|
+
}, [result]);
|
|
484
|
+
return {
|
|
485
|
+
copyFromS3,
|
|
486
|
+
copyWithRetry,
|
|
487
|
+
getStatistics,
|
|
488
|
+
loading,
|
|
489
|
+
error,
|
|
490
|
+
result,
|
|
491
|
+
progress,
|
|
492
|
+
queuePosition,
|
|
493
|
+
};
|
|
494
|
+
}
|
package/sdk-extensions/hooks.ts
CHANGED
|
@@ -7,7 +7,10 @@
|
|
|
7
7
|
|
|
8
8
|
import { useCallback, useEffect, useRef, useState } from 'react'
|
|
9
9
|
import { client } from '../sdk/client.gen'
|
|
10
|
+
import type { S3CopyRequest } from '../sdk/types.gen'
|
|
10
11
|
import { getSDKExtensionsConfig } from './config'
|
|
12
|
+
import type { CopyOptions, CopyResult } from './CopyClient'
|
|
13
|
+
import { CopyClient } from './CopyClient'
|
|
11
14
|
import type { OperationProgress, OperationResult } from './OperationClient'
|
|
12
15
|
import { OperationClient } from './OperationClient'
|
|
13
16
|
import type { QueryOptions, QueryResult } from './QueryClient'
|
|
@@ -404,9 +407,11 @@ export function useMultipleOperations<T = any>() {
|
|
|
404
407
|
*/
|
|
405
408
|
export function useSDKClients() {
|
|
406
409
|
const [clients, setClients] = useState<{
|
|
410
|
+
copy: CopyClient | null
|
|
407
411
|
query: QueryClient | null
|
|
408
412
|
operations: OperationClient | null
|
|
409
413
|
}>({
|
|
414
|
+
copy: null,
|
|
410
415
|
query: null,
|
|
411
416
|
operations: null,
|
|
412
417
|
})
|
|
@@ -420,15 +425,18 @@ export function useSDKClients() {
|
|
|
420
425
|
headers: sdkConfig.headers,
|
|
421
426
|
}
|
|
422
427
|
|
|
428
|
+
const copyClient = new CopyClient(baseConfig)
|
|
423
429
|
const queryClient = new QueryClient(baseConfig)
|
|
424
430
|
const operationsClient = new OperationClient(baseConfig)
|
|
425
431
|
|
|
426
432
|
setClients({
|
|
433
|
+
copy: copyClient,
|
|
427
434
|
query: queryClient,
|
|
428
435
|
operations: operationsClient,
|
|
429
436
|
})
|
|
430
437
|
|
|
431
438
|
return () => {
|
|
439
|
+
copyClient.close()
|
|
432
440
|
queryClient.close()
|
|
433
441
|
operationsClient.closeAll()
|
|
434
442
|
}
|
|
@@ -436,3 +444,134 @@ export function useSDKClients() {
|
|
|
436
444
|
|
|
437
445
|
return clients
|
|
438
446
|
}
|
|
447
|
+
|
|
448
|
+
/**
|
|
449
|
+
* Hook for copying data from S3 to graph database with progress monitoring
|
|
450
|
+
*
|
|
451
|
+
* @example
|
|
452
|
+
* ```tsx
|
|
453
|
+
* const { copyFromS3, loading, progress, error, result } = useCopy('graph_123')
|
|
454
|
+
*
|
|
455
|
+
* const handleImport = async () => {
|
|
456
|
+
* const result = await copyFromS3({
|
|
457
|
+
* table_name: 'companies',
|
|
458
|
+
* source_type: 's3',
|
|
459
|
+
* s3_uri: 's3://my-bucket/data.csv',
|
|
460
|
+
* aws_access_key_id: 'KEY',
|
|
461
|
+
* aws_secret_access_key: 'SECRET',
|
|
462
|
+
* })
|
|
463
|
+
* }
|
|
464
|
+
* ```
|
|
465
|
+
*/
|
|
466
|
+
export function useCopy(graphId: string) {
|
|
467
|
+
const [loading, setLoading] = useState(false)
|
|
468
|
+
const [error, setError] = useState<Error | null>(null)
|
|
469
|
+
const [result, setResult] = useState<CopyResult | null>(null)
|
|
470
|
+
const [progress, setProgress] = useState<{
|
|
471
|
+
message: string
|
|
472
|
+
percent?: number
|
|
473
|
+
} | null>(null)
|
|
474
|
+
const [queuePosition, setQueuePosition] = useState<number | null>(null)
|
|
475
|
+
const clientRef = useRef<CopyClient>(null)
|
|
476
|
+
|
|
477
|
+
// Initialize client
|
|
478
|
+
useEffect(() => {
|
|
479
|
+
const sdkConfig = getSDKExtensionsConfig()
|
|
480
|
+
const clientConfig = client.getConfig()
|
|
481
|
+
clientRef.current = new CopyClient({
|
|
482
|
+
baseUrl: sdkConfig.baseUrl || clientConfig.baseUrl || 'http://localhost:8000',
|
|
483
|
+
credentials: sdkConfig.credentials,
|
|
484
|
+
headers: sdkConfig.headers,
|
|
485
|
+
})
|
|
486
|
+
|
|
487
|
+
return () => {
|
|
488
|
+
clientRef.current?.close()
|
|
489
|
+
}
|
|
490
|
+
}, [])
|
|
491
|
+
|
|
492
|
+
const copyFromS3 = useCallback(
|
|
493
|
+
async (request: S3CopyRequest, options?: CopyOptions): Promise<CopyResult | null> => {
|
|
494
|
+
if (!clientRef.current) return null
|
|
495
|
+
|
|
496
|
+
setLoading(true)
|
|
497
|
+
setError(null)
|
|
498
|
+
setResult(null)
|
|
499
|
+
setProgress(null)
|
|
500
|
+
setQueuePosition(null)
|
|
501
|
+
|
|
502
|
+
try {
|
|
503
|
+
const copyResult = await clientRef.current.copyFromS3(graphId, request, {
|
|
504
|
+
...options,
|
|
505
|
+
onProgress: (message, progressPercent) => {
|
|
506
|
+
setProgress({ message, percent: progressPercent })
|
|
507
|
+
setQueuePosition(null) // Clear queue position when executing
|
|
508
|
+
},
|
|
509
|
+
onQueueUpdate: (position, estimatedWait) => {
|
|
510
|
+
setQueuePosition(position)
|
|
511
|
+
setProgress({
|
|
512
|
+
message: `Queue position: ${position} (est. ${estimatedWait}s)`,
|
|
513
|
+
})
|
|
514
|
+
},
|
|
515
|
+
onWarning: (warning) => {
|
|
516
|
+
console.warn('Copy warning:', warning)
|
|
517
|
+
},
|
|
518
|
+
})
|
|
519
|
+
|
|
520
|
+
setResult(copyResult)
|
|
521
|
+
return copyResult
|
|
522
|
+
} catch (err) {
|
|
523
|
+
const error = err as Error
|
|
524
|
+
setError(error)
|
|
525
|
+
return null
|
|
526
|
+
} finally {
|
|
527
|
+
setLoading(false)
|
|
528
|
+
setQueuePosition(null)
|
|
529
|
+
}
|
|
530
|
+
},
|
|
531
|
+
[graphId]
|
|
532
|
+
)
|
|
533
|
+
|
|
534
|
+
// Simple copy method with retry logic
|
|
535
|
+
const copyWithRetry = useCallback(
|
|
536
|
+
async (request: S3CopyRequest, maxRetries: number = 3): Promise<CopyResult | null> => {
|
|
537
|
+
if (!clientRef.current) return null
|
|
538
|
+
|
|
539
|
+
setLoading(true)
|
|
540
|
+
setError(null)
|
|
541
|
+
|
|
542
|
+
try {
|
|
543
|
+
const result = await clientRef.current.copyWithRetry(graphId, request, 's3', maxRetries, {
|
|
544
|
+
onProgress: (message, progressPercent) => {
|
|
545
|
+
setProgress({ message, percent: progressPercent })
|
|
546
|
+
},
|
|
547
|
+
})
|
|
548
|
+
setResult(result)
|
|
549
|
+
return result
|
|
550
|
+
} catch (err) {
|
|
551
|
+
const error = err as Error
|
|
552
|
+
setError(error)
|
|
553
|
+
return null
|
|
554
|
+
} finally {
|
|
555
|
+
setLoading(false)
|
|
556
|
+
}
|
|
557
|
+
},
|
|
558
|
+
[graphId]
|
|
559
|
+
)
|
|
560
|
+
|
|
561
|
+
// Get statistics from the last copy operation
|
|
562
|
+
const getStatistics = useCallback(() => {
|
|
563
|
+
if (!clientRef.current || !result) return null
|
|
564
|
+
return clientRef.current.calculateStatistics(result)
|
|
565
|
+
}, [result])
|
|
566
|
+
|
|
567
|
+
return {
|
|
568
|
+
copyFromS3,
|
|
569
|
+
copyWithRetry,
|
|
570
|
+
getStatistics,
|
|
571
|
+
loading,
|
|
572
|
+
error,
|
|
573
|
+
result,
|
|
574
|
+
progress,
|
|
575
|
+
queuePosition,
|
|
576
|
+
}
|
|
577
|
+
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* RoboSystems SDK Extensions
|
|
3
3
|
* Enhanced clients with SSE support for the RoboSystems API
|
|
4
4
|
*/
|
|
5
|
+
import { CopyClient } from './CopyClient';
|
|
5
6
|
import { OperationClient } from './OperationClient';
|
|
6
7
|
import { QueryClient } from './QueryClient';
|
|
7
8
|
import { SSEClient } from './SSEClient';
|
|
@@ -12,6 +13,7 @@ export interface RoboSystemsExtensionConfig {
|
|
|
12
13
|
retryDelay?: number;
|
|
13
14
|
}
|
|
14
15
|
export declare class RoboSystemsExtensions {
|
|
16
|
+
readonly copy: CopyClient;
|
|
15
17
|
readonly query: QueryClient;
|
|
16
18
|
readonly operations: OperationClient;
|
|
17
19
|
private config;
|
|
@@ -29,12 +31,14 @@ export declare class RoboSystemsExtensions {
|
|
|
29
31
|
*/
|
|
30
32
|
close(): void;
|
|
31
33
|
}
|
|
34
|
+
export * from './CopyClient';
|
|
32
35
|
export * from './OperationClient';
|
|
33
36
|
export * from './QueryClient';
|
|
34
37
|
export * from './SSEClient';
|
|
35
|
-
export { OperationClient, QueryClient, SSEClient };
|
|
36
|
-
export { useMultipleOperations, useOperation, useQuery, useSDKClients, useStreamingQuery, } from './hooks';
|
|
38
|
+
export { CopyClient, OperationClient, QueryClient, SSEClient };
|
|
39
|
+
export { useCopy, useMultipleOperations, useOperation, useQuery, useSDKClients, useStreamingQuery, } from './hooks';
|
|
37
40
|
export declare const extensions: {
|
|
41
|
+
readonly copy: CopyClient;
|
|
38
42
|
readonly query: QueryClient;
|
|
39
43
|
readonly operations: OperationClient;
|
|
40
44
|
monitorOperation: (operationId: string, onProgress?: (progress: any) => void) => Promise<any>;
|
|
@@ -44,3 +48,4 @@ export declare const extensions: {
|
|
|
44
48
|
export declare const monitorOperation: (operationId: string, onProgress?: (progress: any) => void) => Promise<any>;
|
|
45
49
|
export declare const executeQuery: (graphId: string, query: string, parameters?: Record<string, any>) => Promise<import("./QueryClient").QueryResult>;
|
|
46
50
|
export declare const streamQuery: (graphId: string, query: string, parameters?: Record<string, any>, chunkSize?: number) => AsyncIterableIterator<any>;
|
|
51
|
+
export declare const copyFromS3: (graphId: string, tableName: string, s3Uri: string, accessKeyId: string, secretAccessKey: string, options?: Parameters<CopyClient["copyS3"]>[5]) => Promise<import("./CopyClient").CopyResult>;
|
package/sdk-extensions/index.js
CHANGED
|
@@ -18,8 +18,10 @@ 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.streamQuery = exports.executeQuery = exports.monitorOperation = exports.extensions = exports.useStreamingQuery = exports.useSDKClients = exports.useQuery = exports.useOperation = exports.useMultipleOperations = exports.SSEClient = exports.QueryClient = exports.OperationClient = exports.RoboSystemsExtensions = void 0;
|
|
21
|
+
exports.copyFromS3 = exports.streamQuery = exports.executeQuery = exports.monitorOperation = exports.extensions = exports.useStreamingQuery = exports.useSDKClients = exports.useQuery = exports.useOperation = exports.useMultipleOperations = exports.useCopy = exports.SSEClient = exports.QueryClient = exports.OperationClient = exports.CopyClient = exports.RoboSystemsExtensions = void 0;
|
|
22
22
|
const client_gen_1 = require("../sdk/client.gen");
|
|
23
|
+
const CopyClient_1 = require("./CopyClient");
|
|
24
|
+
Object.defineProperty(exports, "CopyClient", { enumerable: true, get: function () { return CopyClient_1.CopyClient; } });
|
|
23
25
|
const OperationClient_1 = require("./OperationClient");
|
|
24
26
|
Object.defineProperty(exports, "OperationClient", { enumerable: true, get: function () { return OperationClient_1.OperationClient; } });
|
|
25
27
|
const QueryClient_1 = require("./QueryClient");
|
|
@@ -36,6 +38,10 @@ class RoboSystemsExtensions {
|
|
|
36
38
|
maxRetries: config.maxRetries || 5,
|
|
37
39
|
retryDelay: config.retryDelay || 1000,
|
|
38
40
|
};
|
|
41
|
+
this.copy = new CopyClient_1.CopyClient({
|
|
42
|
+
baseUrl: this.config.baseUrl,
|
|
43
|
+
credentials: this.config.credentials,
|
|
44
|
+
});
|
|
39
45
|
this.query = new QueryClient_1.QueryClient({
|
|
40
46
|
baseUrl: this.config.baseUrl,
|
|
41
47
|
credentials: this.config.credentials,
|
|
@@ -66,17 +72,20 @@ class RoboSystemsExtensions {
|
|
|
66
72
|
* Clean up all active connections
|
|
67
73
|
*/
|
|
68
74
|
close() {
|
|
75
|
+
this.copy.close();
|
|
69
76
|
this.query.close();
|
|
70
77
|
this.operations.closeAll();
|
|
71
78
|
}
|
|
72
79
|
}
|
|
73
80
|
exports.RoboSystemsExtensions = RoboSystemsExtensions;
|
|
74
81
|
// Export all types and classes
|
|
82
|
+
__exportStar(require("./CopyClient"), exports);
|
|
75
83
|
__exportStar(require("./OperationClient"), exports);
|
|
76
84
|
__exportStar(require("./QueryClient"), exports);
|
|
77
85
|
__exportStar(require("./SSEClient"), exports);
|
|
78
86
|
// Export React hooks
|
|
79
87
|
var hooks_1 = require("./hooks");
|
|
88
|
+
Object.defineProperty(exports, "useCopy", { enumerable: true, get: function () { return hooks_1.useCopy; } });
|
|
80
89
|
Object.defineProperty(exports, "useMultipleOperations", { enumerable: true, get: function () { return hooks_1.useMultipleOperations; } });
|
|
81
90
|
Object.defineProperty(exports, "useOperation", { enumerable: true, get: function () { return hooks_1.useOperation; } });
|
|
82
91
|
Object.defineProperty(exports, "useQuery", { enumerable: true, get: function () { return hooks_1.useQuery; } });
|
|
@@ -91,6 +100,9 @@ function getExtensions() {
|
|
|
91
100
|
return _extensions;
|
|
92
101
|
}
|
|
93
102
|
exports.extensions = {
|
|
103
|
+
get copy() {
|
|
104
|
+
return getExtensions().copy;
|
|
105
|
+
},
|
|
94
106
|
get query() {
|
|
95
107
|
return getExtensions().query;
|
|
96
108
|
},
|
|
@@ -108,3 +120,5 @@ const executeQuery = (graphId, query, parameters) => getExtensions().query.query
|
|
|
108
120
|
exports.executeQuery = executeQuery;
|
|
109
121
|
const streamQuery = (graphId, query, parameters, chunkSize) => getExtensions().query.streamQuery(graphId, query, parameters, chunkSize);
|
|
110
122
|
exports.streamQuery = streamQuery;
|
|
123
|
+
const copyFromS3 = (graphId, tableName, s3Uri, accessKeyId, secretAccessKey, options) => getExtensions().copy.copyS3(graphId, tableName, s3Uri, accessKeyId, secretAccessKey, options);
|
|
124
|
+
exports.copyFromS3 = copyFromS3;
|
package/sdk-extensions/index.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { client } from '../sdk/client.gen'
|
|
7
|
+
import { CopyClient } from './CopyClient'
|
|
7
8
|
import { OperationClient } from './OperationClient'
|
|
8
9
|
import { QueryClient } from './QueryClient'
|
|
9
10
|
import { SSEClient } from './SSEClient'
|
|
@@ -16,6 +17,7 @@ export interface RoboSystemsExtensionConfig {
|
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
export class RoboSystemsExtensions {
|
|
20
|
+
public readonly copy: CopyClient
|
|
19
21
|
public readonly query: QueryClient
|
|
20
22
|
public readonly operations: OperationClient
|
|
21
23
|
private config: Required<RoboSystemsExtensionConfig>
|
|
@@ -31,6 +33,11 @@ export class RoboSystemsExtensions {
|
|
|
31
33
|
retryDelay: config.retryDelay || 1000,
|
|
32
34
|
}
|
|
33
35
|
|
|
36
|
+
this.copy = new CopyClient({
|
|
37
|
+
baseUrl: this.config.baseUrl,
|
|
38
|
+
credentials: this.config.credentials,
|
|
39
|
+
})
|
|
40
|
+
|
|
34
41
|
this.query = new QueryClient({
|
|
35
42
|
baseUrl: this.config.baseUrl,
|
|
36
43
|
credentials: this.config.credentials,
|
|
@@ -65,19 +72,22 @@ export class RoboSystemsExtensions {
|
|
|
65
72
|
* Clean up all active connections
|
|
66
73
|
*/
|
|
67
74
|
close(): void {
|
|
75
|
+
this.copy.close()
|
|
68
76
|
this.query.close()
|
|
69
77
|
this.operations.closeAll()
|
|
70
78
|
}
|
|
71
79
|
}
|
|
72
80
|
|
|
73
81
|
// Export all types and classes
|
|
82
|
+
export * from './CopyClient'
|
|
74
83
|
export * from './OperationClient'
|
|
75
84
|
export * from './QueryClient'
|
|
76
85
|
export * from './SSEClient'
|
|
77
|
-
export { OperationClient, QueryClient, SSEClient }
|
|
86
|
+
export { CopyClient, OperationClient, QueryClient, SSEClient }
|
|
78
87
|
|
|
79
88
|
// Export React hooks
|
|
80
89
|
export {
|
|
90
|
+
useCopy,
|
|
81
91
|
useMultipleOperations,
|
|
82
92
|
useOperation,
|
|
83
93
|
useQuery,
|
|
@@ -96,6 +106,9 @@ function getExtensions(): RoboSystemsExtensions {
|
|
|
96
106
|
}
|
|
97
107
|
|
|
98
108
|
export const extensions = {
|
|
109
|
+
get copy() {
|
|
110
|
+
return getExtensions().copy
|
|
111
|
+
},
|
|
99
112
|
get query() {
|
|
100
113
|
return getExtensions().query
|
|
101
114
|
},
|
|
@@ -121,3 +134,12 @@ export const streamQuery = (
|
|
|
121
134
|
parameters?: Record<string, any>,
|
|
122
135
|
chunkSize?: number
|
|
123
136
|
) => getExtensions().query.streamQuery(graphId, query, parameters, chunkSize)
|
|
137
|
+
|
|
138
|
+
export const copyFromS3 = (
|
|
139
|
+
graphId: string,
|
|
140
|
+
tableName: string,
|
|
141
|
+
s3Uri: string,
|
|
142
|
+
accessKeyId: string,
|
|
143
|
+
secretAccessKey: string,
|
|
144
|
+
options?: Parameters<CopyClient['copyS3']>[5]
|
|
145
|
+
) => getExtensions().copy.copyS3(graphId, tableName, s3Uri, accessKeyId, secretAccessKey, options)
|
package/sdk.gen.d.ts
CHANGED
|
@@ -1092,9 +1092,44 @@ export declare const getSubgraphQuota: <ThrowOnError extends boolean = false>(op
|
|
|
1092
1092
|
* - Premium: 100GB max file size, 60 min timeout
|
|
1093
1093
|
*
|
|
1094
1094
|
* **Copy Options:**
|
|
1095
|
-
* - `ignore_errors`: Skip duplicate/invalid rows (enables upsert-like behavior)
|
|
1095
|
+
* - `ignore_errors`: Skip duplicate/invalid rows (enables upsert-like behavior). Note: When enabled, row counts may not be accurately reported
|
|
1096
1096
|
* - `extended_timeout`: Use extended timeout for large datasets
|
|
1097
1097
|
* - `validate_schema`: Validate source schema against target table
|
|
1098
|
+
*
|
|
1099
|
+
* **Asynchronous Execution with SSE:**
|
|
1100
|
+
* For large data imports, this endpoint returns immediately with an operation ID
|
|
1101
|
+
* and SSE monitoring endpoint. Connect to the returned stream URL for real-time updates:
|
|
1102
|
+
*
|
|
1103
|
+
* ```javascript
|
|
1104
|
+
* const eventSource = new EventSource('/v1/operations/{operation_id}/stream');
|
|
1105
|
+
* eventSource.onmessage = (event) => {
|
|
1106
|
+
* const data = JSON.parse(event.data);
|
|
1107
|
+
* console.log('Progress:', data.message);
|
|
1108
|
+
* };
|
|
1109
|
+
* ```
|
|
1110
|
+
*
|
|
1111
|
+
* **SSE Events Emitted:**
|
|
1112
|
+
* - `operation_started`: Copy operation begins
|
|
1113
|
+
* - `operation_progress`: Progress updates during data transfer
|
|
1114
|
+
* - `operation_completed`: Copy successful with statistics
|
|
1115
|
+
* - `operation_error`: Copy failed with error details
|
|
1116
|
+
*
|
|
1117
|
+
* **SSE Connection Limits:**
|
|
1118
|
+
* - Maximum 5 concurrent SSE connections per user
|
|
1119
|
+
* - Rate limited to 10 new connections per minute
|
|
1120
|
+
* - Automatic circuit breaker for Redis failures
|
|
1121
|
+
* - Graceful degradation if event system unavailable
|
|
1122
|
+
*
|
|
1123
|
+
* **Error Handling:**
|
|
1124
|
+
* - `403 Forbidden`: Attempted copy to shared repository
|
|
1125
|
+
* - `408 Request Timeout`: Operation exceeded timeout limit
|
|
1126
|
+
* - `429 Too Many Requests`: Rate limit exceeded
|
|
1127
|
+
* - `503 Service Unavailable`: Circuit breaker open or service unavailable
|
|
1128
|
+
* - Clients should implement exponential backoff on errors
|
|
1129
|
+
*
|
|
1130
|
+
* **Note:**
|
|
1131
|
+
* Copy operations are FREE - no credit consumption required.
|
|
1132
|
+
* All copy operations are performed asynchronously with progress monitoring.
|
|
1098
1133
|
*/
|
|
1099
1134
|
export declare const copyDataToGraph: <ThrowOnError extends boolean = false>(options: Options<CopyDataToGraphData, ThrowOnError>) => import("./client").RequestResult<CopyDataToGraphResponses, CopyDataToGraphErrors, ThrowOnError, "fields">;
|
|
1100
1135
|
/**
|
package/sdk.gen.js
CHANGED
|
@@ -2305,9 +2305,44 @@ exports.getSubgraphQuota = getSubgraphQuota;
|
|
|
2305
2305
|
* - Premium: 100GB max file size, 60 min timeout
|
|
2306
2306
|
*
|
|
2307
2307
|
* **Copy Options:**
|
|
2308
|
-
* - `ignore_errors`: Skip duplicate/invalid rows (enables upsert-like behavior)
|
|
2308
|
+
* - `ignore_errors`: Skip duplicate/invalid rows (enables upsert-like behavior). Note: When enabled, row counts may not be accurately reported
|
|
2309
2309
|
* - `extended_timeout`: Use extended timeout for large datasets
|
|
2310
2310
|
* - `validate_schema`: Validate source schema against target table
|
|
2311
|
+
*
|
|
2312
|
+
* **Asynchronous Execution with SSE:**
|
|
2313
|
+
* For large data imports, this endpoint returns immediately with an operation ID
|
|
2314
|
+
* and SSE monitoring endpoint. Connect to the returned stream URL for real-time updates:
|
|
2315
|
+
*
|
|
2316
|
+
* ```javascript
|
|
2317
|
+
* const eventSource = new EventSource('/v1/operations/{operation_id}/stream');
|
|
2318
|
+
* eventSource.onmessage = (event) => {
|
|
2319
|
+
* const data = JSON.parse(event.data);
|
|
2320
|
+
* console.log('Progress:', data.message);
|
|
2321
|
+
* };
|
|
2322
|
+
* ```
|
|
2323
|
+
*
|
|
2324
|
+
* **SSE Events Emitted:**
|
|
2325
|
+
* - `operation_started`: Copy operation begins
|
|
2326
|
+
* - `operation_progress`: Progress updates during data transfer
|
|
2327
|
+
* - `operation_completed`: Copy successful with statistics
|
|
2328
|
+
* - `operation_error`: Copy failed with error details
|
|
2329
|
+
*
|
|
2330
|
+
* **SSE Connection Limits:**
|
|
2331
|
+
* - Maximum 5 concurrent SSE connections per user
|
|
2332
|
+
* - Rate limited to 10 new connections per minute
|
|
2333
|
+
* - Automatic circuit breaker for Redis failures
|
|
2334
|
+
* - Graceful degradation if event system unavailable
|
|
2335
|
+
*
|
|
2336
|
+
* **Error Handling:**
|
|
2337
|
+
* - `403 Forbidden`: Attempted copy to shared repository
|
|
2338
|
+
* - `408 Request Timeout`: Operation exceeded timeout limit
|
|
2339
|
+
* - `429 Too Many Requests`: Rate limit exceeded
|
|
2340
|
+
* - `503 Service Unavailable`: Circuit breaker open or service unavailable
|
|
2341
|
+
* - Clients should implement exponential backoff on errors
|
|
2342
|
+
*
|
|
2343
|
+
* **Note:**
|
|
2344
|
+
* Copy operations are FREE - no credit consumption required.
|
|
2345
|
+
* All copy operations are performed asynchronously with progress monitoring.
|
|
2311
2346
|
*/
|
|
2312
2347
|
const copyDataToGraph = (options) => {
|
|
2313
2348
|
return (options.client ?? client_gen_1.client).post({
|
package/sdk.gen.ts
CHANGED
|
@@ -2319,9 +2319,44 @@ export const getSubgraphQuota = <ThrowOnError extends boolean = false>(options:
|
|
|
2319
2319
|
* - Premium: 100GB max file size, 60 min timeout
|
|
2320
2320
|
*
|
|
2321
2321
|
* **Copy Options:**
|
|
2322
|
-
* - `ignore_errors`: Skip duplicate/invalid rows (enables upsert-like behavior)
|
|
2322
|
+
* - `ignore_errors`: Skip duplicate/invalid rows (enables upsert-like behavior). Note: When enabled, row counts may not be accurately reported
|
|
2323
2323
|
* - `extended_timeout`: Use extended timeout for large datasets
|
|
2324
2324
|
* - `validate_schema`: Validate source schema against target table
|
|
2325
|
+
*
|
|
2326
|
+
* **Asynchronous Execution with SSE:**
|
|
2327
|
+
* For large data imports, this endpoint returns immediately with an operation ID
|
|
2328
|
+
* and SSE monitoring endpoint. Connect to the returned stream URL for real-time updates:
|
|
2329
|
+
*
|
|
2330
|
+
* ```javascript
|
|
2331
|
+
* const eventSource = new EventSource('/v1/operations/{operation_id}/stream');
|
|
2332
|
+
* eventSource.onmessage = (event) => {
|
|
2333
|
+
* const data = JSON.parse(event.data);
|
|
2334
|
+
* console.log('Progress:', data.message);
|
|
2335
|
+
* };
|
|
2336
|
+
* ```
|
|
2337
|
+
*
|
|
2338
|
+
* **SSE Events Emitted:**
|
|
2339
|
+
* - `operation_started`: Copy operation begins
|
|
2340
|
+
* - `operation_progress`: Progress updates during data transfer
|
|
2341
|
+
* - `operation_completed`: Copy successful with statistics
|
|
2342
|
+
* - `operation_error`: Copy failed with error details
|
|
2343
|
+
*
|
|
2344
|
+
* **SSE Connection Limits:**
|
|
2345
|
+
* - Maximum 5 concurrent SSE connections per user
|
|
2346
|
+
* - Rate limited to 10 new connections per minute
|
|
2347
|
+
* - Automatic circuit breaker for Redis failures
|
|
2348
|
+
* - Graceful degradation if event system unavailable
|
|
2349
|
+
*
|
|
2350
|
+
* **Error Handling:**
|
|
2351
|
+
* - `403 Forbidden`: Attempted copy to shared repository
|
|
2352
|
+
* - `408 Request Timeout`: Operation exceeded timeout limit
|
|
2353
|
+
* - `429 Too Many Requests`: Rate limit exceeded
|
|
2354
|
+
* - `503 Service Unavailable`: Circuit breaker open or service unavailable
|
|
2355
|
+
* - Clients should implement exponential backoff on errors
|
|
2356
|
+
*
|
|
2357
|
+
* **Note:**
|
|
2358
|
+
* Copy operations are FREE - no credit consumption required.
|
|
2359
|
+
* All copy operations are performed asynchronously with progress monitoring.
|
|
2325
2360
|
*/
|
|
2326
2361
|
export const copyDataToGraph = <ThrowOnError extends boolean = false>(options: Options<CopyDataToGraphData, ThrowOnError>) => {
|
|
2327
2362
|
return (options.client ?? _heyApiClient).post<CopyDataToGraphResponses, CopyDataToGraphErrors, ThrowOnError>({
|