@spacelr/sdk 0.1.0 → 0.1.1
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/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# @spacelr/sdk
|
|
2
|
+
|
|
3
|
+
> **Note:** Spacelr is currently under active development. APIs may change between releases.
|
|
4
|
+
|
|
5
|
+
TypeScript SDK for the Spacelr API — authentication, storage, database and realtime notifications.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @spacelr/sdk
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { createClient } from '@spacelr/sdk';
|
|
17
|
+
|
|
18
|
+
const spacelr = createClient({
|
|
19
|
+
apiUrl: 'https://api.your-domain.com',
|
|
20
|
+
projectId: 'your-project-id',
|
|
21
|
+
clientId: 'your-client-id',
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
// Login
|
|
25
|
+
const { user } = await spacelr.auth.login({
|
|
26
|
+
username: 'user@example.com',
|
|
27
|
+
password: 'password',
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
// Upload a file
|
|
31
|
+
await spacelr.storage.uploadFile({ file, path: '/images/photo.png' });
|
|
32
|
+
|
|
33
|
+
// Subscribe to database changes
|
|
34
|
+
spacelr.db.subscribe('my-collection', {
|
|
35
|
+
onChange: (event) => console.log('changed:', event),
|
|
36
|
+
});
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Modules
|
|
40
|
+
|
|
41
|
+
| Module | Description |
|
|
42
|
+
| --- | --- |
|
|
43
|
+
| `auth` | Login, registration, OAuth2 PKCE flow, token management, 2FA |
|
|
44
|
+
| `storage` | File upload (including multipart), download, sharing, quota |
|
|
45
|
+
| `db` | Database operations with realtime subscriptions via WebSocket |
|
|
46
|
+
| `notifications` | Web Push notification subscription management |
|
|
47
|
+
|
|
48
|
+
## Requirements
|
|
49
|
+
|
|
50
|
+
- Node.js >= 18
|
|
51
|
+
- TypeScript >= 5 (recommended)
|
|
52
|
+
|
|
53
|
+
## License
|
|
54
|
+
|
|
55
|
+
MIT
|