@fluxbase/sdk-react 0.0.1-rc.45 → 0.0.1-rc.46
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 +1 -1
- package/README.md +27 -14
- package/package.json +2 -2
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/
|
|
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
|
|
27
|
-
import { FluxbaseProvider, useAuth, useTable } from
|
|
28
|
-
import { QueryClient, QueryClientProvider } from
|
|
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:
|
|
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(
|
|
47
|
-
q.select(
|
|
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
|
|
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/
|
|
178
|
-
- [Issues](https://github.com/
|
|
190
|
+
- [GitHub](https://github.com/fluxbase-eu/fluxbase)
|
|
191
|
+
- [Issues](https://github.com/fluxbase-eu/fluxbase/issues)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluxbase/sdk-react",
|
|
3
|
-
"version": "0.0.1-rc.
|
|
3
|
+
"version": "0.0.1-rc.46",
|
|
4
4
|
"description": "React hooks for Fluxbase SDK",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
],
|
|
31
31
|
"repository": {
|
|
32
32
|
"type": "git",
|
|
33
|
-
"url": "https://github.com/
|
|
33
|
+
"url": "https://github.com/fluxbase-eu/fluxbase"
|
|
34
34
|
},
|
|
35
35
|
"publishConfig": {
|
|
36
36
|
"access": "public"
|