@unvired/react-native-unvired-sdk 0.0.34 → 0.0.35
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/BuildNo.txt +1 -1
- package/dist/database/DatabaseManager.d.ts +1 -2
- package/dist/database/DatabaseManager.js +2 -6
- package/dist/database/DatabaseManager.web.d.ts +11 -0
- package/dist/database/DatabaseManager.web.js +14 -0
- package/dist/database/services/DatabaseWeb.js +11 -2
- package/package.json +1 -1
package/BuildNo.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
R-0.000.
|
|
1
|
+
R-0.000.0035
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { IDatabaseAdapter } from "./types";
|
|
2
2
|
/**
|
|
3
|
-
* DatabaseManager - Manages database operations
|
|
3
|
+
* DatabaseManager - Manages native database operations
|
|
4
4
|
* - iOS/Android/Windows: Uses @op-engineering/op-sqlite
|
|
5
|
-
* - Web: Uses Browser/WebSQL/IndexedDB/UnviredDB
|
|
6
5
|
*/
|
|
7
6
|
export declare class DatabaseManager {
|
|
8
7
|
/**
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import { Platform } from "react-native";
|
|
2
1
|
import { DatabaseNative } from "./services/DatabaseNative";
|
|
3
|
-
|
|
4
|
-
// Select database implementation based on platform
|
|
5
|
-
const dbImpl = Platform.OS === "web" ? new DatabaseWeb() : new DatabaseNative();
|
|
2
|
+
const dbImpl = new DatabaseNative();
|
|
6
3
|
/**
|
|
7
|
-
* DatabaseManager - Manages database operations
|
|
4
|
+
* DatabaseManager - Manages native database operations
|
|
8
5
|
* - iOS/Android/Windows: Uses @op-engineering/op-sqlite
|
|
9
|
-
* - Web: Uses Browser/WebSQL/IndexedDB/UnviredDB
|
|
10
6
|
*/
|
|
11
7
|
export class DatabaseManager {
|
|
12
8
|
/**
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IDatabaseAdapter } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* DatabaseManager - Manages web database operations
|
|
4
|
+
* - Web: Uses Browser/WebSQL/IndexedDB/UnviredDB via sql.js
|
|
5
|
+
*/
|
|
6
|
+
export declare class DatabaseManager {
|
|
7
|
+
/**
|
|
8
|
+
* Get the database adapter implementation
|
|
9
|
+
*/
|
|
10
|
+
static getDatabaseAdapter(): IDatabaseAdapter;
|
|
11
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DatabaseWeb } from "./services/DatabaseWeb";
|
|
2
|
+
const dbImpl = new DatabaseWeb();
|
|
3
|
+
/**
|
|
4
|
+
* DatabaseManager - Manages web database operations
|
|
5
|
+
* - Web: Uses Browser/WebSQL/IndexedDB/UnviredDB via sql.js
|
|
6
|
+
*/
|
|
7
|
+
export class DatabaseManager {
|
|
8
|
+
/**
|
|
9
|
+
* Get the database adapter implementation
|
|
10
|
+
*/
|
|
11
|
+
static getDatabaseAdapter() {
|
|
12
|
+
return dbImpl.getAdapter();
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -1,8 +1,17 @@
|
|
|
1
|
-
import initSqlJs from "sql.js";
|
|
2
1
|
let SQL = null;
|
|
3
2
|
let initPromise = null;
|
|
4
3
|
function getSqlJs() {
|
|
5
4
|
if (!initPromise) {
|
|
5
|
+
let initSqlJs;
|
|
6
|
+
try {
|
|
7
|
+
initSqlJs = require("sql.js");
|
|
8
|
+
if (initSqlJs && initSqlJs.default) {
|
|
9
|
+
initSqlJs = initSqlJs.default;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
initSqlJs = globalThis.initSqlJs;
|
|
14
|
+
}
|
|
6
15
|
initPromise = initSqlJs({
|
|
7
16
|
locateFile: (file) => `https://sql.js.org/dist/${file}`,
|
|
8
17
|
}).then((sql) => {
|
|
@@ -10,7 +19,7 @@ function getSqlJs() {
|
|
|
10
19
|
return sql;
|
|
11
20
|
});
|
|
12
21
|
}
|
|
13
|
-
return initPromise;
|
|
22
|
+
return initPromise || Promise.reject(new Error("sql.js not initialized"));
|
|
14
23
|
}
|
|
15
24
|
/**
|
|
16
25
|
* DatabaseWeb - SQLite WebAssembly adapter for React Native Web using sql.js
|
package/package.json
CHANGED