@fluxbase/sdk-react 2026.1.1-rc.5 → 2026.1.1-rc.7
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.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
import * as _fluxbase_sdk from '@fluxbase/sdk';
|
|
4
|
-
import { FluxbaseClient, User, AuthSession, SignInCredentials, SignUpCredentials, CaptchaConfig, CaptchaProvider, SAMLProvider, SAMLLoginOptions, GraphQLRequestOptions, GraphQLError, GraphQLResponse, QueryBuilder, RealtimeCallback, RealtimePostgresChangesPayload, ListOptions, UploadOptions, UploadProgress, TransformOptions, SignedUrlOptions, AdminAuthResponse, ListUsersOptions, EnrichedUser, ClientKey, CreateClientKeyRequest, Webhook, CreateWebhookRequest, UpdateWebhookRequest, AppSettings, UpdateAppSettingsRequest, SystemSetting, UpdateSystemSettingRequest } from '@fluxbase/sdk';
|
|
4
|
+
import { FluxbaseClient, User, AuthSession, SignInCredentials, SignUpCredentials, CaptchaConfig, CaptchaProvider, AuthConfig, SAMLProvider, SAMLLoginOptions, GraphQLRequestOptions, GraphQLError, GraphQLResponse, QueryBuilder, RealtimeCallback, RealtimePostgresChangesPayload, ListOptions, UploadOptions, UploadProgress, TransformOptions, SignedUrlOptions, AdminAuthResponse, ListUsersOptions, EnrichedUser, ClientKey, CreateClientKeyRequest, Webhook, CreateWebhookRequest, UpdateWebhookRequest, AppSettings, UpdateAppSettingsRequest, SystemSetting, UpdateSystemSettingRequest } from '@fluxbase/sdk';
|
|
5
5
|
export { APIKey, AdminUser, AppSettings, AuthSession, CaptchaConfig, CaptchaProvider, ClientKey, EnrichedUser, FluxbaseClient, GraphQLError, GraphQLErrorLocation, GraphQLRequestOptions, GraphQLResponse, ImageFitMode, ImageFormat, PostgrestResponse, RealtimeChangePayload, SAMLLoginOptions, SAMLLoginResponse, SAMLProvider, SAMLProvidersResponse, SAMLSession, SignInCredentials, SignUpCredentials, SignedUrlOptions, StorageObject, SystemSetting, TransformOptions, User, Webhook } from '@fluxbase/sdk';
|
|
6
6
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
7
7
|
import { UseQueryOptions } from '@tanstack/react-query';
|
|
@@ -179,6 +179,81 @@ declare function useCaptcha(provider?: CaptchaProvider): CaptchaState;
|
|
|
179
179
|
*/
|
|
180
180
|
declare function isCaptchaRequiredForEndpoint(config: CaptchaConfig | undefined, endpoint: string): boolean;
|
|
181
181
|
|
|
182
|
+
/**
|
|
183
|
+
* Hook to get the complete authentication configuration from the server
|
|
184
|
+
*
|
|
185
|
+
* Returns all public auth settings in a single request including:
|
|
186
|
+
* - Signup enabled status
|
|
187
|
+
* - Email verification requirements
|
|
188
|
+
* - Magic link availability
|
|
189
|
+
* - MFA availability
|
|
190
|
+
* - Password requirements (length, complexity)
|
|
191
|
+
* - Available OAuth providers (Google, GitHub, etc.)
|
|
192
|
+
* - Available SAML providers (enterprise SSO)
|
|
193
|
+
* - CAPTCHA configuration
|
|
194
|
+
*
|
|
195
|
+
* Use this to conditionally render UI elements based on server configuration,
|
|
196
|
+
* such as hiding signup forms when signup is disabled or displaying available
|
|
197
|
+
* OAuth provider buttons.
|
|
198
|
+
*
|
|
199
|
+
* @returns Query result with authentication configuration
|
|
200
|
+
*
|
|
201
|
+
* @example
|
|
202
|
+
* ```tsx
|
|
203
|
+
* function AuthPage() {
|
|
204
|
+
* const { data: config, isLoading } = useAuthConfig();
|
|
205
|
+
*
|
|
206
|
+
* if (isLoading) return <Loading />;
|
|
207
|
+
*
|
|
208
|
+
* return (
|
|
209
|
+
* <div>
|
|
210
|
+
* {config?.signup_enabled && (
|
|
211
|
+
* <SignupForm passwordMinLength={config.password_min_length} />
|
|
212
|
+
* )}
|
|
213
|
+
*
|
|
214
|
+
* {config?.oauth_providers.map(provider => (
|
|
215
|
+
* <OAuthButton
|
|
216
|
+
* key={provider.provider}
|
|
217
|
+
* provider={provider.provider}
|
|
218
|
+
* displayName={provider.display_name}
|
|
219
|
+
* authorizeUrl={provider.authorize_url}
|
|
220
|
+
* />
|
|
221
|
+
* ))}
|
|
222
|
+
*
|
|
223
|
+
* {config?.saml_providers.map(provider => (
|
|
224
|
+
* <SAMLButton
|
|
225
|
+
* key={provider.provider}
|
|
226
|
+
* provider={provider.provider}
|
|
227
|
+
* displayName={provider.display_name}
|
|
228
|
+
* />
|
|
229
|
+
* ))}
|
|
230
|
+
* </div>
|
|
231
|
+
* );
|
|
232
|
+
* }
|
|
233
|
+
* ```
|
|
234
|
+
*
|
|
235
|
+
* @example Showing password requirements
|
|
236
|
+
* ```tsx
|
|
237
|
+
* function PasswordInput() {
|
|
238
|
+
* const { data: config } = useAuthConfig();
|
|
239
|
+
*
|
|
240
|
+
* return (
|
|
241
|
+
* <div>
|
|
242
|
+
* <input type="password" minLength={config?.password_min_length} />
|
|
243
|
+
* <ul>
|
|
244
|
+
* <li>Minimum {config?.password_min_length || 8} characters</li>
|
|
245
|
+
* {config?.password_require_uppercase && <li>One uppercase letter</li>}
|
|
246
|
+
* {config?.password_require_lowercase && <li>One lowercase letter</li>}
|
|
247
|
+
* {config?.password_require_number && <li>One number</li>}
|
|
248
|
+
* {config?.password_require_special && <li>One special character</li>}
|
|
249
|
+
* </ul>
|
|
250
|
+
* </div>
|
|
251
|
+
* );
|
|
252
|
+
* }
|
|
253
|
+
* ```
|
|
254
|
+
*/
|
|
255
|
+
declare function useAuthConfig(): _tanstack_react_query.UseQueryResult<AuthConfig, Error>;
|
|
256
|
+
|
|
182
257
|
/**
|
|
183
258
|
* Hook to get available SAML SSO providers
|
|
184
259
|
*
|
|
@@ -1158,4 +1233,4 @@ interface UseWebhooksReturn {
|
|
|
1158
1233
|
*/
|
|
1159
1234
|
declare function useWebhooks(options?: UseWebhooksOptions): UseWebhooksReturn;
|
|
1160
1235
|
|
|
1161
|
-
export { type CaptchaState, FluxbaseProvider, type UseGraphQLMutationOptions, type UseGraphQLQueryOptions, isCaptchaRequiredForEndpoint, useAPIKeys, useAdminAuth, useAppSettings, useAuth, useCaptcha, useCaptchaConfig, useClientKeys, useCreateBucket, useDelete, useDeleteBucket, useFluxbaseClient, useFluxbaseQuery, useGetSAMLLoginUrl, useGraphQL, useGraphQLIntrospection, useGraphQLMutation, useGraphQLQuery, useHandleSAMLCallback, useInsert, useRealtime, useSAMLMetadataUrl, useSAMLProviders, useSession, useSignIn, useSignInWithSAML, useSignOut, useSignUp, useStorageBuckets, useStorageCopy, useStorageDelete, useStorageDownload, useStorageList, useStorageMove, useStoragePublicUrl, useStorageSignedUrl, useStorageSignedUrlWithOptions, useStorageTransformUrl, useStorageUpload, useStorageUploadWithProgress, useSystemSettings, useTable, useTableDeletes, useTableInserts, useTableSubscription, useTableUpdates, useUpdate, useUpdateUser, useUpsert, useUser, useUsers, useWebhooks };
|
|
1236
|
+
export { type CaptchaState, FluxbaseProvider, type UseGraphQLMutationOptions, type UseGraphQLQueryOptions, isCaptchaRequiredForEndpoint, useAPIKeys, useAdminAuth, useAppSettings, useAuth, useAuthConfig, useCaptcha, useCaptchaConfig, useClientKeys, useCreateBucket, useDelete, useDeleteBucket, useFluxbaseClient, useFluxbaseQuery, useGetSAMLLoginUrl, useGraphQL, useGraphQLIntrospection, useGraphQLMutation, useGraphQLQuery, useHandleSAMLCallback, useInsert, useRealtime, useSAMLMetadataUrl, useSAMLProviders, useSession, useSignIn, useSignInWithSAML, useSignOut, useSignUp, useStorageBuckets, useStorageCopy, useStorageDelete, useStorageDownload, useStorageList, useStorageMove, useStoragePublicUrl, useStorageSignedUrl, useStorageSignedUrlWithOptions, useStorageTransformUrl, useStorageUpload, useStorageUploadWithProgress, useSystemSettings, useTable, useTableDeletes, useTableInserts, useTableSubscription, useTableUpdates, useUpdate, useUpdateUser, useUpsert, useUser, useUsers, useWebhooks };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
import * as _fluxbase_sdk from '@fluxbase/sdk';
|
|
4
|
-
import { FluxbaseClient, User, AuthSession, SignInCredentials, SignUpCredentials, CaptchaConfig, CaptchaProvider, SAMLProvider, SAMLLoginOptions, GraphQLRequestOptions, GraphQLError, GraphQLResponse, QueryBuilder, RealtimeCallback, RealtimePostgresChangesPayload, ListOptions, UploadOptions, UploadProgress, TransformOptions, SignedUrlOptions, AdminAuthResponse, ListUsersOptions, EnrichedUser, ClientKey, CreateClientKeyRequest, Webhook, CreateWebhookRequest, UpdateWebhookRequest, AppSettings, UpdateAppSettingsRequest, SystemSetting, UpdateSystemSettingRequest } from '@fluxbase/sdk';
|
|
4
|
+
import { FluxbaseClient, User, AuthSession, SignInCredentials, SignUpCredentials, CaptchaConfig, CaptchaProvider, AuthConfig, SAMLProvider, SAMLLoginOptions, GraphQLRequestOptions, GraphQLError, GraphQLResponse, QueryBuilder, RealtimeCallback, RealtimePostgresChangesPayload, ListOptions, UploadOptions, UploadProgress, TransformOptions, SignedUrlOptions, AdminAuthResponse, ListUsersOptions, EnrichedUser, ClientKey, CreateClientKeyRequest, Webhook, CreateWebhookRequest, UpdateWebhookRequest, AppSettings, UpdateAppSettingsRequest, SystemSetting, UpdateSystemSettingRequest } from '@fluxbase/sdk';
|
|
5
5
|
export { APIKey, AdminUser, AppSettings, AuthSession, CaptchaConfig, CaptchaProvider, ClientKey, EnrichedUser, FluxbaseClient, GraphQLError, GraphQLErrorLocation, GraphQLRequestOptions, GraphQLResponse, ImageFitMode, ImageFormat, PostgrestResponse, RealtimeChangePayload, SAMLLoginOptions, SAMLLoginResponse, SAMLProvider, SAMLProvidersResponse, SAMLSession, SignInCredentials, SignUpCredentials, SignedUrlOptions, StorageObject, SystemSetting, TransformOptions, User, Webhook } from '@fluxbase/sdk';
|
|
6
6
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
7
7
|
import { UseQueryOptions } from '@tanstack/react-query';
|
|
@@ -179,6 +179,81 @@ declare function useCaptcha(provider?: CaptchaProvider): CaptchaState;
|
|
|
179
179
|
*/
|
|
180
180
|
declare function isCaptchaRequiredForEndpoint(config: CaptchaConfig | undefined, endpoint: string): boolean;
|
|
181
181
|
|
|
182
|
+
/**
|
|
183
|
+
* Hook to get the complete authentication configuration from the server
|
|
184
|
+
*
|
|
185
|
+
* Returns all public auth settings in a single request including:
|
|
186
|
+
* - Signup enabled status
|
|
187
|
+
* - Email verification requirements
|
|
188
|
+
* - Magic link availability
|
|
189
|
+
* - MFA availability
|
|
190
|
+
* - Password requirements (length, complexity)
|
|
191
|
+
* - Available OAuth providers (Google, GitHub, etc.)
|
|
192
|
+
* - Available SAML providers (enterprise SSO)
|
|
193
|
+
* - CAPTCHA configuration
|
|
194
|
+
*
|
|
195
|
+
* Use this to conditionally render UI elements based on server configuration,
|
|
196
|
+
* such as hiding signup forms when signup is disabled or displaying available
|
|
197
|
+
* OAuth provider buttons.
|
|
198
|
+
*
|
|
199
|
+
* @returns Query result with authentication configuration
|
|
200
|
+
*
|
|
201
|
+
* @example
|
|
202
|
+
* ```tsx
|
|
203
|
+
* function AuthPage() {
|
|
204
|
+
* const { data: config, isLoading } = useAuthConfig();
|
|
205
|
+
*
|
|
206
|
+
* if (isLoading) return <Loading />;
|
|
207
|
+
*
|
|
208
|
+
* return (
|
|
209
|
+
* <div>
|
|
210
|
+
* {config?.signup_enabled && (
|
|
211
|
+
* <SignupForm passwordMinLength={config.password_min_length} />
|
|
212
|
+
* )}
|
|
213
|
+
*
|
|
214
|
+
* {config?.oauth_providers.map(provider => (
|
|
215
|
+
* <OAuthButton
|
|
216
|
+
* key={provider.provider}
|
|
217
|
+
* provider={provider.provider}
|
|
218
|
+
* displayName={provider.display_name}
|
|
219
|
+
* authorizeUrl={provider.authorize_url}
|
|
220
|
+
* />
|
|
221
|
+
* ))}
|
|
222
|
+
*
|
|
223
|
+
* {config?.saml_providers.map(provider => (
|
|
224
|
+
* <SAMLButton
|
|
225
|
+
* key={provider.provider}
|
|
226
|
+
* provider={provider.provider}
|
|
227
|
+
* displayName={provider.display_name}
|
|
228
|
+
* />
|
|
229
|
+
* ))}
|
|
230
|
+
* </div>
|
|
231
|
+
* );
|
|
232
|
+
* }
|
|
233
|
+
* ```
|
|
234
|
+
*
|
|
235
|
+
* @example Showing password requirements
|
|
236
|
+
* ```tsx
|
|
237
|
+
* function PasswordInput() {
|
|
238
|
+
* const { data: config } = useAuthConfig();
|
|
239
|
+
*
|
|
240
|
+
* return (
|
|
241
|
+
* <div>
|
|
242
|
+
* <input type="password" minLength={config?.password_min_length} />
|
|
243
|
+
* <ul>
|
|
244
|
+
* <li>Minimum {config?.password_min_length || 8} characters</li>
|
|
245
|
+
* {config?.password_require_uppercase && <li>One uppercase letter</li>}
|
|
246
|
+
* {config?.password_require_lowercase && <li>One lowercase letter</li>}
|
|
247
|
+
* {config?.password_require_number && <li>One number</li>}
|
|
248
|
+
* {config?.password_require_special && <li>One special character</li>}
|
|
249
|
+
* </ul>
|
|
250
|
+
* </div>
|
|
251
|
+
* );
|
|
252
|
+
* }
|
|
253
|
+
* ```
|
|
254
|
+
*/
|
|
255
|
+
declare function useAuthConfig(): _tanstack_react_query.UseQueryResult<AuthConfig, Error>;
|
|
256
|
+
|
|
182
257
|
/**
|
|
183
258
|
* Hook to get available SAML SSO providers
|
|
184
259
|
*
|
|
@@ -1158,4 +1233,4 @@ interface UseWebhooksReturn {
|
|
|
1158
1233
|
*/
|
|
1159
1234
|
declare function useWebhooks(options?: UseWebhooksOptions): UseWebhooksReturn;
|
|
1160
1235
|
|
|
1161
|
-
export { type CaptchaState, FluxbaseProvider, type UseGraphQLMutationOptions, type UseGraphQLQueryOptions, isCaptchaRequiredForEndpoint, useAPIKeys, useAdminAuth, useAppSettings, useAuth, useCaptcha, useCaptchaConfig, useClientKeys, useCreateBucket, useDelete, useDeleteBucket, useFluxbaseClient, useFluxbaseQuery, useGetSAMLLoginUrl, useGraphQL, useGraphQLIntrospection, useGraphQLMutation, useGraphQLQuery, useHandleSAMLCallback, useInsert, useRealtime, useSAMLMetadataUrl, useSAMLProviders, useSession, useSignIn, useSignInWithSAML, useSignOut, useSignUp, useStorageBuckets, useStorageCopy, useStorageDelete, useStorageDownload, useStorageList, useStorageMove, useStoragePublicUrl, useStorageSignedUrl, useStorageSignedUrlWithOptions, useStorageTransformUrl, useStorageUpload, useStorageUploadWithProgress, useSystemSettings, useTable, useTableDeletes, useTableInserts, useTableSubscription, useTableUpdates, useUpdate, useUpdateUser, useUpsert, useUser, useUsers, useWebhooks };
|
|
1236
|
+
export { type CaptchaState, FluxbaseProvider, type UseGraphQLMutationOptions, type UseGraphQLQueryOptions, isCaptchaRequiredForEndpoint, useAPIKeys, useAdminAuth, useAppSettings, useAuth, useAuthConfig, useCaptcha, useCaptchaConfig, useClientKeys, useCreateBucket, useDelete, useDeleteBucket, useFluxbaseClient, useFluxbaseQuery, useGetSAMLLoginUrl, useGraphQL, useGraphQLIntrospection, useGraphQLMutation, useGraphQLQuery, useHandleSAMLCallback, useInsert, useRealtime, useSAMLMetadataUrl, useSAMLProviders, useSession, useSignIn, useSignInWithSAML, useSignOut, useSignUp, useStorageBuckets, useStorageCopy, useStorageDelete, useStorageDownload, useStorageList, useStorageMove, useStoragePublicUrl, useStorageSignedUrl, useStorageSignedUrlWithOptions, useStorageTransformUrl, useStorageUpload, useStorageUploadWithProgress, useSystemSettings, useTable, useTableDeletes, useTableInserts, useTableSubscription, useTableUpdates, useUpdate, useUpdateUser, useUpsert, useUser, useUsers, useWebhooks };
|
package/dist/index.js
CHANGED
|
@@ -26,6 +26,7 @@ __export(index_exports, {
|
|
|
26
26
|
useAdminAuth: () => useAdminAuth,
|
|
27
27
|
useAppSettings: () => useAppSettings,
|
|
28
28
|
useAuth: () => useAuth,
|
|
29
|
+
useAuthConfig: () => useAuthConfig,
|
|
29
30
|
useCaptcha: () => useCaptcha,
|
|
30
31
|
useCaptchaConfig: () => useCaptchaConfig,
|
|
31
32
|
useClientKeys: () => useClientKeys,
|
|
@@ -305,11 +306,31 @@ function isCaptchaRequiredForEndpoint(config, endpoint) {
|
|
|
305
306
|
return config.endpoints?.includes(endpoint) ?? false;
|
|
306
307
|
}
|
|
307
308
|
|
|
308
|
-
// src/use-
|
|
309
|
+
// src/use-auth-config.ts
|
|
309
310
|
var import_react_query3 = require("@tanstack/react-query");
|
|
310
|
-
function
|
|
311
|
+
function useAuthConfig() {
|
|
311
312
|
const client = useFluxbaseClient();
|
|
312
313
|
return (0, import_react_query3.useQuery)({
|
|
314
|
+
queryKey: ["fluxbase", "auth", "config"],
|
|
315
|
+
queryFn: async () => {
|
|
316
|
+
const { data, error } = await client.auth.getAuthConfig();
|
|
317
|
+
if (error) {
|
|
318
|
+
throw error;
|
|
319
|
+
}
|
|
320
|
+
return data;
|
|
321
|
+
},
|
|
322
|
+
staleTime: 1e3 * 60 * 5,
|
|
323
|
+
// Cache for 5 minutes (config changes infrequently)
|
|
324
|
+
gcTime: 1e3 * 60 * 60
|
|
325
|
+
// Keep in cache for 1 hour
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
// src/use-saml.ts
|
|
330
|
+
var import_react_query4 = require("@tanstack/react-query");
|
|
331
|
+
function useSAMLProviders() {
|
|
332
|
+
const client = useFluxbaseClient();
|
|
333
|
+
return (0, import_react_query4.useQuery)({
|
|
313
334
|
queryKey: ["fluxbase", "auth", "saml", "providers"],
|
|
314
335
|
queryFn: async () => {
|
|
315
336
|
const { data, error } = await client.auth.getSAMLProviders();
|
|
@@ -322,7 +343,7 @@ function useSAMLProviders() {
|
|
|
322
343
|
}
|
|
323
344
|
function useGetSAMLLoginUrl() {
|
|
324
345
|
const client = useFluxbaseClient();
|
|
325
|
-
return (0,
|
|
346
|
+
return (0, import_react_query4.useMutation)({
|
|
326
347
|
mutationFn: async ({
|
|
327
348
|
provider,
|
|
328
349
|
options
|
|
@@ -333,7 +354,7 @@ function useGetSAMLLoginUrl() {
|
|
|
333
354
|
}
|
|
334
355
|
function useSignInWithSAML() {
|
|
335
356
|
const client = useFluxbaseClient();
|
|
336
|
-
return (0,
|
|
357
|
+
return (0, import_react_query4.useMutation)({
|
|
337
358
|
mutationFn: async ({
|
|
338
359
|
provider,
|
|
339
360
|
options
|
|
@@ -344,8 +365,8 @@ function useSignInWithSAML() {
|
|
|
344
365
|
}
|
|
345
366
|
function useHandleSAMLCallback() {
|
|
346
367
|
const client = useFluxbaseClient();
|
|
347
|
-
const queryClient = (0,
|
|
348
|
-
return (0,
|
|
368
|
+
const queryClient = (0, import_react_query4.useQueryClient)();
|
|
369
|
+
return (0, import_react_query4.useMutation)({
|
|
349
370
|
mutationFn: async ({
|
|
350
371
|
samlResponse,
|
|
351
372
|
provider
|
|
@@ -375,11 +396,11 @@ function useSAMLMetadataUrl() {
|
|
|
375
396
|
}
|
|
376
397
|
|
|
377
398
|
// src/use-graphql.ts
|
|
378
|
-
var
|
|
399
|
+
var import_react_query5 = require("@tanstack/react-query");
|
|
379
400
|
function useGraphQLQuery(queryKey, query, options) {
|
|
380
401
|
const client = useFluxbaseClient();
|
|
381
402
|
const normalizedKey = Array.isArray(queryKey) ? ["fluxbase", "graphql", ...queryKey] : ["fluxbase", "graphql", queryKey];
|
|
382
|
-
return (0,
|
|
403
|
+
return (0, import_react_query5.useQuery)({
|
|
383
404
|
queryKey: normalizedKey,
|
|
384
405
|
queryFn: async () => {
|
|
385
406
|
const response = await client.graphql.execute(
|
|
@@ -402,8 +423,8 @@ function useGraphQLQuery(queryKey, query, options) {
|
|
|
402
423
|
}
|
|
403
424
|
function useGraphQLMutation(mutation, options) {
|
|
404
425
|
const client = useFluxbaseClient();
|
|
405
|
-
const queryClient = (0,
|
|
406
|
-
return (0,
|
|
426
|
+
const queryClient = (0, import_react_query5.useQueryClient)();
|
|
427
|
+
return (0, import_react_query5.useMutation)({
|
|
407
428
|
mutationFn: async (variables) => {
|
|
408
429
|
const response = await client.graphql.execute(
|
|
409
430
|
mutation,
|
|
@@ -437,7 +458,7 @@ function useGraphQLMutation(mutation, options) {
|
|
|
437
458
|
}
|
|
438
459
|
function useGraphQLIntrospection(options) {
|
|
439
460
|
const client = useFluxbaseClient();
|
|
440
|
-
return (0,
|
|
461
|
+
return (0, import_react_query5.useQuery)({
|
|
441
462
|
queryKey: ["fluxbase", "graphql", "__introspection"],
|
|
442
463
|
queryFn: async () => {
|
|
443
464
|
const response = await client.graphql.introspect(options?.requestOptions);
|
|
@@ -482,11 +503,11 @@ function useGraphQL() {
|
|
|
482
503
|
}
|
|
483
504
|
|
|
484
505
|
// src/use-query.ts
|
|
485
|
-
var
|
|
506
|
+
var import_react_query6 = require("@tanstack/react-query");
|
|
486
507
|
function useFluxbaseQuery(buildQuery, options) {
|
|
487
508
|
const client = useFluxbaseClient();
|
|
488
509
|
const queryKey = options?.queryKey || ["fluxbase", "query", buildQuery.toString()];
|
|
489
|
-
return (0,
|
|
510
|
+
return (0, import_react_query6.useQuery)({
|
|
490
511
|
queryKey,
|
|
491
512
|
queryFn: async () => {
|
|
492
513
|
const query = buildQuery(client);
|
|
@@ -514,8 +535,8 @@ function useTable(table, buildQuery, options) {
|
|
|
514
535
|
}
|
|
515
536
|
function useInsert(table) {
|
|
516
537
|
const client = useFluxbaseClient();
|
|
517
|
-
const queryClient = (0,
|
|
518
|
-
return (0,
|
|
538
|
+
const queryClient = (0, import_react_query6.useQueryClient)();
|
|
539
|
+
return (0, import_react_query6.useMutation)({
|
|
519
540
|
mutationFn: async (data) => {
|
|
520
541
|
const query = client.from(table);
|
|
521
542
|
const { data: result, error } = await query.insert(data);
|
|
@@ -531,8 +552,8 @@ function useInsert(table) {
|
|
|
531
552
|
}
|
|
532
553
|
function useUpdate(table) {
|
|
533
554
|
const client = useFluxbaseClient();
|
|
534
|
-
const queryClient = (0,
|
|
535
|
-
return (0,
|
|
555
|
+
const queryClient = (0, import_react_query6.useQueryClient)();
|
|
556
|
+
return (0, import_react_query6.useMutation)({
|
|
536
557
|
mutationFn: async (params) => {
|
|
537
558
|
const query = client.from(table);
|
|
538
559
|
const builtQuery = params.buildQuery(query);
|
|
@@ -549,8 +570,8 @@ function useUpdate(table) {
|
|
|
549
570
|
}
|
|
550
571
|
function useUpsert(table) {
|
|
551
572
|
const client = useFluxbaseClient();
|
|
552
|
-
const queryClient = (0,
|
|
553
|
-
return (0,
|
|
573
|
+
const queryClient = (0, import_react_query6.useQueryClient)();
|
|
574
|
+
return (0, import_react_query6.useMutation)({
|
|
554
575
|
mutationFn: async (data) => {
|
|
555
576
|
const query = client.from(table);
|
|
556
577
|
const { data: result, error } = await query.upsert(data);
|
|
@@ -566,8 +587,8 @@ function useUpsert(table) {
|
|
|
566
587
|
}
|
|
567
588
|
function useDelete(table) {
|
|
568
589
|
const client = useFluxbaseClient();
|
|
569
|
-
const queryClient = (0,
|
|
570
|
-
return (0,
|
|
590
|
+
const queryClient = (0, import_react_query6.useQueryClient)();
|
|
591
|
+
return (0, import_react_query6.useMutation)({
|
|
571
592
|
mutationFn: async (buildQuery) => {
|
|
572
593
|
const query = client.from(table);
|
|
573
594
|
const builtQuery = buildQuery(query);
|
|
@@ -584,10 +605,10 @@ function useDelete(table) {
|
|
|
584
605
|
|
|
585
606
|
// src/use-realtime.ts
|
|
586
607
|
var import_react3 = require("react");
|
|
587
|
-
var
|
|
608
|
+
var import_react_query7 = require("@tanstack/react-query");
|
|
588
609
|
function useRealtime(options) {
|
|
589
610
|
const client = useFluxbaseClient();
|
|
590
|
-
const queryClient = (0,
|
|
611
|
+
const queryClient = (0, import_react_query7.useQueryClient)();
|
|
591
612
|
const channelRef = (0, import_react3.useRef)(
|
|
592
613
|
null
|
|
593
614
|
);
|
|
@@ -667,11 +688,11 @@ function useTableDeletes(table, callback, options) {
|
|
|
667
688
|
|
|
668
689
|
// src/use-storage.ts
|
|
669
690
|
var import_react4 = require("react");
|
|
670
|
-
var
|
|
691
|
+
var import_react_query8 = require("@tanstack/react-query");
|
|
671
692
|
function useStorageList(bucket, options) {
|
|
672
693
|
const client = useFluxbaseClient();
|
|
673
694
|
const { prefix, limit, offset, ...queryOptions } = options || {};
|
|
674
|
-
return (0,
|
|
695
|
+
return (0, import_react_query8.useQuery)({
|
|
675
696
|
queryKey: [
|
|
676
697
|
"fluxbase",
|
|
677
698
|
"storage",
|
|
@@ -691,8 +712,8 @@ function useStorageList(bucket, options) {
|
|
|
691
712
|
}
|
|
692
713
|
function useStorageUpload(bucket) {
|
|
693
714
|
const client = useFluxbaseClient();
|
|
694
|
-
const queryClient = (0,
|
|
695
|
-
return (0,
|
|
715
|
+
const queryClient = (0, import_react_query8.useQueryClient)();
|
|
716
|
+
return (0, import_react_query8.useMutation)({
|
|
696
717
|
mutationFn: async (params) => {
|
|
697
718
|
const { path, file, options } = params;
|
|
698
719
|
const { data, error } = await client.storage.from(bucket).upload(path, file, options);
|
|
@@ -710,9 +731,9 @@ function useStorageUpload(bucket) {
|
|
|
710
731
|
}
|
|
711
732
|
function useStorageUploadWithProgress(bucket) {
|
|
712
733
|
const client = useFluxbaseClient();
|
|
713
|
-
const queryClient = (0,
|
|
734
|
+
const queryClient = (0, import_react_query8.useQueryClient)();
|
|
714
735
|
const [progress, setProgress] = (0, import_react4.useState)(null);
|
|
715
|
-
const mutation = (0,
|
|
736
|
+
const mutation = (0, import_react_query8.useMutation)({
|
|
716
737
|
mutationFn: async (params) => {
|
|
717
738
|
const { path, file, options } = params;
|
|
718
739
|
setProgress({ loaded: 0, total: 0, percentage: 0 });
|
|
@@ -744,7 +765,7 @@ function useStorageUploadWithProgress(bucket) {
|
|
|
744
765
|
}
|
|
745
766
|
function useStorageDownload(bucket, path, enabled = true) {
|
|
746
767
|
const client = useFluxbaseClient();
|
|
747
|
-
return (0,
|
|
768
|
+
return (0, import_react_query8.useQuery)({
|
|
748
769
|
queryKey: ["fluxbase", "storage", bucket, "download", path],
|
|
749
770
|
queryFn: async () => {
|
|
750
771
|
if (!path) {
|
|
@@ -761,8 +782,8 @@ function useStorageDownload(bucket, path, enabled = true) {
|
|
|
761
782
|
}
|
|
762
783
|
function useStorageDelete(bucket) {
|
|
763
784
|
const client = useFluxbaseClient();
|
|
764
|
-
const queryClient = (0,
|
|
765
|
-
return (0,
|
|
785
|
+
const queryClient = (0, import_react_query8.useQueryClient)();
|
|
786
|
+
return (0, import_react_query8.useMutation)({
|
|
766
787
|
mutationFn: async (paths) => {
|
|
767
788
|
const { error } = await client.storage.from(bucket).remove(paths);
|
|
768
789
|
if (error) {
|
|
@@ -793,7 +814,7 @@ function useStorageTransformUrl(bucket, path, transform) {
|
|
|
793
814
|
}
|
|
794
815
|
function useStorageSignedUrl(bucket, path, expiresIn) {
|
|
795
816
|
const client = useFluxbaseClient();
|
|
796
|
-
return (0,
|
|
817
|
+
return (0, import_react_query8.useQuery)({
|
|
797
818
|
queryKey: ["fluxbase", "storage", bucket, "signed-url", path, expiresIn],
|
|
798
819
|
queryFn: async () => {
|
|
799
820
|
if (!path) {
|
|
@@ -814,7 +835,7 @@ function useStorageSignedUrlWithOptions(bucket, path, options) {
|
|
|
814
835
|
const client = useFluxbaseClient();
|
|
815
836
|
const expiresIn = options?.expiresIn;
|
|
816
837
|
const transformKey = options?.transform ? JSON.stringify(options.transform) : null;
|
|
817
|
-
return (0,
|
|
838
|
+
return (0, import_react_query8.useQuery)({
|
|
818
839
|
queryKey: [
|
|
819
840
|
"fluxbase",
|
|
820
841
|
"storage",
|
|
@@ -841,8 +862,8 @@ function useStorageSignedUrlWithOptions(bucket, path, options) {
|
|
|
841
862
|
}
|
|
842
863
|
function useStorageMove(bucket) {
|
|
843
864
|
const client = useFluxbaseClient();
|
|
844
|
-
const queryClient = (0,
|
|
845
|
-
return (0,
|
|
865
|
+
const queryClient = (0, import_react_query8.useQueryClient)();
|
|
866
|
+
return (0, import_react_query8.useMutation)({
|
|
846
867
|
mutationFn: async (params) => {
|
|
847
868
|
const { fromPath, toPath } = params;
|
|
848
869
|
const { data, error } = await client.storage.from(bucket).move(fromPath, toPath);
|
|
@@ -860,8 +881,8 @@ function useStorageMove(bucket) {
|
|
|
860
881
|
}
|
|
861
882
|
function useStorageCopy(bucket) {
|
|
862
883
|
const client = useFluxbaseClient();
|
|
863
|
-
const queryClient = (0,
|
|
864
|
-
return (0,
|
|
884
|
+
const queryClient = (0, import_react_query8.useQueryClient)();
|
|
885
|
+
return (0, import_react_query8.useMutation)({
|
|
865
886
|
mutationFn: async (params) => {
|
|
866
887
|
const { fromPath, toPath } = params;
|
|
867
888
|
const { data, error } = await client.storage.from(bucket).copy(fromPath, toPath);
|
|
@@ -879,7 +900,7 @@ function useStorageCopy(bucket) {
|
|
|
879
900
|
}
|
|
880
901
|
function useStorageBuckets() {
|
|
881
902
|
const client = useFluxbaseClient();
|
|
882
|
-
return (0,
|
|
903
|
+
return (0, import_react_query8.useQuery)({
|
|
883
904
|
queryKey: ["fluxbase", "storage", "buckets"],
|
|
884
905
|
queryFn: async () => {
|
|
885
906
|
const { data, error } = await client.storage.listBuckets();
|
|
@@ -892,8 +913,8 @@ function useStorageBuckets() {
|
|
|
892
913
|
}
|
|
893
914
|
function useCreateBucket() {
|
|
894
915
|
const client = useFluxbaseClient();
|
|
895
|
-
const queryClient = (0,
|
|
896
|
-
return (0,
|
|
916
|
+
const queryClient = (0, import_react_query8.useQueryClient)();
|
|
917
|
+
return (0, import_react_query8.useMutation)({
|
|
897
918
|
mutationFn: async (bucketName) => {
|
|
898
919
|
const { error } = await client.storage.createBucket(bucketName);
|
|
899
920
|
if (error) {
|
|
@@ -909,8 +930,8 @@ function useCreateBucket() {
|
|
|
909
930
|
}
|
|
910
931
|
function useDeleteBucket() {
|
|
911
932
|
const client = useFluxbaseClient();
|
|
912
|
-
const queryClient = (0,
|
|
913
|
-
return (0,
|
|
933
|
+
const queryClient = (0, import_react_query8.useQueryClient)();
|
|
934
|
+
return (0, import_react_query8.useMutation)({
|
|
914
935
|
mutationFn: async (bucketName) => {
|
|
915
936
|
const { error } = await client.storage.deleteBucket(bucketName);
|
|
916
937
|
if (error) {
|
|
@@ -1318,6 +1339,7 @@ function useWebhooks(options = {}) {
|
|
|
1318
1339
|
useAdminAuth,
|
|
1319
1340
|
useAppSettings,
|
|
1320
1341
|
useAuth,
|
|
1342
|
+
useAuthConfig,
|
|
1321
1343
|
useCaptcha,
|
|
1322
1344
|
useCaptchaConfig,
|
|
1323
1345
|
useClientKeys,
|