@robosystems/client 0.2.0 → 0.2.1
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/GraphClient.d.ts +58 -0
- package/extensions/GraphClient.js +163 -0
- package/extensions/GraphClient.test.ts +285 -0
- package/extensions/GraphClient.ts +267 -0
- package/extensions/hooks.d.ts +1 -1
- package/extensions/index.d.ts +5 -1
- package/extensions/index.js +14 -1
- package/extensions/index.test.ts +22 -0
- package/extensions/index.ts +15 -1
- package/package.json +1 -1
- package/sdk-extensions/GraphClient.d.ts +58 -0
- package/sdk-extensions/GraphClient.js +163 -0
- package/sdk-extensions/GraphClient.test.ts +285 -0
- package/sdk-extensions/GraphClient.ts +267 -0
- package/sdk-extensions/hooks.d.ts +1 -1
- package/sdk-extensions/index.d.ts +5 -1
- package/sdk-extensions/index.js +14 -1
- package/sdk-extensions/index.test.ts +22 -0
- package/sdk-extensions/index.ts +15 -1
|
@@ -63,7 +63,7 @@ export declare function useStreamingQuery(graphId: string): {
|
|
|
63
63
|
export declare function useOperation<T = any>(operationId?: string): {
|
|
64
64
|
monitor: (id: string, timeout?: number) => Promise<OperationResult<T> | null>;
|
|
65
65
|
cancel: (id: string) => Promise<void>;
|
|
66
|
-
status: "error" | "
|
|
66
|
+
status: "error" | "completed" | "idle" | "running";
|
|
67
67
|
progress: OperationProgress;
|
|
68
68
|
error: Error;
|
|
69
69
|
result: OperationResult<T>;
|
|
@@ -6,6 +6,7 @@ import { OperationClient } from './OperationClient';
|
|
|
6
6
|
import { QueryClient } from './QueryClient';
|
|
7
7
|
import { SSEClient } from './SSEClient';
|
|
8
8
|
import { TableIngestClient } from './TableIngestClient';
|
|
9
|
+
import { GraphClient } from './GraphClient';
|
|
9
10
|
export interface RoboSystemsExtensionConfig {
|
|
10
11
|
baseUrl?: string;
|
|
11
12
|
credentials?: 'include' | 'same-origin' | 'omit';
|
|
@@ -18,6 +19,7 @@ export declare class RoboSystemsExtensions {
|
|
|
18
19
|
readonly query: QueryClient;
|
|
19
20
|
readonly operations: OperationClient;
|
|
20
21
|
readonly tables: TableIngestClient;
|
|
22
|
+
readonly graphs: GraphClient;
|
|
21
23
|
private config;
|
|
22
24
|
constructor(config?: RoboSystemsExtensionConfig);
|
|
23
25
|
/**
|
|
@@ -37,11 +39,13 @@ export * from './OperationClient';
|
|
|
37
39
|
export * from './QueryClient';
|
|
38
40
|
export * from './SSEClient';
|
|
39
41
|
export * from './TableIngestClient';
|
|
40
|
-
export
|
|
42
|
+
export * from './GraphClient';
|
|
43
|
+
export { OperationClient, QueryClient, SSEClient, TableIngestClient, GraphClient };
|
|
41
44
|
export { useMultipleOperations, useOperation, useQuery, useSDKClients, useStreamingQuery, useTableUpload, } from './hooks';
|
|
42
45
|
export declare const extensions: {
|
|
43
46
|
readonly query: QueryClient;
|
|
44
47
|
readonly operations: OperationClient;
|
|
48
|
+
readonly graphs: GraphClient;
|
|
45
49
|
monitorOperation: (operationId: string, onProgress?: (progress: any) => void) => Promise<any>;
|
|
46
50
|
createSSEClient: () => SSEClient;
|
|
47
51
|
close: () => void;
|
package/sdk-extensions/index.js
CHANGED
|
@@ -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.streamQuery = exports.executeQuery = exports.monitorOperation = exports.extensions = exports.useTableUpload = exports.useStreamingQuery = exports.useSDKClients = exports.useQuery = exports.useOperation = exports.useMultipleOperations = exports.TableIngestClient = exports.SSEClient = exports.QueryClient = exports.OperationClient = exports.RoboSystemsExtensions = void 0;
|
|
21
|
+
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.QueryClient = exports.OperationClient = 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,6 +29,8 @@ const SSEClient_1 = require("./SSEClient");
|
|
|
29
29
|
Object.defineProperty(exports, "SSEClient", { enumerable: true, get: function () { return SSEClient_1.SSEClient; } });
|
|
30
30
|
const TableIngestClient_1 = require("./TableIngestClient");
|
|
31
31
|
Object.defineProperty(exports, "TableIngestClient", { enumerable: true, get: function () { return TableIngestClient_1.TableIngestClient; } });
|
|
32
|
+
const GraphClient_1 = require("./GraphClient");
|
|
33
|
+
Object.defineProperty(exports, "GraphClient", { enumerable: true, get: function () { return GraphClient_1.GraphClient; } });
|
|
32
34
|
class RoboSystemsExtensions {
|
|
33
35
|
constructor(config = {}) {
|
|
34
36
|
// Get base URL from SDK client config or use provided/default
|
|
@@ -62,6 +64,12 @@ class RoboSystemsExtensions {
|
|
|
62
64
|
token: this.config.token,
|
|
63
65
|
headers: this.config.headers,
|
|
64
66
|
});
|
|
67
|
+
this.graphs = new GraphClient_1.GraphClient({
|
|
68
|
+
baseUrl: this.config.baseUrl,
|
|
69
|
+
credentials: this.config.credentials,
|
|
70
|
+
token: this.config.token,
|
|
71
|
+
headers: this.config.headers,
|
|
72
|
+
});
|
|
65
73
|
}
|
|
66
74
|
/**
|
|
67
75
|
* Convenience method to monitor any operation
|
|
@@ -88,6 +96,7 @@ class RoboSystemsExtensions {
|
|
|
88
96
|
close() {
|
|
89
97
|
this.query.close();
|
|
90
98
|
this.operations.closeAll();
|
|
99
|
+
this.graphs.close();
|
|
91
100
|
}
|
|
92
101
|
}
|
|
93
102
|
exports.RoboSystemsExtensions = RoboSystemsExtensions;
|
|
@@ -96,6 +105,7 @@ __exportStar(require("./OperationClient"), exports);
|
|
|
96
105
|
__exportStar(require("./QueryClient"), exports);
|
|
97
106
|
__exportStar(require("./SSEClient"), exports);
|
|
98
107
|
__exportStar(require("./TableIngestClient"), exports);
|
|
108
|
+
__exportStar(require("./GraphClient"), exports);
|
|
99
109
|
// Export React hooks
|
|
100
110
|
var hooks_1 = require("./hooks");
|
|
101
111
|
Object.defineProperty(exports, "useMultipleOperations", { enumerable: true, get: function () { return hooks_1.useMultipleOperations; } });
|
|
@@ -119,6 +129,9 @@ exports.extensions = {
|
|
|
119
129
|
get operations() {
|
|
120
130
|
return getExtensions().operations;
|
|
121
131
|
},
|
|
132
|
+
get graphs() {
|
|
133
|
+
return getExtensions().graphs;
|
|
134
|
+
},
|
|
122
135
|
monitorOperation: (operationId, onProgress) => getExtensions().monitorOperation(operationId, onProgress),
|
|
123
136
|
createSSEClient: () => getExtensions().createSSEClient(),
|
|
124
137
|
close: () => getExtensions().close(),
|
|
@@ -24,10 +24,12 @@ describe('RoboSystemsExtensions', () => {
|
|
|
24
24
|
expect(extensions.query).toBeDefined()
|
|
25
25
|
expect(extensions.operations).toBeDefined()
|
|
26
26
|
expect(extensions.tables).toBeDefined()
|
|
27
|
+
expect(extensions.graphs).toBeDefined()
|
|
27
28
|
// Verify clients have expected methods
|
|
28
29
|
expect(typeof extensions.query.executeQuery).toBe('function')
|
|
29
30
|
expect(typeof extensions.operations.monitorOperation).toBe('function')
|
|
30
31
|
expect(typeof extensions.tables.uploadParquetFile).toBe('function')
|
|
32
|
+
expect(typeof extensions.graphs.createGraphAndWait).toBe('function')
|
|
31
33
|
})
|
|
32
34
|
|
|
33
35
|
it('should create instance with custom baseUrl', () => {
|
|
@@ -38,6 +40,7 @@ describe('RoboSystemsExtensions', () => {
|
|
|
38
40
|
expect(extensions.query).toBeDefined()
|
|
39
41
|
expect(extensions.operations).toBeDefined()
|
|
40
42
|
expect(extensions.tables).toBeDefined()
|
|
43
|
+
expect(extensions.graphs).toBeDefined()
|
|
41
44
|
})
|
|
42
45
|
|
|
43
46
|
it('should create instance with JWT token', () => {
|
|
@@ -88,6 +91,7 @@ describe('RoboSystemsExtensions', () => {
|
|
|
88
91
|
expect(extensions.query).toBeDefined()
|
|
89
92
|
expect(extensions.operations).toBeDefined()
|
|
90
93
|
expect(extensions.tables).toBeDefined()
|
|
94
|
+
expect(extensions.graphs).toBeDefined()
|
|
91
95
|
})
|
|
92
96
|
})
|
|
93
97
|
|
|
@@ -152,11 +156,13 @@ describe('RoboSystemsExtensions', () => {
|
|
|
152
156
|
|
|
153
157
|
const queryCloseSpy = vi.spyOn(extensions.query, 'close')
|
|
154
158
|
const operationsCloseSpy = vi.spyOn(extensions.operations, 'closeAll')
|
|
159
|
+
const graphsCloseSpy = vi.spyOn(extensions.graphs, 'close')
|
|
155
160
|
|
|
156
161
|
extensions.close()
|
|
157
162
|
|
|
158
163
|
expect(queryCloseSpy).toHaveBeenCalled()
|
|
159
164
|
expect(operationsCloseSpy).toHaveBeenCalled()
|
|
165
|
+
expect(graphsCloseSpy).toHaveBeenCalled()
|
|
160
166
|
})
|
|
161
167
|
|
|
162
168
|
it('should not throw when called multiple times', () => {
|
|
@@ -188,9 +194,11 @@ describe('RoboSystemsExtensions', () => {
|
|
|
188
194
|
expect(extensions.query).toBeDefined()
|
|
189
195
|
expect(extensions.operations).toBeDefined()
|
|
190
196
|
expect(extensions.tables).toBeDefined()
|
|
197
|
+
expect(extensions.graphs).toBeDefined()
|
|
191
198
|
expect(typeof extensions.query.executeQuery).toBe('function')
|
|
192
199
|
expect(typeof extensions.operations.monitorOperation).toBe('function')
|
|
193
200
|
expect(typeof extensions.tables.uploadParquetFile).toBe('function')
|
|
201
|
+
expect(typeof extensions.graphs.createGraphAndWait).toBe('function')
|
|
194
202
|
})
|
|
195
203
|
|
|
196
204
|
it('should use SDK client baseUrl when no baseUrl provided', () => {
|
|
@@ -200,6 +208,20 @@ describe('RoboSystemsExtensions', () => {
|
|
|
200
208
|
expect(extensions.query).toBeDefined()
|
|
201
209
|
expect(extensions.operations).toBeDefined()
|
|
202
210
|
expect(extensions.tables).toBeDefined()
|
|
211
|
+
expect(extensions.graphs).toBeDefined()
|
|
212
|
+
})
|
|
213
|
+
})
|
|
214
|
+
|
|
215
|
+
describe('graphs client', () => {
|
|
216
|
+
it('should have graphs client with all methods', () => {
|
|
217
|
+
const extensions = new RoboSystemsExtensions()
|
|
218
|
+
|
|
219
|
+
expect(extensions.graphs).toBeDefined()
|
|
220
|
+
expect(typeof extensions.graphs.createGraphAndWait).toBe('function')
|
|
221
|
+
expect(typeof extensions.graphs.getGraphInfo).toBe('function')
|
|
222
|
+
expect(typeof extensions.graphs.listGraphs).toBe('function')
|
|
223
|
+
expect(typeof extensions.graphs.deleteGraph).toBe('function')
|
|
224
|
+
expect(typeof extensions.graphs.close).toBe('function')
|
|
203
225
|
})
|
|
204
226
|
})
|
|
205
227
|
})
|
package/sdk-extensions/index.ts
CHANGED
|
@@ -9,6 +9,7 @@ import { OperationClient } from './OperationClient'
|
|
|
9
9
|
import { QueryClient } from './QueryClient'
|
|
10
10
|
import { SSEClient } from './SSEClient'
|
|
11
11
|
import { TableIngestClient } from './TableIngestClient'
|
|
12
|
+
import { GraphClient } from './GraphClient'
|
|
12
13
|
|
|
13
14
|
export interface RoboSystemsExtensionConfig {
|
|
14
15
|
baseUrl?: string
|
|
@@ -33,6 +34,7 @@ export class RoboSystemsExtensions {
|
|
|
33
34
|
public readonly query: QueryClient
|
|
34
35
|
public readonly operations: OperationClient
|
|
35
36
|
public readonly tables: TableIngestClient
|
|
37
|
+
public readonly graphs: GraphClient
|
|
36
38
|
private config: ResolvedConfig
|
|
37
39
|
|
|
38
40
|
constructor(config: RoboSystemsExtensionConfig = {}) {
|
|
@@ -72,6 +74,13 @@ export class RoboSystemsExtensions {
|
|
|
72
74
|
token: this.config.token,
|
|
73
75
|
headers: this.config.headers,
|
|
74
76
|
})
|
|
77
|
+
|
|
78
|
+
this.graphs = new GraphClient({
|
|
79
|
+
baseUrl: this.config.baseUrl,
|
|
80
|
+
credentials: this.config.credentials,
|
|
81
|
+
token: this.config.token,
|
|
82
|
+
headers: this.config.headers,
|
|
83
|
+
})
|
|
75
84
|
}
|
|
76
85
|
|
|
77
86
|
/**
|
|
@@ -101,6 +110,7 @@ export class RoboSystemsExtensions {
|
|
|
101
110
|
close(): void {
|
|
102
111
|
this.query.close()
|
|
103
112
|
this.operations.closeAll()
|
|
113
|
+
this.graphs.close()
|
|
104
114
|
}
|
|
105
115
|
}
|
|
106
116
|
|
|
@@ -109,7 +119,8 @@ export * from './OperationClient'
|
|
|
109
119
|
export * from './QueryClient'
|
|
110
120
|
export * from './SSEClient'
|
|
111
121
|
export * from './TableIngestClient'
|
|
112
|
-
export
|
|
122
|
+
export * from './GraphClient'
|
|
123
|
+
export { OperationClient, QueryClient, SSEClient, TableIngestClient, GraphClient }
|
|
113
124
|
|
|
114
125
|
// Export React hooks
|
|
115
126
|
export {
|
|
@@ -138,6 +149,9 @@ export const extensions = {
|
|
|
138
149
|
get operations() {
|
|
139
150
|
return getExtensions().operations
|
|
140
151
|
},
|
|
152
|
+
get graphs() {
|
|
153
|
+
return getExtensions().graphs
|
|
154
|
+
},
|
|
141
155
|
monitorOperation: (operationId: string, onProgress?: (progress: any) => void) =>
|
|
142
156
|
getExtensions().monitorOperation(operationId, onProgress),
|
|
143
157
|
createSSEClient: () => getExtensions().createSSEClient(),
|