@fluxbase/sdk-react 2026.1.1-rc.6 → 2026.1.1-rc.8
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 +77 -2
- package/dist/index.d.ts +77 -2
- package/dist/index.js +65 -43
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +34 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +3 -0
- package/src/use-auth-config.ts +101 -0
package/dist/index.mjs
CHANGED
|
@@ -227,11 +227,31 @@ function isCaptchaRequiredForEndpoint(config, endpoint) {
|
|
|
227
227
|
return config.endpoints?.includes(endpoint) ?? false;
|
|
228
228
|
}
|
|
229
229
|
|
|
230
|
+
// src/use-auth-config.ts
|
|
231
|
+
import { useQuery as useQuery3 } from "@tanstack/react-query";
|
|
232
|
+
function useAuthConfig() {
|
|
233
|
+
const client = useFluxbaseClient();
|
|
234
|
+
return useQuery3({
|
|
235
|
+
queryKey: ["fluxbase", "auth", "config"],
|
|
236
|
+
queryFn: async () => {
|
|
237
|
+
const { data, error } = await client.auth.getAuthConfig();
|
|
238
|
+
if (error) {
|
|
239
|
+
throw error;
|
|
240
|
+
}
|
|
241
|
+
return data;
|
|
242
|
+
},
|
|
243
|
+
staleTime: 1e3 * 60 * 5,
|
|
244
|
+
// Cache for 5 minutes (config changes infrequently)
|
|
245
|
+
gcTime: 1e3 * 60 * 60
|
|
246
|
+
// Keep in cache for 1 hour
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
|
|
230
250
|
// src/use-saml.ts
|
|
231
|
-
import { useMutation as useMutation2, useQuery as
|
|
251
|
+
import { useMutation as useMutation2, useQuery as useQuery4, useQueryClient as useQueryClient2 } from "@tanstack/react-query";
|
|
232
252
|
function useSAMLProviders() {
|
|
233
253
|
const client = useFluxbaseClient();
|
|
234
|
-
return
|
|
254
|
+
return useQuery4({
|
|
235
255
|
queryKey: ["fluxbase", "auth", "saml", "providers"],
|
|
236
256
|
queryFn: async () => {
|
|
237
257
|
const { data, error } = await client.auth.getSAMLProviders();
|
|
@@ -297,11 +317,11 @@ function useSAMLMetadataUrl() {
|
|
|
297
317
|
}
|
|
298
318
|
|
|
299
319
|
// src/use-graphql.ts
|
|
300
|
-
import { useMutation as useMutation3, useQuery as
|
|
320
|
+
import { useMutation as useMutation3, useQuery as useQuery5, useQueryClient as useQueryClient3 } from "@tanstack/react-query";
|
|
301
321
|
function useGraphQLQuery(queryKey, query, options) {
|
|
302
322
|
const client = useFluxbaseClient();
|
|
303
323
|
const normalizedKey = Array.isArray(queryKey) ? ["fluxbase", "graphql", ...queryKey] : ["fluxbase", "graphql", queryKey];
|
|
304
|
-
return
|
|
324
|
+
return useQuery5({
|
|
305
325
|
queryKey: normalizedKey,
|
|
306
326
|
queryFn: async () => {
|
|
307
327
|
const response = await client.graphql.execute(
|
|
@@ -359,7 +379,7 @@ function useGraphQLMutation(mutation, options) {
|
|
|
359
379
|
}
|
|
360
380
|
function useGraphQLIntrospection(options) {
|
|
361
381
|
const client = useFluxbaseClient();
|
|
362
|
-
return
|
|
382
|
+
return useQuery5({
|
|
363
383
|
queryKey: ["fluxbase", "graphql", "__introspection"],
|
|
364
384
|
queryFn: async () => {
|
|
365
385
|
const response = await client.graphql.introspect(options?.requestOptions);
|
|
@@ -404,11 +424,11 @@ function useGraphQL() {
|
|
|
404
424
|
}
|
|
405
425
|
|
|
406
426
|
// src/use-query.ts
|
|
407
|
-
import { useQuery as
|
|
427
|
+
import { useQuery as useQuery6, useMutation as useMutation4, useQueryClient as useQueryClient4 } from "@tanstack/react-query";
|
|
408
428
|
function useFluxbaseQuery(buildQuery, options) {
|
|
409
429
|
const client = useFluxbaseClient();
|
|
410
430
|
const queryKey = options?.queryKey || ["fluxbase", "query", buildQuery.toString()];
|
|
411
|
-
return
|
|
431
|
+
return useQuery6({
|
|
412
432
|
queryKey,
|
|
413
433
|
queryFn: async () => {
|
|
414
434
|
const query = buildQuery(client);
|
|
@@ -591,13 +611,13 @@ function useTableDeletes(table, callback, options) {
|
|
|
591
611
|
import { useState as useState2 } from "react";
|
|
592
612
|
import {
|
|
593
613
|
useMutation as useMutation5,
|
|
594
|
-
useQuery as
|
|
614
|
+
useQuery as useQuery7,
|
|
595
615
|
useQueryClient as useQueryClient6
|
|
596
616
|
} from "@tanstack/react-query";
|
|
597
617
|
function useStorageList(bucket, options) {
|
|
598
618
|
const client = useFluxbaseClient();
|
|
599
619
|
const { prefix, limit, offset, ...queryOptions } = options || {};
|
|
600
|
-
return
|
|
620
|
+
return useQuery7({
|
|
601
621
|
queryKey: [
|
|
602
622
|
"fluxbase",
|
|
603
623
|
"storage",
|
|
@@ -670,7 +690,7 @@ function useStorageUploadWithProgress(bucket) {
|
|
|
670
690
|
}
|
|
671
691
|
function useStorageDownload(bucket, path, enabled = true) {
|
|
672
692
|
const client = useFluxbaseClient();
|
|
673
|
-
return
|
|
693
|
+
return useQuery7({
|
|
674
694
|
queryKey: ["fluxbase", "storage", bucket, "download", path],
|
|
675
695
|
queryFn: async () => {
|
|
676
696
|
if (!path) {
|
|
@@ -719,7 +739,7 @@ function useStorageTransformUrl(bucket, path, transform) {
|
|
|
719
739
|
}
|
|
720
740
|
function useStorageSignedUrl(bucket, path, expiresIn) {
|
|
721
741
|
const client = useFluxbaseClient();
|
|
722
|
-
return
|
|
742
|
+
return useQuery7({
|
|
723
743
|
queryKey: ["fluxbase", "storage", bucket, "signed-url", path, expiresIn],
|
|
724
744
|
queryFn: async () => {
|
|
725
745
|
if (!path) {
|
|
@@ -740,7 +760,7 @@ function useStorageSignedUrlWithOptions(bucket, path, options) {
|
|
|
740
760
|
const client = useFluxbaseClient();
|
|
741
761
|
const expiresIn = options?.expiresIn;
|
|
742
762
|
const transformKey = options?.transform ? JSON.stringify(options.transform) : null;
|
|
743
|
-
return
|
|
763
|
+
return useQuery7({
|
|
744
764
|
queryKey: [
|
|
745
765
|
"fluxbase",
|
|
746
766
|
"storage",
|
|
@@ -805,7 +825,7 @@ function useStorageCopy(bucket) {
|
|
|
805
825
|
}
|
|
806
826
|
function useStorageBuckets() {
|
|
807
827
|
const client = useFluxbaseClient();
|
|
808
|
-
return
|
|
828
|
+
return useQuery7({
|
|
809
829
|
queryKey: ["fluxbase", "storage", "buckets"],
|
|
810
830
|
queryFn: async () => {
|
|
811
831
|
const { data, error } = await client.storage.listBuckets();
|
|
@@ -1243,6 +1263,7 @@ export {
|
|
|
1243
1263
|
useAdminAuth,
|
|
1244
1264
|
useAppSettings,
|
|
1245
1265
|
useAuth,
|
|
1266
|
+
useAuthConfig,
|
|
1246
1267
|
useCaptcha,
|
|
1247
1268
|
useCaptchaConfig,
|
|
1248
1269
|
useClientKeys,
|