@fluxbase/sdk 0.0.1-rc.44 → 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/README.md +29 -28
- package/dist/index.cjs +14 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -9
- package/dist/index.d.ts +7 -9
- package/dist/index.js +14 -8
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
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)
|
package/dist/index.cjs
CHANGED
|
@@ -1815,13 +1815,20 @@ var StorageBucket = class {
|
|
|
1815
1815
|
/**
|
|
1816
1816
|
* Upload a file to the bucket
|
|
1817
1817
|
* @param path - The path/key for the file
|
|
1818
|
-
* @param file - The file to upload (File, Blob, or
|
|
1818
|
+
* @param file - The file to upload (File, Blob, ArrayBuffer, or ArrayBufferView like Uint8Array)
|
|
1819
1819
|
* @param options - Upload options
|
|
1820
1820
|
*/
|
|
1821
1821
|
async upload(path, file, options) {
|
|
1822
1822
|
try {
|
|
1823
1823
|
const formData = new FormData();
|
|
1824
|
-
|
|
1824
|
+
let blob;
|
|
1825
|
+
if (file instanceof ArrayBuffer) {
|
|
1826
|
+
blob = new Blob([file], { type: options?.contentType });
|
|
1827
|
+
} else if (ArrayBuffer.isView(file)) {
|
|
1828
|
+
blob = new Blob([file], { type: options?.contentType });
|
|
1829
|
+
} else {
|
|
1830
|
+
blob = file;
|
|
1831
|
+
}
|
|
1825
1832
|
formData.append("file", blob);
|
|
1826
1833
|
if (options?.contentType) {
|
|
1827
1834
|
formData.append("content_type", options.contentType);
|
|
@@ -2640,6 +2647,7 @@ var FluxbaseJobs = class {
|
|
|
2640
2647
|
if (filters?.namespace) params.append("namespace", filters.namespace);
|
|
2641
2648
|
if (filters?.limit) params.append("limit", filters.limit.toString());
|
|
2642
2649
|
if (filters?.offset) params.append("offset", filters.offset.toString());
|
|
2650
|
+
if (filters?.includeResult) params.append("include_result", "true");
|
|
2643
2651
|
const queryString = params.toString();
|
|
2644
2652
|
const data = await this.fetch.get(
|
|
2645
2653
|
`/api/v1/jobs${queryString ? `?${queryString}` : ""}`
|
|
@@ -5396,6 +5404,7 @@ var FluxbaseAdminJobs = class _FluxbaseAdminJobs {
|
|
|
5396
5404
|
if (filters?.namespace) params.append("namespace", filters.namespace);
|
|
5397
5405
|
if (filters?.limit) params.append("limit", filters.limit.toString());
|
|
5398
5406
|
if (filters?.offset) params.append("offset", filters.offset.toString());
|
|
5407
|
+
if (filters?.includeResult) params.append("include_result", "true");
|
|
5399
5408
|
const queryString = params.toString();
|
|
5400
5409
|
const data = await this.fetch.get(
|
|
5401
5410
|
`/api/v1/admin/jobs/queue${queryString ? `?${queryString}` : ""}`
|
|
@@ -5848,9 +5857,7 @@ var FluxbaseAdmin = class {
|
|
|
5848
5857
|
* Creates the first admin user and completes initial setup.
|
|
5849
5858
|
* This endpoint can only be called once.
|
|
5850
5859
|
*
|
|
5851
|
-
* @param
|
|
5852
|
-
* @param password - Admin password (minimum 12 characters)
|
|
5853
|
-
* @param name - Admin display name
|
|
5860
|
+
* @param request - Setup request containing email, password, and name
|
|
5854
5861
|
* @returns Authentication response with tokens
|
|
5855
5862
|
*
|
|
5856
5863
|
* @example
|
|
@@ -5880,8 +5887,7 @@ var FluxbaseAdmin = class {
|
|
|
5880
5887
|
*
|
|
5881
5888
|
* Authenticate as an admin user
|
|
5882
5889
|
*
|
|
5883
|
-
* @param
|
|
5884
|
-
* @param password - Admin password
|
|
5890
|
+
* @param request - Login request containing email and password
|
|
5885
5891
|
* @returns Authentication response with tokens
|
|
5886
5892
|
*
|
|
5887
5893
|
* @example
|
|
@@ -5908,7 +5914,7 @@ var FluxbaseAdmin = class {
|
|
|
5908
5914
|
/**
|
|
5909
5915
|
* Refresh admin access token
|
|
5910
5916
|
*
|
|
5911
|
-
* @param
|
|
5917
|
+
* @param request - Refresh request containing the refresh token
|
|
5912
5918
|
* @returns New access and refresh tokens
|
|
5913
5919
|
*
|
|
5914
5920
|
* @example
|