@unvired/react-native-unvired-sdk 0.0.35 → 0.0.36

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 CHANGED
@@ -1 +1 @@
1
- R-0.000.0035
1
+ R-0.000.0036
@@ -12,12 +12,30 @@ function getSqlJs() {
12
12
  catch {
13
13
  initSqlJs = globalThis.initSqlJs;
14
14
  }
15
- initPromise = initSqlJs({
16
- locateFile: (file) => `https://sql.js.org/dist/${file}`,
17
- }).then((sql) => {
18
- SQL = sql;
19
- return sql;
20
- });
15
+ if (typeof initSqlJs === "function") {
16
+ initPromise = initSqlJs({
17
+ locateFile: (file) => {
18
+ if (typeof window !== "undefined" && window.SQL_WASM_PATH) {
19
+ return `${window.SQL_WASM_PATH}/${file}`;
20
+ }
21
+ return `https://cdn.jsdelivr.net/npm/sql.js@1.14.2/dist/${file}`;
22
+ },
23
+ }).then((sql) => {
24
+ SQL = sql;
25
+ return sql;
26
+ }).catch((err) => {
27
+ console.warn("[DatabaseWeb] Failed loading sql.js from jsdelivr, trying cdnjs fallback:", err);
28
+ return initSqlJs({
29
+ locateFile: (file) => `https://cdnjs.cloudflare.com/ajax/libs/sql.js/1.12.0/${file}`,
30
+ }).then((sql) => {
31
+ SQL = sql;
32
+ return sql;
33
+ });
34
+ });
35
+ }
36
+ else {
37
+ initPromise = Promise.reject(new Error("sql.js module not found"));
38
+ }
21
39
  }
22
40
  return initPromise || Promise.reject(new Error("sql.js not initialized"));
23
41
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unvired/react-native-unvired-sdk",
3
- "version": "0.0.35",
3
+ "version": "0.0.36",
4
4
  "description": "Unvired SDK for React Native with logging, database, notifications, and file system support",
5
5
  "main": "dist/main.js",
6
6
  "types": "dist/main.d.ts",