@fluxbase/sdk-react 2026.3.1 → 2026.3.2-rc.3
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/README.md +4 -0
- package/package.json +2 -2
- package/src/test-utils.tsx +2 -2
- package/dist/index.d.mts +0 -1457
- package/dist/index.d.ts +0 -1457
- package/dist/index.js +0 -1637
- package/dist/index.js.map +0 -1
- package/dist/index.mjs +0 -1554
- package/dist/index.mjs.map +0 -1
package/dist/index.mjs
DELETED
|
@@ -1,1554 +0,0 @@
|
|
|
1
|
-
// src/context.tsx
|
|
2
|
-
import { createContext, useContext } from "react";
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
var FluxbaseContext = createContext(null);
|
|
5
|
-
function FluxbaseProvider({ client, children }) {
|
|
6
|
-
return /* @__PURE__ */ jsx(FluxbaseContext.Provider, { value: client, children });
|
|
7
|
-
}
|
|
8
|
-
function useFluxbaseClient() {
|
|
9
|
-
const client = useContext(FluxbaseContext);
|
|
10
|
-
if (!client) {
|
|
11
|
-
throw new Error("useFluxbaseClient must be used within a FluxbaseProvider");
|
|
12
|
-
}
|
|
13
|
-
return client;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
// src/use-auth.ts
|
|
17
|
-
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
18
|
-
function useUser() {
|
|
19
|
-
const client = useFluxbaseClient();
|
|
20
|
-
return useQuery({
|
|
21
|
-
queryKey: ["fluxbase", "auth", "user"],
|
|
22
|
-
queryFn: async () => {
|
|
23
|
-
const { data } = await client.auth.getSession();
|
|
24
|
-
if (!data?.session) {
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
|
-
try {
|
|
28
|
-
const result = await client.auth.getCurrentUser();
|
|
29
|
-
return result.data?.user ?? null;
|
|
30
|
-
} catch {
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
staleTime: 1e3 * 60 * 5
|
|
35
|
-
// 5 minutes
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
function useSession() {
|
|
39
|
-
const client = useFluxbaseClient();
|
|
40
|
-
return useQuery({
|
|
41
|
-
queryKey: ["fluxbase", "auth", "session"],
|
|
42
|
-
queryFn: async () => {
|
|
43
|
-
const { data } = await client.auth.getSession();
|
|
44
|
-
return data?.session ?? null;
|
|
45
|
-
},
|
|
46
|
-
staleTime: 1e3 * 60 * 5
|
|
47
|
-
// 5 minutes
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
function useSignIn() {
|
|
51
|
-
const client = useFluxbaseClient();
|
|
52
|
-
const queryClient = useQueryClient();
|
|
53
|
-
return useMutation({
|
|
54
|
-
mutationFn: async (credentials) => {
|
|
55
|
-
return await client.auth.signIn(credentials);
|
|
56
|
-
},
|
|
57
|
-
onSuccess: (session) => {
|
|
58
|
-
queryClient.setQueryData(["fluxbase", "auth", "session"], session);
|
|
59
|
-
if (session && "user" in session && session.user) {
|
|
60
|
-
queryClient.setQueryData(["fluxbase", "auth", "user"], session.user);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
function useSignUp() {
|
|
66
|
-
const client = useFluxbaseClient();
|
|
67
|
-
const queryClient = useQueryClient();
|
|
68
|
-
return useMutation({
|
|
69
|
-
mutationFn: async (credentials) => {
|
|
70
|
-
return await client.auth.signUp(credentials);
|
|
71
|
-
},
|
|
72
|
-
onSuccess: (response) => {
|
|
73
|
-
if (response.data) {
|
|
74
|
-
queryClient.setQueryData(
|
|
75
|
-
["fluxbase", "auth", "session"],
|
|
76
|
-
response.data.session
|
|
77
|
-
);
|
|
78
|
-
queryClient.setQueryData(
|
|
79
|
-
["fluxbase", "auth", "user"],
|
|
80
|
-
response.data.user
|
|
81
|
-
);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
function useSignOut() {
|
|
87
|
-
const client = useFluxbaseClient();
|
|
88
|
-
const queryClient = useQueryClient();
|
|
89
|
-
return useMutation({
|
|
90
|
-
mutationFn: async () => {
|
|
91
|
-
await client.auth.signOut();
|
|
92
|
-
},
|
|
93
|
-
onSuccess: () => {
|
|
94
|
-
queryClient.setQueryData(["fluxbase", "auth", "session"], null);
|
|
95
|
-
queryClient.setQueryData(["fluxbase", "auth", "user"], null);
|
|
96
|
-
queryClient.invalidateQueries({ queryKey: ["fluxbase"] });
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
function useUpdateUser() {
|
|
101
|
-
const client = useFluxbaseClient();
|
|
102
|
-
const queryClient = useQueryClient();
|
|
103
|
-
return useMutation({
|
|
104
|
-
mutationFn: async (data) => {
|
|
105
|
-
return await client.auth.updateUser(data);
|
|
106
|
-
},
|
|
107
|
-
onSuccess: (user) => {
|
|
108
|
-
queryClient.setQueryData(["fluxbase", "auth", "user"], user);
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
function useAuth() {
|
|
113
|
-
const { data: user, isLoading: isLoadingUser } = useUser();
|
|
114
|
-
const { data: session, isLoading: isLoadingSession } = useSession();
|
|
115
|
-
const signIn = useSignIn();
|
|
116
|
-
const signUp = useSignUp();
|
|
117
|
-
const signOut = useSignOut();
|
|
118
|
-
const updateUser = useUpdateUser();
|
|
119
|
-
return {
|
|
120
|
-
user,
|
|
121
|
-
session,
|
|
122
|
-
isLoading: isLoadingUser || isLoadingSession,
|
|
123
|
-
isAuthenticated: !!session,
|
|
124
|
-
signIn: signIn.mutateAsync,
|
|
125
|
-
signUp: signUp.mutateAsync,
|
|
126
|
-
signOut: signOut.mutateAsync,
|
|
127
|
-
updateUser: updateUser.mutateAsync,
|
|
128
|
-
isSigningIn: signIn.isPending,
|
|
129
|
-
isSigningUp: signUp.isPending,
|
|
130
|
-
isSigningOut: signOut.isPending,
|
|
131
|
-
isUpdating: updateUser.isPending
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
// src/use-captcha.ts
|
|
136
|
-
import { useQuery as useQuery2 } from "@tanstack/react-query";
|
|
137
|
-
import { useCallback, useEffect, useRef, useState } from "react";
|
|
138
|
-
function useCaptchaConfig() {
|
|
139
|
-
const client = useFluxbaseClient();
|
|
140
|
-
return useQuery2({
|
|
141
|
-
queryKey: ["fluxbase", "auth", "captcha", "config"],
|
|
142
|
-
queryFn: async () => {
|
|
143
|
-
const { data, error } = await client.auth.getCaptchaConfig();
|
|
144
|
-
if (error) {
|
|
145
|
-
throw error;
|
|
146
|
-
}
|
|
147
|
-
return data;
|
|
148
|
-
},
|
|
149
|
-
staleTime: 1e3 * 60 * 60,
|
|
150
|
-
// Cache for 1 hour (config rarely changes)
|
|
151
|
-
gcTime: 1e3 * 60 * 60 * 24
|
|
152
|
-
// Keep in cache for 24 hours
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
function useCaptcha(provider) {
|
|
156
|
-
const [token, setToken] = useState(null);
|
|
157
|
-
const [isReady, setIsReady] = useState(false);
|
|
158
|
-
const [isLoading, setIsLoading] = useState(false);
|
|
159
|
-
const [error, setError] = useState(null);
|
|
160
|
-
const executeResolverRef = useRef(null);
|
|
161
|
-
const executeRejecterRef = useRef(null);
|
|
162
|
-
const onVerify = useCallback((newToken) => {
|
|
163
|
-
setToken(newToken);
|
|
164
|
-
setIsLoading(false);
|
|
165
|
-
setError(null);
|
|
166
|
-
setIsReady(true);
|
|
167
|
-
if (executeResolverRef.current) {
|
|
168
|
-
executeResolverRef.current(newToken);
|
|
169
|
-
executeResolverRef.current = null;
|
|
170
|
-
executeRejecterRef.current = null;
|
|
171
|
-
}
|
|
172
|
-
}, []);
|
|
173
|
-
const onExpire = useCallback(() => {
|
|
174
|
-
setToken(null);
|
|
175
|
-
setIsReady(true);
|
|
176
|
-
}, []);
|
|
177
|
-
const onError = useCallback((err) => {
|
|
178
|
-
setError(err);
|
|
179
|
-
setIsLoading(false);
|
|
180
|
-
setToken(null);
|
|
181
|
-
if (executeRejecterRef.current) {
|
|
182
|
-
executeRejecterRef.current(err);
|
|
183
|
-
executeResolverRef.current = null;
|
|
184
|
-
executeRejecterRef.current = null;
|
|
185
|
-
}
|
|
186
|
-
}, []);
|
|
187
|
-
const reset = useCallback(() => {
|
|
188
|
-
setToken(null);
|
|
189
|
-
setError(null);
|
|
190
|
-
setIsLoading(false);
|
|
191
|
-
}, []);
|
|
192
|
-
const execute = useCallback(async () => {
|
|
193
|
-
if (token) {
|
|
194
|
-
return token;
|
|
195
|
-
}
|
|
196
|
-
if (!provider) {
|
|
197
|
-
return "";
|
|
198
|
-
}
|
|
199
|
-
setIsLoading(true);
|
|
200
|
-
setError(null);
|
|
201
|
-
return new Promise((resolve, reject) => {
|
|
202
|
-
executeResolverRef.current = resolve;
|
|
203
|
-
executeRejecterRef.current = reject;
|
|
204
|
-
});
|
|
205
|
-
}, [token, provider]);
|
|
206
|
-
useEffect(() => {
|
|
207
|
-
if (provider) {
|
|
208
|
-
setIsReady(true);
|
|
209
|
-
}
|
|
210
|
-
}, [provider]);
|
|
211
|
-
return {
|
|
212
|
-
token,
|
|
213
|
-
isReady,
|
|
214
|
-
isLoading,
|
|
215
|
-
error,
|
|
216
|
-
reset,
|
|
217
|
-
execute,
|
|
218
|
-
onVerify,
|
|
219
|
-
onExpire,
|
|
220
|
-
onError
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
function isCaptchaRequiredForEndpoint(config, endpoint) {
|
|
224
|
-
if (!config?.enabled) {
|
|
225
|
-
return false;
|
|
226
|
-
}
|
|
227
|
-
return config.endpoints?.includes(endpoint) ?? false;
|
|
228
|
-
}
|
|
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
|
-
|
|
250
|
-
// src/use-saml.ts
|
|
251
|
-
import { useMutation as useMutation2, useQuery as useQuery4, useQueryClient as useQueryClient2 } from "@tanstack/react-query";
|
|
252
|
-
function useSAMLProviders() {
|
|
253
|
-
const client = useFluxbaseClient();
|
|
254
|
-
return useQuery4({
|
|
255
|
-
queryKey: ["fluxbase", "auth", "saml", "providers"],
|
|
256
|
-
queryFn: async () => {
|
|
257
|
-
const { data, error } = await client.auth.getSAMLProviders();
|
|
258
|
-
if (error) throw error;
|
|
259
|
-
return data.providers;
|
|
260
|
-
},
|
|
261
|
-
staleTime: 1e3 * 60 * 5
|
|
262
|
-
// 5 minutes - providers don't change often
|
|
263
|
-
});
|
|
264
|
-
}
|
|
265
|
-
function useGetSAMLLoginUrl() {
|
|
266
|
-
const client = useFluxbaseClient();
|
|
267
|
-
return useMutation2({
|
|
268
|
-
mutationFn: async ({
|
|
269
|
-
provider,
|
|
270
|
-
options
|
|
271
|
-
}) => {
|
|
272
|
-
return await client.auth.getSAMLLoginUrl(provider, options);
|
|
273
|
-
}
|
|
274
|
-
});
|
|
275
|
-
}
|
|
276
|
-
function useSignInWithSAML() {
|
|
277
|
-
const client = useFluxbaseClient();
|
|
278
|
-
return useMutation2({
|
|
279
|
-
mutationFn: async ({
|
|
280
|
-
provider,
|
|
281
|
-
options
|
|
282
|
-
}) => {
|
|
283
|
-
return await client.auth.signInWithSAML(provider, options);
|
|
284
|
-
}
|
|
285
|
-
});
|
|
286
|
-
}
|
|
287
|
-
function useHandleSAMLCallback() {
|
|
288
|
-
const client = useFluxbaseClient();
|
|
289
|
-
const queryClient = useQueryClient2();
|
|
290
|
-
return useMutation2({
|
|
291
|
-
mutationFn: async ({
|
|
292
|
-
samlResponse,
|
|
293
|
-
provider
|
|
294
|
-
}) => {
|
|
295
|
-
return await client.auth.handleSAMLCallback(samlResponse, provider);
|
|
296
|
-
},
|
|
297
|
-
onSuccess: (result) => {
|
|
298
|
-
if (result.data) {
|
|
299
|
-
queryClient.setQueryData(
|
|
300
|
-
["fluxbase", "auth", "session"],
|
|
301
|
-
result.data.session
|
|
302
|
-
);
|
|
303
|
-
queryClient.setQueryData(
|
|
304
|
-
["fluxbase", "auth", "user"],
|
|
305
|
-
result.data.user
|
|
306
|
-
);
|
|
307
|
-
queryClient.invalidateQueries({ queryKey: ["fluxbase"] });
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
});
|
|
311
|
-
}
|
|
312
|
-
function useSAMLMetadataUrl() {
|
|
313
|
-
const client = useFluxbaseClient();
|
|
314
|
-
return (provider) => {
|
|
315
|
-
return client.auth.getSAMLMetadataUrl(provider);
|
|
316
|
-
};
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
// src/use-graphql.ts
|
|
320
|
-
import { useMutation as useMutation3, useQuery as useQuery5, useQueryClient as useQueryClient3 } from "@tanstack/react-query";
|
|
321
|
-
function useGraphQLQuery(queryKey, query, options) {
|
|
322
|
-
const client = useFluxbaseClient();
|
|
323
|
-
const normalizedKey = Array.isArray(queryKey) ? ["fluxbase", "graphql", ...queryKey] : ["fluxbase", "graphql", queryKey];
|
|
324
|
-
return useQuery5({
|
|
325
|
-
queryKey: normalizedKey,
|
|
326
|
-
queryFn: async () => {
|
|
327
|
-
const response = await client.graphql.execute(
|
|
328
|
-
query,
|
|
329
|
-
options?.variables,
|
|
330
|
-
options?.operationName,
|
|
331
|
-
options?.requestOptions
|
|
332
|
-
);
|
|
333
|
-
if (response.errors && response.errors.length > 0) {
|
|
334
|
-
throw response.errors[0];
|
|
335
|
-
}
|
|
336
|
-
return response.data;
|
|
337
|
-
},
|
|
338
|
-
enabled: options?.enabled ?? true,
|
|
339
|
-
staleTime: options?.staleTime ?? 0,
|
|
340
|
-
gcTime: options?.gcTime,
|
|
341
|
-
refetchOnWindowFocus: options?.refetchOnWindowFocus ?? true,
|
|
342
|
-
select: options?.select
|
|
343
|
-
});
|
|
344
|
-
}
|
|
345
|
-
function useGraphQLMutation(mutation, options) {
|
|
346
|
-
const client = useFluxbaseClient();
|
|
347
|
-
const queryClient = useQueryClient3();
|
|
348
|
-
return useMutation3({
|
|
349
|
-
mutationFn: async (variables) => {
|
|
350
|
-
const response = await client.graphql.execute(
|
|
351
|
-
mutation,
|
|
352
|
-
variables,
|
|
353
|
-
options?.operationName,
|
|
354
|
-
options?.requestOptions
|
|
355
|
-
);
|
|
356
|
-
if (response.errors && response.errors.length > 0) {
|
|
357
|
-
throw response.errors[0];
|
|
358
|
-
}
|
|
359
|
-
return response.data;
|
|
360
|
-
},
|
|
361
|
-
onSuccess: (data, variables) => {
|
|
362
|
-
if (options?.invalidateQueries) {
|
|
363
|
-
for (const key of options.invalidateQueries) {
|
|
364
|
-
queryClient.invalidateQueries({
|
|
365
|
-
queryKey: ["fluxbase", "graphql", key]
|
|
366
|
-
});
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
if (options?.onSuccess && data !== void 0) {
|
|
370
|
-
options.onSuccess(data, variables);
|
|
371
|
-
}
|
|
372
|
-
},
|
|
373
|
-
onError: (error, variables) => {
|
|
374
|
-
if (options?.onError) {
|
|
375
|
-
options.onError(error, variables);
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
});
|
|
379
|
-
}
|
|
380
|
-
function useGraphQLIntrospection(options) {
|
|
381
|
-
const client = useFluxbaseClient();
|
|
382
|
-
return useQuery5({
|
|
383
|
-
queryKey: ["fluxbase", "graphql", "__introspection"],
|
|
384
|
-
queryFn: async () => {
|
|
385
|
-
const response = await client.graphql.introspect(options?.requestOptions);
|
|
386
|
-
if (response.errors && response.errors.length > 0) {
|
|
387
|
-
throw response.errors[0];
|
|
388
|
-
}
|
|
389
|
-
return response.data;
|
|
390
|
-
},
|
|
391
|
-
enabled: options?.enabled ?? true,
|
|
392
|
-
staleTime: options?.staleTime ?? 1e3 * 60 * 5
|
|
393
|
-
// 5 minutes - schema doesn't change often
|
|
394
|
-
});
|
|
395
|
-
}
|
|
396
|
-
function useGraphQL() {
|
|
397
|
-
const client = useFluxbaseClient();
|
|
398
|
-
return {
|
|
399
|
-
/**
|
|
400
|
-
* Execute a GraphQL query
|
|
401
|
-
*/
|
|
402
|
-
executeQuery: (query, variables, options) => {
|
|
403
|
-
return client.graphql.query(query, variables, options);
|
|
404
|
-
},
|
|
405
|
-
/**
|
|
406
|
-
* Execute a GraphQL mutation
|
|
407
|
-
*/
|
|
408
|
-
executeMutation: (mutation, variables, options) => {
|
|
409
|
-
return client.graphql.mutation(mutation, variables, options);
|
|
410
|
-
},
|
|
411
|
-
/**
|
|
412
|
-
* Execute a GraphQL operation with an explicit operation name
|
|
413
|
-
*/
|
|
414
|
-
execute: (document, variables, operationName, options) => {
|
|
415
|
-
return client.graphql.execute(document, variables, operationName, options);
|
|
416
|
-
},
|
|
417
|
-
/**
|
|
418
|
-
* Fetch the GraphQL schema via introspection
|
|
419
|
-
*/
|
|
420
|
-
introspect: (options) => {
|
|
421
|
-
return client.graphql.introspect(options);
|
|
422
|
-
}
|
|
423
|
-
};
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
// src/use-query.ts
|
|
427
|
-
import { useQuery as useQuery6, useMutation as useMutation4, useQueryClient as useQueryClient4 } from "@tanstack/react-query";
|
|
428
|
-
function useFluxbaseQuery(buildQuery, options) {
|
|
429
|
-
const client = useFluxbaseClient();
|
|
430
|
-
if (!options?.queryKey) {
|
|
431
|
-
console.warn(
|
|
432
|
-
"[useFluxbaseQuery] No queryKey provided. This may cause cache misses. Please provide a stable queryKey in options."
|
|
433
|
-
);
|
|
434
|
-
}
|
|
435
|
-
const queryKey = options?.queryKey || ["fluxbase", "query", "unstable"];
|
|
436
|
-
return useQuery6({
|
|
437
|
-
queryKey,
|
|
438
|
-
queryFn: async () => {
|
|
439
|
-
const query = buildQuery(client);
|
|
440
|
-
const { data, error } = await query.execute();
|
|
441
|
-
if (error) {
|
|
442
|
-
throw error;
|
|
443
|
-
}
|
|
444
|
-
return Array.isArray(data) ? data : data ? [data] : [];
|
|
445
|
-
},
|
|
446
|
-
...options
|
|
447
|
-
});
|
|
448
|
-
}
|
|
449
|
-
function useTable(table, buildQuery, options) {
|
|
450
|
-
const client = useFluxbaseClient();
|
|
451
|
-
if (buildQuery && !options?.queryKey) {
|
|
452
|
-
console.warn(
|
|
453
|
-
`[useTable] Using buildQuery without a custom queryKey for table "${table}". This may cause cache misses. Provide a queryKey that includes your filter values.`
|
|
454
|
-
);
|
|
455
|
-
}
|
|
456
|
-
return useFluxbaseQuery(
|
|
457
|
-
(client2) => {
|
|
458
|
-
const query = client2.from(table);
|
|
459
|
-
return buildQuery ? buildQuery(query) : query;
|
|
460
|
-
},
|
|
461
|
-
{
|
|
462
|
-
...options,
|
|
463
|
-
// Use table name as base key, or custom key if provided
|
|
464
|
-
queryKey: options?.queryKey || ["fluxbase", "table", table]
|
|
465
|
-
}
|
|
466
|
-
);
|
|
467
|
-
}
|
|
468
|
-
function useInsert(table) {
|
|
469
|
-
const client = useFluxbaseClient();
|
|
470
|
-
const queryClient = useQueryClient4();
|
|
471
|
-
return useMutation4({
|
|
472
|
-
mutationFn: async (data) => {
|
|
473
|
-
const query = client.from(table);
|
|
474
|
-
const { data: result, error } = await query.insert(data);
|
|
475
|
-
if (error) {
|
|
476
|
-
throw error;
|
|
477
|
-
}
|
|
478
|
-
return result;
|
|
479
|
-
},
|
|
480
|
-
onSuccess: () => {
|
|
481
|
-
queryClient.invalidateQueries({ queryKey: ["fluxbase", "table", table] });
|
|
482
|
-
}
|
|
483
|
-
});
|
|
484
|
-
}
|
|
485
|
-
function useUpdate(table) {
|
|
486
|
-
const client = useFluxbaseClient();
|
|
487
|
-
const queryClient = useQueryClient4();
|
|
488
|
-
return useMutation4({
|
|
489
|
-
mutationFn: async (params) => {
|
|
490
|
-
const query = client.from(table);
|
|
491
|
-
const builtQuery = params.buildQuery(query);
|
|
492
|
-
const { data: result, error } = await builtQuery.update(params.data);
|
|
493
|
-
if (error) {
|
|
494
|
-
throw error;
|
|
495
|
-
}
|
|
496
|
-
return result;
|
|
497
|
-
},
|
|
498
|
-
onSuccess: () => {
|
|
499
|
-
queryClient.invalidateQueries({ queryKey: ["fluxbase", "table", table] });
|
|
500
|
-
}
|
|
501
|
-
});
|
|
502
|
-
}
|
|
503
|
-
function useUpsert(table) {
|
|
504
|
-
const client = useFluxbaseClient();
|
|
505
|
-
const queryClient = useQueryClient4();
|
|
506
|
-
return useMutation4({
|
|
507
|
-
mutationFn: async (data) => {
|
|
508
|
-
const query = client.from(table);
|
|
509
|
-
const { data: result, error } = await query.upsert(data);
|
|
510
|
-
if (error) {
|
|
511
|
-
throw error;
|
|
512
|
-
}
|
|
513
|
-
return result;
|
|
514
|
-
},
|
|
515
|
-
onSuccess: () => {
|
|
516
|
-
queryClient.invalidateQueries({ queryKey: ["fluxbase", "table", table] });
|
|
517
|
-
}
|
|
518
|
-
});
|
|
519
|
-
}
|
|
520
|
-
function useDelete(table) {
|
|
521
|
-
const client = useFluxbaseClient();
|
|
522
|
-
const queryClient = useQueryClient4();
|
|
523
|
-
return useMutation4({
|
|
524
|
-
mutationFn: async (buildQuery) => {
|
|
525
|
-
const query = client.from(table);
|
|
526
|
-
const builtQuery = buildQuery(query);
|
|
527
|
-
const { error } = await builtQuery.delete();
|
|
528
|
-
if (error) {
|
|
529
|
-
throw error;
|
|
530
|
-
}
|
|
531
|
-
},
|
|
532
|
-
onSuccess: () => {
|
|
533
|
-
queryClient.invalidateQueries({ queryKey: ["fluxbase", "table", table] });
|
|
534
|
-
}
|
|
535
|
-
});
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
// src/use-realtime.ts
|
|
539
|
-
import { useEffect as useEffect2, useRef as useRef2 } from "react";
|
|
540
|
-
import { useQueryClient as useQueryClient5 } from "@tanstack/react-query";
|
|
541
|
-
function useRealtime(options) {
|
|
542
|
-
const client = useFluxbaseClient();
|
|
543
|
-
const queryClient = useQueryClient5();
|
|
544
|
-
const channelRef = useRef2(
|
|
545
|
-
null
|
|
546
|
-
);
|
|
547
|
-
const {
|
|
548
|
-
channel: channelName,
|
|
549
|
-
event = "*",
|
|
550
|
-
callback,
|
|
551
|
-
autoInvalidate = true,
|
|
552
|
-
invalidateKey,
|
|
553
|
-
enabled = true
|
|
554
|
-
} = options;
|
|
555
|
-
const callbackRef = useRef2(callback);
|
|
556
|
-
const invalidateKeyRef = useRef2(invalidateKey);
|
|
557
|
-
const autoInvalidateRef = useRef2(autoInvalidate);
|
|
558
|
-
callbackRef.current = callback;
|
|
559
|
-
invalidateKeyRef.current = invalidateKey;
|
|
560
|
-
autoInvalidateRef.current = autoInvalidate;
|
|
561
|
-
useEffect2(() => {
|
|
562
|
-
if (!enabled) {
|
|
563
|
-
return;
|
|
564
|
-
}
|
|
565
|
-
const channel = client.realtime.channel(channelName);
|
|
566
|
-
channelRef.current = channel;
|
|
567
|
-
const handleChange = (payload) => {
|
|
568
|
-
if (callbackRef.current) {
|
|
569
|
-
callbackRef.current(payload);
|
|
570
|
-
}
|
|
571
|
-
if (autoInvalidateRef.current) {
|
|
572
|
-
const tableName = channelName.replace(/^table:/, "");
|
|
573
|
-
const key = invalidateKeyRef.current || ["fluxbase", "table", tableName];
|
|
574
|
-
queryClient.invalidateQueries({ queryKey: key });
|
|
575
|
-
}
|
|
576
|
-
};
|
|
577
|
-
channel.on(event, handleChange).subscribe();
|
|
578
|
-
return () => {
|
|
579
|
-
channel.unsubscribe();
|
|
580
|
-
channelRef.current = null;
|
|
581
|
-
};
|
|
582
|
-
}, [client, channelName, event, queryClient, enabled]);
|
|
583
|
-
return {
|
|
584
|
-
channel: channelRef.current
|
|
585
|
-
};
|
|
586
|
-
}
|
|
587
|
-
function useTableSubscription(table, options) {
|
|
588
|
-
return useRealtime({
|
|
589
|
-
...options,
|
|
590
|
-
channel: `table:${table}`
|
|
591
|
-
});
|
|
592
|
-
}
|
|
593
|
-
function useTableInserts(table, callback, options) {
|
|
594
|
-
return useRealtime({
|
|
595
|
-
...options,
|
|
596
|
-
channel: `table:${table}`,
|
|
597
|
-
event: "INSERT",
|
|
598
|
-
callback
|
|
599
|
-
});
|
|
600
|
-
}
|
|
601
|
-
function useTableUpdates(table, callback, options) {
|
|
602
|
-
return useRealtime({
|
|
603
|
-
...options,
|
|
604
|
-
channel: `table:${table}`,
|
|
605
|
-
event: "UPDATE",
|
|
606
|
-
callback
|
|
607
|
-
});
|
|
608
|
-
}
|
|
609
|
-
function useTableDeletes(table, callback, options) {
|
|
610
|
-
return useRealtime({
|
|
611
|
-
...options,
|
|
612
|
-
channel: `table:${table}`,
|
|
613
|
-
event: "DELETE",
|
|
614
|
-
callback
|
|
615
|
-
});
|
|
616
|
-
}
|
|
617
|
-
|
|
618
|
-
// src/use-storage.ts
|
|
619
|
-
import { useState as useState2 } from "react";
|
|
620
|
-
import {
|
|
621
|
-
useMutation as useMutation5,
|
|
622
|
-
useQuery as useQuery7,
|
|
623
|
-
useQueryClient as useQueryClient6
|
|
624
|
-
} from "@tanstack/react-query";
|
|
625
|
-
function useStorageList(bucket, options) {
|
|
626
|
-
const client = useFluxbaseClient();
|
|
627
|
-
const { prefix, limit, offset, ...queryOptions } = options || {};
|
|
628
|
-
return useQuery7({
|
|
629
|
-
queryKey: [
|
|
630
|
-
"fluxbase",
|
|
631
|
-
"storage",
|
|
632
|
-
bucket,
|
|
633
|
-
"list",
|
|
634
|
-
{ prefix, limit, offset }
|
|
635
|
-
],
|
|
636
|
-
queryFn: async () => {
|
|
637
|
-
const { data, error } = await client.storage.from(bucket).list({ prefix, limit, offset });
|
|
638
|
-
if (error) {
|
|
639
|
-
throw error;
|
|
640
|
-
}
|
|
641
|
-
return data || [];
|
|
642
|
-
},
|
|
643
|
-
...queryOptions
|
|
644
|
-
});
|
|
645
|
-
}
|
|
646
|
-
function useStorageUpload(bucket) {
|
|
647
|
-
const client = useFluxbaseClient();
|
|
648
|
-
const queryClient = useQueryClient6();
|
|
649
|
-
return useMutation5({
|
|
650
|
-
mutationFn: async (params) => {
|
|
651
|
-
const { path, file, options } = params;
|
|
652
|
-
const { data, error } = await client.storage.from(bucket).upload(path, file, options);
|
|
653
|
-
if (error) {
|
|
654
|
-
throw error;
|
|
655
|
-
}
|
|
656
|
-
return data;
|
|
657
|
-
},
|
|
658
|
-
onSuccess: () => {
|
|
659
|
-
queryClient.invalidateQueries({
|
|
660
|
-
queryKey: ["fluxbase", "storage", bucket, "list"]
|
|
661
|
-
});
|
|
662
|
-
}
|
|
663
|
-
});
|
|
664
|
-
}
|
|
665
|
-
function useStorageUploadWithProgress(bucket) {
|
|
666
|
-
const client = useFluxbaseClient();
|
|
667
|
-
const queryClient = useQueryClient6();
|
|
668
|
-
const [progress, setProgress] = useState2(null);
|
|
669
|
-
const mutation = useMutation5({
|
|
670
|
-
mutationFn: async (params) => {
|
|
671
|
-
const { path, file, options } = params;
|
|
672
|
-
setProgress({ loaded: 0, total: 0, percentage: 0 });
|
|
673
|
-
const { data, error } = await client.storage.from(bucket).upload(path, file, {
|
|
674
|
-
...options,
|
|
675
|
-
onUploadProgress: (p) => {
|
|
676
|
-
setProgress(p);
|
|
677
|
-
}
|
|
678
|
-
});
|
|
679
|
-
if (error) {
|
|
680
|
-
throw error;
|
|
681
|
-
}
|
|
682
|
-
return data;
|
|
683
|
-
},
|
|
684
|
-
onSuccess: () => {
|
|
685
|
-
queryClient.invalidateQueries({
|
|
686
|
-
queryKey: ["fluxbase", "storage", bucket, "list"]
|
|
687
|
-
});
|
|
688
|
-
},
|
|
689
|
-
onError: () => {
|
|
690
|
-
setProgress(null);
|
|
691
|
-
}
|
|
692
|
-
});
|
|
693
|
-
return {
|
|
694
|
-
upload: mutation,
|
|
695
|
-
progress,
|
|
696
|
-
reset: () => setProgress(null)
|
|
697
|
-
};
|
|
698
|
-
}
|
|
699
|
-
function useStorageDownload(bucket, path, enabled = true) {
|
|
700
|
-
const client = useFluxbaseClient();
|
|
701
|
-
return useQuery7({
|
|
702
|
-
queryKey: ["fluxbase", "storage", bucket, "download", path],
|
|
703
|
-
queryFn: async () => {
|
|
704
|
-
if (!path) {
|
|
705
|
-
return null;
|
|
706
|
-
}
|
|
707
|
-
const { data, error } = await client.storage.from(bucket).download(path);
|
|
708
|
-
if (error) {
|
|
709
|
-
throw error;
|
|
710
|
-
}
|
|
711
|
-
return data;
|
|
712
|
-
},
|
|
713
|
-
enabled: enabled && !!path
|
|
714
|
-
});
|
|
715
|
-
}
|
|
716
|
-
function useStorageDelete(bucket) {
|
|
717
|
-
const client = useFluxbaseClient();
|
|
718
|
-
const queryClient = useQueryClient6();
|
|
719
|
-
return useMutation5({
|
|
720
|
-
mutationFn: async (paths) => {
|
|
721
|
-
const { error } = await client.storage.from(bucket).remove(paths);
|
|
722
|
-
if (error) {
|
|
723
|
-
throw error;
|
|
724
|
-
}
|
|
725
|
-
},
|
|
726
|
-
onSuccess: () => {
|
|
727
|
-
queryClient.invalidateQueries({
|
|
728
|
-
queryKey: ["fluxbase", "storage", bucket, "list"]
|
|
729
|
-
});
|
|
730
|
-
}
|
|
731
|
-
});
|
|
732
|
-
}
|
|
733
|
-
function useStoragePublicUrl(bucket, path) {
|
|
734
|
-
const client = useFluxbaseClient();
|
|
735
|
-
if (!path) {
|
|
736
|
-
return null;
|
|
737
|
-
}
|
|
738
|
-
const { data } = client.storage.from(bucket).getPublicUrl(path);
|
|
739
|
-
return data.publicUrl;
|
|
740
|
-
}
|
|
741
|
-
function useStorageTransformUrl(bucket, path, transform) {
|
|
742
|
-
const client = useFluxbaseClient();
|
|
743
|
-
if (!path) {
|
|
744
|
-
return null;
|
|
745
|
-
}
|
|
746
|
-
return client.storage.from(bucket).getTransformUrl(path, transform);
|
|
747
|
-
}
|
|
748
|
-
function useStorageSignedUrl(bucket, path, expiresIn) {
|
|
749
|
-
const client = useFluxbaseClient();
|
|
750
|
-
return useQuery7({
|
|
751
|
-
queryKey: ["fluxbase", "storage", bucket, "signed-url", path, expiresIn],
|
|
752
|
-
queryFn: async () => {
|
|
753
|
-
if (!path) {
|
|
754
|
-
return null;
|
|
755
|
-
}
|
|
756
|
-
const { data, error } = await client.storage.from(bucket).createSignedUrl(path, { expiresIn });
|
|
757
|
-
if (error) {
|
|
758
|
-
throw error;
|
|
759
|
-
}
|
|
760
|
-
return data?.signedUrl || null;
|
|
761
|
-
},
|
|
762
|
-
enabled: !!path,
|
|
763
|
-
// Refresh 1 minute before expiry, but ensure staleTime is never negative
|
|
764
|
-
// For very short expirations (<60s), use half the expiration time
|
|
765
|
-
staleTime: expiresIn ? Math.max(expiresIn * 500, expiresIn * 1e3 - 6e4) : 1e3 * 60 * 50
|
|
766
|
-
// 50 minutes default
|
|
767
|
-
});
|
|
768
|
-
}
|
|
769
|
-
function useStorageSignedUrlWithOptions(bucket, path, options) {
|
|
770
|
-
const client = useFluxbaseClient();
|
|
771
|
-
const expiresIn = options?.expiresIn;
|
|
772
|
-
const transformKey = options?.transform ? JSON.stringify(options.transform) : null;
|
|
773
|
-
return useQuery7({
|
|
774
|
-
queryKey: [
|
|
775
|
-
"fluxbase",
|
|
776
|
-
"storage",
|
|
777
|
-
bucket,
|
|
778
|
-
"signed-url",
|
|
779
|
-
path,
|
|
780
|
-
expiresIn,
|
|
781
|
-
transformKey
|
|
782
|
-
],
|
|
783
|
-
queryFn: async () => {
|
|
784
|
-
if (!path) {
|
|
785
|
-
return null;
|
|
786
|
-
}
|
|
787
|
-
const { data, error } = await client.storage.from(bucket).createSignedUrl(path, options);
|
|
788
|
-
if (error) {
|
|
789
|
-
throw error;
|
|
790
|
-
}
|
|
791
|
-
return data?.signedUrl || null;
|
|
792
|
-
},
|
|
793
|
-
enabled: !!path,
|
|
794
|
-
// Refresh 1 minute before expiry, but ensure staleTime is never negative
|
|
795
|
-
// For very short expirations (<60s), use half the expiration time
|
|
796
|
-
staleTime: expiresIn ? Math.max(expiresIn * 500, expiresIn * 1e3 - 6e4) : 1e3 * 60 * 50
|
|
797
|
-
// 50 minutes default
|
|
798
|
-
});
|
|
799
|
-
}
|
|
800
|
-
function useStorageMove(bucket) {
|
|
801
|
-
const client = useFluxbaseClient();
|
|
802
|
-
const queryClient = useQueryClient6();
|
|
803
|
-
return useMutation5({
|
|
804
|
-
mutationFn: async (params) => {
|
|
805
|
-
const { fromPath, toPath } = params;
|
|
806
|
-
const { data, error } = await client.storage.from(bucket).move(fromPath, toPath);
|
|
807
|
-
if (error) {
|
|
808
|
-
throw error;
|
|
809
|
-
}
|
|
810
|
-
return data;
|
|
811
|
-
},
|
|
812
|
-
onSuccess: () => {
|
|
813
|
-
queryClient.invalidateQueries({
|
|
814
|
-
queryKey: ["fluxbase", "storage", bucket, "list"]
|
|
815
|
-
});
|
|
816
|
-
}
|
|
817
|
-
});
|
|
818
|
-
}
|
|
819
|
-
function useStorageCopy(bucket) {
|
|
820
|
-
const client = useFluxbaseClient();
|
|
821
|
-
const queryClient = useQueryClient6();
|
|
822
|
-
return useMutation5({
|
|
823
|
-
mutationFn: async (params) => {
|
|
824
|
-
const { fromPath, toPath } = params;
|
|
825
|
-
const { data, error } = await client.storage.from(bucket).copy(fromPath, toPath);
|
|
826
|
-
if (error) {
|
|
827
|
-
throw error;
|
|
828
|
-
}
|
|
829
|
-
return data;
|
|
830
|
-
},
|
|
831
|
-
onSuccess: () => {
|
|
832
|
-
queryClient.invalidateQueries({
|
|
833
|
-
queryKey: ["fluxbase", "storage", bucket, "list"]
|
|
834
|
-
});
|
|
835
|
-
}
|
|
836
|
-
});
|
|
837
|
-
}
|
|
838
|
-
function useStorageBuckets() {
|
|
839
|
-
const client = useFluxbaseClient();
|
|
840
|
-
return useQuery7({
|
|
841
|
-
queryKey: ["fluxbase", "storage", "buckets"],
|
|
842
|
-
queryFn: async () => {
|
|
843
|
-
const { data, error } = await client.storage.listBuckets();
|
|
844
|
-
if (error) {
|
|
845
|
-
throw error;
|
|
846
|
-
}
|
|
847
|
-
return data || [];
|
|
848
|
-
}
|
|
849
|
-
});
|
|
850
|
-
}
|
|
851
|
-
function useCreateBucket() {
|
|
852
|
-
const client = useFluxbaseClient();
|
|
853
|
-
const queryClient = useQueryClient6();
|
|
854
|
-
return useMutation5({
|
|
855
|
-
mutationFn: async (bucketName) => {
|
|
856
|
-
const { error } = await client.storage.createBucket(bucketName);
|
|
857
|
-
if (error) {
|
|
858
|
-
throw error;
|
|
859
|
-
}
|
|
860
|
-
},
|
|
861
|
-
onSuccess: () => {
|
|
862
|
-
queryClient.invalidateQueries({
|
|
863
|
-
queryKey: ["fluxbase", "storage", "buckets"]
|
|
864
|
-
});
|
|
865
|
-
}
|
|
866
|
-
});
|
|
867
|
-
}
|
|
868
|
-
function useDeleteBucket() {
|
|
869
|
-
const client = useFluxbaseClient();
|
|
870
|
-
const queryClient = useQueryClient6();
|
|
871
|
-
return useMutation5({
|
|
872
|
-
mutationFn: async (bucketName) => {
|
|
873
|
-
const { error } = await client.storage.deleteBucket(bucketName);
|
|
874
|
-
if (error) {
|
|
875
|
-
throw error;
|
|
876
|
-
}
|
|
877
|
-
},
|
|
878
|
-
onSuccess: () => {
|
|
879
|
-
queryClient.invalidateQueries({
|
|
880
|
-
queryKey: ["fluxbase", "storage", "buckets"]
|
|
881
|
-
});
|
|
882
|
-
}
|
|
883
|
-
});
|
|
884
|
-
}
|
|
885
|
-
|
|
886
|
-
// src/use-admin-auth.ts
|
|
887
|
-
import { useState as useState3, useEffect as useEffect3, useCallback as useCallback2 } from "react";
|
|
888
|
-
function useAdminAuth(options = {}) {
|
|
889
|
-
const { autoCheck = true } = options;
|
|
890
|
-
const client = useFluxbaseClient();
|
|
891
|
-
const [user, setUser] = useState3(null);
|
|
892
|
-
const [isLoading, setIsLoading] = useState3(autoCheck);
|
|
893
|
-
const [error, setError] = useState3(null);
|
|
894
|
-
const checkAuth = useCallback2(async () => {
|
|
895
|
-
try {
|
|
896
|
-
setIsLoading(true);
|
|
897
|
-
setError(null);
|
|
898
|
-
const { data, error: apiError } = await client.admin.me();
|
|
899
|
-
if (apiError) {
|
|
900
|
-
throw apiError;
|
|
901
|
-
}
|
|
902
|
-
setUser(data.user);
|
|
903
|
-
} catch (err) {
|
|
904
|
-
setUser(null);
|
|
905
|
-
setError(err);
|
|
906
|
-
} finally {
|
|
907
|
-
setIsLoading(false);
|
|
908
|
-
}
|
|
909
|
-
}, [client]);
|
|
910
|
-
const login = useCallback2(
|
|
911
|
-
async (email, password) => {
|
|
912
|
-
try {
|
|
913
|
-
setIsLoading(true);
|
|
914
|
-
setError(null);
|
|
915
|
-
const { data, error: apiError } = await client.admin.login({
|
|
916
|
-
email,
|
|
917
|
-
password
|
|
918
|
-
});
|
|
919
|
-
if (apiError) {
|
|
920
|
-
throw apiError;
|
|
921
|
-
}
|
|
922
|
-
setUser(data.user);
|
|
923
|
-
return data;
|
|
924
|
-
} catch (err) {
|
|
925
|
-
setError(err);
|
|
926
|
-
throw err;
|
|
927
|
-
} finally {
|
|
928
|
-
setIsLoading(false);
|
|
929
|
-
}
|
|
930
|
-
},
|
|
931
|
-
[client]
|
|
932
|
-
);
|
|
933
|
-
const logout = useCallback2(async () => {
|
|
934
|
-
try {
|
|
935
|
-
setIsLoading(true);
|
|
936
|
-
setError(null);
|
|
937
|
-
setUser(null);
|
|
938
|
-
} catch (err) {
|
|
939
|
-
setError(err);
|
|
940
|
-
throw err;
|
|
941
|
-
} finally {
|
|
942
|
-
setIsLoading(false);
|
|
943
|
-
}
|
|
944
|
-
}, []);
|
|
945
|
-
const refresh = useCallback2(async () => {
|
|
946
|
-
await checkAuth();
|
|
947
|
-
}, [checkAuth]);
|
|
948
|
-
useEffect3(() => {
|
|
949
|
-
if (autoCheck) {
|
|
950
|
-
checkAuth();
|
|
951
|
-
}
|
|
952
|
-
}, [autoCheck, checkAuth]);
|
|
953
|
-
return {
|
|
954
|
-
user,
|
|
955
|
-
isAuthenticated: user !== null,
|
|
956
|
-
isLoading,
|
|
957
|
-
error,
|
|
958
|
-
login,
|
|
959
|
-
logout,
|
|
960
|
-
refresh
|
|
961
|
-
};
|
|
962
|
-
}
|
|
963
|
-
|
|
964
|
-
// src/use-users.ts
|
|
965
|
-
import { useState as useState4, useEffect as useEffect4, useCallback as useCallback3 } from "react";
|
|
966
|
-
function useUsers(options = {}) {
|
|
967
|
-
const { autoFetch = true, refetchInterval = 0, ...listOptions } = options;
|
|
968
|
-
const client = useFluxbaseClient();
|
|
969
|
-
const [users, setUsers] = useState4([]);
|
|
970
|
-
const [total, setTotal] = useState4(0);
|
|
971
|
-
const [isLoading, setIsLoading] = useState4(autoFetch);
|
|
972
|
-
const [error, setError] = useState4(null);
|
|
973
|
-
const fetchUsers = useCallback3(async () => {
|
|
974
|
-
try {
|
|
975
|
-
setIsLoading(true);
|
|
976
|
-
setError(null);
|
|
977
|
-
const { data, error: apiError } = await client.admin.listUsers(listOptions);
|
|
978
|
-
if (apiError) {
|
|
979
|
-
throw apiError;
|
|
980
|
-
}
|
|
981
|
-
setUsers(data.users);
|
|
982
|
-
setTotal(data.total);
|
|
983
|
-
} catch (err) {
|
|
984
|
-
setError(err);
|
|
985
|
-
} finally {
|
|
986
|
-
setIsLoading(false);
|
|
987
|
-
}
|
|
988
|
-
}, [client, JSON.stringify(listOptions)]);
|
|
989
|
-
const inviteUser = useCallback3(
|
|
990
|
-
async (email, role) => {
|
|
991
|
-
await client.admin.inviteUser({ email, role });
|
|
992
|
-
await fetchUsers();
|
|
993
|
-
},
|
|
994
|
-
[client, fetchUsers]
|
|
995
|
-
);
|
|
996
|
-
const updateUserRole = useCallback3(
|
|
997
|
-
async (userId, role) => {
|
|
998
|
-
await client.admin.updateUserRole(userId, role);
|
|
999
|
-
await fetchUsers();
|
|
1000
|
-
},
|
|
1001
|
-
[client, fetchUsers]
|
|
1002
|
-
);
|
|
1003
|
-
const deleteUser = useCallback3(
|
|
1004
|
-
async (userId) => {
|
|
1005
|
-
await client.admin.deleteUser(userId);
|
|
1006
|
-
await fetchUsers();
|
|
1007
|
-
},
|
|
1008
|
-
[client, fetchUsers]
|
|
1009
|
-
);
|
|
1010
|
-
const resetPassword = useCallback3(
|
|
1011
|
-
async (userId) => {
|
|
1012
|
-
const { data, error: error2 } = await client.admin.resetUserPassword(userId);
|
|
1013
|
-
if (error2) {
|
|
1014
|
-
throw error2;
|
|
1015
|
-
}
|
|
1016
|
-
return data;
|
|
1017
|
-
},
|
|
1018
|
-
[client]
|
|
1019
|
-
);
|
|
1020
|
-
useEffect4(() => {
|
|
1021
|
-
if (autoFetch) {
|
|
1022
|
-
fetchUsers();
|
|
1023
|
-
}
|
|
1024
|
-
}, [autoFetch, fetchUsers]);
|
|
1025
|
-
useEffect4(() => {
|
|
1026
|
-
if (refetchInterval > 0) {
|
|
1027
|
-
const interval = setInterval(fetchUsers, refetchInterval);
|
|
1028
|
-
return () => clearInterval(interval);
|
|
1029
|
-
}
|
|
1030
|
-
}, [refetchInterval, fetchUsers]);
|
|
1031
|
-
return {
|
|
1032
|
-
users,
|
|
1033
|
-
total,
|
|
1034
|
-
isLoading,
|
|
1035
|
-
error,
|
|
1036
|
-
refetch: fetchUsers,
|
|
1037
|
-
inviteUser,
|
|
1038
|
-
updateUserRole,
|
|
1039
|
-
deleteUser,
|
|
1040
|
-
resetPassword
|
|
1041
|
-
};
|
|
1042
|
-
}
|
|
1043
|
-
|
|
1044
|
-
// src/use-client-keys.ts
|
|
1045
|
-
import { useState as useState5, useEffect as useEffect5, useCallback as useCallback4 } from "react";
|
|
1046
|
-
function useClientKeys(options = {}) {
|
|
1047
|
-
const { autoFetch = true } = options;
|
|
1048
|
-
const client = useFluxbaseClient();
|
|
1049
|
-
const [keys, setKeys] = useState5([]);
|
|
1050
|
-
const [isLoading, setIsLoading] = useState5(autoFetch);
|
|
1051
|
-
const [error, setError] = useState5(null);
|
|
1052
|
-
const fetchKeys = useCallback4(async () => {
|
|
1053
|
-
try {
|
|
1054
|
-
setIsLoading(true);
|
|
1055
|
-
setError(null);
|
|
1056
|
-
const response = await client.admin.management.clientKeys.list();
|
|
1057
|
-
setKeys(response.client_keys);
|
|
1058
|
-
} catch (err) {
|
|
1059
|
-
setError(err);
|
|
1060
|
-
} finally {
|
|
1061
|
-
setIsLoading(false);
|
|
1062
|
-
}
|
|
1063
|
-
}, [client]);
|
|
1064
|
-
const createKey = useCallback4(
|
|
1065
|
-
async (request) => {
|
|
1066
|
-
const response = await client.admin.management.clientKeys.create(request);
|
|
1067
|
-
await fetchKeys();
|
|
1068
|
-
return { key: response.key, keyData: response.client_key };
|
|
1069
|
-
},
|
|
1070
|
-
[client, fetchKeys]
|
|
1071
|
-
);
|
|
1072
|
-
const updateKey = useCallback4(
|
|
1073
|
-
async (keyId, update) => {
|
|
1074
|
-
await client.admin.management.clientKeys.update(keyId, update);
|
|
1075
|
-
await fetchKeys();
|
|
1076
|
-
},
|
|
1077
|
-
[client, fetchKeys]
|
|
1078
|
-
);
|
|
1079
|
-
const revokeKey = useCallback4(
|
|
1080
|
-
async (keyId) => {
|
|
1081
|
-
await client.admin.management.clientKeys.revoke(keyId);
|
|
1082
|
-
await fetchKeys();
|
|
1083
|
-
},
|
|
1084
|
-
[client, fetchKeys]
|
|
1085
|
-
);
|
|
1086
|
-
const deleteKey = useCallback4(
|
|
1087
|
-
async (keyId) => {
|
|
1088
|
-
await client.admin.management.clientKeys.delete(keyId);
|
|
1089
|
-
await fetchKeys();
|
|
1090
|
-
},
|
|
1091
|
-
[client, fetchKeys]
|
|
1092
|
-
);
|
|
1093
|
-
useEffect5(() => {
|
|
1094
|
-
if (autoFetch) {
|
|
1095
|
-
fetchKeys();
|
|
1096
|
-
}
|
|
1097
|
-
}, [autoFetch, fetchKeys]);
|
|
1098
|
-
return {
|
|
1099
|
-
keys,
|
|
1100
|
-
isLoading,
|
|
1101
|
-
error,
|
|
1102
|
-
refetch: fetchKeys,
|
|
1103
|
-
createKey,
|
|
1104
|
-
updateKey,
|
|
1105
|
-
revokeKey,
|
|
1106
|
-
deleteKey
|
|
1107
|
-
};
|
|
1108
|
-
}
|
|
1109
|
-
var useAPIKeys = useClientKeys;
|
|
1110
|
-
|
|
1111
|
-
// src/use-admin-hooks.ts
|
|
1112
|
-
import { useState as useState6, useEffect as useEffect6, useCallback as useCallback5 } from "react";
|
|
1113
|
-
function useAppSettings(options = {}) {
|
|
1114
|
-
const { autoFetch = true } = options;
|
|
1115
|
-
const client = useFluxbaseClient();
|
|
1116
|
-
const [settings, setSettings] = useState6(null);
|
|
1117
|
-
const [isLoading, setIsLoading] = useState6(autoFetch);
|
|
1118
|
-
const [error, setError] = useState6(null);
|
|
1119
|
-
const fetchSettings = useCallback5(async () => {
|
|
1120
|
-
try {
|
|
1121
|
-
setIsLoading(true);
|
|
1122
|
-
setError(null);
|
|
1123
|
-
const appSettings = await client.admin.settings.app.get();
|
|
1124
|
-
setSettings(appSettings);
|
|
1125
|
-
} catch (err) {
|
|
1126
|
-
setError(err);
|
|
1127
|
-
} finally {
|
|
1128
|
-
setIsLoading(false);
|
|
1129
|
-
}
|
|
1130
|
-
}, [client]);
|
|
1131
|
-
const updateSettings = useCallback5(
|
|
1132
|
-
async (update) => {
|
|
1133
|
-
await client.admin.settings.app.update(update);
|
|
1134
|
-
await fetchSettings();
|
|
1135
|
-
},
|
|
1136
|
-
[client, fetchSettings]
|
|
1137
|
-
);
|
|
1138
|
-
useEffect6(() => {
|
|
1139
|
-
if (autoFetch) {
|
|
1140
|
-
fetchSettings();
|
|
1141
|
-
}
|
|
1142
|
-
}, [autoFetch, fetchSettings]);
|
|
1143
|
-
return {
|
|
1144
|
-
settings,
|
|
1145
|
-
isLoading,
|
|
1146
|
-
error,
|
|
1147
|
-
refetch: fetchSettings,
|
|
1148
|
-
updateSettings
|
|
1149
|
-
};
|
|
1150
|
-
}
|
|
1151
|
-
function useSystemSettings(options = {}) {
|
|
1152
|
-
const { autoFetch = true } = options;
|
|
1153
|
-
const client = useFluxbaseClient();
|
|
1154
|
-
const [settings, setSettings] = useState6([]);
|
|
1155
|
-
const [isLoading, setIsLoading] = useState6(autoFetch);
|
|
1156
|
-
const [error, setError] = useState6(null);
|
|
1157
|
-
const fetchSettings = useCallback5(async () => {
|
|
1158
|
-
try {
|
|
1159
|
-
setIsLoading(true);
|
|
1160
|
-
setError(null);
|
|
1161
|
-
const response = await client.admin.settings.system.list();
|
|
1162
|
-
setSettings(response.settings);
|
|
1163
|
-
} catch (err) {
|
|
1164
|
-
setError(err);
|
|
1165
|
-
} finally {
|
|
1166
|
-
setIsLoading(false);
|
|
1167
|
-
}
|
|
1168
|
-
}, [client]);
|
|
1169
|
-
const getSetting = useCallback5(
|
|
1170
|
-
(key) => {
|
|
1171
|
-
return settings.find((s) => s.key === key);
|
|
1172
|
-
},
|
|
1173
|
-
[settings]
|
|
1174
|
-
);
|
|
1175
|
-
const updateSetting = useCallback5(
|
|
1176
|
-
async (key, update) => {
|
|
1177
|
-
await client.admin.settings.system.update(key, update);
|
|
1178
|
-
await fetchSettings();
|
|
1179
|
-
},
|
|
1180
|
-
[client, fetchSettings]
|
|
1181
|
-
);
|
|
1182
|
-
const deleteSetting = useCallback5(
|
|
1183
|
-
async (key) => {
|
|
1184
|
-
await client.admin.settings.system.delete(key);
|
|
1185
|
-
await fetchSettings();
|
|
1186
|
-
},
|
|
1187
|
-
[client, fetchSettings]
|
|
1188
|
-
);
|
|
1189
|
-
useEffect6(() => {
|
|
1190
|
-
if (autoFetch) {
|
|
1191
|
-
fetchSettings();
|
|
1192
|
-
}
|
|
1193
|
-
}, [autoFetch, fetchSettings]);
|
|
1194
|
-
return {
|
|
1195
|
-
settings,
|
|
1196
|
-
isLoading,
|
|
1197
|
-
error,
|
|
1198
|
-
refetch: fetchSettings,
|
|
1199
|
-
getSetting,
|
|
1200
|
-
updateSetting,
|
|
1201
|
-
deleteSetting
|
|
1202
|
-
};
|
|
1203
|
-
}
|
|
1204
|
-
function useWebhooks(options = {}) {
|
|
1205
|
-
const { autoFetch = true, refetchInterval = 0 } = options;
|
|
1206
|
-
const client = useFluxbaseClient();
|
|
1207
|
-
const [webhooks, setWebhooks] = useState6([]);
|
|
1208
|
-
const [isLoading, setIsLoading] = useState6(autoFetch);
|
|
1209
|
-
const [error, setError] = useState6(null);
|
|
1210
|
-
const fetchWebhooks = useCallback5(async () => {
|
|
1211
|
-
try {
|
|
1212
|
-
setIsLoading(true);
|
|
1213
|
-
setError(null);
|
|
1214
|
-
const response = await client.admin.management.webhooks.list();
|
|
1215
|
-
setWebhooks(response.webhooks);
|
|
1216
|
-
} catch (err) {
|
|
1217
|
-
setError(err);
|
|
1218
|
-
} finally {
|
|
1219
|
-
setIsLoading(false);
|
|
1220
|
-
}
|
|
1221
|
-
}, [client]);
|
|
1222
|
-
const createWebhook = useCallback5(
|
|
1223
|
-
async (webhook) => {
|
|
1224
|
-
const created = await client.admin.management.webhooks.create(webhook);
|
|
1225
|
-
await fetchWebhooks();
|
|
1226
|
-
return created;
|
|
1227
|
-
},
|
|
1228
|
-
[client, fetchWebhooks]
|
|
1229
|
-
);
|
|
1230
|
-
const updateWebhook = useCallback5(
|
|
1231
|
-
async (id, update) => {
|
|
1232
|
-
const updated = await client.admin.management.webhooks.update(id, update);
|
|
1233
|
-
await fetchWebhooks();
|
|
1234
|
-
return updated;
|
|
1235
|
-
},
|
|
1236
|
-
[client, fetchWebhooks]
|
|
1237
|
-
);
|
|
1238
|
-
const deleteWebhook = useCallback5(
|
|
1239
|
-
async (id) => {
|
|
1240
|
-
await client.admin.management.webhooks.delete(id);
|
|
1241
|
-
await fetchWebhooks();
|
|
1242
|
-
},
|
|
1243
|
-
[client, fetchWebhooks]
|
|
1244
|
-
);
|
|
1245
|
-
const testWebhook = useCallback5(
|
|
1246
|
-
async (id) => {
|
|
1247
|
-
await client.admin.management.webhooks.test(id);
|
|
1248
|
-
},
|
|
1249
|
-
[client]
|
|
1250
|
-
);
|
|
1251
|
-
useEffect6(() => {
|
|
1252
|
-
if (autoFetch) {
|
|
1253
|
-
fetchWebhooks();
|
|
1254
|
-
}
|
|
1255
|
-
if (refetchInterval > 0) {
|
|
1256
|
-
const interval = setInterval(fetchWebhooks, refetchInterval);
|
|
1257
|
-
return () => clearInterval(interval);
|
|
1258
|
-
}
|
|
1259
|
-
}, [autoFetch, refetchInterval, fetchWebhooks]);
|
|
1260
|
-
return {
|
|
1261
|
-
webhooks,
|
|
1262
|
-
isLoading,
|
|
1263
|
-
error,
|
|
1264
|
-
refetch: fetchWebhooks,
|
|
1265
|
-
createWebhook,
|
|
1266
|
-
updateWebhook,
|
|
1267
|
-
deleteWebhook,
|
|
1268
|
-
testWebhook
|
|
1269
|
-
};
|
|
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
|
-
}
|
|
1491
|
-
export {
|
|
1492
|
-
FluxbaseProvider,
|
|
1493
|
-
isCaptchaRequiredForEndpoint,
|
|
1494
|
-
useAPIKeys,
|
|
1495
|
-
useAdminAuth,
|
|
1496
|
-
useAppSettings,
|
|
1497
|
-
useAuth,
|
|
1498
|
-
useAuthConfig,
|
|
1499
|
-
useCaptcha,
|
|
1500
|
-
useCaptchaConfig,
|
|
1501
|
-
useClientKeys,
|
|
1502
|
-
useCreateBucket,
|
|
1503
|
-
useCreateTableExportSync,
|
|
1504
|
-
useDelete,
|
|
1505
|
-
useDeleteBucket,
|
|
1506
|
-
useDeleteTableExportSync,
|
|
1507
|
-
useExportTable,
|
|
1508
|
-
useFluxbaseClient,
|
|
1509
|
-
useFluxbaseQuery,
|
|
1510
|
-
useGetSAMLLoginUrl,
|
|
1511
|
-
useGraphQL,
|
|
1512
|
-
useGraphQLIntrospection,
|
|
1513
|
-
useGraphQLMutation,
|
|
1514
|
-
useGraphQLQuery,
|
|
1515
|
-
useHandleSAMLCallback,
|
|
1516
|
-
useInsert,
|
|
1517
|
-
useRealtime,
|
|
1518
|
-
useSAMLMetadataUrl,
|
|
1519
|
-
useSAMLProviders,
|
|
1520
|
-
useSession,
|
|
1521
|
-
useSignIn,
|
|
1522
|
-
useSignInWithSAML,
|
|
1523
|
-
useSignOut,
|
|
1524
|
-
useSignUp,
|
|
1525
|
-
useStorageBuckets,
|
|
1526
|
-
useStorageCopy,
|
|
1527
|
-
useStorageDelete,
|
|
1528
|
-
useStorageDownload,
|
|
1529
|
-
useStorageList,
|
|
1530
|
-
useStorageMove,
|
|
1531
|
-
useStoragePublicUrl,
|
|
1532
|
-
useStorageSignedUrl,
|
|
1533
|
-
useStorageSignedUrlWithOptions,
|
|
1534
|
-
useStorageTransformUrl,
|
|
1535
|
-
useStorageUpload,
|
|
1536
|
-
useStorageUploadWithProgress,
|
|
1537
|
-
useSystemSettings,
|
|
1538
|
-
useTable,
|
|
1539
|
-
useTableDeletes,
|
|
1540
|
-
useTableDetails,
|
|
1541
|
-
useTableExportSyncs,
|
|
1542
|
-
useTableInserts,
|
|
1543
|
-
useTableSubscription,
|
|
1544
|
-
useTableUpdates,
|
|
1545
|
-
useTriggerTableExportSync,
|
|
1546
|
-
useUpdate,
|
|
1547
|
-
useUpdateTableExportSync,
|
|
1548
|
-
useUpdateUser,
|
|
1549
|
-
useUpsert,
|
|
1550
|
-
useUser,
|
|
1551
|
-
useUsers,
|
|
1552
|
-
useWebhooks
|
|
1553
|
-
};
|
|
1554
|
-
//# sourceMappingURL=index.mjs.map
|