@swiftpatch/react-native 2.0.0

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 (182) hide show
  1. package/README.md +430 -0
  2. package/android/build.gradle +105 -0
  3. package/android/src/main/AndroidManifest.xml +6 -0
  4. package/android/src/main/java/com/swiftpatch/BundleManager.kt +107 -0
  5. package/android/src/main/java/com/swiftpatch/CrashDetector.kt +79 -0
  6. package/android/src/main/java/com/swiftpatch/CryptoVerifier.kt +69 -0
  7. package/android/src/main/java/com/swiftpatch/DownloadManager.kt +120 -0
  8. package/android/src/main/java/com/swiftpatch/EventQueue.kt +86 -0
  9. package/android/src/main/java/com/swiftpatch/FileUtils.kt +60 -0
  10. package/android/src/main/java/com/swiftpatch/PatchApplier.kt +60 -0
  11. package/android/src/main/java/com/swiftpatch/SignalCrashHandler.kt +84 -0
  12. package/android/src/main/java/com/swiftpatch/SlotManager.kt +299 -0
  13. package/android/src/main/java/com/swiftpatch/SwiftPatchModule.kt +630 -0
  14. package/android/src/main/java/com/swiftpatch/SwiftPatchPackage.kt +21 -0
  15. package/android/src/main/jni/CMakeLists.txt +12 -0
  16. package/android/src/main/jni/bspatch.c +188 -0
  17. package/android/src/main/jni/bspatch.h +57 -0
  18. package/android/src/main/jni/bspatch_jni.c +28 -0
  19. package/ios/Libraries/bspatch/bspatch.c +188 -0
  20. package/ios/Libraries/bspatch/bspatch.h +50 -0
  21. package/ios/Libraries/bspatch/module.modulemap +4 -0
  22. package/ios/SwiftPatch/BundleManager.swift +113 -0
  23. package/ios/SwiftPatch/CrashDetector.swift +71 -0
  24. package/ios/SwiftPatch/CryptoVerifier.swift +70 -0
  25. package/ios/SwiftPatch/DownloadManager.swift +125 -0
  26. package/ios/SwiftPatch/EventQueue.swift +116 -0
  27. package/ios/SwiftPatch/FileUtils.swift +38 -0
  28. package/ios/SwiftPatch/PatchApplier.swift +41 -0
  29. package/ios/SwiftPatch/SignalCrashHandler.swift +129 -0
  30. package/ios/SwiftPatch/SlotManager.swift +360 -0
  31. package/ios/SwiftPatch/SwiftPatchModule.m +56 -0
  32. package/ios/SwiftPatch/SwiftPatchModule.swift +621 -0
  33. package/lib/commonjs/SwiftPatchCore.js +140 -0
  34. package/lib/commonjs/SwiftPatchCore.js.map +1 -0
  35. package/lib/commonjs/SwiftPatchProvider.js +617 -0
  36. package/lib/commonjs/SwiftPatchProvider.js.map +1 -0
  37. package/lib/commonjs/constants.js +50 -0
  38. package/lib/commonjs/constants.js.map +1 -0
  39. package/lib/commonjs/core/Downloader.js +63 -0
  40. package/lib/commonjs/core/Downloader.js.map +1 -0
  41. package/lib/commonjs/core/Installer.js +46 -0
  42. package/lib/commonjs/core/Installer.js.map +1 -0
  43. package/lib/commonjs/core/Rollback.js +36 -0
  44. package/lib/commonjs/core/Rollback.js.map +1 -0
  45. package/lib/commonjs/core/UpdateChecker.js +57 -0
  46. package/lib/commonjs/core/UpdateChecker.js.map +1 -0
  47. package/lib/commonjs/core/Verifier.js +82 -0
  48. package/lib/commonjs/core/Verifier.js.map +1 -0
  49. package/lib/commonjs/core/index.js +41 -0
  50. package/lib/commonjs/core/index.js.map +1 -0
  51. package/lib/commonjs/index.js +154 -0
  52. package/lib/commonjs/index.js.map +1 -0
  53. package/lib/commonjs/modal/SwiftPatchModal.js +667 -0
  54. package/lib/commonjs/modal/SwiftPatchModal.js.map +1 -0
  55. package/lib/commonjs/modal/useSwiftPatchModal.js +26 -0
  56. package/lib/commonjs/modal/useSwiftPatchModal.js.map +1 -0
  57. package/lib/commonjs/native/NativeSwiftPatch.js +85 -0
  58. package/lib/commonjs/native/NativeSwiftPatch.js.map +1 -0
  59. package/lib/commonjs/native/NativeSwiftPatchSpec.js +15 -0
  60. package/lib/commonjs/native/NativeSwiftPatchSpec.js.map +1 -0
  61. package/lib/commonjs/package.json +1 -0
  62. package/lib/commonjs/types.js +126 -0
  63. package/lib/commonjs/types.js.map +1 -0
  64. package/lib/commonjs/useSwiftPatch.js +31 -0
  65. package/lib/commonjs/useSwiftPatch.js.map +1 -0
  66. package/lib/commonjs/utils/api.js +206 -0
  67. package/lib/commonjs/utils/api.js.map +1 -0
  68. package/lib/commonjs/utils/device.js +23 -0
  69. package/lib/commonjs/utils/device.js.map +1 -0
  70. package/lib/commonjs/utils/logger.js +30 -0
  71. package/lib/commonjs/utils/logger.js.map +1 -0
  72. package/lib/commonjs/utils/storage.js +31 -0
  73. package/lib/commonjs/utils/storage.js.map +1 -0
  74. package/lib/commonjs/withSwiftPatch.js +42 -0
  75. package/lib/commonjs/withSwiftPatch.js.map +1 -0
  76. package/lib/module/SwiftPatchCore.js +135 -0
  77. package/lib/module/SwiftPatchCore.js.map +1 -0
  78. package/lib/module/SwiftPatchProvider.js +611 -0
  79. package/lib/module/SwiftPatchProvider.js.map +1 -0
  80. package/lib/module/constants.js +46 -0
  81. package/lib/module/constants.js.map +1 -0
  82. package/lib/module/core/Downloader.js +57 -0
  83. package/lib/module/core/Downloader.js.map +1 -0
  84. package/lib/module/core/Installer.js +41 -0
  85. package/lib/module/core/Installer.js.map +1 -0
  86. package/lib/module/core/Rollback.js +31 -0
  87. package/lib/module/core/Rollback.js.map +1 -0
  88. package/lib/module/core/UpdateChecker.js +51 -0
  89. package/lib/module/core/UpdateChecker.js.map +1 -0
  90. package/lib/module/core/Verifier.js +76 -0
  91. package/lib/module/core/Verifier.js.map +1 -0
  92. package/lib/module/core/index.js +8 -0
  93. package/lib/module/core/index.js.map +1 -0
  94. package/lib/module/index.js +34 -0
  95. package/lib/module/index.js.map +1 -0
  96. package/lib/module/modal/SwiftPatchModal.js +661 -0
  97. package/lib/module/modal/SwiftPatchModal.js.map +1 -0
  98. package/lib/module/modal/useSwiftPatchModal.js +22 -0
  99. package/lib/module/modal/useSwiftPatchModal.js.map +1 -0
  100. package/lib/module/native/NativeSwiftPatch.js +78 -0
  101. package/lib/module/native/NativeSwiftPatch.js.map +1 -0
  102. package/lib/module/native/NativeSwiftPatchSpec.js +12 -0
  103. package/lib/module/native/NativeSwiftPatchSpec.js.map +1 -0
  104. package/lib/module/types.js +139 -0
  105. package/lib/module/types.js.map +1 -0
  106. package/lib/module/useSwiftPatch.js +26 -0
  107. package/lib/module/useSwiftPatch.js.map +1 -0
  108. package/lib/module/utils/api.js +197 -0
  109. package/lib/module/utils/api.js.map +1 -0
  110. package/lib/module/utils/device.js +18 -0
  111. package/lib/module/utils/device.js.map +1 -0
  112. package/lib/module/utils/logger.js +26 -0
  113. package/lib/module/utils/logger.js.map +1 -0
  114. package/lib/module/utils/storage.js +24 -0
  115. package/lib/module/utils/storage.js.map +1 -0
  116. package/lib/module/withSwiftPatch.js +37 -0
  117. package/lib/module/withSwiftPatch.js.map +1 -0
  118. package/lib/typescript/SwiftPatchCore.d.ts +64 -0
  119. package/lib/typescript/SwiftPatchCore.d.ts.map +1 -0
  120. package/lib/typescript/SwiftPatchProvider.d.ts +22 -0
  121. package/lib/typescript/SwiftPatchProvider.d.ts.map +1 -0
  122. package/lib/typescript/constants.d.ts +33 -0
  123. package/lib/typescript/constants.d.ts.map +1 -0
  124. package/lib/typescript/core/Downloader.d.ts +34 -0
  125. package/lib/typescript/core/Downloader.d.ts.map +1 -0
  126. package/lib/typescript/core/Installer.d.ts +25 -0
  127. package/lib/typescript/core/Installer.d.ts.map +1 -0
  128. package/lib/typescript/core/Rollback.d.ts +18 -0
  129. package/lib/typescript/core/Rollback.d.ts.map +1 -0
  130. package/lib/typescript/core/UpdateChecker.d.ts +27 -0
  131. package/lib/typescript/core/UpdateChecker.d.ts.map +1 -0
  132. package/lib/typescript/core/Verifier.d.ts +31 -0
  133. package/lib/typescript/core/Verifier.d.ts.map +1 -0
  134. package/lib/typescript/core/index.d.ts +8 -0
  135. package/lib/typescript/core/index.d.ts.map +1 -0
  136. package/lib/typescript/index.d.ts +13 -0
  137. package/lib/typescript/index.d.ts.map +1 -0
  138. package/lib/typescript/modal/SwiftPatchModal.d.ts +11 -0
  139. package/lib/typescript/modal/SwiftPatchModal.d.ts.map +1 -0
  140. package/lib/typescript/modal/useSwiftPatchModal.d.ts +7 -0
  141. package/lib/typescript/modal/useSwiftPatchModal.d.ts.map +1 -0
  142. package/lib/typescript/native/NativeSwiftPatch.d.ts +61 -0
  143. package/lib/typescript/native/NativeSwiftPatch.d.ts.map +1 -0
  144. package/lib/typescript/native/NativeSwiftPatchSpec.d.ts +67 -0
  145. package/lib/typescript/native/NativeSwiftPatchSpec.d.ts.map +1 -0
  146. package/lib/typescript/types.d.ts +266 -0
  147. package/lib/typescript/types.d.ts.map +1 -0
  148. package/lib/typescript/useSwiftPatch.d.ts +12 -0
  149. package/lib/typescript/useSwiftPatch.d.ts.map +1 -0
  150. package/lib/typescript/utils/api.d.ts +87 -0
  151. package/lib/typescript/utils/api.d.ts.map +1 -0
  152. package/lib/typescript/utils/device.d.ts +9 -0
  153. package/lib/typescript/utils/device.d.ts.map +1 -0
  154. package/lib/typescript/utils/logger.d.ts +8 -0
  155. package/lib/typescript/utils/logger.d.ts.map +1 -0
  156. package/lib/typescript/utils/storage.d.ts +14 -0
  157. package/lib/typescript/utils/storage.d.ts.map +1 -0
  158. package/lib/typescript/withSwiftPatch.d.ts +12 -0
  159. package/lib/typescript/withSwiftPatch.d.ts.map +1 -0
  160. package/package.json +99 -0
  161. package/react-native-swiftpatch.podspec +50 -0
  162. package/src/SwiftPatchCore.ts +148 -0
  163. package/src/SwiftPatchProvider.tsx +514 -0
  164. package/src/constants.ts +49 -0
  165. package/src/core/Downloader.ts +74 -0
  166. package/src/core/Installer.ts +38 -0
  167. package/src/core/Rollback.ts +28 -0
  168. package/src/core/UpdateChecker.ts +70 -0
  169. package/src/core/Verifier.ts +92 -0
  170. package/src/core/index.ts +11 -0
  171. package/src/index.ts +64 -0
  172. package/src/modal/SwiftPatchModal.tsx +657 -0
  173. package/src/modal/useSwiftPatchModal.ts +24 -0
  174. package/src/native/NativeSwiftPatch.ts +205 -0
  175. package/src/native/NativeSwiftPatchSpec.ts +139 -0
  176. package/src/types.ts +336 -0
  177. package/src/useSwiftPatch.ts +29 -0
  178. package/src/utils/api.ts +244 -0
  179. package/src/utils/device.ts +15 -0
  180. package/src/utils/logger.ts +29 -0
  181. package/src/utils/storage.ts +23 -0
  182. package/src/withSwiftPatch.tsx +41 -0
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+
3
+ import React, { useState } from 'react';
4
+ import { SwiftPatchProvider } from './SwiftPatchProvider';
5
+ import { SwiftPatchModal } from './modal/SwiftPatchModal';
6
+ import { DEFAULT_CONFIG } from './constants';
7
+
8
+ /**
9
+ * Higher-order component to wrap your root component with SwiftPatchProvider.
10
+ * Also includes the built-in dashboard modal (accessible via useSwiftPatchModal).
11
+ */
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ export function withSwiftPatch(WrappedComponent, config) {
14
+ const mergedConfig = {
15
+ ...DEFAULT_CONFIG,
16
+ ...config
17
+ };
18
+ function WithSwiftPatch(props) {
19
+ const [modalVisible, setModalVisible] = useState(false);
20
+ return /*#__PURE__*/_jsxs(SwiftPatchProvider, {
21
+ config: config,
22
+ children: [/*#__PURE__*/_jsx(WrappedComponent, {
23
+ ...props
24
+ }), /*#__PURE__*/_jsx(SwiftPatchModal, {
25
+ visible: modalVisible,
26
+ onClose: () => setModalVisible(false),
27
+ serverUrl: mergedConfig.serverUrl,
28
+ deploymentKey: config.deploymentKey,
29
+ customHeaders: mergedConfig.customHeaders
30
+ })]
31
+ });
32
+ }
33
+ WithSwiftPatch.displayName = `withSwiftPatch(${WrappedComponent.displayName || WrappedComponent.name || 'Component'})`;
34
+ return WithSwiftPatch;
35
+ }
36
+ export default withSwiftPatch;
37
+ //# sourceMappingURL=withSwiftPatch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","useState","SwiftPatchProvider","SwiftPatchModal","DEFAULT_CONFIG","jsx","_jsx","jsxs","_jsxs","withSwiftPatch","WrappedComponent","config","mergedConfig","WithSwiftPatch","props","modalVisible","setModalVisible","children","visible","onClose","serverUrl","deploymentKey","customHeaders","displayName","name"],"sourceRoot":"../../src","sources":["withSwiftPatch.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAA4B,OAAO;AAC3D,SAASC,kBAAkB,QAAQ,sBAAsB;AACzD,SAASC,eAAe,QAAQ,yBAAyB;AAEzD,SAASC,cAAc,QAAQ,aAAa;;AAE5C;AACA;AACA;AACA;AAHA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAIA,OAAO,SAASC,cAAcA,CAC5BC,gBAAkC,EAClCC,MAAwB,EACxB;EACA,MAAMC,YAAY,GAAG;IAAE,GAAGR,cAAc;IAAE,GAAGO;EAAO,CAAC;EAErD,SAASE,cAAcA,CAACC,KAAQ,EAAE;IAChC,MAAM,CAACC,YAAY,EAAEC,eAAe,CAAC,GAAGf,QAAQ,CAAC,KAAK,CAAC;IAEvD,oBACEO,KAAA,CAACN,kBAAkB;MAACS,MAAM,EAAEA,MAAO;MAAAM,QAAA,gBACjCX,IAAA,CAACI,gBAAgB;QAAA,GAAKI;MAAK,CAAG,CAAC,eAC/BR,IAAA,CAACH,eAAe;QACde,OAAO,EAAEH,YAAa;QACtBI,OAAO,EAAEA,CAAA,KAAMH,eAAe,CAAC,KAAK,CAAE;QACtCI,SAAS,EAAER,YAAY,CAACQ,SAAW;QACnCC,aAAa,EAAEV,MAAM,CAACU,aAAc;QACpCC,aAAa,EAAEV,YAAY,CAACU;MAAc,CAC3C,CAAC;IAAA,CACgB,CAAC;EAEzB;EAEAT,cAAc,CAACU,WAAW,GAAG,kBAC3Bb,gBAAgB,CAACa,WAAW,IAAIb,gBAAgB,CAACc,IAAI,IAAI,WAAW,GACnE;EAEH,OAAOX,cAAc;AACvB;AAEA,eAAeJ,cAAc","ignoreList":[]}
@@ -0,0 +1,64 @@
1
+ import type { SwiftPatchConfig, ReleaseInfo, BundleInfo } from './types';
2
+ /**
3
+ * Imperative API for SwiftPatch (non-React usage).
4
+ *
5
+ * Use this when you need to interact with SwiftPatch outside of
6
+ * React components, such as in native module callbacks or background tasks.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * import { SwiftPatch } from '@orbitplus/react-native';
11
+ *
12
+ * const sp = new SwiftPatch({ deploymentKey: 'your-key' });
13
+ * await sp.init();
14
+ * const update = await sp.checkForUpdate();
15
+ * if (update) {
16
+ * await sp.downloadAndInstall(update);
17
+ * }
18
+ * ```
19
+ */
20
+ export declare class SwiftPatch {
21
+ private config;
22
+ private updateChecker;
23
+ private downloader;
24
+ private installer;
25
+ private rollbackModule;
26
+ constructor(userConfig: SwiftPatchConfig);
27
+ /**
28
+ * Initialize the native module
29
+ */
30
+ init(): Promise<void>;
31
+ /**
32
+ * Check for an available update
33
+ */
34
+ checkForUpdate(): Promise<ReleaseInfo | null>;
35
+ /**
36
+ * Download an update
37
+ */
38
+ download(release: ReleaseInfo): Promise<void>;
39
+ /**
40
+ * Install a downloaded update
41
+ */
42
+ install(release: ReleaseInfo): Promise<void>;
43
+ /**
44
+ * Download and install an update in one call
45
+ */
46
+ downloadAndInstall(release: ReleaseInfo): Promise<void>;
47
+ /**
48
+ * Restart the app to apply the update
49
+ */
50
+ restart(): void;
51
+ /**
52
+ * Rollback to the previous bundle
53
+ */
54
+ rollback(): Promise<void>;
55
+ /**
56
+ * Get current bundle info
57
+ */
58
+ getCurrentBundle(): Promise<BundleInfo | null>;
59
+ /**
60
+ * Clear any pending update
61
+ */
62
+ clearPendingUpdate(): Promise<void>;
63
+ }
64
+ //# sourceMappingURL=SwiftPatchCore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SwiftPatchCore.d.ts","sourceRoot":"","sources":["../../src/SwiftPatchCore.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,gBAAgB,EAChB,WAAW,EACX,UAAU,EACX,MAAM,SAAS,CAAC;AAGjB;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAGZ;IAEF,OAAO,CAAC,aAAa,CAAiB;IACtC,OAAO,CAAC,UAAU,CAAc;IAChC,OAAO,CAAC,SAAS,CAAa;IAC9B,OAAO,CAAC,cAAc,CAAkB;gBAE5B,UAAU,EAAE,gBAAgB;IAIxC;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAsB3B;;OAEG;IACG,cAAc,IAAI,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;IASnD;;OAEG;IACG,QAAQ,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAWnD;;OAEG;IACG,OAAO,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAWlD;;OAEG;IACG,kBAAkB,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAK7D;;OAEG;IACH,OAAO,IAAI,IAAI;IAIf;;OAEG;IACG,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAI/B;;OAEG;IACG,gBAAgB,IAAI,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;IAIpD;;OAEG;IACG,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC;CAG1C"}
@@ -0,0 +1,22 @@
1
+ import React, { type ReactNode } from 'react';
2
+ import type { SwiftPatchConfig, SwiftPatchState, SwiftPatchActions } from './types';
3
+ interface SwiftPatchContextValue extends SwiftPatchState, SwiftPatchActions {
4
+ }
5
+ interface SwiftPatchProviderProps {
6
+ config: SwiftPatchConfig;
7
+ children: ReactNode;
8
+ }
9
+ /**
10
+ * SwiftPatch Provider Component
11
+ *
12
+ * Wrap your app with this provider to enable OTA updates
13
+ * with dual-slot architecture, crash detection, and event analytics.
14
+ */
15
+ export declare function SwiftPatchProvider({ config, children, }: SwiftPatchProviderProps): React.JSX.Element;
16
+ /**
17
+ * Hook to access SwiftPatch context.
18
+ * Must be used within SwiftPatchProvider.
19
+ */
20
+ export declare function useSwiftPatchContext(): SwiftPatchContextValue;
21
+ export {};
22
+ //# sourceMappingURL=SwiftPatchProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SwiftPatchProvider.d.ts","sourceRoot":"","sources":["../../src/SwiftPatchProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAOZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EAOlB,MAAM,SAAS,CAAC;AAqBjB,UAAU,sBAAuB,SAAQ,eAAe,EAAE,iBAAiB;CAAG;AA0D9E,UAAU,uBAAuB;IAC/B,MAAM,EAAE,gBAAgB,CAAC;IACzB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,MAAM,EACN,QAAQ,GACT,EAAE,uBAAuB,qBAoYzB;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,sBAAsB,CAM7D"}
@@ -0,0 +1,33 @@
1
+ import type { SwiftPatchConfig } from './types';
2
+ /**
3
+ * Default SDK configuration values
4
+ */
5
+ export declare const DEFAULT_CONFIG: Required<Omit<SwiftPatchConfig, 'deploymentKey' | 'customHeaders' | 'publicKey' | 'sdkPin'>> & {
6
+ customHeaders: Record<string, string>;
7
+ publicKey: string | null;
8
+ sdkPin: string | null;
9
+ };
10
+ /**
11
+ * Native event names emitted from native modules
12
+ */
13
+ export declare const NativeEvents: {
14
+ readonly DOWNLOAD_PROGRESS: "SwiftPatch:downloadProgress";
15
+ readonly INSTALL_COMPLETE: "SwiftPatch:installComplete";
16
+ readonly ROLLBACK_OCCURRED: "SwiftPatch:rollbackOccurred";
17
+ readonly ERROR: "SwiftPatch:error";
18
+ readonly VERSION_CHANGED: "SwiftPatch:versionChanged";
19
+ readonly NATIVE_EVENT: "SwiftPatch:event";
20
+ };
21
+ /**
22
+ * SDK version identifier
23
+ */
24
+ export declare const SDK_VERSION = "2.0.0";
25
+ /**
26
+ * Crash detection window in milliseconds
27
+ */
28
+ export declare const CRASH_DETECTION_WINDOW_MS = 10000;
29
+ /**
30
+ * Event polling interval (ms)
31
+ */
32
+ export declare const EVENT_POLL_INTERVAL_MS = 3000;
33
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,IAAI,CAAC,gBAAgB,EAAE,eAAe,GAAG,eAAe,GAAG,WAAW,GAAG,QAAQ,CAAC,CAAC,GAAG;IAC1H,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CAYvB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY;;;;;;;CAOf,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,WAAW,UAAU,CAAC;AAEnC;;GAEG;AACH,eAAO,MAAM,yBAAyB,QAAS,CAAC;AAEhD;;GAEG;AACH,eAAO,MAAM,sBAAsB,OAAQ,CAAC"}
@@ -0,0 +1,34 @@
1
+ import type { ReleaseInfo, DownloadProgress } from '../types';
2
+ export interface DownloadOptions {
3
+ url: string;
4
+ expectedHash: string;
5
+ isPatch: boolean;
6
+ signature: string | null;
7
+ }
8
+ /**
9
+ * Core module responsible for downloading OTA bundles or patches.
10
+ *
11
+ * Delegates to the native module for actual download + disk I/O.
12
+ * Provides progress tracking and cancellation.
13
+ */
14
+ export declare class Downloader {
15
+ private unsubscribeProgress;
16
+ /**
17
+ * Download a bundle or patch from the given options.
18
+ */
19
+ download(options: DownloadOptions): Promise<void>;
20
+ /**
21
+ * Convenience: download a release (extracts fields from ReleaseInfo).
22
+ */
23
+ downloadRelease(release: ReleaseInfo): Promise<void>;
24
+ /**
25
+ * Register a callback for download progress events.
26
+ * Returns an unsubscribe function.
27
+ */
28
+ onProgress(callback: (progress: DownloadProgress) => void): () => void;
29
+ /**
30
+ * Cancel an in-progress download.
31
+ */
32
+ cancel(): Promise<void>;
33
+ }
34
+ //# sourceMappingURL=Downloader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Downloader.d.ts","sourceRoot":"","sources":["../../../src/core/Downloader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE9D,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED;;;;;GAKG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,mBAAmB,CAA6B;IAExD;;OAEG;IACG,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IAevD;;OAEG;IACG,eAAe,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAS1D;;;OAGG;IACH,UAAU,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,gBAAgB,KAAK,IAAI,GAAG,MAAM,IAAI;IAUtE;;OAEG;IACG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;CAI9B"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Core module responsible for installing verified bundles.
3
+ *
4
+ * Delegates to the native module for atomic file operations
5
+ * and pending install tracking.
6
+ */
7
+ export declare class Installer {
8
+ /**
9
+ * Install a downloaded and verified bundle by its hash.
10
+ * The native module handles moving the file to the correct location
11
+ * and setting it as the pending bundle.
12
+ */
13
+ install(bundleHash: string): Promise<void>;
14
+ /**
15
+ * Confirm the current installation as stable.
16
+ * Call this after the app has been running without crashes
17
+ * for the crash detection window period.
18
+ */
19
+ confirm(): Promise<void>;
20
+ /**
21
+ * Check if there is a pending installation awaiting restart.
22
+ */
23
+ hasPending(): Promise<boolean>;
24
+ }
25
+ //# sourceMappingURL=Installer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Installer.d.ts","sourceRoot":"","sources":["../../../src/core/Installer.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,qBAAa,SAAS;IACpB;;;;OAIG;IACG,OAAO,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAMhD;;;;OAIG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAK9B;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC;CAGrC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Core module responsible for rollback operations.
3
+ *
4
+ * Delegates to the native module for reverting to the
5
+ * previous bundle version and clearing pending updates.
6
+ */
7
+ export declare class Rollback {
8
+ /**
9
+ * Rollback to the previous bundle version.
10
+ * The native module restores the prior known-good bundle.
11
+ */
12
+ rollback(): Promise<void>;
13
+ /**
14
+ * Clear any pending update that has not yet been activated.
15
+ */
16
+ clearPending(): Promise<void>;
17
+ }
18
+ //# sourceMappingURL=Rollback.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Rollback.d.ts","sourceRoot":"","sources":["../../../src/core/Rollback.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,qBAAa,QAAQ;IACnB;;;OAGG;IACG,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAM/B;;OAEG;IACG,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;CAIpC"}
@@ -0,0 +1,27 @@
1
+ import type { ReleaseInfo } from '../types';
2
+ export interface UpdateCheckOptions {
3
+ serverUrl: string;
4
+ deploymentKey: string;
5
+ customHeaders?: Record<string, string>;
6
+ }
7
+ export interface UpdateCheckResult {
8
+ updateAvailable: boolean;
9
+ release?: ReleaseInfo;
10
+ reason?: string;
11
+ }
12
+ /**
13
+ * Core module responsible for checking for available OTA updates.
14
+ *
15
+ * Gathers device info from the native module and calls the
16
+ * server's check-update endpoint.
17
+ */
18
+ export declare class UpdateChecker {
19
+ private options;
20
+ constructor(options: UpdateCheckOptions);
21
+ /**
22
+ * Check the server for an available update.
23
+ * Gathers appVersion, currentBundleHash, deviceId from native module.
24
+ */
25
+ check(): Promise<UpdateCheckResult>;
26
+ }
27
+ //# sourceMappingURL=UpdateChecker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UpdateChecker.d.ts","sourceRoot":"","sources":["../../../src/core/UpdateChecker.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACxC;AAED,MAAM,WAAW,iBAAiB;IAChC,eAAe,EAAE,OAAO,CAAC;IACzB,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;GAKG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,OAAO,CAAqB;gBAExB,OAAO,EAAE,kBAAkB;IAIvC;;;OAGG;IACG,KAAK,IAAI,OAAO,CAAC,iBAAiB,CAAC;CAiC1C"}
@@ -0,0 +1,31 @@
1
+ import type { ReleaseInfo } from '../types';
2
+ /**
3
+ * Core module responsible for verifying downloaded bundles.
4
+ *
5
+ * 4-step verification pipeline:
6
+ * 1. Apply patch if isPatch (via native bspatch)
7
+ * 2. Compute SHA-256 hash of the resulting bundle (via native)
8
+ * 3. Verify hash matches release.bundleHash
9
+ * 4. Verify RSA signature if provided (via native)
10
+ */
11
+ export declare class Verifier {
12
+ private publicKey;
13
+ /**
14
+ * Set the RSA public key for signature verification.
15
+ */
16
+ setPublicKey(key: string | null): void;
17
+ /**
18
+ * Run the full verification pipeline on a downloaded bundle/patch.
19
+ *
20
+ * @param downloadedPath Path to the downloaded file on disk
21
+ * @param release Release metadata from the server
22
+ * @param currentBundlePath Path to the current bundle (needed if isPatch)
23
+ * @returns The path to the final verified bundle
24
+ */
25
+ verify(downloadedPath: string, release: ReleaseInfo, currentBundlePath?: string): Promise<string>;
26
+ /**
27
+ * Quick hash-only verification.
28
+ */
29
+ verifyHash(bundlePath: string, expectedHash: string): Promise<boolean>;
30
+ }
31
+ //# sourceMappingURL=Verifier.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Verifier.d.ts","sourceRoot":"","sources":["../../../src/core/Verifier.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C;;;;;;;;GAQG;AACH,qBAAa,QAAQ;IACnB,OAAO,CAAC,SAAS,CAAuB;IAExC;;OAEG;IACH,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAItC;;;;;;;OAOG;IACG,MAAM,CACV,cAAc,EAAE,MAAM,EACtB,OAAO,EAAE,WAAW,EACpB,iBAAiB,CAAC,EAAE,MAAM,GACzB,OAAO,CAAC,MAAM,CAAC;IAiDlB;;OAEG;IACG,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAI7E"}
@@ -0,0 +1,8 @@
1
+ export { UpdateChecker } from './UpdateChecker';
2
+ export type { UpdateCheckOptions, UpdateCheckResult } from './UpdateChecker';
3
+ export { Downloader } from './Downloader';
4
+ export type { DownloadOptions } from './Downloader';
5
+ export { Verifier } from './Verifier';
6
+ export { Installer } from './Installer';
7
+ export { Rollback } from './Rollback';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAE7E,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,13 @@
1
+ export { SwiftPatchProvider } from './SwiftPatchProvider';
2
+ export { useSwiftPatch, useSwiftPatchUpdate } from './useSwiftPatch';
3
+ export { useSwiftPatchModal } from './modal/useSwiftPatchModal';
4
+ export { withSwiftPatch } from './withSwiftPatch';
5
+ export { SwiftPatch } from './SwiftPatchCore';
6
+ export { SwiftPatchModal } from './modal/SwiftPatchModal';
7
+ export type { SwiftPatchConfig, SwiftPatchState, SwiftPatchActions, UseSwiftPatchReturn, UseSwiftPatchUpdateReturn, UseSwiftPatchModalReturn, ReleaseInfo, BundleInfo, DownloadProgress, SwiftPatchError, SlotMetadata, SwiftPatchEvent, } from './types';
8
+ export { UpdateStatus, InstallMode, SwiftPatchErrorCode, SlotState, EnvironmentMode, SwiftPatchEventType, } from './types';
9
+ export { default as NativeSwiftPatch } from './native/NativeSwiftPatch';
10
+ export { UpdateChecker, Downloader, Verifier, Installer, Rollback, } from './core';
11
+ export type { UpdateCheckOptions, UpdateCheckResult, DownloadOptions, } from './core';
12
+ export declare function restart(): void;
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAG1D,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAGhE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAG9C,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG1D,YAAY,EACV,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,yBAAyB,EACzB,wBAAwB,EACxB,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,eAAe,GAChB,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,YAAY,EACZ,WAAW,EACX,mBAAmB,EACnB,SAAS,EACT,eAAe,EACf,mBAAmB,GACpB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAGxE,OAAO,EACL,aAAa,EACb,UAAU,EACV,QAAQ,EACR,SAAS,EACT,QAAQ,GACT,MAAM,QAAQ,CAAC;AAChB,YAAY,EACV,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,GAChB,MAAM,QAAQ,CAAC;AAGhB,wBAAgB,OAAO,IAAI,IAAI,CAG9B"}
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ interface SwiftPatchModalProps {
3
+ visible: boolean;
4
+ onClose: () => void;
5
+ serverUrl: string;
6
+ deploymentKey: string;
7
+ customHeaders?: Record<string, string>;
8
+ }
9
+ export declare function SwiftPatchModal({ visible, onClose, serverUrl, deploymentKey, customHeaders, }: SwiftPatchModalProps): React.JSX.Element;
10
+ export {};
11
+ //# sourceMappingURL=SwiftPatchModal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SwiftPatchModal.d.ts","sourceRoot":"","sources":["../../../src/modal/SwiftPatchModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAuBhE,UAAU,oBAAoB;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACxC;AAyBD,wBAAgB,eAAe,CAAC,EAC9B,OAAO,EACP,OAAO,EACP,SAAS,EACT,aAAa,EACb,aAAkB,GACnB,EAAE,oBAAoB,qBAgWtB"}
@@ -0,0 +1,7 @@
1
+ import type { UseSwiftPatchModalReturn } from '../types';
2
+ /**
3
+ * Hook for controlling the SwiftPatch in-app dashboard modal.
4
+ * Use this to show/hide the modal for bundle management.
5
+ */
6
+ export declare function useSwiftPatchModal(): UseSwiftPatchModalReturn;
7
+ //# sourceMappingURL=useSwiftPatchModal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSwiftPatchModal.d.ts","sourceRoot":"","sources":["../../../src/modal/useSwiftPatchModal.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAEzD;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,wBAAwB,CAgB7D"}
@@ -0,0 +1,61 @@
1
+ import { NativeEventEmitter } from 'react-native';
2
+ import type { BundleInfo, DownloadProgress, SlotMetadata } from '../types';
3
+ export declare const swiftPatchEmitter: NativeEventEmitter;
4
+ export declare const IS_TURBO_MODULE_ENABLED: boolean;
5
+ /**
6
+ * Native module interface
7
+ */
8
+ export interface NativeSwiftPatchModule {
9
+ initialize(config: {
10
+ deploymentKey: string;
11
+ serverUrl: string;
12
+ publicKey: string | null;
13
+ }): Promise<void>;
14
+ getJSBundleFile(): string | null;
15
+ setDebugMode(enabled: boolean): void;
16
+ markMounted(): Promise<void>;
17
+ markUnmounted(): Promise<void>;
18
+ getCurrentBundle(): Promise<BundleInfo | null>;
19
+ getSlotMetadata(): Promise<SlotMetadata>;
20
+ getDeviceId(): Promise<string>;
21
+ getAppVersion(): Promise<string>;
22
+ switchEnvironment(environment: string): Promise<SlotMetadata>;
23
+ downloadUpdate(url: string, expectedHash: string, isPatch: boolean, signature: string | null): Promise<void>;
24
+ downloadStageBundle(url: string, expectedHash: string): Promise<void>;
25
+ installUpdate(bundleHash: string): Promise<void>;
26
+ hasPendingInstall(): Promise<boolean>;
27
+ confirmInstall(): Promise<void>;
28
+ stabilize(): Promise<SlotMetadata>;
29
+ restart(): void;
30
+ rollback(): Promise<string>;
31
+ clearPendingUpdate(): Promise<void>;
32
+ popEvents(): Promise<Array<Record<string, unknown>>>;
33
+ acknowledgeEvents(eventIdsJson: string): Promise<void>;
34
+ recordSuccessfulLaunch(bundleHash: string): Promise<number>;
35
+ getLaunchCount(bundleHash: string): Promise<number>;
36
+ reportStatus(releaseId: string, status: 'downloaded' | 'installed' | 'crashed' | 'rolledBack'): Promise<void>;
37
+ computeHash(filePath: string): Promise<string>;
38
+ applyPatch(currentBundlePath: string, patchPath: string, outputPath: string): Promise<string>;
39
+ verifySignature(data: string, signature: string, publicKey: string): Promise<boolean>;
40
+ cancelDownload(): Promise<void>;
41
+ getDownloadedBundlePath(bundleHash: string): Promise<string>;
42
+ }
43
+ declare const _default: NativeSwiftPatchModule;
44
+ export default _default;
45
+ /**
46
+ * Subscribe to download progress events
47
+ */
48
+ export declare function onDownloadProgress(callback: (progress: DownloadProgress) => void): () => void;
49
+ /**
50
+ * Subscribe to rollback events
51
+ */
52
+ export declare function onRollback(callback: (reason: string) => void): () => void;
53
+ /**
54
+ * Subscribe to version change events
55
+ */
56
+ export declare function onVersionChanged(callback: (reason: string) => void): () => void;
57
+ /**
58
+ * Subscribe to native SDK events
59
+ */
60
+ export declare function onNativeEvent(callback: (event: Record<string, unknown>) => void): () => void;
61
+ //# sourceMappingURL=NativeSwiftPatch.d.ts.map
@@ -0,0 +1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CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC9D;wBAEkC,sBAAsB;AAAzD,wBAA0D;AAE1D;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,CAAC,QAAQ,EAAE,gBAAgB,KAAK,IAAI,GAC7C,MAAM,IAAI,CAMZ;AAED;;GAEG;AACH,wBAAgB,UAAU,CACxB,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,GACjC,MAAM,IAAI,CAMZ;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,GACjC,MAAM,IAAI,CAMZ;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,GACjD,MAAM,IAAI,CAMZ"}
@@ -0,0 +1,67 @@
1
+ /**
2
+ * TurboModule Spec for SwiftPatch
3
+ *
4
+ * This file defines the interface for the New Architecture TurboModule.
5
+ * Codegen will use this to generate native code for iOS and Android.
6
+ */
7
+ import type { TurboModule } from 'react-native';
8
+ export interface BundleInfo {
9
+ hash: string;
10
+ version: string;
11
+ installedAt: string;
12
+ isOriginal: boolean;
13
+ slot: string;
14
+ environment: string;
15
+ }
16
+ export interface SlotMetadata {
17
+ environment: string;
18
+ prod: {
19
+ currentSlot: string;
20
+ newHash: string | null;
21
+ stableHash: string | null;
22
+ tempHash: string | null;
23
+ };
24
+ stage: {
25
+ newHash: string | null;
26
+ };
27
+ }
28
+ export interface Spec extends TurboModule {
29
+ initialize(config: {
30
+ deploymentKey: string;
31
+ serverUrl: string;
32
+ publicKey: string | null;
33
+ }): Promise<void>;
34
+ getJSBundleFile(): string | null;
35
+ setDebugMode(enabled: boolean): void;
36
+ markMounted(): Promise<void>;
37
+ markUnmounted(): Promise<void>;
38
+ getCurrentBundle(): Promise<BundleInfo | null>;
39
+ getSlotMetadata(): Promise<SlotMetadata>;
40
+ getDeviceId(): Promise<string>;
41
+ getAppVersion(): Promise<string>;
42
+ switchEnvironment(environment: string): Promise<SlotMetadata>;
43
+ downloadUpdate(url: string, expectedHash: string, isPatch: boolean, signature: string | null): Promise<void>;
44
+ downloadStageBundle(url: string, expectedHash: string): Promise<void>;
45
+ installUpdate(bundleHash: string): Promise<void>;
46
+ hasPendingInstall(): Promise<boolean>;
47
+ confirmInstall(): Promise<void>;
48
+ stabilize(): Promise<SlotMetadata>;
49
+ restart(): void;
50
+ rollback(): Promise<string>;
51
+ clearPendingUpdate(): Promise<void>;
52
+ popEvents(): Promise<Array<Record<string, unknown>>>;
53
+ acknowledgeEvents(eventIdsJson: string): Promise<void>;
54
+ recordSuccessfulLaunch(bundleHash: string): Promise<number>;
55
+ getLaunchCount(bundleHash: string): Promise<number>;
56
+ reportStatus(releaseId: string, status: 'downloaded' | 'installed' | 'crashed' | 'rolledBack'): Promise<void>;
57
+ computeHash(filePath: string): Promise<string>;
58
+ applyPatch(currentBundlePath: string, patchPath: string, outputPath: string): Promise<string>;
59
+ verifySignature(data: string, signature: string, publicKey: string): Promise<boolean>;
60
+ cancelDownload(): Promise<void>;
61
+ getDownloadedBundlePath(bundleHash: string): Promise<string>;
62
+ addListener(eventName: string): void;
63
+ removeListeners(count: number): void;
64
+ }
65
+ declare const _default: Spec;
66
+ export default _default;
67
+ //# sourceMappingURL=NativeSwiftPatchSpec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativeSwiftPatchSpec.d.ts","sourceRoot":"","sources":["../../../src/native/NativeSwiftPatchSpec.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,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