@robosystems/client 0.1.10 → 0.1.12
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/client/client.gen.d.ts +2 -0
- package/client/client.gen.js +153 -0
- package/client/index.d.ts +7 -0
- package/client/index.js +15 -0
- package/client/types.gen.d.ts +122 -0
- package/client/types.gen.js +4 -0
- package/client/utils.gen.d.ts +45 -0
- package/client/utils.gen.js +296 -0
- package/client.gen.d.ts +12 -0
- package/client.gen.js +8 -0
- package/core/auth.gen.d.ts +18 -0
- package/core/auth.gen.js +18 -0
- package/core/bodySerializer.gen.d.ts +17 -0
- package/core/bodySerializer.gen.js +57 -0
- package/core/params.gen.d.ts +33 -0
- package/core/params.gen.js +92 -0
- package/core/pathSerializer.gen.d.ts +33 -0
- package/core/pathSerializer.gen.js +123 -0
- package/core/types.gen.d.ts +78 -0
- package/core/types.gen.js +4 -0
- package/extensions/OperationClient.d.js +45 -0
- package/extensions/OperationClient.d.ts +64 -0
- package/extensions/OperationClient.js +297 -0
- package/extensions/OperationClient.ts +322 -0
- package/extensions/QueryClient.d.js +22 -0
- package/extensions/QueryClient.d.ts +50 -0
- package/extensions/QueryClient.js +245 -0
- package/extensions/QueryClient.ts +283 -0
- package/extensions/SSEClient.d.js +35 -0
- package/extensions/SSEClient.d.ts +48 -0
- package/extensions/SSEClient.js +166 -0
- package/extensions/SSEClient.ts +189 -0
- package/extensions/config.d.js +25 -0
- package/extensions/config.d.ts +32 -0
- package/extensions/config.js +66 -0
- package/extensions/config.ts +91 -0
- package/extensions/hooks.d.js +80 -0
- package/extensions/hooks.d.ts +110 -0
- package/extensions/hooks.js +435 -0
- package/extensions/hooks.ts +438 -0
- package/extensions/index.d.js +35 -0
- package/extensions/index.d.ts +46 -0
- package/extensions/index.js +118 -0
- package/extensions/index.ts +123 -0
- package/package.json +3 -2
- package/prepare.js +10 -0
- package/sdk.gen.d.ts +1145 -0
- package/sdk.gen.js +2436 -0
- package/types.gen.d.ts +5712 -0
- package/types.gen.js +3 -0
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RoboSystems SDK Extensions
|
|
3
|
+
* Enhanced clients with SSE support for the RoboSystems API
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { client } from '../client.gen'
|
|
7
|
+
import { OperationClient } from './OperationClient'
|
|
8
|
+
import { QueryClient } from './QueryClient'
|
|
9
|
+
import { SSEClient } from './SSEClient'
|
|
10
|
+
|
|
11
|
+
export interface RoboSystemsExtensionConfig {
|
|
12
|
+
baseUrl?: string
|
|
13
|
+
credentials?: 'include' | 'same-origin' | 'omit'
|
|
14
|
+
maxRetries?: number
|
|
15
|
+
retryDelay?: number
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export class RoboSystemsExtensions {
|
|
19
|
+
public readonly query: QueryClient
|
|
20
|
+
public readonly operations: OperationClient
|
|
21
|
+
private config: Required<RoboSystemsExtensionConfig>
|
|
22
|
+
|
|
23
|
+
constructor(config: RoboSystemsExtensionConfig = {}) {
|
|
24
|
+
// Get base URL from SDK client config or use provided/default
|
|
25
|
+
const sdkConfig = client.getConfig()
|
|
26
|
+
|
|
27
|
+
this.config = {
|
|
28
|
+
baseUrl: config.baseUrl || sdkConfig.baseUrl || 'http://localhost:8000',
|
|
29
|
+
credentials: config.credentials || 'include',
|
|
30
|
+
maxRetries: config.maxRetries || 5,
|
|
31
|
+
retryDelay: config.retryDelay || 1000,
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
this.query = new QueryClient({
|
|
35
|
+
baseUrl: this.config.baseUrl,
|
|
36
|
+
credentials: this.config.credentials,
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
this.operations = new OperationClient({
|
|
40
|
+
baseUrl: this.config.baseUrl,
|
|
41
|
+
credentials: this.config.credentials,
|
|
42
|
+
})
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Convenience method to monitor any operation
|
|
47
|
+
*/
|
|
48
|
+
async monitorOperation(operationId: string, onProgress?: (progress: any) => void): Promise<any> {
|
|
49
|
+
return this.operations.monitorOperation(operationId, { onProgress })
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Create custom SSE client for advanced use cases
|
|
54
|
+
*/
|
|
55
|
+
createSSEClient(): SSEClient {
|
|
56
|
+
return new SSEClient({
|
|
57
|
+
baseUrl: this.config.baseUrl,
|
|
58
|
+
credentials: this.config.credentials,
|
|
59
|
+
maxRetries: this.config.maxRetries,
|
|
60
|
+
retryDelay: this.config.retryDelay,
|
|
61
|
+
})
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Clean up all active connections
|
|
66
|
+
*/
|
|
67
|
+
close(): void {
|
|
68
|
+
this.query.close()
|
|
69
|
+
this.operations.closeAll()
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Export all types and classes
|
|
74
|
+
export * from './OperationClient'
|
|
75
|
+
export * from './QueryClient'
|
|
76
|
+
export * from './SSEClient'
|
|
77
|
+
export { OperationClient, QueryClient, SSEClient }
|
|
78
|
+
|
|
79
|
+
// Export React hooks
|
|
80
|
+
export {
|
|
81
|
+
useMultipleOperations,
|
|
82
|
+
useOperation,
|
|
83
|
+
useQuery,
|
|
84
|
+
useSDKClients,
|
|
85
|
+
useStreamingQuery,
|
|
86
|
+
} from './hooks'
|
|
87
|
+
|
|
88
|
+
// Lazy initialization of default instance
|
|
89
|
+
let _extensions: RoboSystemsExtensions | null = null
|
|
90
|
+
|
|
91
|
+
function getExtensions(): RoboSystemsExtensions {
|
|
92
|
+
if (!_extensions) {
|
|
93
|
+
_extensions = new RoboSystemsExtensions()
|
|
94
|
+
}
|
|
95
|
+
return _extensions
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export const extensions = {
|
|
99
|
+
get query() {
|
|
100
|
+
return getExtensions().query
|
|
101
|
+
},
|
|
102
|
+
get operations() {
|
|
103
|
+
return getExtensions().operations
|
|
104
|
+
},
|
|
105
|
+
monitorOperation: (operationId: string, onProgress?: (progress: any) => void) =>
|
|
106
|
+
getExtensions().monitorOperation(operationId, onProgress),
|
|
107
|
+
createSSEClient: () => getExtensions().createSSEClient(),
|
|
108
|
+
close: () => getExtensions().close(),
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Export convenience functions that use the default instance
|
|
112
|
+
export const monitorOperation = (operationId: string, onProgress?: (progress: any) => void) =>
|
|
113
|
+
getExtensions().monitorOperation(operationId, onProgress)
|
|
114
|
+
|
|
115
|
+
export const executeQuery = (graphId: string, query: string, parameters?: Record<string, any>) =>
|
|
116
|
+
getExtensions().query.query(graphId, query, parameters)
|
|
117
|
+
|
|
118
|
+
export const streamQuery = (
|
|
119
|
+
graphId: string,
|
|
120
|
+
query: string,
|
|
121
|
+
parameters?: Record<string, any>,
|
|
122
|
+
chunkSize?: number
|
|
123
|
+
) => getExtensions().query.streamQuery(graphId, query, parameters, chunkSize)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@robosystems/client",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.12",
|
|
4
4
|
"description": "TypeScript client library for RoboSystems Financial Knowledge Graph API",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"*.d.ts",
|
|
11
11
|
"client/**/*",
|
|
12
12
|
"core/**/*",
|
|
13
|
+
"extensions/**/*",
|
|
13
14
|
"src/**/*",
|
|
14
15
|
"README.md",
|
|
15
16
|
"LICENSE"
|
|
@@ -51,13 +52,13 @@
|
|
|
51
52
|
"url": "https://github.com/RoboFinSystems/robosystems-typescript-client/issues"
|
|
52
53
|
},
|
|
53
54
|
"homepage": "https://github.com/RoboFinSystems/robosystems-typescript-client#readme",
|
|
54
|
-
"dependencies": {},
|
|
55
55
|
"engines": {
|
|
56
56
|
"node": ">=18.0.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@hey-api/openapi-ts": "^0.80.2",
|
|
60
60
|
"@types/node": "^22.0.0",
|
|
61
|
+
"@types/react": "^19.1.9",
|
|
61
62
|
"@typescript-eslint/eslint-plugin": "^7.0.0",
|
|
62
63
|
"@typescript-eslint/parser": "^7.0.0",
|
|
63
64
|
"eslint": "^8.0.0",
|
package/prepare.js
CHANGED
|
@@ -11,6 +11,16 @@ const { execSync } = require('child_process')
|
|
|
11
11
|
|
|
12
12
|
console.log('🚀 Preparing RoboSystems SDK for publishing...')
|
|
13
13
|
|
|
14
|
+
// First, build the TypeScript
|
|
15
|
+
console.log('🔨 Building TypeScript...')
|
|
16
|
+
try {
|
|
17
|
+
execSync('npm run build', { stdio: 'inherit' })
|
|
18
|
+
console.log('✅ TypeScript build complete')
|
|
19
|
+
} catch (error) {
|
|
20
|
+
console.error('❌ TypeScript build failed:', error.message)
|
|
21
|
+
process.exit(1)
|
|
22
|
+
}
|
|
23
|
+
|
|
14
24
|
const sdkSourceDir = path.join(__dirname, 'sdk')
|
|
15
25
|
const currentDir = __dirname
|
|
16
26
|
|