tevrocsdk 0.1.61 → 0.1.63
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 +107 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -240,6 +240,113 @@ await tevroc.native.projects.upsertUser({
|
|
|
240
240
|
});
|
|
241
241
|
```
|
|
242
242
|
|
|
243
|
+
## Capacitor SQLite setup (mobile)
|
|
244
|
+
|
|
245
|
+
For Capacitor mobile apps, enable native SQLite persistence by installing the `@capacitor-community/sqlite` plugin in your app project (not the SDK):
|
|
246
|
+
|
|
247
|
+
### Installation
|
|
248
|
+
|
|
249
|
+
```bash
|
|
250
|
+
cd your-capacitor-app
|
|
251
|
+
npm install @capacitor-community/sqlite jeep-sqlite sql.js --save
|
|
252
|
+
npx cap sync
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
### Configure capacitor.config.ts
|
|
256
|
+
|
|
257
|
+
Add SQLite plugin configuration:
|
|
258
|
+
|
|
259
|
+
```typescript
|
|
260
|
+
import type { CapacitorConfig } from "@capacitor/cli";
|
|
261
|
+
|
|
262
|
+
const config: CapacitorConfig = {
|
|
263
|
+
appId: "com.example.app",
|
|
264
|
+
appName: "Example App",
|
|
265
|
+
webDir: "dist",
|
|
266
|
+
plugins: {
|
|
267
|
+
CapacitorSQLite: {
|
|
268
|
+
iosDatabaseLocation: "Library/CapacitorDatabase",
|
|
269
|
+
iosIsEncryption: false,
|
|
270
|
+
iosKeychainPrefix: "your-app-prefix",
|
|
271
|
+
iosBiometric: {
|
|
272
|
+
biometricAuth: false,
|
|
273
|
+
biometricTitle: "Biometric login"
|
|
274
|
+
},
|
|
275
|
+
androidIsEncryption: false,
|
|
276
|
+
androidBiometric: {
|
|
277
|
+
biometricAuth: false,
|
|
278
|
+
biometricTitle: "Biometric login",
|
|
279
|
+
biometricSubTitle: "Log in using your biometric"
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
export default config;
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
### Android setup
|
|
289
|
+
|
|
290
|
+
1. Update `android/app/src/main/AndroidManifest.xml`:
|
|
291
|
+
|
|
292
|
+
```xml
|
|
293
|
+
<application
|
|
294
|
+
android:allowBackup="false"
|
|
295
|
+
android:dataExtractionRules="@xml/data_extraction_rules"
|
|
296
|
+
android:icon="@mipmap/ic_launcher"
|
|
297
|
+
android:label="@string/app_name"
|
|
298
|
+
android:supportsRtl="true"
|
|
299
|
+
android:theme="@style/AppTheme">
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
2. Create `android/app/src/main/res/xml/data_extraction_rules.xml`:
|
|
303
|
+
|
|
304
|
+
```xml
|
|
305
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
306
|
+
<data-extraction-rules>
|
|
307
|
+
<cloud-backup>
|
|
308
|
+
<exclude domain="root" />
|
|
309
|
+
<exclude domain="database" />
|
|
310
|
+
<exclude domain="sharedpref" />
|
|
311
|
+
<exclude domain="external" />
|
|
312
|
+
</cloud-backup>
|
|
313
|
+
<device-transfer>
|
|
314
|
+
<exclude domain="root" />
|
|
315
|
+
<exclude domain="database" />
|
|
316
|
+
<exclude domain="sharedpref" />
|
|
317
|
+
<exclude domain="external" />
|
|
318
|
+
</device-transfer>
|
|
319
|
+
</data-extraction-rules>
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
3. Sync and build:
|
|
323
|
+
|
|
324
|
+
```bash
|
|
325
|
+
npx cap sync android
|
|
326
|
+
npx cap open android
|
|
327
|
+
# In Android Studio: Build > Rebuild Project
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
### Web platform
|
|
331
|
+
|
|
332
|
+
For web, copy the WASM file to your public assets:
|
|
333
|
+
|
|
334
|
+
```bash
|
|
335
|
+
cp node_modules/sql.js/dist/sql-wasm.wasm public/assets/
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
The SDK automatically uses IndexedDB via `jeep-sqlite` on the web platform.
|
|
339
|
+
|
|
340
|
+
### Verify installation
|
|
341
|
+
|
|
342
|
+
Check that the plugin is registered:
|
|
343
|
+
|
|
344
|
+
```bash
|
|
345
|
+
ls android/app/src/main/assets/capacitor.plugins.json
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
You should see `@capacitor-community/sqlite` in the list.
|
|
349
|
+
|
|
243
350
|
## Offline sync
|
|
244
351
|
|
|
245
352
|
Tevroc SDK uses native storage as the authoritative offline store for entities and queued file uploads when available. Write operations are persisted locally and replayed once connectivity returns. On mobile and desktop this uses SQLite-backed native storage; in browser-only environments it falls back to `localStorage`.
|