@robosystems/client 0.1.17 → 0.1.18
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/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 +1 -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
package/extensions/hooks.ts
CHANGED
|
@@ -7,7 +7,10 @@
|
|
|
7
7
|
|
|
8
8
|
import { useCallback, useEffect, useRef, useState } from 'react'
|
|
9
9
|
import { client } from '../client.gen'
|
|
10
|
+
import type { S3CopyRequest } from '../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
|
+
}
|
package/extensions/index.d.ts
CHANGED
|
@@ -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/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("../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/extensions/index.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { client } from '../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/package.json
CHANGED
package/sdk/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/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/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>({
|
package/sdk/types.gen.d.ts
CHANGED
|
@@ -599,7 +599,17 @@ export type CopyResponse = {
|
|
|
599
599
|
* Status
|
|
600
600
|
* Operation status
|
|
601
601
|
*/
|
|
602
|
-
status: 'completed' | 'failed' | 'partial';
|
|
602
|
+
status: 'completed' | 'failed' | 'partial' | 'accepted';
|
|
603
|
+
/**
|
|
604
|
+
* Operation Id
|
|
605
|
+
* Operation ID for SSE monitoring (for long-running operations)
|
|
606
|
+
*/
|
|
607
|
+
operation_id?: string | null;
|
|
608
|
+
/**
|
|
609
|
+
* Sse Url
|
|
610
|
+
* SSE endpoint URL for monitoring operation progress
|
|
611
|
+
*/
|
|
612
|
+
sse_url?: string | null;
|
|
603
613
|
/**
|
|
604
614
|
* Source Type
|
|
605
615
|
* Type of source that was copied from
|
|
@@ -607,9 +617,9 @@ export type CopyResponse = {
|
|
|
607
617
|
source_type: string;
|
|
608
618
|
/**
|
|
609
619
|
* Execution Time Ms
|
|
610
|
-
* Total execution time in milliseconds
|
|
620
|
+
* Total execution time in milliseconds (for synchronous operations)
|
|
611
621
|
*/
|
|
612
|
-
execution_time_ms
|
|
622
|
+
execution_time_ms?: number | null;
|
|
613
623
|
/**
|
|
614
624
|
* Message
|
|
615
625
|
* Human-readable status message
|
|
@@ -1930,6 +1940,9 @@ export type ResponseMode = 'auto' | 'sync' | 'async' | 'stream';
|
|
|
1930
1940
|
/**
|
|
1931
1941
|
* S3CopyRequest
|
|
1932
1942
|
* Request model for S3 copy operations.
|
|
1943
|
+
*
|
|
1944
|
+
* Copies data from S3 buckets into graph database tables using user-provided
|
|
1945
|
+
* AWS credentials. Supports various file formats and bulk loading options.
|
|
1933
1946
|
*/
|
|
1934
1947
|
export type S3CopyRequest = {
|
|
1935
1948
|
/**
|
|
@@ -6125,17 +6138,45 @@ export type CopyDataToGraphData = {
|
|
|
6125
6138
|
url: '/v1/{graph_id}/copy';
|
|
6126
6139
|
};
|
|
6127
6140
|
export type CopyDataToGraphErrors = {
|
|
6141
|
+
/**
|
|
6142
|
+
* Invalid request parameters
|
|
6143
|
+
*/
|
|
6144
|
+
400: unknown;
|
|
6145
|
+
/**
|
|
6146
|
+
* Access denied or shared repository
|
|
6147
|
+
*/
|
|
6148
|
+
403: unknown;
|
|
6149
|
+
/**
|
|
6150
|
+
* Operation timeout
|
|
6151
|
+
*/
|
|
6152
|
+
408: unknown;
|
|
6128
6153
|
/**
|
|
6129
6154
|
* Validation Error
|
|
6130
6155
|
*/
|
|
6131
6156
|
422: HttpValidationError;
|
|
6157
|
+
/**
|
|
6158
|
+
* Rate limit exceeded
|
|
6159
|
+
*/
|
|
6160
|
+
429: unknown;
|
|
6161
|
+
/**
|
|
6162
|
+
* Internal error
|
|
6163
|
+
*/
|
|
6164
|
+
500: unknown;
|
|
6165
|
+
/**
|
|
6166
|
+
* Service unavailable
|
|
6167
|
+
*/
|
|
6168
|
+
503: unknown;
|
|
6132
6169
|
};
|
|
6133
6170
|
export type CopyDataToGraphError = CopyDataToGraphErrors[keyof CopyDataToGraphErrors];
|
|
6134
6171
|
export type CopyDataToGraphResponses = {
|
|
6135
6172
|
/**
|
|
6136
|
-
*
|
|
6173
|
+
* Copy operation accepted and started
|
|
6137
6174
|
*/
|
|
6138
6175
|
200: CopyResponse;
|
|
6176
|
+
/**
|
|
6177
|
+
* Copy operation queued for execution
|
|
6178
|
+
*/
|
|
6179
|
+
202: unknown;
|
|
6139
6180
|
};
|
|
6140
6181
|
export type CopyDataToGraphResponse = CopyDataToGraphResponses[keyof CopyDataToGraphResponses];
|
|
6141
6182
|
export type CreateGraphData = {
|
package/sdk/types.gen.ts
CHANGED
|
@@ -620,7 +620,17 @@ export type CopyResponse = {
|
|
|
620
620
|
* Status
|
|
621
621
|
* Operation status
|
|
622
622
|
*/
|
|
623
|
-
status: 'completed' | 'failed' | 'partial';
|
|
623
|
+
status: 'completed' | 'failed' | 'partial' | 'accepted';
|
|
624
|
+
/**
|
|
625
|
+
* Operation Id
|
|
626
|
+
* Operation ID for SSE monitoring (for long-running operations)
|
|
627
|
+
*/
|
|
628
|
+
operation_id?: string | null;
|
|
629
|
+
/**
|
|
630
|
+
* Sse Url
|
|
631
|
+
* SSE endpoint URL for monitoring operation progress
|
|
632
|
+
*/
|
|
633
|
+
sse_url?: string | null;
|
|
624
634
|
/**
|
|
625
635
|
* Source Type
|
|
626
636
|
* Type of source that was copied from
|
|
@@ -628,9 +638,9 @@ export type CopyResponse = {
|
|
|
628
638
|
source_type: string;
|
|
629
639
|
/**
|
|
630
640
|
* Execution Time Ms
|
|
631
|
-
* Total execution time in milliseconds
|
|
641
|
+
* Total execution time in milliseconds (for synchronous operations)
|
|
632
642
|
*/
|
|
633
|
-
execution_time_ms
|
|
643
|
+
execution_time_ms?: number | null;
|
|
634
644
|
/**
|
|
635
645
|
* Message
|
|
636
646
|
* Human-readable status message
|
|
@@ -1996,6 +2006,9 @@ export type ResponseMode = 'auto' | 'sync' | 'async' | 'stream';
|
|
|
1996
2006
|
/**
|
|
1997
2007
|
* S3CopyRequest
|
|
1998
2008
|
* Request model for S3 copy operations.
|
|
2009
|
+
*
|
|
2010
|
+
* Copies data from S3 buckets into graph database tables using user-provided
|
|
2011
|
+
* AWS credentials. Supports various file formats and bulk loading options.
|
|
1999
2012
|
*/
|
|
2000
2013
|
export type S3CopyRequest = {
|
|
2001
2014
|
/**
|
|
@@ -6601,19 +6614,47 @@ export type CopyDataToGraphData = {
|
|
|
6601
6614
|
};
|
|
6602
6615
|
|
|
6603
6616
|
export type CopyDataToGraphErrors = {
|
|
6617
|
+
/**
|
|
6618
|
+
* Invalid request parameters
|
|
6619
|
+
*/
|
|
6620
|
+
400: unknown;
|
|
6621
|
+
/**
|
|
6622
|
+
* Access denied or shared repository
|
|
6623
|
+
*/
|
|
6624
|
+
403: unknown;
|
|
6625
|
+
/**
|
|
6626
|
+
* Operation timeout
|
|
6627
|
+
*/
|
|
6628
|
+
408: unknown;
|
|
6604
6629
|
/**
|
|
6605
6630
|
* Validation Error
|
|
6606
6631
|
*/
|
|
6607
6632
|
422: HttpValidationError;
|
|
6633
|
+
/**
|
|
6634
|
+
* Rate limit exceeded
|
|
6635
|
+
*/
|
|
6636
|
+
429: unknown;
|
|
6637
|
+
/**
|
|
6638
|
+
* Internal error
|
|
6639
|
+
*/
|
|
6640
|
+
500: unknown;
|
|
6641
|
+
/**
|
|
6642
|
+
* Service unavailable
|
|
6643
|
+
*/
|
|
6644
|
+
503: unknown;
|
|
6608
6645
|
};
|
|
6609
6646
|
|
|
6610
6647
|
export type CopyDataToGraphError = CopyDataToGraphErrors[keyof CopyDataToGraphErrors];
|
|
6611
6648
|
|
|
6612
6649
|
export type CopyDataToGraphResponses = {
|
|
6613
6650
|
/**
|
|
6614
|
-
*
|
|
6651
|
+
* Copy operation accepted and started
|
|
6615
6652
|
*/
|
|
6616
6653
|
200: CopyResponse;
|
|
6654
|
+
/**
|
|
6655
|
+
* Copy operation queued for execution
|
|
6656
|
+
*/
|
|
6657
|
+
202: unknown;
|
|
6617
6658
|
};
|
|
6618
6659
|
|
|
6619
6660
|
export type CopyDataToGraphResponse = CopyDataToGraphResponses[keyof CopyDataToGraphResponses];
|