@vaiftech/sdk-expo 1.0.0 → 1.0.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 +17 -17
- package/dist/index.d.mts +528 -3
- package/dist/index.d.ts +528 -3
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
# @
|
|
1
|
+
# @vaiftech/sdk-expo
|
|
2
2
|
|
|
3
3
|
React Native and Expo SDK for VAIF Studio - a Backend-as-a-Service platform.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install @
|
|
8
|
+
npm install @vaiftech/sdk-expo @vaiftech/client @react-native-async-storage/async-storage
|
|
9
9
|
# or
|
|
10
|
-
pnpm add @
|
|
10
|
+
pnpm add @vaiftech/sdk-expo @vaiftech/client @react-native-async-storage/async-storage
|
|
11
11
|
# or
|
|
12
|
-
yarn add @
|
|
12
|
+
yarn add @vaiftech/sdk-expo @vaiftech/client @react-native-async-storage/async-storage
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
## Quick Start
|
|
16
16
|
|
|
17
17
|
```tsx
|
|
18
|
-
import { VaifProvider } from '@
|
|
19
|
-
import { createVaifClient } from '@
|
|
18
|
+
import { VaifProvider } from '@vaiftech/sdk-expo';
|
|
19
|
+
import { createVaifClient } from '@vaiftech/client';
|
|
20
20
|
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
21
21
|
|
|
22
22
|
const client = createVaifClient({
|
|
@@ -40,7 +40,7 @@ export default function App() {
|
|
|
40
40
|
Sessions are automatically persisted using AsyncStorage, so users stay logged in:
|
|
41
41
|
|
|
42
42
|
```tsx
|
|
43
|
-
import { useAuth } from '@
|
|
43
|
+
import { useAuth } from '@vaiftech/sdk-expo';
|
|
44
44
|
|
|
45
45
|
function LoginScreen() {
|
|
46
46
|
const { user, isLoading, signIn } = useAuth();
|
|
@@ -63,7 +63,7 @@ function LoginScreen() {
|
|
|
63
63
|
Upload images directly from Expo ImagePicker:
|
|
64
64
|
|
|
65
65
|
```tsx
|
|
66
|
-
import { useUpload } from '@
|
|
66
|
+
import { useUpload } from '@vaiftech/sdk-expo';
|
|
67
67
|
import * as ImagePicker from 'expo-image-picker';
|
|
68
68
|
|
|
69
69
|
function ImageUpload() {
|
|
@@ -97,7 +97,7 @@ function ImageUpload() {
|
|
|
97
97
|
### Realtime Updates
|
|
98
98
|
|
|
99
99
|
```tsx
|
|
100
|
-
import { useRealtime, useRealtimePresence } from '@
|
|
100
|
+
import { useRealtime, useRealtimePresence } from '@vaiftech/sdk-expo';
|
|
101
101
|
|
|
102
102
|
function ChatRoom({ roomId }) {
|
|
103
103
|
// Listen for new messages
|
|
@@ -129,7 +129,7 @@ function ChatRoom({ roomId }) {
|
|
|
129
129
|
### Authentication
|
|
130
130
|
|
|
131
131
|
```tsx
|
|
132
|
-
import { useAuth, useUser, useSession } from '@
|
|
132
|
+
import { useAuth, useUser, useSession } from '@vaiftech/sdk-expo';
|
|
133
133
|
|
|
134
134
|
// Full auth functionality
|
|
135
135
|
const {
|
|
@@ -154,7 +154,7 @@ const { session, refresh } = useSession();
|
|
|
154
154
|
### Data
|
|
155
155
|
|
|
156
156
|
```tsx
|
|
157
|
-
import { useQuery, useMutation, useRealtime } from '@
|
|
157
|
+
import { useQuery, useMutation, useRealtime } from '@vaiftech/sdk-expo';
|
|
158
158
|
|
|
159
159
|
// Fetch data
|
|
160
160
|
const { data, isLoading, error, refetch } = useQuery<Post>('posts', {
|
|
@@ -176,7 +176,7 @@ useRealtime<Post>('posts', {
|
|
|
176
176
|
### Storage
|
|
177
177
|
|
|
178
178
|
```tsx
|
|
179
|
-
import { useUpload, useDownload, usePublicUrl } from '@
|
|
179
|
+
import { useUpload, useDownload, usePublicUrl } from '@vaiftech/sdk-expo';
|
|
180
180
|
|
|
181
181
|
// Upload files
|
|
182
182
|
const { upload, uploadUri, isUploading, progress } = useUpload();
|
|
@@ -191,7 +191,7 @@ const url = usePublicUrl('avatars/user-123.jpg');
|
|
|
191
191
|
### Functions
|
|
192
192
|
|
|
193
193
|
```tsx
|
|
194
|
-
import { useFunction } from '@
|
|
194
|
+
import { useFunction } from '@vaiftech/sdk-expo';
|
|
195
195
|
|
|
196
196
|
const { invoke, isInvoking, result, error } = useFunction('process-image');
|
|
197
197
|
|
|
@@ -203,7 +203,7 @@ const handleProcess = async () => {
|
|
|
203
203
|
### Presence & Broadcast
|
|
204
204
|
|
|
205
205
|
```tsx
|
|
206
|
-
import { useRealtimePresence, useRealtimeBroadcast } from '@
|
|
206
|
+
import { useRealtimePresence, useRealtimeBroadcast } from '@vaiftech/sdk-expo';
|
|
207
207
|
|
|
208
208
|
// Presence tracking
|
|
209
209
|
const { users, track, leave } = useRealtimePresence('room-1');
|
|
@@ -229,9 +229,9 @@ const { data } = useQuery<User>('users');
|
|
|
229
229
|
|
|
230
230
|
## Related Packages
|
|
231
231
|
|
|
232
|
-
- [@
|
|
233
|
-
- [@
|
|
234
|
-
- [@
|
|
232
|
+
- [@vaiftech/client](https://www.npmjs.com/package/@vaiftech/client) - Core client SDK
|
|
233
|
+
- [@vaiftech/react](https://www.npmjs.com/package/@vaiftech/react) - React (web) hooks
|
|
234
|
+
- [@vaiftech/cli](https://www.npmjs.com/package/@vaiftech/cli) - CLI tools
|
|
235
235
|
|
|
236
236
|
## License
|
|
237
237
|
|