@afribase/afribase-js 0.2.0
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 +55 -0
- package/dist/index.d.mts +1113 -0
- package/dist/index.d.ts +1113 -0
- package/dist/index.js +1979 -0
- package/dist/index.mjs +1903 -0
- package/package.json +51 -0
package/README.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Afribase JS SDK
|
|
2
|
+
|
|
3
|
+
The official JavaScript/TypeScript client for Afribase.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @afribase/afribase-js
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
### Initializing the Client
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { createClient } from '@afribase/afribase-js';
|
|
17
|
+
|
|
18
|
+
const afribase = createClient('http://your-afribase-url.com', 'your-anon-key');
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Authentication
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
// Sign up
|
|
25
|
+
const { user, error } = await afribase.auth.signUp({
|
|
26
|
+
email: 'hello@useafribase.app',
|
|
27
|
+
password: 'password123'
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
// Sign in
|
|
31
|
+
const { access_token, error } = await afribase.auth.signIn({
|
|
32
|
+
email: 'hello@useafribase.app',
|
|
33
|
+
password: 'password123'
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
// Get current user
|
|
37
|
+
const user = await afribase.auth.getUser();
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Working with Data
|
|
41
|
+
|
|
42
|
+
```typescript
|
|
43
|
+
// Fetch data
|
|
44
|
+
const posts = await afribase.from('posts').select();
|
|
45
|
+
|
|
46
|
+
// Insert data
|
|
47
|
+
const newPost = await afribase.from('posts').insert({
|
|
48
|
+
title: 'Hello Afribase',
|
|
49
|
+
content: 'Building faster in Africa'
|
|
50
|
+
});
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## License
|
|
54
|
+
|
|
55
|
+
Apache-2.0
|