@robosystems/client 0.2.43 → 0.2.44
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/LedgerClient.d.ts +88 -0
- package/extensions/LedgerClient.js +143 -0
- package/extensions/LedgerClient.ts +267 -0
- package/extensions/ReportClient.d.ts +14 -6
- package/extensions/ReportClient.js +19 -15
- package/extensions/ReportClient.ts +37 -21
- package/extensions/hooks.d.ts +1 -40
- package/extensions/hooks.js +0 -134
- package/extensions/hooks.ts +0 -156
- package/extensions/index.d.ts +2 -24
- package/extensions/index.js +1 -65
- package/extensions/index.test.ts +4 -38
- package/extensions/index.ts +0 -78
- package/index.ts +2 -2
- package/package.json +1 -1
- package/sdk/index.d.ts +2 -2
- package/sdk/index.js +9 -4
- package/sdk/index.ts +2 -2
- package/sdk/sdk.gen.d.ts +31 -1
- package/sdk/sdk.gen.js +65 -2
- package/sdk/sdk.gen.ts +64 -1
- package/sdk/types.gen.d.ts +601 -87
- package/sdk/types.gen.ts +640 -88
- package/sdk-extensions/LedgerClient.d.ts +88 -0
- package/sdk-extensions/LedgerClient.js +143 -0
- package/sdk-extensions/LedgerClient.ts +267 -0
- package/sdk-extensions/ReportClient.d.ts +14 -6
- package/sdk-extensions/ReportClient.js +19 -15
- package/sdk-extensions/ReportClient.ts +37 -21
- package/sdk-extensions/hooks.d.ts +1 -40
- package/sdk-extensions/hooks.js +0 -134
- package/sdk-extensions/hooks.ts +0 -156
- package/sdk-extensions/index.d.ts +2 -24
- package/sdk-extensions/index.js +1 -65
- package/sdk-extensions/index.test.ts +4 -38
- package/sdk-extensions/index.ts +0 -78
- package/sdk.gen.d.ts +31 -1
- package/sdk.gen.js +65 -2
- package/sdk.gen.ts +64 -1
- package/types.gen.d.ts +601 -87
- package/types.gen.ts +640 -88
- package/extensions/DocumentClient.d.ts +0 -102
- package/extensions/DocumentClient.js +0 -176
- package/extensions/DocumentClient.ts +0 -297
- package/extensions/FileClient.d.ts +0 -57
- package/extensions/FileClient.js +0 -246
- package/extensions/FileClient.ts +0 -330
- package/extensions/GraphClient.d.ts +0 -91
- package/extensions/GraphClient.js +0 -244
- package/extensions/GraphClient.test.ts +0 -455
- package/extensions/GraphClient.ts +0 -371
- package/extensions/MaterializationClient.d.ts +0 -61
- package/extensions/MaterializationClient.js +0 -157
- package/extensions/MaterializationClient.ts +0 -223
- package/extensions/TableClient.d.ts +0 -38
- package/extensions/TableClient.js +0 -92
- package/extensions/TableClient.ts +0 -132
- package/sdk-extensions/DocumentClient.d.ts +0 -102
- package/sdk-extensions/DocumentClient.js +0 -176
- package/sdk-extensions/DocumentClient.ts +0 -297
- package/sdk-extensions/FileClient.d.ts +0 -57
- package/sdk-extensions/FileClient.js +0 -246
- package/sdk-extensions/FileClient.ts +0 -330
- package/sdk-extensions/GraphClient.d.ts +0 -91
- package/sdk-extensions/GraphClient.js +0 -244
- package/sdk-extensions/GraphClient.test.ts +0 -455
- package/sdk-extensions/GraphClient.ts +0 -371
- package/sdk-extensions/MaterializationClient.d.ts +0 -61
- package/sdk-extensions/MaterializationClient.js +0 -157
- package/sdk-extensions/MaterializationClient.ts +0 -223
- package/sdk-extensions/TableClient.d.ts +0 -38
- package/sdk-extensions/TableClient.js +0 -92
- package/sdk-extensions/TableClient.ts +0 -132
|
@@ -68,13 +68,18 @@ export interface Report {
|
|
|
68
68
|
import type { Structure } from './LedgerClient'
|
|
69
69
|
export type { Structure } from './LedgerClient'
|
|
70
70
|
|
|
71
|
+
export interface StatementPeriod {
|
|
72
|
+
start: string
|
|
73
|
+
end: string
|
|
74
|
+
label: string
|
|
75
|
+
}
|
|
76
|
+
|
|
71
77
|
export interface StatementRow {
|
|
72
78
|
elementId: string
|
|
73
79
|
elementQname: string
|
|
74
80
|
elementName: string
|
|
75
81
|
classification: string
|
|
76
|
-
|
|
77
|
-
priorValue: number | null
|
|
82
|
+
values: (number | null)[]
|
|
78
83
|
isSubtotal: boolean
|
|
79
84
|
depth: number
|
|
80
85
|
}
|
|
@@ -84,10 +89,7 @@ export interface StatementData {
|
|
|
84
89
|
structureId: string
|
|
85
90
|
structureName: string
|
|
86
91
|
structureType: string
|
|
87
|
-
|
|
88
|
-
periodEnd: string
|
|
89
|
-
comparativePeriodStart: string | null
|
|
90
|
-
comparativePeriodEnd: string | null
|
|
92
|
+
periods: StatementPeriod[]
|
|
91
93
|
rows: StatementRow[]
|
|
92
94
|
validation: {
|
|
93
95
|
passed: boolean
|
|
@@ -131,6 +133,12 @@ export interface PublishListMember {
|
|
|
131
133
|
addedAt: string
|
|
132
134
|
}
|
|
133
135
|
|
|
136
|
+
export interface PeriodSpecInput {
|
|
137
|
+
start: string
|
|
138
|
+
end: string
|
|
139
|
+
label: string
|
|
140
|
+
}
|
|
141
|
+
|
|
134
142
|
export interface CreateReportOptions {
|
|
135
143
|
name: string
|
|
136
144
|
mappingId: string
|
|
@@ -139,6 +147,8 @@ export interface CreateReportOptions {
|
|
|
139
147
|
taxonomyId?: string
|
|
140
148
|
periodType?: string
|
|
141
149
|
comparative?: boolean
|
|
150
|
+
/** When set, overrides periodStart/periodEnd/comparative with N explicit periods. */
|
|
151
|
+
periods?: PeriodSpecInput[]
|
|
142
152
|
}
|
|
143
153
|
|
|
144
154
|
// ── Client ──────────────────────────────────────────────────────────────
|
|
@@ -164,17 +174,23 @@ export class ReportClient {
|
|
|
164
174
|
* Create a report — generates facts for all structures in the taxonomy.
|
|
165
175
|
*/
|
|
166
176
|
async create(graphId: string, options: CreateReportOptions): Promise<Report> {
|
|
177
|
+
const body: CreateReportRequest = {
|
|
178
|
+
name: options.name,
|
|
179
|
+
mapping_id: options.mappingId,
|
|
180
|
+
period_start: options.periodStart,
|
|
181
|
+
period_end: options.periodEnd,
|
|
182
|
+
taxonomy_id: options.taxonomyId ?? 'tax_usgaap_reporting',
|
|
183
|
+
period_type: options.periodType ?? 'quarterly',
|
|
184
|
+
comparative: options.comparative ?? true,
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
if (options.periods && options.periods.length > 0) {
|
|
188
|
+
body.periods = options.periods
|
|
189
|
+
}
|
|
190
|
+
|
|
167
191
|
const response = await createReport({
|
|
168
192
|
path: { graph_id: graphId },
|
|
169
|
-
body
|
|
170
|
-
name: options.name,
|
|
171
|
-
mapping_id: options.mappingId,
|
|
172
|
-
period_start: options.periodStart,
|
|
173
|
-
period_end: options.periodEnd,
|
|
174
|
-
taxonomy_id: options.taxonomyId ?? 'tax_usgaap_reporting',
|
|
175
|
-
period_type: options.periodType ?? 'quarterly',
|
|
176
|
-
comparative: options.comparative ?? true,
|
|
177
|
-
} as CreateReportRequest,
|
|
193
|
+
body,
|
|
178
194
|
})
|
|
179
195
|
|
|
180
196
|
if (response.error) {
|
|
@@ -239,17 +255,17 @@ export class ReportClient {
|
|
|
239
255
|
structureId: data.structure_id,
|
|
240
256
|
structureName: data.structure_name,
|
|
241
257
|
structureType: data.structure_type,
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
258
|
+
periods: (data.periods ?? []).map((p) => ({
|
|
259
|
+
start: p.start,
|
|
260
|
+
end: p.end,
|
|
261
|
+
label: p.label,
|
|
262
|
+
})),
|
|
246
263
|
rows: (data.rows ?? []).map((r: FactRowResponse) => ({
|
|
247
264
|
elementId: r.element_id,
|
|
248
265
|
elementQname: r.element_qname,
|
|
249
266
|
elementName: r.element_name,
|
|
250
267
|
classification: r.classification,
|
|
251
|
-
|
|
252
|
-
priorValue: r.prior_value ?? null,
|
|
268
|
+
values: r.values ?? [],
|
|
253
269
|
isSubtotal: r.is_subtotal ?? false,
|
|
254
270
|
depth: r.depth ?? 0,
|
|
255
271
|
})),
|
package/extensions/hooks.d.ts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import type { FileInput, FileUploadOptions, FileUploadResult } from './FileClient';
|
|
2
|
-
import type { MaterializationOptions } from './MaterializationClient';
|
|
3
1
|
import type { OperationProgress, OperationResult } from './OperationClient';
|
|
4
2
|
import { OperationClient } from './OperationClient';
|
|
5
3
|
import type { QueryOptions, QueryResult } from './QueryClient';
|
|
6
4
|
import { QueryClient } from './QueryClient';
|
|
7
|
-
import type { TableInfo } from './TableClient';
|
|
8
5
|
/**
|
|
9
6
|
* Hook for executing Cypher queries with loading states and error handling
|
|
10
7
|
*
|
|
@@ -65,7 +62,7 @@ export declare function useStreamingQuery(graphId: string): {
|
|
|
65
62
|
export declare function useOperation<T = any>(operationId?: string): {
|
|
66
63
|
monitor: (id: string, timeout?: number) => Promise<OperationResult<T> | null>;
|
|
67
64
|
cancel: (id: string) => Promise<void>;
|
|
68
|
-
status: "error" | "
|
|
65
|
+
status: "error" | "idle" | "running" | "completed";
|
|
69
66
|
progress: OperationProgress;
|
|
70
67
|
error: Error;
|
|
71
68
|
result: OperationResult<T>;
|
|
@@ -111,39 +108,3 @@ export declare function useSDKClients(): {
|
|
|
111
108
|
query: QueryClient | null;
|
|
112
109
|
operations: OperationClient | null;
|
|
113
110
|
};
|
|
114
|
-
/**
|
|
115
|
-
* Hook for uploading Parquet files to staging and materializing graphs
|
|
116
|
-
*
|
|
117
|
-
* @example
|
|
118
|
-
* ```tsx
|
|
119
|
-
* const { upload, listTables, materialize, loading, error, progress } = useTableUpload('graph_123')
|
|
120
|
-
*
|
|
121
|
-
* const handleFileUpload = async (file: File) => {
|
|
122
|
-
* const result = await upload('Entity', file, {
|
|
123
|
-
* onProgress: (msg) => console.log(msg),
|
|
124
|
-
* })
|
|
125
|
-
*
|
|
126
|
-
* if (result?.success) {
|
|
127
|
-
* console.log(`Uploaded ${result.rowCount} rows`)
|
|
128
|
-
* }
|
|
129
|
-
* }
|
|
130
|
-
* ```
|
|
131
|
-
*
|
|
132
|
-
* @remarks
|
|
133
|
-
* For local development with LocalStack, configure s3EndpointUrl when initializing RoboSystemsExtensions:
|
|
134
|
-
* ```tsx
|
|
135
|
-
* const extensions = new RoboSystemsExtensions({
|
|
136
|
-
* baseUrl: 'http://localhost:8000',
|
|
137
|
-
* s3EndpointUrl: 'http://localhost:4566', // LocalStack endpoint
|
|
138
|
-
* })
|
|
139
|
-
* ```
|
|
140
|
-
*/
|
|
141
|
-
export declare function useTableUpload(graphId: string): {
|
|
142
|
-
upload: (tableName: string, fileOrBuffer: FileInput, options?: FileUploadOptions) => Promise<FileUploadResult | null>;
|
|
143
|
-
listTables: () => Promise<TableInfo[]>;
|
|
144
|
-
materialize: (options?: MaterializationOptions) => Promise<import("./MaterializationClient").MaterializationResult>;
|
|
145
|
-
loading: boolean;
|
|
146
|
-
error: Error;
|
|
147
|
-
progress: string;
|
|
148
|
-
uploadResult: FileUploadResult;
|
|
149
|
-
};
|
package/extensions/hooks.js
CHANGED
|
@@ -6,7 +6,6 @@ exports.useStreamingQuery = useStreamingQuery;
|
|
|
6
6
|
exports.useOperation = useOperation;
|
|
7
7
|
exports.useMultipleOperations = useMultipleOperations;
|
|
8
8
|
exports.useSDKClients = useSDKClients;
|
|
9
|
-
exports.useTableUpload = useTableUpload;
|
|
10
9
|
/**
|
|
11
10
|
* React hooks for SDK extensions
|
|
12
11
|
* Provides easy-to-use hooks for Next.js/React applications
|
|
@@ -14,11 +13,8 @@ exports.useTableUpload = useTableUpload;
|
|
|
14
13
|
const react_1 = require("react");
|
|
15
14
|
const client_gen_1 = require("../client.gen");
|
|
16
15
|
const config_1 = require("./config");
|
|
17
|
-
const FileClient_1 = require("./FileClient");
|
|
18
|
-
const MaterializationClient_1 = require("./MaterializationClient");
|
|
19
16
|
const OperationClient_1 = require("./OperationClient");
|
|
20
17
|
const QueryClient_1 = require("./QueryClient");
|
|
21
|
-
const TableClient_1 = require("./TableClient");
|
|
22
18
|
/**
|
|
23
19
|
* Hook for executing Cypher queries with loading states and error handling
|
|
24
20
|
*
|
|
@@ -386,133 +382,3 @@ function useSDKClients() {
|
|
|
386
382
|
}, []);
|
|
387
383
|
return clients;
|
|
388
384
|
}
|
|
389
|
-
/**
|
|
390
|
-
* Hook for uploading Parquet files to staging and materializing graphs
|
|
391
|
-
*
|
|
392
|
-
* @example
|
|
393
|
-
* ```tsx
|
|
394
|
-
* const { upload, listTables, materialize, loading, error, progress } = useTableUpload('graph_123')
|
|
395
|
-
*
|
|
396
|
-
* const handleFileUpload = async (file: File) => {
|
|
397
|
-
* const result = await upload('Entity', file, {
|
|
398
|
-
* onProgress: (msg) => console.log(msg),
|
|
399
|
-
* })
|
|
400
|
-
*
|
|
401
|
-
* if (result?.success) {
|
|
402
|
-
* console.log(`Uploaded ${result.rowCount} rows`)
|
|
403
|
-
* }
|
|
404
|
-
* }
|
|
405
|
-
* ```
|
|
406
|
-
*
|
|
407
|
-
* @remarks
|
|
408
|
-
* For local development with LocalStack, configure s3EndpointUrl when initializing RoboSystemsExtensions:
|
|
409
|
-
* ```tsx
|
|
410
|
-
* const extensions = new RoboSystemsExtensions({
|
|
411
|
-
* baseUrl: 'http://localhost:8000',
|
|
412
|
-
* s3EndpointUrl: 'http://localhost:4566', // LocalStack endpoint
|
|
413
|
-
* })
|
|
414
|
-
* ```
|
|
415
|
-
*/
|
|
416
|
-
function useTableUpload(graphId) {
|
|
417
|
-
const [loading, setLoading] = (0, react_1.useState)(false);
|
|
418
|
-
const [error, setError] = (0, react_1.useState)(null);
|
|
419
|
-
const [progress, setProgress] = (0, react_1.useState)(null);
|
|
420
|
-
const [uploadResult, setUploadResult] = (0, react_1.useState)(null);
|
|
421
|
-
const fileClientRef = (0, react_1.useRef)(null);
|
|
422
|
-
const materializationClientRef = (0, react_1.useRef)(null);
|
|
423
|
-
const tableClientRef = (0, react_1.useRef)(null);
|
|
424
|
-
(0, react_1.useEffect)(() => {
|
|
425
|
-
const sdkConfig = (0, config_1.getSDKExtensionsConfig)();
|
|
426
|
-
const clientConfig = client_gen_1.client.getConfig();
|
|
427
|
-
const token = (0, config_1.extractTokenFromSDKClient)();
|
|
428
|
-
const baseConfig = {
|
|
429
|
-
baseUrl: sdkConfig.baseUrl || clientConfig.baseUrl || 'http://localhost:8000',
|
|
430
|
-
credentials: sdkConfig.credentials,
|
|
431
|
-
token,
|
|
432
|
-
headers: sdkConfig.headers,
|
|
433
|
-
};
|
|
434
|
-
fileClientRef.current = new FileClient_1.FileClient(baseConfig);
|
|
435
|
-
materializationClientRef.current = new MaterializationClient_1.MaterializationClient(baseConfig);
|
|
436
|
-
tableClientRef.current = new TableClient_1.TableClient(baseConfig);
|
|
437
|
-
}, []);
|
|
438
|
-
const upload = (0, react_1.useCallback)(async (tableName, fileOrBuffer, options) => {
|
|
439
|
-
if (!fileClientRef.current)
|
|
440
|
-
return null;
|
|
441
|
-
setLoading(true);
|
|
442
|
-
setError(null);
|
|
443
|
-
setUploadResult(null);
|
|
444
|
-
setProgress(null);
|
|
445
|
-
try {
|
|
446
|
-
const result = await fileClientRef.current.upload(graphId, tableName, fileOrBuffer, {
|
|
447
|
-
...options,
|
|
448
|
-
onProgress: (msg) => {
|
|
449
|
-
setProgress(msg);
|
|
450
|
-
options?.onProgress?.(msg);
|
|
451
|
-
},
|
|
452
|
-
});
|
|
453
|
-
setUploadResult(result);
|
|
454
|
-
if (!result.success && result.error) {
|
|
455
|
-
setError(new Error(result.error));
|
|
456
|
-
}
|
|
457
|
-
return result;
|
|
458
|
-
}
|
|
459
|
-
catch (err) {
|
|
460
|
-
const error = err;
|
|
461
|
-
setError(error);
|
|
462
|
-
return null;
|
|
463
|
-
}
|
|
464
|
-
finally {
|
|
465
|
-
setLoading(false);
|
|
466
|
-
setProgress(null);
|
|
467
|
-
}
|
|
468
|
-
}, [graphId]);
|
|
469
|
-
const listTables = (0, react_1.useCallback)(async () => {
|
|
470
|
-
if (!tableClientRef.current)
|
|
471
|
-
return [];
|
|
472
|
-
try {
|
|
473
|
-
return await tableClientRef.current.list(graphId);
|
|
474
|
-
}
|
|
475
|
-
catch (err) {
|
|
476
|
-
setError(err);
|
|
477
|
-
return [];
|
|
478
|
-
}
|
|
479
|
-
}, [graphId]);
|
|
480
|
-
const materialize = (0, react_1.useCallback)(async (options) => {
|
|
481
|
-
if (!materializationClientRef.current)
|
|
482
|
-
return null;
|
|
483
|
-
setLoading(true);
|
|
484
|
-
setError(null);
|
|
485
|
-
setProgress(null);
|
|
486
|
-
try {
|
|
487
|
-
const result = await materializationClientRef.current.materialize(graphId, {
|
|
488
|
-
...options,
|
|
489
|
-
onProgress: (msg) => {
|
|
490
|
-
setProgress(msg);
|
|
491
|
-
options?.onProgress?.(msg);
|
|
492
|
-
},
|
|
493
|
-
});
|
|
494
|
-
if (!result.success && result.error) {
|
|
495
|
-
setError(new Error(result.error));
|
|
496
|
-
}
|
|
497
|
-
return result;
|
|
498
|
-
}
|
|
499
|
-
catch (err) {
|
|
500
|
-
const error = err;
|
|
501
|
-
setError(error);
|
|
502
|
-
return null;
|
|
503
|
-
}
|
|
504
|
-
finally {
|
|
505
|
-
setLoading(false);
|
|
506
|
-
setProgress(null);
|
|
507
|
-
}
|
|
508
|
-
}, [graphId]);
|
|
509
|
-
return {
|
|
510
|
-
upload,
|
|
511
|
-
listTables,
|
|
512
|
-
materialize,
|
|
513
|
-
loading,
|
|
514
|
-
error,
|
|
515
|
-
progress,
|
|
516
|
-
uploadResult,
|
|
517
|
-
};
|
|
518
|
-
}
|
package/extensions/hooks.ts
CHANGED
|
@@ -8,16 +8,10 @@
|
|
|
8
8
|
import { useCallback, useEffect, useRef, useState } from 'react'
|
|
9
9
|
import { client } from '../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'
|
|
15
11
|
import type { OperationProgress, OperationResult } from './OperationClient'
|
|
16
12
|
import { OperationClient } from './OperationClient'
|
|
17
13
|
import type { QueryOptions, QueryResult } from './QueryClient'
|
|
18
14
|
import { QueryClient } from './QueryClient'
|
|
19
|
-
import type { TableInfo } from './TableClient'
|
|
20
|
-
import { TableClient } from './TableClient'
|
|
21
15
|
|
|
22
16
|
/**
|
|
23
17
|
* Hook for executing Cypher queries with loading states and error handling
|
|
@@ -463,153 +457,3 @@ export function useSDKClients() {
|
|
|
463
457
|
|
|
464
458
|
return clients
|
|
465
459
|
}
|
|
466
|
-
|
|
467
|
-
/**
|
|
468
|
-
* Hook for uploading Parquet files to staging and materializing graphs
|
|
469
|
-
*
|
|
470
|
-
* @example
|
|
471
|
-
* ```tsx
|
|
472
|
-
* const { upload, listTables, materialize, loading, error, progress } = useTableUpload('graph_123')
|
|
473
|
-
*
|
|
474
|
-
* const handleFileUpload = async (file: File) => {
|
|
475
|
-
* const result = await upload('Entity', file, {
|
|
476
|
-
* onProgress: (msg) => console.log(msg),
|
|
477
|
-
* })
|
|
478
|
-
*
|
|
479
|
-
* if (result?.success) {
|
|
480
|
-
* console.log(`Uploaded ${result.rowCount} rows`)
|
|
481
|
-
* }
|
|
482
|
-
* }
|
|
483
|
-
* ```
|
|
484
|
-
*
|
|
485
|
-
* @remarks
|
|
486
|
-
* For local development with LocalStack, configure s3EndpointUrl when initializing RoboSystemsExtensions:
|
|
487
|
-
* ```tsx
|
|
488
|
-
* const extensions = new RoboSystemsExtensions({
|
|
489
|
-
* baseUrl: 'http://localhost:8000',
|
|
490
|
-
* s3EndpointUrl: 'http://localhost:4566', // LocalStack endpoint
|
|
491
|
-
* })
|
|
492
|
-
* ```
|
|
493
|
-
*/
|
|
494
|
-
export function useTableUpload(graphId: string) {
|
|
495
|
-
const [loading, setLoading] = useState(false)
|
|
496
|
-
const [error, setError] = useState<Error | null>(null)
|
|
497
|
-
const [progress, setProgress] = useState<string | null>(null)
|
|
498
|
-
const [uploadResult, setUploadResult] = useState<FileUploadResult | null>(null)
|
|
499
|
-
const fileClientRef = useRef<FileClient | null>(null)
|
|
500
|
-
const materializationClientRef = useRef<MaterializationClient | null>(null)
|
|
501
|
-
const tableClientRef = useRef<TableClient | null>(null)
|
|
502
|
-
|
|
503
|
-
useEffect(() => {
|
|
504
|
-
const sdkConfig = getSDKExtensionsConfig()
|
|
505
|
-
const clientConfig = client.getConfig()
|
|
506
|
-
const token = extractTokenFromSDKClient()
|
|
507
|
-
|
|
508
|
-
const baseConfig = {
|
|
509
|
-
baseUrl: sdkConfig.baseUrl || clientConfig.baseUrl || 'http://localhost:8000',
|
|
510
|
-
credentials: sdkConfig.credentials,
|
|
511
|
-
token,
|
|
512
|
-
headers: sdkConfig.headers,
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
fileClientRef.current = new FileClient(baseConfig)
|
|
516
|
-
materializationClientRef.current = new MaterializationClient(baseConfig)
|
|
517
|
-
tableClientRef.current = new TableClient(baseConfig)
|
|
518
|
-
}, [])
|
|
519
|
-
|
|
520
|
-
const upload = useCallback(
|
|
521
|
-
async (
|
|
522
|
-
tableName: string,
|
|
523
|
-
fileOrBuffer: FileInput,
|
|
524
|
-
options?: FileUploadOptions
|
|
525
|
-
): Promise<FileUploadResult | null> => {
|
|
526
|
-
if (!fileClientRef.current) return null
|
|
527
|
-
|
|
528
|
-
setLoading(true)
|
|
529
|
-
setError(null)
|
|
530
|
-
setUploadResult(null)
|
|
531
|
-
setProgress(null)
|
|
532
|
-
|
|
533
|
-
try {
|
|
534
|
-
const result = await fileClientRef.current.upload(graphId, tableName, fileOrBuffer, {
|
|
535
|
-
...options,
|
|
536
|
-
onProgress: (msg) => {
|
|
537
|
-
setProgress(msg)
|
|
538
|
-
options?.onProgress?.(msg)
|
|
539
|
-
},
|
|
540
|
-
})
|
|
541
|
-
|
|
542
|
-
setUploadResult(result)
|
|
543
|
-
|
|
544
|
-
if (!result.success && result.error) {
|
|
545
|
-
setError(new Error(result.error))
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
return result
|
|
549
|
-
} catch (err) {
|
|
550
|
-
const error = err as Error
|
|
551
|
-
setError(error)
|
|
552
|
-
return null
|
|
553
|
-
} finally {
|
|
554
|
-
setLoading(false)
|
|
555
|
-
setProgress(null)
|
|
556
|
-
}
|
|
557
|
-
},
|
|
558
|
-
[graphId]
|
|
559
|
-
)
|
|
560
|
-
|
|
561
|
-
const listTables = useCallback(async (): Promise<TableInfo[]> => {
|
|
562
|
-
if (!tableClientRef.current) return []
|
|
563
|
-
|
|
564
|
-
try {
|
|
565
|
-
return await tableClientRef.current.list(graphId)
|
|
566
|
-
} catch (err) {
|
|
567
|
-
setError(err as Error)
|
|
568
|
-
return []
|
|
569
|
-
}
|
|
570
|
-
}, [graphId])
|
|
571
|
-
|
|
572
|
-
const materialize = useCallback(
|
|
573
|
-
async (options?: MaterializationOptions) => {
|
|
574
|
-
if (!materializationClientRef.current) return null
|
|
575
|
-
|
|
576
|
-
setLoading(true)
|
|
577
|
-
setError(null)
|
|
578
|
-
setProgress(null)
|
|
579
|
-
|
|
580
|
-
try {
|
|
581
|
-
const result = await materializationClientRef.current.materialize(graphId, {
|
|
582
|
-
...options,
|
|
583
|
-
onProgress: (msg) => {
|
|
584
|
-
setProgress(msg)
|
|
585
|
-
options?.onProgress?.(msg)
|
|
586
|
-
},
|
|
587
|
-
})
|
|
588
|
-
|
|
589
|
-
if (!result.success && result.error) {
|
|
590
|
-
setError(new Error(result.error))
|
|
591
|
-
}
|
|
592
|
-
|
|
593
|
-
return result
|
|
594
|
-
} catch (err) {
|
|
595
|
-
const error = err as Error
|
|
596
|
-
setError(error)
|
|
597
|
-
return null
|
|
598
|
-
} finally {
|
|
599
|
-
setLoading(false)
|
|
600
|
-
setProgress(null)
|
|
601
|
-
}
|
|
602
|
-
},
|
|
603
|
-
[graphId]
|
|
604
|
-
)
|
|
605
|
-
|
|
606
|
-
return {
|
|
607
|
-
upload,
|
|
608
|
-
listTables,
|
|
609
|
-
materialize,
|
|
610
|
-
loading,
|
|
611
|
-
error,
|
|
612
|
-
progress,
|
|
613
|
-
uploadResult,
|
|
614
|
-
}
|
|
615
|
-
}
|
package/extensions/index.d.ts
CHANGED
|
@@ -6,11 +6,6 @@ import { OperationClient } from './OperationClient';
|
|
|
6
6
|
import { QueryClient } from './QueryClient';
|
|
7
7
|
import { AgentClient } from './AgentClient';
|
|
8
8
|
import { SSEClient } from './SSEClient';
|
|
9
|
-
import { FileClient } from './FileClient';
|
|
10
|
-
import { MaterializationClient } from './MaterializationClient';
|
|
11
|
-
import { TableClient } from './TableClient';
|
|
12
|
-
import { GraphClient } from './GraphClient';
|
|
13
|
-
import { DocumentClient } from './DocumentClient';
|
|
14
9
|
import { LedgerClient } from './LedgerClient';
|
|
15
10
|
import { ReportClient } from './ReportClient';
|
|
16
11
|
export interface RoboSystemsExtensionConfig {
|
|
@@ -20,17 +15,11 @@ export interface RoboSystemsExtensionConfig {
|
|
|
20
15
|
headers?: Record<string, string>;
|
|
21
16
|
maxRetries?: number;
|
|
22
17
|
retryDelay?: number;
|
|
23
|
-
s3EndpointUrl?: string;
|
|
24
18
|
}
|
|
25
19
|
export declare class RoboSystemsExtensions {
|
|
26
20
|
readonly query: QueryClient;
|
|
27
21
|
readonly agent: AgentClient;
|
|
28
22
|
readonly operations: OperationClient;
|
|
29
|
-
readonly files: FileClient;
|
|
30
|
-
readonly materialization: MaterializationClient;
|
|
31
|
-
readonly tables: TableClient;
|
|
32
|
-
readonly graphs: GraphClient;
|
|
33
|
-
readonly documents: DocumentClient;
|
|
34
23
|
readonly ledger: LedgerClient;
|
|
35
24
|
readonly reports: ReportClient;
|
|
36
25
|
private config;
|
|
@@ -52,26 +41,15 @@ export * from './OperationClient';
|
|
|
52
41
|
export * from './QueryClient';
|
|
53
42
|
export * from './AgentClient';
|
|
54
43
|
export * from './SSEClient';
|
|
55
|
-
export * from './FileClient';
|
|
56
|
-
export * from './MaterializationClient';
|
|
57
|
-
export * from './GraphClient';
|
|
58
|
-
export * from './DocumentClient';
|
|
59
44
|
export * from './LedgerClient';
|
|
60
45
|
export * from './ReportClient';
|
|
61
46
|
export * from './config';
|
|
62
|
-
export
|
|
63
|
-
export {
|
|
64
|
-
export { OperationClient, QueryClient, AgentClient, SSEClient, FileClient, MaterializationClient, GraphClient, DocumentClient, LedgerClient, ReportClient, };
|
|
65
|
-
export { useMultipleOperations, useOperation, useQuery, useSDKClients, useStreamingQuery, useTableUpload, } from './hooks';
|
|
47
|
+
export { OperationClient, QueryClient, AgentClient, SSEClient, LedgerClient, ReportClient, };
|
|
48
|
+
export { useMultipleOperations, useOperation, useQuery, useSDKClients, useStreamingQuery, } from './hooks';
|
|
66
49
|
export declare const extensions: {
|
|
67
50
|
readonly query: QueryClient;
|
|
68
51
|
readonly agent: AgentClient;
|
|
69
52
|
readonly operations: OperationClient;
|
|
70
|
-
readonly files: FileClient;
|
|
71
|
-
readonly materialization: MaterializationClient;
|
|
72
|
-
readonly tables: TableClient;
|
|
73
|
-
readonly graphs: GraphClient;
|
|
74
|
-
readonly documents: DocumentClient;
|
|
75
53
|
readonly ledger: LedgerClient;
|
|
76
54
|
readonly reports: ReportClient;
|
|
77
55
|
monitorOperation: (operationId: string, onProgress?: (progress: any) => void) => Promise<any>;
|
package/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.analyzeFinancials = exports.agentQuery = exports.streamQuery = exports.executeQuery = exports.monitorOperation = exports.extensions = exports.
|
|
21
|
+
exports.analyzeFinancials = exports.agentQuery = exports.streamQuery = exports.executeQuery = exports.monitorOperation = exports.extensions = exports.useStreamingQuery = exports.useSDKClients = exports.useQuery = exports.useOperation = exports.useMultipleOperations = exports.ReportClient = exports.LedgerClient = exports.SSEClient = exports.AgentClient = exports.QueryClient = exports.OperationClient = exports.RoboSystemsExtensions = void 0;
|
|
22
22
|
const client_gen_1 = require("../client.gen");
|
|
23
23
|
const config_1 = require("./config");
|
|
24
24
|
const OperationClient_1 = require("./OperationClient");
|
|
@@ -29,15 +29,6 @@ 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 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");
|
|
37
|
-
const GraphClient_1 = require("./GraphClient");
|
|
38
|
-
Object.defineProperty(exports, "GraphClient", { enumerable: true, get: function () { return GraphClient_1.GraphClient; } });
|
|
39
|
-
const DocumentClient_1 = require("./DocumentClient");
|
|
40
|
-
Object.defineProperty(exports, "DocumentClient", { enumerable: true, get: function () { return DocumentClient_1.DocumentClient; } });
|
|
41
32
|
const LedgerClient_1 = require("./LedgerClient");
|
|
42
33
|
Object.defineProperty(exports, "LedgerClient", { enumerable: true, get: function () { return LedgerClient_1.LedgerClient; } });
|
|
43
34
|
const ReportClient_1 = require("./ReportClient");
|
|
@@ -55,7 +46,6 @@ class RoboSystemsExtensions {
|
|
|
55
46
|
headers: config.headers,
|
|
56
47
|
maxRetries: config.maxRetries || 5,
|
|
57
48
|
retryDelay: config.retryDelay || 1000,
|
|
58
|
-
s3EndpointUrl: config.s3EndpointUrl,
|
|
59
49
|
};
|
|
60
50
|
this.query = new QueryClient_1.QueryClient({
|
|
61
51
|
baseUrl: this.config.baseUrl,
|
|
@@ -76,37 +66,6 @@ class RoboSystemsExtensions {
|
|
|
76
66
|
maxRetries: this.config.maxRetries,
|
|
77
67
|
retryDelay: this.config.retryDelay,
|
|
78
68
|
});
|
|
79
|
-
this.files = new FileClient_1.FileClient({
|
|
80
|
-
baseUrl: this.config.baseUrl,
|
|
81
|
-
credentials: this.config.credentials,
|
|
82
|
-
token: this.config.token,
|
|
83
|
-
headers: this.config.headers,
|
|
84
|
-
s3EndpointUrl: this.config.s3EndpointUrl,
|
|
85
|
-
});
|
|
86
|
-
this.materialization = new MaterializationClient_1.MaterializationClient({
|
|
87
|
-
baseUrl: this.config.baseUrl,
|
|
88
|
-
credentials: this.config.credentials,
|
|
89
|
-
token: this.config.token,
|
|
90
|
-
headers: this.config.headers,
|
|
91
|
-
});
|
|
92
|
-
this.tables = new TableClient_1.TableClient({
|
|
93
|
-
baseUrl: this.config.baseUrl,
|
|
94
|
-
credentials: this.config.credentials,
|
|
95
|
-
token: this.config.token,
|
|
96
|
-
headers: this.config.headers,
|
|
97
|
-
});
|
|
98
|
-
this.graphs = new GraphClient_1.GraphClient({
|
|
99
|
-
baseUrl: this.config.baseUrl,
|
|
100
|
-
credentials: this.config.credentials,
|
|
101
|
-
token: this.config.token,
|
|
102
|
-
headers: this.config.headers,
|
|
103
|
-
});
|
|
104
|
-
this.documents = new DocumentClient_1.DocumentClient({
|
|
105
|
-
baseUrl: this.config.baseUrl,
|
|
106
|
-
credentials: this.config.credentials,
|
|
107
|
-
token: this.config.token,
|
|
108
|
-
headers: this.config.headers,
|
|
109
|
-
});
|
|
110
69
|
this.ledger = new LedgerClient_1.LedgerClient({
|
|
111
70
|
baseUrl: this.config.baseUrl,
|
|
112
71
|
credentials: this.config.credentials,
|
|
@@ -146,7 +105,6 @@ class RoboSystemsExtensions {
|
|
|
146
105
|
this.query.close();
|
|
147
106
|
this.agent.close();
|
|
148
107
|
this.operations.closeAll();
|
|
149
|
-
this.graphs.close();
|
|
150
108
|
}
|
|
151
109
|
}
|
|
152
110
|
exports.RoboSystemsExtensions = RoboSystemsExtensions;
|
|
@@ -155,15 +113,9 @@ __exportStar(require("./OperationClient"), exports);
|
|
|
155
113
|
__exportStar(require("./QueryClient"), exports);
|
|
156
114
|
__exportStar(require("./AgentClient"), exports);
|
|
157
115
|
__exportStar(require("./SSEClient"), exports);
|
|
158
|
-
__exportStar(require("./FileClient"), exports);
|
|
159
|
-
__exportStar(require("./MaterializationClient"), exports);
|
|
160
|
-
__exportStar(require("./GraphClient"), exports);
|
|
161
|
-
__exportStar(require("./DocumentClient"), exports);
|
|
162
116
|
__exportStar(require("./LedgerClient"), exports);
|
|
163
117
|
__exportStar(require("./ReportClient"), exports);
|
|
164
118
|
__exportStar(require("./config"), exports);
|
|
165
|
-
var TableClient_2 = require("./TableClient");
|
|
166
|
-
Object.defineProperty(exports, "TableClient", { enumerable: true, get: function () { return TableClient_2.TableClient; } });
|
|
167
119
|
// Export React hooks
|
|
168
120
|
var hooks_1 = require("./hooks");
|
|
169
121
|
Object.defineProperty(exports, "useMultipleOperations", { enumerable: true, get: function () { return hooks_1.useMultipleOperations; } });
|
|
@@ -171,7 +123,6 @@ Object.defineProperty(exports, "useOperation", { enumerable: true, get: function
|
|
|
171
123
|
Object.defineProperty(exports, "useQuery", { enumerable: true, get: function () { return hooks_1.useQuery; } });
|
|
172
124
|
Object.defineProperty(exports, "useSDKClients", { enumerable: true, get: function () { return hooks_1.useSDKClients; } });
|
|
173
125
|
Object.defineProperty(exports, "useStreamingQuery", { enumerable: true, get: function () { return hooks_1.useStreamingQuery; } });
|
|
174
|
-
Object.defineProperty(exports, "useTableUpload", { enumerable: true, get: function () { return hooks_1.useTableUpload; } });
|
|
175
126
|
// Lazy initialization of default instance
|
|
176
127
|
let _extensions = null;
|
|
177
128
|
function getExtensions() {
|
|
@@ -190,21 +141,6 @@ exports.extensions = {
|
|
|
190
141
|
get operations() {
|
|
191
142
|
return getExtensions().operations;
|
|
192
143
|
},
|
|
193
|
-
get files() {
|
|
194
|
-
return getExtensions().files;
|
|
195
|
-
},
|
|
196
|
-
get materialization() {
|
|
197
|
-
return getExtensions().materialization;
|
|
198
|
-
},
|
|
199
|
-
get tables() {
|
|
200
|
-
return getExtensions().tables;
|
|
201
|
-
},
|
|
202
|
-
get graphs() {
|
|
203
|
-
return getExtensions().graphs;
|
|
204
|
-
},
|
|
205
|
-
get documents() {
|
|
206
|
-
return getExtensions().documents;
|
|
207
|
-
},
|
|
208
144
|
get ledger() {
|
|
209
145
|
return getExtensions().ledger;
|
|
210
146
|
},
|