@fluxbase/sdk-react 0.0.1-rc.6 → 0.0.1-rc.60

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/CHANGELOG.md CHANGED
@@ -64,4 +64,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
64
64
  - `@tanstack/react-query`: ^5.0.0
65
65
  - `react`: ^18.0.0 || ^19.0.0
66
66
 
67
- [0.1.0]: https://github.com/wayli-app/fluxbase/releases/tag/sdk-react-v0.1.0
67
+ [0.1.0]: https://github.com/fluxbase-eu/fluxbase/releases/tag/sdk-react-v0.1.0
package/README.md CHANGED
@@ -23,13 +23,13 @@ npm install @fluxbase/sdk @fluxbase/sdk-react @tanstack/react-query
23
23
  ## Quick Start
24
24
 
25
25
  ```tsx
26
- import { createClient } from '@fluxbase/sdk'
27
- import { FluxbaseProvider, useAuth, useTable } from '@fluxbase/sdk-react'
28
- import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
26
+ import { createClient } from "@fluxbase/sdk";
27
+ import { FluxbaseProvider, useAuth, useTable } from "@fluxbase/sdk-react";
28
+ import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
29
29
 
30
30
  // Create clients
31
- const fluxbaseClient = createClient({ url: 'http://localhost:8080' })
32
- const queryClient = new QueryClient()
31
+ const fluxbaseClient = createClient({ url: "http://localhost:8080" });
32
+ const queryClient = new QueryClient();
33
33
 
34
34
  function App() {
35
35
  return (
@@ -38,14 +38,14 @@ function App() {
38
38
  <YourApp />
39
39
  </FluxbaseProvider>
40
40
  </QueryClientProvider>
41
- )
41
+ );
42
42
  }
43
43
 
44
44
  function YourApp() {
45
- const { user, signIn, signOut } = useAuth()
46
- const { data: products } = useTable('products', (q) =>
47
- q.select('*').eq('active', true).order('created_at', { ascending: false })
48
- )
45
+ const { user, signIn, signOut } = useAuth();
46
+ const { data: products } = useTable("products", (q) =>
47
+ q.select("*").eq("active", true).order("created_at", { ascending: false })
48
+ );
49
49
 
50
50
  return (
51
51
  <div>
@@ -55,7 +55,11 @@ function YourApp() {
55
55
  <button onClick={signOut}>Sign Out</button>
56
56
  </>
57
57
  ) : (
58
- <button onClick={() => signIn({ email: 'user@example.com', password: 'pass' })}>
58
+ <button
59
+ onClick={() =>
60
+ signIn({ email: "user@example.com", password: "pass" })
61
+ }
62
+ >
59
63
  Sign In
60
64
  </button>
61
65
  )}
@@ -65,13 +69,14 @@ function YourApp() {
65
69
  <div key={product.id}>{product.name}</div>
66
70
  ))}
67
71
  </div>
68
- )
72
+ );
69
73
  }
70
74
  ```
71
75
 
72
76
  ## Available Hooks
73
77
 
74
78
  ### Authentication
79
+
75
80
  - `useAuth()` - Complete auth state and methods
76
81
  - `useUser()` - Current user data
77
82
  - `useSession()` - Current session
@@ -81,6 +86,7 @@ function YourApp() {
81
86
  - `useUpdateUser()` - Update user profile
82
87
 
83
88
  ### Database
89
+
84
90
  - `useTable()` - Query table with filters and ordering
85
91
  - `useFluxbaseQuery()` - Custom query hook
86
92
  - `useInsert()` - Insert rows
@@ -90,6 +96,7 @@ function YourApp() {
90
96
  - `useFluxbaseMutation()` - Generic mutation hook
91
97
 
92
98
  ### Realtime
99
+
93
100
  - `useRealtime()` - Subscribe to database changes
94
101
  - `useTableSubscription()` - Auto-refetch on changes
95
102
  - `useTableInserts()` - Listen to inserts
@@ -97,6 +104,7 @@ function YourApp() {
97
104
  - `useTableDeletes()` - Listen to deletes
98
105
 
99
106
  ### Storage
107
+
100
108
  - `useStorageUpload()` - Upload files
101
109
  - `useStorageList()` - List files in bucket
102
110
  - `useStorageDownload()` - Download files
@@ -105,11 +113,13 @@ function YourApp() {
105
113
  - `useStoragePublicUrl()` - Get public URLs
106
114
 
107
115
  ### RPC (PostgreSQL Functions)
116
+
108
117
  - `useRPC()` - Call PostgreSQL function (query)
109
118
  - `useRPCMutation()` - Call PostgreSQL function (mutation)
110
119
  - `useRPCBatch()` - Call multiple functions in parallel
111
120
 
112
121
  ### Admin (Management & Operations)
122
+
113
123
  - `useAdminAuth()` - Admin authentication state and login/logout
114
124
  - `useUsers()` - User management with pagination and CRUD
115
125
  - `useAPIKeys()` - API key creation and management
@@ -124,11 +134,13 @@ function YourApp() {
124
134
  📚 **[Complete React Hooks Guide](../../docs/docs/sdks/react-hooks.md)**
125
135
 
126
136
  ### Core Guides
137
+
127
138
  - **[Getting Started](../../docs/docs/sdks/getting-started.md)** - Installation and setup
128
139
  - **[React Hooks](../../docs/docs/sdks/react-hooks.md)** - Comprehensive hooks documentation with examples
129
140
  - **[Database Operations](../../docs/docs/sdks/database.md)** - Query building and data operations
130
141
 
131
142
  ### API Reference
143
+
132
144
  - **[React Hooks API](../../docs/static/api/sdk-react/)** - Auto-generated from source code
133
145
  - **[Core SDK API](../../docs/static/api/sdk/)** - Core TypeScript SDK reference
134
146
 
@@ -154,6 +166,7 @@ function ProductList() {
154
166
  ## Examples
155
167
 
156
168
  Check out working examples in the [`/example`](../example/) directory:
169
+
157
170
  - React with Vite
158
171
  - Next.js App Router
159
172
  - Next.js Pages Router
@@ -174,5 +187,5 @@ MIT © Fluxbase
174
187
  - [Documentation](../../docs/docs/sdks/react-hooks.md)
175
188
  - [API Reference](../../docs/static/api/sdk-react/)
176
189
  - [Core SDK](../sdk/)
177
- - [GitHub](https://github.com/wayli-app/fluxbase)
178
- - [Issues](https://github.com/wayli-app/fluxbase/issues)
190
+ - [GitHub](https://github.com/fluxbase-eu/fluxbase)
191
+ - [Issues](https://github.com/fluxbase-eu/fluxbase/issues)
package/dist/index.d.mts CHANGED
@@ -1,11 +1,10 @@
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, QueryBuilder, RealtimeCallback, RealtimeChangePayload, ListOptions, UploadOptions, AdminAuthResponse, ListUsersOptions, EnrichedUser, APIKey, CreateAPIKeyRequest, Webhook, CreateWebhookRequest, UpdateWebhookRequest, AppSettings, UpdateAppSettingsRequest, SystemSetting, UpdateSystemSettingRequest } from '@fluxbase/sdk';
4
+ import { FluxbaseClient, User, AuthSession, SignInCredentials, SignUpCredentials, QueryBuilder, RealtimeCallback, RealtimePostgresChangesPayload, ListOptions, UploadOptions, AdminAuthResponse, ListUsersOptions, EnrichedUser, APIKey, CreateAPIKeyRequest, Webhook, CreateWebhookRequest, UpdateWebhookRequest, AppSettings, UpdateAppSettingsRequest, SystemSetting, UpdateSystemSettingRequest } from '@fluxbase/sdk';
5
5
  export { APIKey, AdminUser, AppSettings, AuthSession, EnrichedUser, FluxbaseClient, PostgrestResponse, RealtimeChangePayload, SignInCredentials, SignUpCredentials, StorageObject, SystemSetting, User, Webhook } from '@fluxbase/sdk';
6
6
  import * as _tanstack_react_query from '@tanstack/react-query';
7
- import { UseQueryOptions, UseMutationOptions } from '@tanstack/react-query';
8
- import * as _tanstack_query_core from '@tanstack/query-core';
7
+ import { UseQueryOptions } from '@tanstack/react-query';
9
8
 
10
9
  interface FluxbaseProviderProps {
11
10
  client: FluxbaseClient;
@@ -31,11 +30,11 @@ declare function useSession(): _tanstack_react_query.UseQueryResult<AuthSession
31
30
  /**
32
31
  * Hook for signing in
33
32
  */
34
- declare function useSignIn(): _tanstack_react_query.UseMutationResult<AuthSession | _fluxbase_sdk.SignInWith2FAResponse, Error, SignInCredentials, unknown>;
33
+ declare function useSignIn(): _tanstack_react_query.UseMutationResult<_fluxbase_sdk.FluxbaseResponse<_fluxbase_sdk.AuthResponseData | _fluxbase_sdk.SignInWith2FAResponse>, Error, SignInCredentials, unknown>;
35
34
  /**
36
35
  * Hook for signing up
37
36
  */
38
- declare function useSignUp(): _tanstack_react_query.UseMutationResult<AuthSession, Error, SignUpCredentials, unknown>;
37
+ declare function useSignUp(): _tanstack_react_query.UseMutationResult<_fluxbase_sdk.FluxbaseAuthResponse, Error, SignUpCredentials, unknown>;
39
38
  /**
40
39
  * Hook for signing out
41
40
  */
@@ -43,7 +42,7 @@ declare function useSignOut(): _tanstack_react_query.UseMutationResult<void, Err
43
42
  /**
44
43
  * Hook for updating the current user
45
44
  */
46
- declare function useUpdateUser(): _tanstack_react_query.UseMutationResult<User, Error, Partial<Pick<User, "email" | "metadata">>, unknown>;
45
+ declare function useUpdateUser(): _tanstack_react_query.UseMutationResult<_fluxbase_sdk.UserResponse, Error, Partial<Pick<User, "email" | "metadata">>, unknown>;
47
46
  /**
48
47
  * Combined auth hook with all auth state and methods
49
48
  */
@@ -52,10 +51,10 @@ declare function useAuth(): {
52
51
  session: AuthSession | null | undefined;
53
52
  isLoading: boolean;
54
53
  isAuthenticated: boolean;
55
- signIn: _tanstack_react_query.UseMutateAsyncFunction<AuthSession | _fluxbase_sdk.SignInWith2FAResponse, Error, SignInCredentials, unknown>;
56
- signUp: _tanstack_react_query.UseMutateAsyncFunction<AuthSession, Error, SignUpCredentials, unknown>;
54
+ signIn: _tanstack_react_query.UseMutateAsyncFunction<_fluxbase_sdk.FluxbaseResponse<_fluxbase_sdk.AuthResponseData | _fluxbase_sdk.SignInWith2FAResponse>, Error, SignInCredentials, unknown>;
55
+ signUp: _tanstack_react_query.UseMutateAsyncFunction<_fluxbase_sdk.FluxbaseAuthResponse, Error, SignUpCredentials, unknown>;
57
56
  signOut: _tanstack_react_query.UseMutateAsyncFunction<void, Error, void, unknown>;
58
- updateUser: _tanstack_react_query.UseMutateAsyncFunction<User, Error, Partial<Pick<User, "email" | "metadata">>, unknown>;
57
+ updateUser: _tanstack_react_query.UseMutateAsyncFunction<_fluxbase_sdk.UserResponse, Error, Partial<Pick<User, "email" | "metadata">>, unknown>;
59
58
  isSigningIn: boolean;
60
59
  isSigningUp: boolean;
61
60
  isSigningOut: boolean;
@@ -108,7 +107,7 @@ interface UseRealtimeOptions {
108
107
  /**
109
108
  * Event type to listen for ('INSERT', 'UPDATE', 'DELETE', or '*' for all)
110
109
  */
111
- event?: 'INSERT' | 'UPDATE' | 'DELETE' | '*';
110
+ event?: "INSERT" | "UPDATE" | "DELETE" | "*";
112
111
  /**
113
112
  * Callback function when an event is received
114
113
  */
@@ -140,36 +139,59 @@ declare function useRealtime(options: UseRealtimeOptions): {
140
139
  * @param table - Table name (with optional schema, e.g., 'public.products')
141
140
  * @param options - Subscription options
142
141
  */
143
- declare function useTableSubscription(table: string, options?: Omit<UseRealtimeOptions, 'channel'>): {
142
+ declare function useTableSubscription(table: string, options?: Omit<UseRealtimeOptions, "channel">): {
144
143
  channel: _fluxbase_sdk.RealtimeChannel | null;
145
144
  };
146
145
  /**
147
146
  * Hook to subscribe to INSERT events on a table
148
147
  */
149
- declare function useTableInserts(table: string, callback: (payload: RealtimeChangePayload) => void, options?: Omit<UseRealtimeOptions, 'channel' | 'event' | 'callback'>): {
148
+ declare function useTableInserts(table: string, callback: (payload: RealtimePostgresChangesPayload) => void, options?: Omit<UseRealtimeOptions, "channel" | "event" | "callback">): {
150
149
  channel: _fluxbase_sdk.RealtimeChannel | null;
151
150
  };
152
151
  /**
153
152
  * Hook to subscribe to UPDATE events on a table
154
153
  */
155
- declare function useTableUpdates(table: string, callback: (payload: RealtimeChangePayload) => void, options?: Omit<UseRealtimeOptions, 'channel' | 'event' | 'callback'>): {
154
+ declare function useTableUpdates(table: string, callback: (payload: RealtimePostgresChangesPayload) => void, options?: Omit<UseRealtimeOptions, "channel" | "event" | "callback">): {
156
155
  channel: _fluxbase_sdk.RealtimeChannel | null;
157
156
  };
158
157
  /**
159
158
  * Hook to subscribe to DELETE events on a table
160
159
  */
161
- declare function useTableDeletes(table: string, callback: (payload: RealtimeChangePayload) => void, options?: Omit<UseRealtimeOptions, 'channel' | 'event' | 'callback'>): {
160
+ declare function useTableDeletes(table: string, callback: (payload: RealtimePostgresChangesPayload) => void, options?: Omit<UseRealtimeOptions, "channel" | "event" | "callback">): {
162
161
  channel: _fluxbase_sdk.RealtimeChannel | null;
163
162
  };
164
163
 
165
164
  /**
166
165
  * Hook to list files in a bucket
167
166
  */
168
- declare function useStorageList(bucket: string, options?: ListOptions & Omit<UseQueryOptions<any[], Error>, 'queryKey' | 'queryFn'>): _tanstack_react_query.UseQueryResult<any[], Error>;
167
+ declare function useStorageList(bucket: string, options?: ListOptions & Omit<UseQueryOptions<any[], Error>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<any[], Error>;
169
168
  /**
170
169
  * Hook to upload a file to a bucket
170
+ *
171
+ * Note: You can track upload progress by passing an `onUploadProgress` callback in the options:
172
+ *
173
+ * @example
174
+ * ```tsx
175
+ * const upload = useStorageUpload('avatars')
176
+ *
177
+ * upload.mutate({
178
+ * path: 'user.jpg',
179
+ * file: file,
180
+ * options: {
181
+ * onUploadProgress: (progress) => {
182
+ * console.log(`${progress.percentage}% uploaded`)
183
+ * }
184
+ * }
185
+ * })
186
+ * ```
187
+ *
188
+ * For automatic progress state management, use `useStorageUploadWithProgress` instead.
171
189
  */
172
- declare function useStorageUpload(bucket: string): _tanstack_react_query.UseMutationResult<_fluxbase_sdk.StorageObject | null, Error, {
190
+ declare function useStorageUpload(bucket: string): _tanstack_react_query.UseMutationResult<{
191
+ id: string;
192
+ path: string;
193
+ fullPath: string;
194
+ } | null, Error, {
173
195
  path: string;
174
196
  file: File | Blob | ArrayBuffer;
175
197
  options?: UploadOptions;
@@ -193,14 +215,18 @@ declare function useStorageSignedUrl(bucket: string, path: string | null, expire
193
215
  /**
194
216
  * Hook to move a file
195
217
  */
196
- declare function useStorageMove(bucket: string): _tanstack_react_query.UseMutationResult<_fluxbase_sdk.StorageObject | null, Error, {
218
+ declare function useStorageMove(bucket: string): _tanstack_react_query.UseMutationResult<{
219
+ message: string;
220
+ } | null, Error, {
197
221
  fromPath: string;
198
222
  toPath: string;
199
223
  }, unknown>;
200
224
  /**
201
225
  * Hook to copy a file
202
226
  */
203
- declare function useStorageCopy(bucket: string): _tanstack_react_query.UseMutationResult<_fluxbase_sdk.StorageObject | null, Error, {
227
+ declare function useStorageCopy(bucket: string): _tanstack_react_query.UseMutationResult<{
228
+ path: string;
229
+ } | null, Error, {
204
230
  fromPath: string;
205
231
  toPath: string;
206
232
  }, unknown>;
@@ -220,52 +246,6 @@ declare function useCreateBucket(): _tanstack_react_query.UseMutationResult<void
220
246
  */
221
247
  declare function useDeleteBucket(): _tanstack_react_query.UseMutationResult<void, Error, string, unknown>;
222
248
 
223
- /**
224
- * Hook to call a PostgreSQL function and cache the result
225
- *
226
- * @example
227
- * ```tsx
228
- * const { data, isLoading, error } = useRPC(
229
- * 'calculate_total',
230
- * { order_id: 123 },
231
- * { enabled: !!orderId }
232
- * )
233
- * ```
234
- */
235
- declare function useRPC<TData = unknown, TParams extends Record<string, unknown> = Record<string, unknown>>(functionName: string, params?: TParams, options?: Omit<UseQueryOptions<TData, Error>, 'queryKey' | 'queryFn'>): _tanstack_react_query.UseQueryResult<_tanstack_query_core.NoInfer<TData>, Error>;
236
- /**
237
- * Hook to create a mutation for calling PostgreSQL functions
238
- * Useful for functions that modify data
239
- *
240
- * @example
241
- * ```tsx
242
- * const createOrder = useRPCMutation('create_order')
243
- *
244
- * const handleSubmit = async () => {
245
- * await createOrder.mutateAsync({
246
- * user_id: 123,
247
- * items: [{ product_id: 1, quantity: 2 }]
248
- * })
249
- * }
250
- * ```
251
- */
252
- declare function useRPCMutation<TData = unknown, TParams extends Record<string, unknown> = Record<string, unknown>>(functionName: string, options?: Omit<UseMutationOptions<TData, Error, TParams>, 'mutationFn'>): _tanstack_react_query.UseMutationResult<TData, Error, TParams, unknown>;
253
- /**
254
- * Hook to call multiple RPC functions in parallel
255
- *
256
- * @example
257
- * ```tsx
258
- * const { data, isLoading } = useRPCBatch([
259
- * { name: 'get_user_stats', params: { user_id: 123 } },
260
- * { name: 'get_recent_orders', params: { limit: 10 } },
261
- * ])
262
- * ```
263
- */
264
- declare function useRPCBatch<TData = unknown>(calls: Array<{
265
- name: string;
266
- params?: Record<string, unknown>;
267
- }>, options?: Omit<UseQueryOptions<TData[], Error, TData[], readonly unknown[]>, 'queryKey' | 'queryFn'>): _tanstack_react_query.UseQueryResult<TData[], Error>;
268
-
269
249
  /**
270
250
  * Simplified admin user type returned by authentication
271
251
  */
@@ -603,4 +583,4 @@ interface UseWebhooksReturn {
603
583
  */
604
584
  declare function useWebhooks(options?: UseWebhooksOptions): UseWebhooksReturn;
605
585
 
606
- export { FluxbaseProvider, useAPIKeys, useAdminAuth, useAppSettings, useAuth, useCreateBucket, useDelete, useDeleteBucket, useFluxbaseClient, useFluxbaseQuery, useInsert, useRPC, useRPCBatch, useRPCMutation, useRealtime, useSession, useSignIn, useSignOut, useSignUp, useStorageBuckets, useStorageCopy, useStorageDelete, useStorageDownload, useStorageList, useStorageMove, useStoragePublicUrl, useStorageSignedUrl, useStorageUpload, useSystemSettings, useTable, useTableDeletes, useTableInserts, useTableSubscription, useTableUpdates, useUpdate, useUpdateUser, useUpsert, useUser, useUsers, useWebhooks };
586
+ export { FluxbaseProvider, useAPIKeys, useAdminAuth, useAppSettings, useAuth, useCreateBucket, useDelete, useDeleteBucket, useFluxbaseClient, useFluxbaseQuery, useInsert, useRealtime, useSession, useSignIn, useSignOut, useSignUp, useStorageBuckets, useStorageCopy, useStorageDelete, useStorageDownload, useStorageList, useStorageMove, useStoragePublicUrl, useStorageSignedUrl, useStorageUpload, useSystemSettings, useTable, useTableDeletes, useTableInserts, useTableSubscription, useTableUpdates, useUpdate, useUpdateUser, useUpsert, useUser, useUsers, useWebhooks };
package/dist/index.d.ts CHANGED
@@ -1,11 +1,10 @@
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, QueryBuilder, RealtimeCallback, RealtimeChangePayload, ListOptions, UploadOptions, AdminAuthResponse, ListUsersOptions, EnrichedUser, APIKey, CreateAPIKeyRequest, Webhook, CreateWebhookRequest, UpdateWebhookRequest, AppSettings, UpdateAppSettingsRequest, SystemSetting, UpdateSystemSettingRequest } from '@fluxbase/sdk';
4
+ import { FluxbaseClient, User, AuthSession, SignInCredentials, SignUpCredentials, QueryBuilder, RealtimeCallback, RealtimePostgresChangesPayload, ListOptions, UploadOptions, AdminAuthResponse, ListUsersOptions, EnrichedUser, APIKey, CreateAPIKeyRequest, Webhook, CreateWebhookRequest, UpdateWebhookRequest, AppSettings, UpdateAppSettingsRequest, SystemSetting, UpdateSystemSettingRequest } from '@fluxbase/sdk';
5
5
  export { APIKey, AdminUser, AppSettings, AuthSession, EnrichedUser, FluxbaseClient, PostgrestResponse, RealtimeChangePayload, SignInCredentials, SignUpCredentials, StorageObject, SystemSetting, User, Webhook } from '@fluxbase/sdk';
6
6
  import * as _tanstack_react_query from '@tanstack/react-query';
7
- import { UseQueryOptions, UseMutationOptions } from '@tanstack/react-query';
8
- import * as _tanstack_query_core from '@tanstack/query-core';
7
+ import { UseQueryOptions } from '@tanstack/react-query';
9
8
 
10
9
  interface FluxbaseProviderProps {
11
10
  client: FluxbaseClient;
@@ -31,11 +30,11 @@ declare function useSession(): _tanstack_react_query.UseQueryResult<AuthSession
31
30
  /**
32
31
  * Hook for signing in
33
32
  */
34
- declare function useSignIn(): _tanstack_react_query.UseMutationResult<AuthSession | _fluxbase_sdk.SignInWith2FAResponse, Error, SignInCredentials, unknown>;
33
+ declare function useSignIn(): _tanstack_react_query.UseMutationResult<_fluxbase_sdk.FluxbaseResponse<_fluxbase_sdk.AuthResponseData | _fluxbase_sdk.SignInWith2FAResponse>, Error, SignInCredentials, unknown>;
35
34
  /**
36
35
  * Hook for signing up
37
36
  */
38
- declare function useSignUp(): _tanstack_react_query.UseMutationResult<AuthSession, Error, SignUpCredentials, unknown>;
37
+ declare function useSignUp(): _tanstack_react_query.UseMutationResult<_fluxbase_sdk.FluxbaseAuthResponse, Error, SignUpCredentials, unknown>;
39
38
  /**
40
39
  * Hook for signing out
41
40
  */
@@ -43,7 +42,7 @@ declare function useSignOut(): _tanstack_react_query.UseMutationResult<void, Err
43
42
  /**
44
43
  * Hook for updating the current user
45
44
  */
46
- declare function useUpdateUser(): _tanstack_react_query.UseMutationResult<User, Error, Partial<Pick<User, "email" | "metadata">>, unknown>;
45
+ declare function useUpdateUser(): _tanstack_react_query.UseMutationResult<_fluxbase_sdk.UserResponse, Error, Partial<Pick<User, "email" | "metadata">>, unknown>;
47
46
  /**
48
47
  * Combined auth hook with all auth state and methods
49
48
  */
@@ -52,10 +51,10 @@ declare function useAuth(): {
52
51
  session: AuthSession | null | undefined;
53
52
  isLoading: boolean;
54
53
  isAuthenticated: boolean;
55
- signIn: _tanstack_react_query.UseMutateAsyncFunction<AuthSession | _fluxbase_sdk.SignInWith2FAResponse, Error, SignInCredentials, unknown>;
56
- signUp: _tanstack_react_query.UseMutateAsyncFunction<AuthSession, Error, SignUpCredentials, unknown>;
54
+ signIn: _tanstack_react_query.UseMutateAsyncFunction<_fluxbase_sdk.FluxbaseResponse<_fluxbase_sdk.AuthResponseData | _fluxbase_sdk.SignInWith2FAResponse>, Error, SignInCredentials, unknown>;
55
+ signUp: _tanstack_react_query.UseMutateAsyncFunction<_fluxbase_sdk.FluxbaseAuthResponse, Error, SignUpCredentials, unknown>;
57
56
  signOut: _tanstack_react_query.UseMutateAsyncFunction<void, Error, void, unknown>;
58
- updateUser: _tanstack_react_query.UseMutateAsyncFunction<User, Error, Partial<Pick<User, "email" | "metadata">>, unknown>;
57
+ updateUser: _tanstack_react_query.UseMutateAsyncFunction<_fluxbase_sdk.UserResponse, Error, Partial<Pick<User, "email" | "metadata">>, unknown>;
59
58
  isSigningIn: boolean;
60
59
  isSigningUp: boolean;
61
60
  isSigningOut: boolean;
@@ -108,7 +107,7 @@ interface UseRealtimeOptions {
108
107
  /**
109
108
  * Event type to listen for ('INSERT', 'UPDATE', 'DELETE', or '*' for all)
110
109
  */
111
- event?: 'INSERT' | 'UPDATE' | 'DELETE' | '*';
110
+ event?: "INSERT" | "UPDATE" | "DELETE" | "*";
112
111
  /**
113
112
  * Callback function when an event is received
114
113
  */
@@ -140,36 +139,59 @@ declare function useRealtime(options: UseRealtimeOptions): {
140
139
  * @param table - Table name (with optional schema, e.g., 'public.products')
141
140
  * @param options - Subscription options
142
141
  */
143
- declare function useTableSubscription(table: string, options?: Omit<UseRealtimeOptions, 'channel'>): {
142
+ declare function useTableSubscription(table: string, options?: Omit<UseRealtimeOptions, "channel">): {
144
143
  channel: _fluxbase_sdk.RealtimeChannel | null;
145
144
  };
146
145
  /**
147
146
  * Hook to subscribe to INSERT events on a table
148
147
  */
149
- declare function useTableInserts(table: string, callback: (payload: RealtimeChangePayload) => void, options?: Omit<UseRealtimeOptions, 'channel' | 'event' | 'callback'>): {
148
+ declare function useTableInserts(table: string, callback: (payload: RealtimePostgresChangesPayload) => void, options?: Omit<UseRealtimeOptions, "channel" | "event" | "callback">): {
150
149
  channel: _fluxbase_sdk.RealtimeChannel | null;
151
150
  };
152
151
  /**
153
152
  * Hook to subscribe to UPDATE events on a table
154
153
  */
155
- declare function useTableUpdates(table: string, callback: (payload: RealtimeChangePayload) => void, options?: Omit<UseRealtimeOptions, 'channel' | 'event' | 'callback'>): {
154
+ declare function useTableUpdates(table: string, callback: (payload: RealtimePostgresChangesPayload) => void, options?: Omit<UseRealtimeOptions, "channel" | "event" | "callback">): {
156
155
  channel: _fluxbase_sdk.RealtimeChannel | null;
157
156
  };
158
157
  /**
159
158
  * Hook to subscribe to DELETE events on a table
160
159
  */
161
- declare function useTableDeletes(table: string, callback: (payload: RealtimeChangePayload) => void, options?: Omit<UseRealtimeOptions, 'channel' | 'event' | 'callback'>): {
160
+ declare function useTableDeletes(table: string, callback: (payload: RealtimePostgresChangesPayload) => void, options?: Omit<UseRealtimeOptions, "channel" | "event" | "callback">): {
162
161
  channel: _fluxbase_sdk.RealtimeChannel | null;
163
162
  };
164
163
 
165
164
  /**
166
165
  * Hook to list files in a bucket
167
166
  */
168
- declare function useStorageList(bucket: string, options?: ListOptions & Omit<UseQueryOptions<any[], Error>, 'queryKey' | 'queryFn'>): _tanstack_react_query.UseQueryResult<any[], Error>;
167
+ declare function useStorageList(bucket: string, options?: ListOptions & Omit<UseQueryOptions<any[], Error>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<any[], Error>;
169
168
  /**
170
169
  * Hook to upload a file to a bucket
170
+ *
171
+ * Note: You can track upload progress by passing an `onUploadProgress` callback in the options:
172
+ *
173
+ * @example
174
+ * ```tsx
175
+ * const upload = useStorageUpload('avatars')
176
+ *
177
+ * upload.mutate({
178
+ * path: 'user.jpg',
179
+ * file: file,
180
+ * options: {
181
+ * onUploadProgress: (progress) => {
182
+ * console.log(`${progress.percentage}% uploaded`)
183
+ * }
184
+ * }
185
+ * })
186
+ * ```
187
+ *
188
+ * For automatic progress state management, use `useStorageUploadWithProgress` instead.
171
189
  */
172
- declare function useStorageUpload(bucket: string): _tanstack_react_query.UseMutationResult<_fluxbase_sdk.StorageObject | null, Error, {
190
+ declare function useStorageUpload(bucket: string): _tanstack_react_query.UseMutationResult<{
191
+ id: string;
192
+ path: string;
193
+ fullPath: string;
194
+ } | null, Error, {
173
195
  path: string;
174
196
  file: File | Blob | ArrayBuffer;
175
197
  options?: UploadOptions;
@@ -193,14 +215,18 @@ declare function useStorageSignedUrl(bucket: string, path: string | null, expire
193
215
  /**
194
216
  * Hook to move a file
195
217
  */
196
- declare function useStorageMove(bucket: string): _tanstack_react_query.UseMutationResult<_fluxbase_sdk.StorageObject | null, Error, {
218
+ declare function useStorageMove(bucket: string): _tanstack_react_query.UseMutationResult<{
219
+ message: string;
220
+ } | null, Error, {
197
221
  fromPath: string;
198
222
  toPath: string;
199
223
  }, unknown>;
200
224
  /**
201
225
  * Hook to copy a file
202
226
  */
203
- declare function useStorageCopy(bucket: string): _tanstack_react_query.UseMutationResult<_fluxbase_sdk.StorageObject | null, Error, {
227
+ declare function useStorageCopy(bucket: string): _tanstack_react_query.UseMutationResult<{
228
+ path: string;
229
+ } | null, Error, {
204
230
  fromPath: string;
205
231
  toPath: string;
206
232
  }, unknown>;
@@ -220,52 +246,6 @@ declare function useCreateBucket(): _tanstack_react_query.UseMutationResult<void
220
246
  */
221
247
  declare function useDeleteBucket(): _tanstack_react_query.UseMutationResult<void, Error, string, unknown>;
222
248
 
223
- /**
224
- * Hook to call a PostgreSQL function and cache the result
225
- *
226
- * @example
227
- * ```tsx
228
- * const { data, isLoading, error } = useRPC(
229
- * 'calculate_total',
230
- * { order_id: 123 },
231
- * { enabled: !!orderId }
232
- * )
233
- * ```
234
- */
235
- declare function useRPC<TData = unknown, TParams extends Record<string, unknown> = Record<string, unknown>>(functionName: string, params?: TParams, options?: Omit<UseQueryOptions<TData, Error>, 'queryKey' | 'queryFn'>): _tanstack_react_query.UseQueryResult<_tanstack_query_core.NoInfer<TData>, Error>;
236
- /**
237
- * Hook to create a mutation for calling PostgreSQL functions
238
- * Useful for functions that modify data
239
- *
240
- * @example
241
- * ```tsx
242
- * const createOrder = useRPCMutation('create_order')
243
- *
244
- * const handleSubmit = async () => {
245
- * await createOrder.mutateAsync({
246
- * user_id: 123,
247
- * items: [{ product_id: 1, quantity: 2 }]
248
- * })
249
- * }
250
- * ```
251
- */
252
- declare function useRPCMutation<TData = unknown, TParams extends Record<string, unknown> = Record<string, unknown>>(functionName: string, options?: Omit<UseMutationOptions<TData, Error, TParams>, 'mutationFn'>): _tanstack_react_query.UseMutationResult<TData, Error, TParams, unknown>;
253
- /**
254
- * Hook to call multiple RPC functions in parallel
255
- *
256
- * @example
257
- * ```tsx
258
- * const { data, isLoading } = useRPCBatch([
259
- * { name: 'get_user_stats', params: { user_id: 123 } },
260
- * { name: 'get_recent_orders', params: { limit: 10 } },
261
- * ])
262
- * ```
263
- */
264
- declare function useRPCBatch<TData = unknown>(calls: Array<{
265
- name: string;
266
- params?: Record<string, unknown>;
267
- }>, options?: Omit<UseQueryOptions<TData[], Error, TData[], readonly unknown[]>, 'queryKey' | 'queryFn'>): _tanstack_react_query.UseQueryResult<TData[], Error>;
268
-
269
249
  /**
270
250
  * Simplified admin user type returned by authentication
271
251
  */
@@ -603,4 +583,4 @@ interface UseWebhooksReturn {
603
583
  */
604
584
  declare function useWebhooks(options?: UseWebhooksOptions): UseWebhooksReturn;
605
585
 
606
- export { FluxbaseProvider, useAPIKeys, useAdminAuth, useAppSettings, useAuth, useCreateBucket, useDelete, useDeleteBucket, useFluxbaseClient, useFluxbaseQuery, useInsert, useRPC, useRPCBatch, useRPCMutation, useRealtime, useSession, useSignIn, useSignOut, useSignUp, useStorageBuckets, useStorageCopy, useStorageDelete, useStorageDownload, useStorageList, useStorageMove, useStoragePublicUrl, useStorageSignedUrl, useStorageUpload, useSystemSettings, useTable, useTableDeletes, useTableInserts, useTableSubscription, useTableUpdates, useUpdate, useUpdateUser, useUpsert, useUser, useUsers, useWebhooks };
586
+ export { FluxbaseProvider, useAPIKeys, useAdminAuth, useAppSettings, useAuth, useCreateBucket, useDelete, useDeleteBucket, useFluxbaseClient, useFluxbaseQuery, useInsert, useRealtime, useSession, useSignIn, useSignOut, useSignUp, useStorageBuckets, useStorageCopy, useStorageDelete, useStorageDownload, useStorageList, useStorageMove, useStoragePublicUrl, useStorageSignedUrl, useStorageUpload, useSystemSettings, useTable, useTableDeletes, useTableInserts, useTableSubscription, useTableUpdates, useUpdate, useUpdateUser, useUpsert, useUser, useUsers, useWebhooks };