@fluxbase/sdk-react 2026.2.3-rc.12 → 2026.2.3-rc.14
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.d.mts +192 -2
- package/dist/index.d.ts +192 -2
- package/dist/index.js +234 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +227 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +20 -0
- package/src/use-table-export.ts +481 -0
package/dist/index.mjs
CHANGED
|
@@ -1268,6 +1268,226 @@ function useWebhooks(options = {}) {
|
|
|
1268
1268
|
testWebhook
|
|
1269
1269
|
};
|
|
1270
1270
|
}
|
|
1271
|
+
|
|
1272
|
+
// src/use-table-export.ts
|
|
1273
|
+
import { useState as useState7, useEffect as useEffect7, useCallback as useCallback6 } from "react";
|
|
1274
|
+
function useTableDetails(options) {
|
|
1275
|
+
const { schema, table, autoFetch = true } = options;
|
|
1276
|
+
const client = useFluxbaseClient();
|
|
1277
|
+
const [data, setData] = useState7(null);
|
|
1278
|
+
const [isLoading, setIsLoading] = useState7(autoFetch && !!schema && !!table);
|
|
1279
|
+
const [error, setError] = useState7(null);
|
|
1280
|
+
const fetchData = useCallback6(async () => {
|
|
1281
|
+
if (!schema || !table) return;
|
|
1282
|
+
try {
|
|
1283
|
+
setIsLoading(true);
|
|
1284
|
+
setError(null);
|
|
1285
|
+
const result = await client.admin.ai.getTableDetails(schema, table);
|
|
1286
|
+
if (result.error) {
|
|
1287
|
+
throw result.error;
|
|
1288
|
+
}
|
|
1289
|
+
setData(result.data);
|
|
1290
|
+
} catch (err) {
|
|
1291
|
+
setError(err);
|
|
1292
|
+
} finally {
|
|
1293
|
+
setIsLoading(false);
|
|
1294
|
+
}
|
|
1295
|
+
}, [client, schema, table]);
|
|
1296
|
+
useEffect7(() => {
|
|
1297
|
+
if (autoFetch && schema && table) {
|
|
1298
|
+
fetchData();
|
|
1299
|
+
}
|
|
1300
|
+
}, [autoFetch, fetchData, schema, table]);
|
|
1301
|
+
return {
|
|
1302
|
+
data,
|
|
1303
|
+
isLoading,
|
|
1304
|
+
error,
|
|
1305
|
+
refetch: fetchData
|
|
1306
|
+
};
|
|
1307
|
+
}
|
|
1308
|
+
function useExportTable(knowledgeBaseId) {
|
|
1309
|
+
const client = useFluxbaseClient();
|
|
1310
|
+
const [isLoading, setIsLoading] = useState7(false);
|
|
1311
|
+
const [error, setError] = useState7(null);
|
|
1312
|
+
const exportTable = useCallback6(
|
|
1313
|
+
async (options) => {
|
|
1314
|
+
try {
|
|
1315
|
+
setIsLoading(true);
|
|
1316
|
+
setError(null);
|
|
1317
|
+
const result = await client.admin.ai.exportTable(knowledgeBaseId, options);
|
|
1318
|
+
if (result.error) {
|
|
1319
|
+
throw result.error;
|
|
1320
|
+
}
|
|
1321
|
+
return result.data;
|
|
1322
|
+
} catch (err) {
|
|
1323
|
+
setError(err);
|
|
1324
|
+
return null;
|
|
1325
|
+
} finally {
|
|
1326
|
+
setIsLoading(false);
|
|
1327
|
+
}
|
|
1328
|
+
},
|
|
1329
|
+
[client, knowledgeBaseId]
|
|
1330
|
+
);
|
|
1331
|
+
const reset = useCallback6(() => {
|
|
1332
|
+
setError(null);
|
|
1333
|
+
setIsLoading(false);
|
|
1334
|
+
}, []);
|
|
1335
|
+
return {
|
|
1336
|
+
exportTable,
|
|
1337
|
+
isLoading,
|
|
1338
|
+
error,
|
|
1339
|
+
reset
|
|
1340
|
+
};
|
|
1341
|
+
}
|
|
1342
|
+
function useTableExportSyncs(knowledgeBaseId, options = {}) {
|
|
1343
|
+
const { autoFetch = true } = options;
|
|
1344
|
+
const client = useFluxbaseClient();
|
|
1345
|
+
const [configs, setConfigs] = useState7([]);
|
|
1346
|
+
const [isLoading, setIsLoading] = useState7(autoFetch);
|
|
1347
|
+
const [error, setError] = useState7(null);
|
|
1348
|
+
const fetchData = useCallback6(async () => {
|
|
1349
|
+
try {
|
|
1350
|
+
setIsLoading(true);
|
|
1351
|
+
setError(null);
|
|
1352
|
+
const result = await client.admin.ai.listTableExportSyncs(knowledgeBaseId);
|
|
1353
|
+
if (result.error) {
|
|
1354
|
+
throw result.error;
|
|
1355
|
+
}
|
|
1356
|
+
setConfigs(result.data || []);
|
|
1357
|
+
} catch (err) {
|
|
1358
|
+
setError(err);
|
|
1359
|
+
} finally {
|
|
1360
|
+
setIsLoading(false);
|
|
1361
|
+
}
|
|
1362
|
+
}, [client, knowledgeBaseId]);
|
|
1363
|
+
useEffect7(() => {
|
|
1364
|
+
if (autoFetch) {
|
|
1365
|
+
fetchData();
|
|
1366
|
+
}
|
|
1367
|
+
}, [autoFetch, fetchData]);
|
|
1368
|
+
return {
|
|
1369
|
+
configs,
|
|
1370
|
+
isLoading,
|
|
1371
|
+
error,
|
|
1372
|
+
refetch: fetchData
|
|
1373
|
+
};
|
|
1374
|
+
}
|
|
1375
|
+
function useCreateTableExportSync(knowledgeBaseId) {
|
|
1376
|
+
const client = useFluxbaseClient();
|
|
1377
|
+
const [isLoading, setIsLoading] = useState7(false);
|
|
1378
|
+
const [error, setError] = useState7(null);
|
|
1379
|
+
const createSync = useCallback6(
|
|
1380
|
+
async (config) => {
|
|
1381
|
+
try {
|
|
1382
|
+
setIsLoading(true);
|
|
1383
|
+
setError(null);
|
|
1384
|
+
const result = await client.admin.ai.createTableExportSync(knowledgeBaseId, config);
|
|
1385
|
+
if (result.error) {
|
|
1386
|
+
throw result.error;
|
|
1387
|
+
}
|
|
1388
|
+
return result.data;
|
|
1389
|
+
} catch (err) {
|
|
1390
|
+
setError(err);
|
|
1391
|
+
return null;
|
|
1392
|
+
} finally {
|
|
1393
|
+
setIsLoading(false);
|
|
1394
|
+
}
|
|
1395
|
+
},
|
|
1396
|
+
[client, knowledgeBaseId]
|
|
1397
|
+
);
|
|
1398
|
+
return {
|
|
1399
|
+
createSync,
|
|
1400
|
+
isLoading,
|
|
1401
|
+
error
|
|
1402
|
+
};
|
|
1403
|
+
}
|
|
1404
|
+
function useUpdateTableExportSync(knowledgeBaseId) {
|
|
1405
|
+
const client = useFluxbaseClient();
|
|
1406
|
+
const [isLoading, setIsLoading] = useState7(false);
|
|
1407
|
+
const [error, setError] = useState7(null);
|
|
1408
|
+
const updateSync = useCallback6(
|
|
1409
|
+
async (syncId, updates) => {
|
|
1410
|
+
try {
|
|
1411
|
+
setIsLoading(true);
|
|
1412
|
+
setError(null);
|
|
1413
|
+
const result = await client.admin.ai.updateTableExportSync(knowledgeBaseId, syncId, updates);
|
|
1414
|
+
if (result.error) {
|
|
1415
|
+
throw result.error;
|
|
1416
|
+
}
|
|
1417
|
+
return result.data;
|
|
1418
|
+
} catch (err) {
|
|
1419
|
+
setError(err);
|
|
1420
|
+
return null;
|
|
1421
|
+
} finally {
|
|
1422
|
+
setIsLoading(false);
|
|
1423
|
+
}
|
|
1424
|
+
},
|
|
1425
|
+
[client, knowledgeBaseId]
|
|
1426
|
+
);
|
|
1427
|
+
return {
|
|
1428
|
+
updateSync,
|
|
1429
|
+
isLoading,
|
|
1430
|
+
error
|
|
1431
|
+
};
|
|
1432
|
+
}
|
|
1433
|
+
function useDeleteTableExportSync(knowledgeBaseId) {
|
|
1434
|
+
const client = useFluxbaseClient();
|
|
1435
|
+
const [isLoading, setIsLoading] = useState7(false);
|
|
1436
|
+
const [error, setError] = useState7(null);
|
|
1437
|
+
const deleteSync = useCallback6(
|
|
1438
|
+
async (syncId) => {
|
|
1439
|
+
try {
|
|
1440
|
+
setIsLoading(true);
|
|
1441
|
+
setError(null);
|
|
1442
|
+
const result = await client.admin.ai.deleteTableExportSync(knowledgeBaseId, syncId);
|
|
1443
|
+
if (result.error) {
|
|
1444
|
+
throw result.error;
|
|
1445
|
+
}
|
|
1446
|
+
return true;
|
|
1447
|
+
} catch (err) {
|
|
1448
|
+
setError(err);
|
|
1449
|
+
return false;
|
|
1450
|
+
} finally {
|
|
1451
|
+
setIsLoading(false);
|
|
1452
|
+
}
|
|
1453
|
+
},
|
|
1454
|
+
[client, knowledgeBaseId]
|
|
1455
|
+
);
|
|
1456
|
+
return {
|
|
1457
|
+
deleteSync,
|
|
1458
|
+
isLoading,
|
|
1459
|
+
error
|
|
1460
|
+
};
|
|
1461
|
+
}
|
|
1462
|
+
function useTriggerTableExportSync(knowledgeBaseId) {
|
|
1463
|
+
const client = useFluxbaseClient();
|
|
1464
|
+
const [isLoading, setIsLoading] = useState7(false);
|
|
1465
|
+
const [error, setError] = useState7(null);
|
|
1466
|
+
const triggerSync = useCallback6(
|
|
1467
|
+
async (syncId) => {
|
|
1468
|
+
try {
|
|
1469
|
+
setIsLoading(true);
|
|
1470
|
+
setError(null);
|
|
1471
|
+
const result = await client.admin.ai.triggerTableExportSync(knowledgeBaseId, syncId);
|
|
1472
|
+
if (result.error) {
|
|
1473
|
+
throw result.error;
|
|
1474
|
+
}
|
|
1475
|
+
return result.data;
|
|
1476
|
+
} catch (err) {
|
|
1477
|
+
setError(err);
|
|
1478
|
+
return null;
|
|
1479
|
+
} finally {
|
|
1480
|
+
setIsLoading(false);
|
|
1481
|
+
}
|
|
1482
|
+
},
|
|
1483
|
+
[client, knowledgeBaseId]
|
|
1484
|
+
);
|
|
1485
|
+
return {
|
|
1486
|
+
triggerSync,
|
|
1487
|
+
isLoading,
|
|
1488
|
+
error
|
|
1489
|
+
};
|
|
1490
|
+
}
|
|
1271
1491
|
export {
|
|
1272
1492
|
FluxbaseProvider,
|
|
1273
1493
|
isCaptchaRequiredForEndpoint,
|
|
@@ -1280,8 +1500,11 @@ export {
|
|
|
1280
1500
|
useCaptchaConfig,
|
|
1281
1501
|
useClientKeys,
|
|
1282
1502
|
useCreateBucket,
|
|
1503
|
+
useCreateTableExportSync,
|
|
1283
1504
|
useDelete,
|
|
1284
1505
|
useDeleteBucket,
|
|
1506
|
+
useDeleteTableExportSync,
|
|
1507
|
+
useExportTable,
|
|
1285
1508
|
useFluxbaseClient,
|
|
1286
1509
|
useFluxbaseQuery,
|
|
1287
1510
|
useGetSAMLLoginUrl,
|
|
@@ -1314,10 +1537,14 @@ export {
|
|
|
1314
1537
|
useSystemSettings,
|
|
1315
1538
|
useTable,
|
|
1316
1539
|
useTableDeletes,
|
|
1540
|
+
useTableDetails,
|
|
1541
|
+
useTableExportSyncs,
|
|
1317
1542
|
useTableInserts,
|
|
1318
1543
|
useTableSubscription,
|
|
1319
1544
|
useTableUpdates,
|
|
1545
|
+
useTriggerTableExportSync,
|
|
1320
1546
|
useUpdate,
|
|
1547
|
+
useUpdateTableExportSync,
|
|
1321
1548
|
useUpdateUser,
|
|
1322
1549
|
useUpsert,
|
|
1323
1550
|
useUser,
|