@fluxbase/sdk 0.0.2-rc.2 → 0.1.0-rc.2
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 +29 -28
- package/dist/index.cjs +5285 -1076
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4723 -1256
- package/dist/index.d.ts +4723 -1256
- package/dist/index.js +5278 -1077
- package/dist/index.js.map +1 -1
- package/package.json +14 -3
package/README.md
CHANGED
|
@@ -30,48 +30,46 @@ pnpm add @fluxbase/sdk
|
|
|
30
30
|
## Quick Start
|
|
31
31
|
|
|
32
32
|
```typescript
|
|
33
|
-
import { createClient } from
|
|
33
|
+
import { createClient } from "@fluxbase/sdk";
|
|
34
34
|
|
|
35
35
|
// Create a client
|
|
36
36
|
const client = createClient({
|
|
37
|
-
url:
|
|
37
|
+
url: "http://localhost:8080",
|
|
38
38
|
auth: {
|
|
39
39
|
autoRefresh: true,
|
|
40
40
|
persist: true,
|
|
41
41
|
},
|
|
42
|
-
})
|
|
42
|
+
});
|
|
43
43
|
|
|
44
44
|
// Authentication
|
|
45
45
|
await client.auth.signUp({
|
|
46
|
-
email:
|
|
47
|
-
password:
|
|
48
|
-
})
|
|
46
|
+
email: "user@example.com",
|
|
47
|
+
password: "secure-password",
|
|
48
|
+
});
|
|
49
49
|
|
|
50
50
|
// Query data
|
|
51
51
|
const { data } = await client
|
|
52
|
-
.from(
|
|
53
|
-
.select(
|
|
54
|
-
.eq(
|
|
55
|
-
.gte(
|
|
56
|
-
.execute()
|
|
52
|
+
.from("products")
|
|
53
|
+
.select("*")
|
|
54
|
+
.eq("category", "electronics")
|
|
55
|
+
.gte("price", 100)
|
|
56
|
+
.execute();
|
|
57
57
|
|
|
58
58
|
// Aggregations
|
|
59
59
|
const stats = await client
|
|
60
|
-
.from(
|
|
61
|
-
.count(
|
|
62
|
-
.groupBy(
|
|
63
|
-
.execute()
|
|
60
|
+
.from("products")
|
|
61
|
+
.count("*")
|
|
62
|
+
.groupBy("category")
|
|
63
|
+
.execute();
|
|
64
64
|
|
|
65
65
|
// Realtime subscriptions
|
|
66
66
|
client.realtime
|
|
67
|
-
.channel(
|
|
68
|
-
.on(
|
|
69
|
-
.subscribe()
|
|
67
|
+
.channel("table:public.products")
|
|
68
|
+
.on("INSERT", (payload) => console.log("New:", payload.new_record))
|
|
69
|
+
.subscribe();
|
|
70
70
|
|
|
71
71
|
// File upload
|
|
72
|
-
await client.storage
|
|
73
|
-
.from('avatars')
|
|
74
|
-
.upload('user-123.png', file)
|
|
72
|
+
await client.storage.from("avatars").upload("user-123.png", file);
|
|
75
73
|
```
|
|
76
74
|
|
|
77
75
|
## Documentation
|
|
@@ -79,11 +77,13 @@ await client.storage
|
|
|
79
77
|
📚 **[Complete Documentation](../../docs/docs/sdks/getting-started.md)**
|
|
80
78
|
|
|
81
79
|
### Core Guides
|
|
80
|
+
|
|
82
81
|
- **[Getting Started](../../docs/docs/sdks/getting-started.md)** - Installation, configuration, and basic usage
|
|
83
82
|
- **[Database Operations](../../docs/docs/sdks/database.md)** - Queries, filters, aggregations, batch operations, and RPC
|
|
84
83
|
- **[React Hooks](../../docs/docs/sdks/react-hooks.md)** - React integration with `@fluxbase/sdk-react`
|
|
85
84
|
|
|
86
85
|
### API Reference
|
|
86
|
+
|
|
87
87
|
- **[TypeScript API Docs](../../docs/static/api/sdk/)** - Auto-generated from source code
|
|
88
88
|
|
|
89
89
|
## Browser & Node.js Support
|
|
@@ -97,19 +97,20 @@ Fully typed with TypeScript. Define your schemas for complete type safety:
|
|
|
97
97
|
|
|
98
98
|
```typescript
|
|
99
99
|
interface Product {
|
|
100
|
-
id: number
|
|
101
|
-
name: string
|
|
102
|
-
price: number
|
|
103
|
-
category: string
|
|
100
|
+
id: number;
|
|
101
|
+
name: string;
|
|
102
|
+
price: number;
|
|
103
|
+
category: string;
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
const { data } = await client.from<Product>(
|
|
106
|
+
const { data } = await client.from<Product>("products").select("*").execute();
|
|
107
107
|
// data is typed as Product[]
|
|
108
108
|
```
|
|
109
109
|
|
|
110
110
|
## Examples
|
|
111
111
|
|
|
112
112
|
Check out working examples in the [`/example`](../example/) directory:
|
|
113
|
+
|
|
113
114
|
- Vanilla JavaScript/TypeScript
|
|
114
115
|
- React with hooks
|
|
115
116
|
- Next.js integration
|
|
@@ -137,5 +138,5 @@ MIT © Fluxbase
|
|
|
137
138
|
|
|
138
139
|
- [Documentation](../../docs/docs/sdks/getting-started.md)
|
|
139
140
|
- [API Reference](../../docs/static/api/sdk/)
|
|
140
|
-
- [GitHub](https://github.com/
|
|
141
|
-
- [Issues](https://github.com/
|
|
141
|
+
- [GitHub](https://github.com/fluxbase-eu/fluxbase)
|
|
142
|
+
- [Issues](https://github.com/fluxbase-eu/fluxbase/issues)
|