@upfluxhq/capacitor 0.1.0-beta.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.
Files changed (58) hide show
  1. package/README.md +220 -0
  2. package/dist/Upflux.d.ts +92 -0
  3. package/dist/Upflux.d.ts.map +1 -0
  4. package/dist/Upflux.js +147 -0
  5. package/dist/Upflux.js.map +1 -0
  6. package/dist/config.d.ts +30 -0
  7. package/dist/config.d.ts.map +1 -0
  8. package/dist/config.js +53 -0
  9. package/dist/config.js.map +1 -0
  10. package/dist/http/client.d.ts +28 -0
  11. package/dist/http/client.d.ts.map +1 -0
  12. package/dist/http/client.js +118 -0
  13. package/dist/http/client.js.map +1 -0
  14. package/dist/index.d.ts +21 -0
  15. package/dist/index.d.ts.map +1 -0
  16. package/dist/index.js +28 -0
  17. package/dist/index.js.map +1 -0
  18. package/dist/native/UpfluxModule.d.ts +39 -0
  19. package/dist/native/UpfluxModule.d.ts.map +1 -0
  20. package/dist/native/UpfluxModule.js +111 -0
  21. package/dist/native/UpfluxModule.js.map +1 -0
  22. package/dist/startup/resolveInitialBundle.d.ts +19 -0
  23. package/dist/startup/resolveInitialBundle.d.ts.map +1 -0
  24. package/dist/startup/resolveInitialBundle.js +59 -0
  25. package/dist/startup/resolveInitialBundle.js.map +1 -0
  26. package/dist/storage/assetStorage.d.ts +31 -0
  27. package/dist/storage/assetStorage.d.ts.map +1 -0
  28. package/dist/storage/assetStorage.js +54 -0
  29. package/dist/storage/assetStorage.js.map +1 -0
  30. package/dist/storage/bundleStorage.d.ts +41 -0
  31. package/dist/storage/bundleStorage.d.ts.map +1 -0
  32. package/dist/storage/bundleStorage.js +110 -0
  33. package/dist/storage/bundleStorage.js.map +1 -0
  34. package/dist/storage/fileSystem.d.ts +69 -0
  35. package/dist/storage/fileSystem.d.ts.map +1 -0
  36. package/dist/storage/fileSystem.js +230 -0
  37. package/dist/storage/fileSystem.js.map +1 -0
  38. package/dist/types/index.d.ts +119 -0
  39. package/dist/types/index.d.ts.map +1 -0
  40. package/dist/types/index.js +5 -0
  41. package/dist/types/index.js.map +1 -0
  42. package/dist/updates/applyUpdate.d.ts +16 -0
  43. package/dist/updates/applyUpdate.d.ts.map +1 -0
  44. package/dist/updates/applyUpdate.js +100 -0
  45. package/dist/updates/applyUpdate.js.map +1 -0
  46. package/dist/updates/checkForUpdates.d.ts +16 -0
  47. package/dist/updates/checkForUpdates.d.ts.map +1 -0
  48. package/dist/updates/checkForUpdates.js +215 -0
  49. package/dist/updates/checkForUpdates.js.map +1 -0
  50. package/dist/updates/downloadUpdate.d.ts +18 -0
  51. package/dist/updates/downloadUpdate.d.ts.map +1 -0
  52. package/dist/updates/downloadUpdate.js +76 -0
  53. package/dist/updates/downloadUpdate.js.map +1 -0
  54. package/dist/updates/manifest.d.ts +17 -0
  55. package/dist/updates/manifest.d.ts.map +1 -0
  56. package/dist/updates/manifest.js +42 -0
  57. package/dist/updates/manifest.js.map +1 -0
  58. package/package.json +42 -0
@@ -0,0 +1,118 @@
1
+ /**
2
+ * HTTP Client for Upflux Capacitor SDK
3
+ *
4
+ * Simple HTTP client using fetch API.
5
+ */
6
+ import { getApiBaseUrl, getClientKey } from '../config';
7
+ /**
8
+ * HTTP Error class
9
+ */
10
+ export class HttpError extends Error {
11
+ constructor(statusCode, statusText, responseBody) {
12
+ super(`HTTP ${statusCode}: ${statusText}`);
13
+ this.statusCode = statusCode;
14
+ this.statusText = statusText;
15
+ this.responseBody = responseBody;
16
+ this.name = 'HttpError';
17
+ }
18
+ }
19
+ /**
20
+ * Default request headers
21
+ */
22
+ function getDefaultHeaders() {
23
+ return {
24
+ 'Content-Type': 'application/json',
25
+ 'x-client-key': getClientKey(),
26
+ };
27
+ }
28
+ /**
29
+ * Make a GET request
30
+ */
31
+ export async function get(path) {
32
+ const baseUrl = getApiBaseUrl();
33
+ const url = `${baseUrl}/api${path}`;
34
+ const headers = getDefaultHeaders();
35
+ console.log(`[HTTP] ========== GET REQUEST ==========`);
36
+ console.log(`[HTTP] Base URL from config: ${baseUrl}`);
37
+ console.log(`[HTTP] Full URL: ${url}`);
38
+ console.log(`[HTTP] Headers:`, JSON.stringify(headers, null, 2));
39
+ console.log(`[HTTP] =====================================`);
40
+ const response = await fetch(url, {
41
+ method: 'GET',
42
+ headers,
43
+ });
44
+ console.log(`[HTTP] Response status: ${response.status} ${response.statusText}`);
45
+ if (!response.ok) {
46
+ const body = await response.text();
47
+ console.error(`[HTTP] Error response body: ${body}`);
48
+ throw new HttpError(response.status, response.statusText, body);
49
+ }
50
+ return response.json();
51
+ }
52
+ /**
53
+ * Make a POST request
54
+ */
55
+ export async function post(path, body) {
56
+ const baseUrl = getApiBaseUrl();
57
+ const url = `${baseUrl}/api${path}`;
58
+ const headers = getDefaultHeaders();
59
+ console.log(`[HTTP] ========== POST REQUEST ==========`);
60
+ console.log(`[HTTP] Base URL from config: ${baseUrl}`);
61
+ console.log(`[HTTP] Full URL: ${url}`);
62
+ console.log(`[HTTP] Headers:`, JSON.stringify(headers, null, 2));
63
+ console.log(`[HTTP] Request body:`, JSON.stringify(body, null, 2));
64
+ console.log(`[HTTP] =====================================`);
65
+ const response = await fetch(url, {
66
+ method: 'POST',
67
+ headers,
68
+ body: body ? JSON.stringify(body) : undefined,
69
+ });
70
+ console.log(`[HTTP] Response status: ${response.status} ${response.statusText}`);
71
+ if (!response.ok) {
72
+ const responseBody = await response.text();
73
+ console.error(`[HTTP] Error response body: ${responseBody}`);
74
+ throw new HttpError(response.status, response.statusText, responseBody);
75
+ }
76
+ const jsonResponse = await response.json();
77
+ console.log(`[HTTP] Response:`, JSON.stringify(jsonResponse, null, 2));
78
+ return jsonResponse;
79
+ }
80
+ /**
81
+ * Download a file from URL
82
+ * Returns the file content as ArrayBuffer
83
+ */
84
+ export async function downloadFile(url, onProgress) {
85
+ console.log(`[HTTP] Downloading: ${url}`);
86
+ const response = await fetch(url);
87
+ if (!response.ok) {
88
+ throw new HttpError(response.status, response.statusText);
89
+ }
90
+ const contentLength = response.headers.get('content-length');
91
+ const total = contentLength ? parseInt(contentLength, 10) : 0;
92
+ if (!response.body) {
93
+ return response.arrayBuffer();
94
+ }
95
+ const reader = response.body.getReader();
96
+ const chunks = [];
97
+ let loaded = 0;
98
+ while (true) {
99
+ const { done, value } = await reader.read();
100
+ if (done)
101
+ break;
102
+ chunks.push(value);
103
+ loaded += value.length;
104
+ if (onProgress && total > 0) {
105
+ onProgress(loaded, total);
106
+ }
107
+ }
108
+ // Combine chunks into single ArrayBuffer
109
+ const buffer = new Uint8Array(loaded);
110
+ let offset = 0;
111
+ for (const chunk of chunks) {
112
+ buffer.set(chunk, offset);
113
+ offset += chunk.length;
114
+ }
115
+ console.log(`[HTTP] Download complete: ${loaded} bytes`);
116
+ return buffer.buffer;
117
+ }
118
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/http/client.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAExD;;GAEG;AACH,MAAM,OAAO,SAAU,SAAQ,KAAK;IAChC,YACW,UAAkB,EAClB,UAAkB,EAClB,YAAqB;QAE5B,KAAK,CAAC,QAAQ,UAAU,KAAK,UAAU,EAAE,CAAC,CAAC;QAJpC,eAAU,GAAV,UAAU,CAAQ;QAClB,eAAU,GAAV,UAAU,CAAQ;QAClB,iBAAY,GAAZ,YAAY,CAAS;QAG5B,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;IAC5B,CAAC;CACJ;AAED;;GAEG;AACH,SAAS,iBAAiB;IACtB,OAAO;QACH,cAAc,EAAE,kBAAkB;QAClC,cAAc,EAAE,YAAY,EAAE;KACjC,CAAC;AACN,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,GAAG,CAAI,IAAY;IACrC,MAAM,OAAO,GAAG,aAAa,EAAE,CAAC;IAChC,MAAM,GAAG,GA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AC;IACtC,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QACzB,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC;IAC3B,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,6BAA6B,MAAM,QAAQ,CAAC,CAAC;IAEzD,OAAO,MAAM,CAAC,MAAM,CAAC;AACzB,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Upflux Capacitor SDK
3
+ *
4
+ * OTA update management for Capacitor applications.
5
+ *
6
+ * @packageDocumentation
7
+ */
8
+ export { Upflux } from './Upflux';
9
+ export type { UpfluxConfig, DeviceInfo, Asset, ReleaseManifest, UpdateCheckResponse, UpdateInfo, ActiveBundleMetadata, DownloadResult, ApplyResult, StartupBundle, DownloadProgress, DownloadOptions, } from './types';
10
+ export { setConfig, getConfig, isConfigured, clearConfig, getApiBaseUrl, getClientKey, } from './config';
11
+ export { get, post, downloadFile, HttpError, } from './http/client';
12
+ export { checkForUpdates } from './updates/checkForUpdates';
13
+ export { downloadUpdate } from './updates/downloadUpdate';
14
+ export { applyUpdate } from './updates/applyUpdate';
15
+ export { isValidManifest, parseManifest, getManifestTotalSize } from './updates/manifest';
16
+ export { saveBundle, getActiveBundle, getActiveBundleMetadata, setActiveBundle, clearActiveBundle, bundleExists, getDefaultBundlePath, } from './storage/bundleStorage';
17
+ export { saveAsset, saveAssets, assetExists, getAssetPath, listAssets, } from './storage/assetStorage';
18
+ export * as FileSystem from './storage/fileSystem';
19
+ export { resolveInitialBundle, getBundlePathToLoad, } from './startup/resolveInitialBundle';
20
+ export { isNativeModuleAvailable, getCustomBundlePath, setCustomBundlePath, clearCustomBundlePath, restartApp, isAndroid, isIOS, isWeb, getPlatform, } from './native/UpfluxModule';
21
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGlC,YAAY,EACR,YAAY,EACZ,UAAU,EACV,KAAK,EACL,eAAe,EACf,mBAAmB,EACnB,UAAU,EACV,oBAAoB,EACpB,cAAc,EACd,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,eAAe,GAClB,MAAM,SAAS,CAAC;AAGjB,OAAO,EACH,SAAS,EACT,SAAS,EACT,YAAY,EACZ,WAAW,EACX,aAAa,EACb,YAAY,GACf,MAAM,UAAU,CAAC;AAGlB,OAAO,EACH,GAAG,EACH,IAAI,EACJ,YAAY,EACZ,SAAS,GACZ,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAG1F,OAAO,EACH,UAAU,EACV,eAAe,EACf,uBAAuB,EACvB,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,oBAAoB,GACvB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACH,SAAS,EACT,UAAU,EACV,WAAW,EACX,YAAY,EACZ,UAAU,GACb,MAAM,wBAAwB,CAAC;AAGhC,OAAO,KAAK,UAAU,MAAM,sBAAsB,CAAC;AAGnD,OAAO,EACH,oBAAoB,EACpB,mBAAmB,GACtB,MAAM,gCAAgC,CAAC;AAGxC,OAAO,EACH,uBAAuB,EACvB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,UAAU,EACV,SAAS,EACT,KAAK,EACL,KAAK,EACL,WAAW,GACd,MAAM,uBAAuB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Upflux Capacitor SDK
3
+ *
4
+ * OTA update management for Capacitor applications.
5
+ *
6
+ * @packageDocumentation
7
+ */
8
+ // Main SDK class
9
+ export { Upflux } from './Upflux';
10
+ // Configuration
11
+ export { setConfig, getConfig, isConfigured, clearConfig, getApiBaseUrl, getClientKey, } from './config';
12
+ // HTTP Client
13
+ export { get, post, downloadFile, HttpError, } from './http/client';
14
+ // Updates
15
+ export { checkForUpdates } from './updates/checkForUpdates';
16
+ export { downloadUpdate } from './updates/downloadUpdate';
17
+ export { applyUpdate } from './updates/applyUpdate';
18
+ export { isValidManifest, parseManifest, getManifestTotalSize } from './updates/manifest';
19
+ // Storage
20
+ export { saveBundle, getActiveBundle, getActiveBundleMetadata, setActiveBundle, clearActiveBundle, bundleExists, getDefaultBundlePath, } from './storage/bundleStorage';
21
+ export { saveAsset, saveAssets, assetExists, getAssetPath, listAssets, } from './storage/assetStorage';
22
+ // File System
23
+ export * as FileSystem from './storage/fileSystem';
24
+ // Startup
25
+ export { resolveInitialBundle, getBundlePathToLoad, } from './startup/resolveInitialBundle';
26
+ // Native Module (Capacitor WebView wrapper)
27
+ export { isNativeModuleAvailable, getCustomBundlePath, setCustomBundlePath, clearCustomBundlePath, restartApp, isAndroid, isIOS, isWeb, getPlatform, } from './native/UpfluxModule';
28
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,iBAAiB;AACjB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAkBlC,gBAAgB;AAChB,OAAO,EACH,SAAS,EACT,SAAS,EACT,YAAY,EACZ,WAAW,EACX,aAAa,EACb,YAAY,GACf,MAAM,UAAU,CAAC;AAElB,cAAc;AACd,OAAO,EACH,GAAG,EACH,IAAI,EACJ,YAAY,EACZ,SAAS,GACZ,MAAM,eAAe,CAAC;AAEvB,UAAU;AACV,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE1F,UAAU;AACV,OAAO,EACH,UAAU,EACV,eAAe,EACf,uBAAuB,EACvB,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,oBAAoB,GACvB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACH,SAAS,EACT,UAAU,EACV,WAAW,EACX,YAAY,EACZ,UAAU,GACb,MAAM,wBAAwB,CAAC;AAEhC,cAAc;AACd,OAAO,KAAK,UAAU,MAAM,sBAAsB,CAAC;AAEnD,UAAU;AACV,OAAO,EACH,oBAAoB,EACpB,mBAAmB,GACtB,MAAM,gCAAgC,CAAC;AAExC,4CAA4C;AAC5C,OAAO,EACH,uBAAuB,EACvB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,UAAU,EACV,SAAS,EACT,KAAK,EACL,KAAK,EACL,WAAW,GACd,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Upflux Native Module Interface for Capacitor
3
+ *
4
+ * Uses Capacitor's built-in WebView APIs - no custom native code needed!
5
+ */
6
+ /**
7
+ * Check if running on a native platform
8
+ */
9
+ export declare function isNativeModuleAvailable(): boolean;
10
+ /**
11
+ * Get the current bundle path
12
+ * Note: In Capacitor, this is managed by WebView internally
13
+ */
14
+ export declare function getCustomBundlePath(): Promise<string | null>;
15
+ /**
16
+ * Set the bundle path to use
17
+ * Uses Capacitor's WebView.setServerBasePath()
18
+ */
19
+ export declare function setCustomBundlePath(path: string): Promise<void>;
20
+ /**
21
+ * Clear the custom bundle path (revert to original)
22
+ */
23
+ export declare function clearCustomBundlePath(): Promise<void>;
24
+ /**
25
+ * Restart the app to apply an update
26
+ * For Capacitor, we reload the page which will load from the new path
27
+ */
28
+ export declare function restartApp(): Promise<void>;
29
+ /**
30
+ * Platform helpers
31
+ */
32
+ export declare function isAndroid(): boolean;
33
+ export declare function isIOS(): boolean;
34
+ export declare function isWeb(): boolean;
35
+ /**
36
+ * Get platform name
37
+ */
38
+ export declare function getPlatform(): 'ios' | 'android' | 'web';
39
+ //# sourceMappingURL=UpfluxModule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UpfluxModule.d.ts","sourceRoot":"","sources":["../../src/native/UpfluxModule.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH;;GAEG;AACH,wBAAgB,uBAAuB,IAAI,OAAO,CAEjD;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAYlE;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAoCrE;AAED;;GAEG;AACH,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC,CAY3D;AAED;;;GAGG;AACH,wBAAsB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAMhD;AAED;;GAEG;AACH,wBAAgB,SAAS,IAAI,OAAO,CAEnC;AAED,wBAAgB,KAAK,IAAI,OAAO,CAE/B;AAED,wBAAgB,KAAK,IAAI,OAAO,CAE/B;AAED;;GAEG;AACH,wBAAgB,WAAW,IAAI,KAAK,GAAG,SAAS,GAAG,KAAK,CAEvD"}
@@ -0,0 +1,111 @@
1
+ /**
2
+ * Upflux Native Module Interface for Capacitor
3
+ *
4
+ * Uses Capacitor's built-in WebView APIs - no custom native code needed!
5
+ */
6
+ import { Capacitor } from '@capacitor/core';
7
+ import { Filesystem, Directory, Encoding } from '@capacitor/filesystem';
8
+ /**
9
+ * Check if running on a native platform
10
+ */
11
+ export function isNativeModuleAvailable() {
12
+ return Capacitor.isNativePlatform();
13
+ }
14
+ /**
15
+ * Get the current bundle path
16
+ * Note: In Capacitor, this is managed by WebView internally
17
+ */
18
+ export async function getCustomBundlePath() {
19
+ // Read from our stored metadata
20
+ try {
21
+ const result = await Filesystem.readFile({
22
+ path: 'upflux/currentPath.txt',
23
+ directory: Directory.Data,
24
+ encoding: Encoding.UTF8,
25
+ });
26
+ return result.data || null;
27
+ }
28
+ catch {
29
+ return null;
30
+ }
31
+ }
32
+ /**
33
+ * Set the bundle path to use
34
+ * Uses Capacitor's WebView.setServerBasePath()
35
+ */
36
+ export async function setCustomBundlePath(path) {
37
+ const { WebView } = await import('@capacitor/core');
38
+ // Get the full URI for the path
39
+ const uri = await Filesystem.getUri({
40
+ path,
41
+ directory: Directory.Data,
42
+ });
43
+ // For Capacitor 6, setServerBasePath expects the raw file path
44
+ // Remove the 'file://' prefix if present
45
+ let serverPath = uri.uri;
46
+ if (serverPath.startsWith('file://')) {
47
+ serverPath = serverPath.replace('file://', '');
48
+ }
49
+ console.log(`[UpfluxModule] Bundle path: ${path}`);
50
+ console.log(`[UpfluxModule] Full URI: ${uri.uri}`);
51
+ console.log(`[UpfluxModule] Server path: ${serverPath}`);
52
+ // Set the WebView to load from this path
53
+ await WebView.setServerBasePath({ path: serverPath });
54
+ // Persist so it survives app restarts
55
+ await WebView.persistServerBasePath();
56
+ // Store the path for reference
57
+ await Filesystem.writeFile({
58
+ path: 'upflux/currentPath.txt',
59
+ data: path,
60
+ directory: Directory.Data,
61
+ encoding: Encoding.UTF8,
62
+ recursive: true,
63
+ });
64
+ console.log('[UpfluxModule] Server base path set and persisted');
65
+ }
66
+ /**
67
+ * Clear the custom bundle path (revert to original)
68
+ */
69
+ export async function clearCustomBundlePath() {
70
+ try {
71
+ // Delete stored path
72
+ await Filesystem.deleteFile({
73
+ path: 'upflux/currentPath.txt',
74
+ directory: Directory.Data,
75
+ });
76
+ console.log('[UpfluxModule] Custom bundle path cleared');
77
+ }
78
+ catch {
79
+ // Ignore if file doesn't exist
80
+ }
81
+ }
82
+ /**
83
+ * Restart the app to apply an update
84
+ * For Capacitor, we reload the page which will load from the new path
85
+ */
86
+ export async function restartApp() {
87
+ console.log('[UpfluxModule] Reloading app...');
88
+ // Longer delay to ensure WebView has fully switched to the new server base path
89
+ // This prevents the "localhost not found" error on first reload
90
+ await new Promise((resolve) => setTimeout(resolve, 500));
91
+ window.location.reload();
92
+ }
93
+ /**
94
+ * Platform helpers
95
+ */
96
+ export function isAndroid() {
97
+ return Capacitor.getPlatform() === 'android';
98
+ }
99
+ export function isIOS() {
100
+ return Capacitor.getPlatform() === 'ios';
101
+ }
102
+ export function isWeb() {
103
+ return Capacitor.getPlatform() === 'web';
104
+ }
105
+ /**
106
+ * Get platform name
107
+ */
108
+ export function getPlatform() {
109
+ return Capacitor.getPlatform();
110
+ }
111
+ //# sourceMappingURL=UpfluxModule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UpfluxModule.js","sourceRoot":"","sources":["../../src/native/UpfluxModule.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAExE;;GAEG;AACH,MAAM,UAAU,uBAAuB;IACnC,OAAO,SAAS,CAAC,gBAAgB,EAAE,CAAC;AACxC,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB;IACrC,gCAAgC;IAChC,IAAI,CAAC;QACD,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,QAAQ,CAAC;YACrC,IAAI,EAAE,wBAAwB;YAC9B,SAAS,EAAE,SAAS,CAAC,IAAI;YACzB,QAAQ,EAAE,QAAQ,CAAC,IAAI;SAC1B,CAAC,CAAC;QACH,OAAQ,MAAM,CAAC,IAAe,IAAI,IAAI,CAAC;IAC3C,CAAC;IAAC,MAAM,CAAC;QACL,OAAO,IAAI,CAAC;IAChB,CAAC;A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AM,UAAU,CAAC,UAAU,CAAC;YACxB,IAAI,EAAE,wBAAwB;YAC9B,SAAS,EAAE,SAAS,CAAC,IAAI;SAC5B,CAAC,CAAC;QAEH,OAAO,CAAC,GAAG,CAAC,2CAA2C,CAAC,CAAC;IAC7D,CAAC;IAAC,MAAM,CAAC;QACL,+BAA+B;IACnC,CAAC;AACL,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU;IAC5B,OAAO,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC;IAC/C,gFAAgF;IAChF,gEAAgE;IAChE,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC;IACzD,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;AAC7B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS;IACrB,OAAO,SAAS,CAAC,WAAW,EAAE,KAAK,SAAS,CAAC;AACjD,CAAC;AAED,MAAM,UAAU,KAAK;IACjB,OAAO,SAAS,CAAC,WAAW,EAAE,KAAK,KAAK,CAAC;AAC7C,CAAC;AAED,MAAM,UAAU,KAAK;IACjB,OAAO,SAAS,CAAC,WAAW,EAAE,KAAK,KAAK,CAAC;AAC7C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW;IACvB,OAAO,SAAS,CAAC,WAAW,EAA+B,CAAC;AAChE,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Startup Bundle Resolution - Capacitor SDK
3
+ *
4
+ * Determines which bundle to load at app startup.
5
+ */
6
+ import { StartupBundle } from '../types';
7
+ /**
8
+ * Resolve the initial bundle to use at startup
9
+ *
10
+ * For Capacitor, the WebView automatically loads from the persisted path.
11
+ * This function is mainly for tracking/logging purposes.
12
+ */
13
+ export declare function resolveInitialBundle(): Promise<StartupBundle>;
14
+ /**
15
+ * Get the bundle path to load
16
+ * Returns null if using default www
17
+ */
18
+ export declare function getBundlePathToLoad(): Promise<string | null>;
19
+ //# sourceMappingURL=resolveInitialBundle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveInitialBundle.d.ts","sourceRoot":"","sources":["../../src/startup/resolveInitialBundle.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAIzC;;;;;GAKG;AACH,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,aAAa,CAAC,CA0CnE;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAGlE"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Startup Bundle Resolution - Capacitor SDK
3
+ *
4
+ * Determines which bundle to load at app startup.
5
+ */
6
+ import { getActiveBundleMetadata, bundleExists } from '../storage/bundleStorage';
7
+ import { getCustomBundlePath } from '../native/UpfluxModule';
8
+ /**
9
+ * Resolve the initial bundle to use at startup
10
+ *
11
+ * For Capacitor, the WebView automatically loads from the persisted path.
12
+ * This function is mainly for tracking/logging purposes.
13
+ */
14
+ export async function resolveInitialBundle() {
15
+ console.log('[Startup] Resolving initial bundle...');
16
+ try {
17
+ // Check if we have a custom bundle path set
18
+ const customPath = await getCustomBundlePath();
19
+ if (customPath) {
20
+ // Verify the bundle still exists
21
+ const exists = await bundleExists(customPath);
22
+ if (exists) {
23
+ // Get metadata for the release label
24
+ const metadata = await getActiveBundleMetadata();
25
+ console.log(`[Startup] Using OTA bundle: ${customPath}`);
26
+ return {
27
+ bundlePath: customPath,
28
+ isUpdate: true,
29
+ releaseLabel: metadata?.releaseLabel,
30
+ };
31
+ }
32
+ else {
33
+ console.warn(`[Startup] Bundle not found at ${customPath}, using default`);
34
+ }
35
+ }
36
+ // No custom bundle, using default www
37
+ console.log('[Startup] Using default bundle');
38
+ return {
39
+ bundlePath: null,
40
+ isUpdate: false,
41
+ };
42
+ }
43
+ catch (error) {
44
+ console.error('[Startup] Error resolving bundle:', error);
45
+ return {
46
+ bundlePath: null,
47
+ isUpdate: false,
48
+ };
49
+ }
50
+ }
51
+ /**
52
+ * Get the bundle path to load
53
+ * Returns null if using default www
54
+ */
55
+ export async function getBundlePathToLoad() {
56
+ const bundle = await resolveInitialBundle();
57
+ return bundle.bundlePath;
58
+ }
59
+ //# sourceMappingURL=resolveInitialBundle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveInitialBundle.js","sourceRoot":"","sources":["../../src/startup/resolveInitialBundle.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,uBAAuB,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACjF,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE7D;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB;IACtC,OAAO,CAAC,GAAG,CAAC,uCAAuC,CAAC,CAAC;IAErD,IAAI,CAAC;QACD,4CAA4C;QAC5C,MAAM,UAAU,GAAG,MAAM,mBAAmB,EAAE,CAAC;QAE/C,IAAI,UAAU,EAAE,CAAC;YACb,iCAAiC;YACjC,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,UAAU,CAAC,CAAC;YAE9C,IAAI,MAAM,EAAE,CAAC;gBACT,qCAAqC;gBACrC,MAAM,QAAQ,GAAG,MAAM,uBAAuB,EAAE,CAAC;gBAEjD,OAAO,CAAC,GAAG,CAAC,+BAA+B,UAAU,EAAE,CAAC,CAAC;gBAEzD,OAAO;oBACH,UAAU,EAAE,UAAU;oBACtB,QAAQ,EAAE,IAAI;oBACd,YAAY,EAAE,QAAQ,EAAE,YAAY;iBACvC,CAAC;YACN,CAAC;iBAAM,CAAC;gBACJ,OAAO,CAAC,IAAI,CAAC,iCAAiC,UAAU,iBAAiB,CAAC,CAAC;YAC/E,CAAC;QACL,CAAC;QAED,sCAAsC;QACtC,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;QAE9C,OAAO;YACH,UAAU,EAAE,IAAI;YAChB,QAAQ,EAAE,KAAK;SAClB,CAAC;IACN,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,mCAAmC,EAAE,KAAK,CAAC,CAAC;QAE1D,OAAO;YACH,UAAU,EAAE,IAAI;YAChB,QAAQ,EAAE,KAAK;SAClB,CAAC;IACN,CAAC;AACL,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB;IACrC,MAAM,MAAM,GAAG,MAAM,oBAAoB,EAAE,CAAC;IAC5C,OAAO,MAAM,CAAC,UAAU,CAAC;AAC7B,CAAC"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Asset Storage for Capacitor SDK
3
+ *
4
+ * Note: For Capacitor, assets are bundled inside the zip file
5
+ * and extracted together with the bundle. This file provides
6
+ * compatibility with the React Native SDK interface.
7
+ */
8
+ import { Asset } from '../types';
9
+ /**
10
+ * Save an asset to local storage
11
+ * For Capacitor, assets are already extracted with the bundle
12
+ */
13
+ export declare function saveAsset(asset: Asset, releaseLabel: string): Promise<string>;
14
+ /**
15
+ * Save multiple assets
16
+ * For Capacitor, this is a no-op as assets are in the zip
17
+ */
18
+ export declare function saveAssets(assets: Asset[], releaseLabel: string, onProgress?: (current: number, total: number) => void): Promise<string[]>;
19
+ /**
20
+ * Check if an asset exists
21
+ */
22
+ export declare function assetExists(assetPath: string): Promise<boolean>;
23
+ /**
24
+ * Get the path to an asset
25
+ */
26
+ export declare function getAssetPath(releaseLabel: string, assetName: string): Promise<string>;
27
+ /**
28
+ * List assets for a release
29
+ */
30
+ export declare function listAssets(releaseLabel: string): Promise<string[]>;
31
+ //# sourceMappingURL=assetStorage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assetStorage.d.ts","sourceRoot":"","sources":["../../src/storage/assetStorage.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAGjC;;;GAGG;AACH,wBAAsB,SAAS,CAC3B,KAAK,EAAE,KAAK,EACZ,YAAY,EAAE,MAAM,GACrB,OAAO,CAAC,MAAM,CAAC,CASjB;AAED;;;GAGG;AACH,wBAAsB,UAAU,CAC5B,MAAM,EAAE,KAAK,EAAE,EACf,YAAY,EAAE,MAAM,EACpB,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,GACtD,OAAO,CAAC,MAAM,EAAE,CAAC,CAUnB;AAED;;GAEG;AACH,wBAAsB,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAErE;AAED;;GAEG;AACH,wBAAsB,YAAY,CAAC,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAG3F;AAED;;GAEG;AACH,wBAAsB,UAAU,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAGxE"}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Asset Storage for Capacitor SDK
3
+ *
4
+ * Note: For Capacitor, assets are bundled inside the zip file
5
+ * and extracted together with the bundle. This file provides
6
+ * compatibility with the React Native SDK interface.
7
+ */
8
+ import * as FileSystem from './fileSystem';
9
+ /**
10
+ * Save an asset to local storage
11
+ * For Capacitor, assets are already extracted with the bundle
12
+ */
13
+ export async function saveAsset(asset, releaseLabel) {
14
+ const assetsDir = await FileSystem.getAssetsDir(releaseLabel);
15
+ const assetPath = `${assetsDir}/${asset.name}`;
16
+ // Assets are extracted from zip in bundleStorage
17
+ // This is mainly for compatibility with React Native interface
18
+ console.log(`[AssetStorage] Asset path: ${assetPath}`);
19
+ return assetPath;
20
+ }
21
+ /**
22
+ * Save multiple assets
23
+ * For Capacitor, this is a no-op as assets are in the zip
24
+ */
25
+ export async function saveAssets(assets, releaseLabel, onProgress) {
26
+ const paths = [];
27
+ for (let i = 0; i < assets.length; i++) {
28
+ const path = await saveAsset(assets[i], releaseLabel);
29
+ paths.push(path);
30
+ onProgress?.(i + 1, assets.length);
31
+ }
32
+ return paths;
33
+ }
34
+ /**
35
+ * Check if an asset exists
36
+ */
37
+ export async function assetExists(assetPath) {
38
+ return FileSystem.exists(assetPath);
39
+ }
40
+ /**
41
+ * Get the path to an asset
42
+ */
43
+ export async function getAssetPath(releaseLabel, assetName) {
44
+ const assetsDir = await FileSystem.getAssetsDir(releaseLabel);
45
+ return `${assetsDir}/${assetName}`;
46
+ }
47
+ /**
48
+ * List assets for a release
49
+ */
50
+ export async function listAssets(releaseLabel) {
51
+ const assetsDir = await FileSystem.getAssetsDir(releaseLabel);
52
+ return FileSystem.readdir(assetsDir);
53
+ }
54
+ //# sourceMappingURL=assetStorage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assetStorage.js","sourceRoot":"","sources":["../../src/storage/assetStorage.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAE3C;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAC3B,KAAY,EACZ,YAAoB;IAEpB,MAAM,SAAS,GAAG,MAAM,UAAU,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;IAC9D,MAAM,SAAS,GAAG,GAAG,SAAS,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC;IAE/C,iDAAiD;IACjD,+DAA+D;IAC/D,OAAO,CAAC,GAAG,CAAC,8BAA8B,SAAS,EAAE,CAAC,CAAC;IAEvD,OAAO,SAAS,CAAC;AACrB,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAC5B,MAAe,EACf,YAAoB,EACpB,UAAqD;IAErD,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,MAAM,IAAI,GAAG,MAAM,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC;QACtD,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjB,UAAU,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IACvC,CAAC;IAED,OAAO,KAAK,CAAC;AACjB,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,SAAiB;IAC/C,OAAO,UAAU,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;AACxC,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,YAAoB,EAAE,SAAiB;IACtE,MAAM,SAAS,GAAG,MAAM,UAAU,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;IAC9D,OAAO,GAAG,SAAS,IAAI,SAAS,EAAE,CAAC;AACvC,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,YAAoB;IACjD,MAAM,SAAS,GAAG,MAAM,UAAU,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;IAC9D,OAAO,UAAU,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AACzC,CAAC"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Bundle Storage for Capacitor SDK
3
+ *
4
+ * Manages bundle files and active bundle metadata.
5
+ */
6
+ import { ActiveBundleMetadata } from '../types';
7
+ /**
8
+ * Save a bundle from URL to local storage
9
+ * Capacitor bundles are zip files that need to be extracted
10
+ *
11
+ * @param bundleUrl - URL to download the bundle from
12
+ * @param releaseLabel - Release label for directory naming
13
+ * @returns Path to the extracted bundle directory
14
+ */
15
+ export declare function saveBundle(bundleUrl: string, releaseLabel: string): Promise<string>;
16
+ /**
17
+ * Get the currently active bundle metadata
18
+ */
19
+ export declare function getActiveBundleMetadata(): Promise<ActiveBundleMetadata | null>;
20
+ /**
21
+ * Get the active bundle path (or null if no active bundle)
22
+ */
23
+ export declare function getActiveBundle(): Promise<string | null>;
24
+ /**
25
+ * Set the active bundle
26
+ */
27
+ export declare function setActiveBundle(bundlePath: string, assets: string[], releaseLabel: string): Promise<void>;
28
+ /**
29
+ * Clear the active bundle (revert to default)
30
+ */
31
+ export declare function clearActiveBundle(): Promise<void>;
32
+ /**
33
+ * Check if a bundle exists at the given path
34
+ */
35
+ export declare function bundleExists(bundlePath: string): Promise<boolean>;
36
+ /**
37
+ * Get the default bundle path (www folder in app)
38
+ * For Capacitor, this is handled by the WebView automatically
39
+ */
40
+ export declare function getDefaultBundlePath(): string;
41
+ //# sourceMappingURL=bundleStorage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bundleStorage.d.ts","sourceRoot":"","sources":["../../src/storage/bundleStorage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAKhD;;;;;;;GAOG;AACH,wBAAsB,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAiCzF;AAED;;GAEG;AACH,wBAAsB,uBAAuB,IAAI,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAcpF;AAED;;GAEG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAG9D;AAED;;GAEG;AACH,wBAAsB,eAAe,CACjC,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EAAE,EAChB,YAAY,EAAE,MAAM,GACrB,OAAO,CAAC,IAAI,CAAC,CAYf;AAED;;GAEG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,CAQvD;AAED;;GAEG;AACH,wBAAsB,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAIvE;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAE7C"}