@erdoai/ui 0.1.24 → 0.1.27
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/dist/index.cjs +8 -8
- package/dist/index.d.cts +19 -5
- package/dist/index.d.ts +19 -5
- package/dist/index.js +8 -8
- package/package.json +1 -2
package/dist/index.d.cts
CHANGED
|
@@ -4,7 +4,6 @@ import React__default from 'react';
|
|
|
4
4
|
import { ErdoClient, ContentItem, InvokeResult, LogEntry, ToolGroup, InvocationStatus as InvocationStatus$1, SSEEvent, Thread } from '@erdoai/types';
|
|
5
5
|
export { ContentItem } from '@erdoai/types';
|
|
6
6
|
import * as RechartsPrimitive from 'recharts';
|
|
7
|
-
import { UseQueryResult } from '@tanstack/react-query';
|
|
8
7
|
import { ClassValue } from 'clsx';
|
|
9
8
|
|
|
10
9
|
/**
|
|
@@ -1230,25 +1229,40 @@ declare function useChartZoom({ onZoomChange }?: UseChartZoomProps): {
|
|
|
1230
1229
|
};
|
|
1231
1230
|
};
|
|
1232
1231
|
|
|
1232
|
+
/**
|
|
1233
|
+
* Result type for dataset content hooks.
|
|
1234
|
+
* Mirrors common data-fetching patterns without requiring React Query.
|
|
1235
|
+
*/
|
|
1236
|
+
interface UseDatasetContentsResult {
|
|
1237
|
+
data: any[] | undefined;
|
|
1238
|
+
isLoading: boolean;
|
|
1239
|
+
error: Error | null;
|
|
1240
|
+
refetch: () => void;
|
|
1241
|
+
}
|
|
1233
1242
|
/**
|
|
1234
1243
|
* Hook to fetch contents of a single dataset.
|
|
1244
|
+
* Uses the DataFetcher from ErdoProvider if available, otherwise falls back to REST API.
|
|
1235
1245
|
*
|
|
1236
1246
|
* @param datasetSlug - The slug/identifier of the dataset
|
|
1237
1247
|
* @param invocationId - The invocation ID context
|
|
1238
|
-
* @returns
|
|
1248
|
+
* @returns Object with data, isLoading, error, and refetch function
|
|
1239
1249
|
*
|
|
1240
1250
|
* @example
|
|
1241
1251
|
* ```tsx
|
|
1242
1252
|
* const { data, isLoading, error } = useDatasetContents('my-dataset', invocationId);
|
|
1253
|
+
* if (isLoading) return <Loading />;
|
|
1254
|
+
* if (error) return <Error message={error.message} />;
|
|
1255
|
+
* return <Chart data={data} />;
|
|
1243
1256
|
* ```
|
|
1244
1257
|
*/
|
|
1245
|
-
declare function useDatasetContents(datasetSlug: string, invocationId: string):
|
|
1258
|
+
declare function useDatasetContents(datasetSlug: string, invocationId: string): UseDatasetContentsResult;
|
|
1246
1259
|
/**
|
|
1247
1260
|
* Hook to fetch contents of multiple datasets in parallel.
|
|
1261
|
+
* Uses the DataFetcher from ErdoProvider if available, otherwise falls back to REST API.
|
|
1248
1262
|
*
|
|
1249
1263
|
* @param datasetSlugs - Array of dataset slugs/identifiers
|
|
1250
1264
|
* @param invocationId - The invocation ID context
|
|
1251
|
-
* @returns Array of
|
|
1265
|
+
* @returns Array of result objects, one per dataset
|
|
1252
1266
|
*
|
|
1253
1267
|
* @example
|
|
1254
1268
|
* ```tsx
|
|
@@ -1257,7 +1271,7 @@ declare function useDatasetContents(datasetSlug: string, invocationId: string):
|
|
|
1257
1271
|
* const allData = results.map(r => r.data || []);
|
|
1258
1272
|
* ```
|
|
1259
1273
|
*/
|
|
1260
|
-
declare function useMultipleDatasetContents(datasetSlugs: string[], invocationId: string):
|
|
1274
|
+
declare function useMultipleDatasetContents(datasetSlugs: string[], invocationId: string): UseDatasetContentsResult[];
|
|
1261
1275
|
|
|
1262
1276
|
interface UseThreadOptions {
|
|
1263
1277
|
/** Initial thread ID to use (if resuming an existing thread) */
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ import React__default from 'react';
|
|
|
4
4
|
import { ErdoClient, ContentItem, InvokeResult, LogEntry, ToolGroup, InvocationStatus as InvocationStatus$1, SSEEvent, Thread } from '@erdoai/types';
|
|
5
5
|
export { ContentItem } from '@erdoai/types';
|
|
6
6
|
import * as RechartsPrimitive from 'recharts';
|
|
7
|
-
import { UseQueryResult } from '@tanstack/react-query';
|
|
8
7
|
import { ClassValue } from 'clsx';
|
|
9
8
|
|
|
10
9
|
/**
|
|
@@ -1230,25 +1229,40 @@ declare function useChartZoom({ onZoomChange }?: UseChartZoomProps): {
|
|
|
1230
1229
|
};
|
|
1231
1230
|
};
|
|
1232
1231
|
|
|
1232
|
+
/**
|
|
1233
|
+
* Result type for dataset content hooks.
|
|
1234
|
+
* Mirrors common data-fetching patterns without requiring React Query.
|
|
1235
|
+
*/
|
|
1236
|
+
interface UseDatasetContentsResult {
|
|
1237
|
+
data: any[] | undefined;
|
|
1238
|
+
isLoading: boolean;
|
|
1239
|
+
error: Error | null;
|
|
1240
|
+
refetch: () => void;
|
|
1241
|
+
}
|
|
1233
1242
|
/**
|
|
1234
1243
|
* Hook to fetch contents of a single dataset.
|
|
1244
|
+
* Uses the DataFetcher from ErdoProvider if available, otherwise falls back to REST API.
|
|
1235
1245
|
*
|
|
1236
1246
|
* @param datasetSlug - The slug/identifier of the dataset
|
|
1237
1247
|
* @param invocationId - The invocation ID context
|
|
1238
|
-
* @returns
|
|
1248
|
+
* @returns Object with data, isLoading, error, and refetch function
|
|
1239
1249
|
*
|
|
1240
1250
|
* @example
|
|
1241
1251
|
* ```tsx
|
|
1242
1252
|
* const { data, isLoading, error } = useDatasetContents('my-dataset', invocationId);
|
|
1253
|
+
* if (isLoading) return <Loading />;
|
|
1254
|
+
* if (error) return <Error message={error.message} />;
|
|
1255
|
+
* return <Chart data={data} />;
|
|
1243
1256
|
* ```
|
|
1244
1257
|
*/
|
|
1245
|
-
declare function useDatasetContents(datasetSlug: string, invocationId: string):
|
|
1258
|
+
declare function useDatasetContents(datasetSlug: string, invocationId: string): UseDatasetContentsResult;
|
|
1246
1259
|
/**
|
|
1247
1260
|
* Hook to fetch contents of multiple datasets in parallel.
|
|
1261
|
+
* Uses the DataFetcher from ErdoProvider if available, otherwise falls back to REST API.
|
|
1248
1262
|
*
|
|
1249
1263
|
* @param datasetSlugs - Array of dataset slugs/identifiers
|
|
1250
1264
|
* @param invocationId - The invocation ID context
|
|
1251
|
-
* @returns Array of
|
|
1265
|
+
* @returns Array of result objects, one per dataset
|
|
1252
1266
|
*
|
|
1253
1267
|
* @example
|
|
1254
1268
|
* ```tsx
|
|
@@ -1257,7 +1271,7 @@ declare function useDatasetContents(datasetSlug: string, invocationId: string):
|
|
|
1257
1271
|
* const allData = results.map(r => r.data || []);
|
|
1258
1272
|
* ```
|
|
1259
1273
|
*/
|
|
1260
|
-
declare function useMultipleDatasetContents(datasetSlugs: string[], invocationId: string):
|
|
1274
|
+
declare function useMultipleDatasetContents(datasetSlugs: string[], invocationId: string): UseDatasetContentsResult[];
|
|
1261
1275
|
|
|
1262
1276
|
interface UseThreadOptions {
|
|
1263
1277
|
/** Initial thread ID to use (if resuming an existing thread) */
|