@algocare/react-native-code-push 12.6.3 → 13.0.0-rc.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 (292) hide show
  1. package/CodePush.podspec +6 -8
  2. package/README.md +343 -586
  3. package/android/app/build.gradle +2 -1
  4. package/android/app/proguard-rules.pro +14 -0
  5. package/android/app/src/debug/AndroidManifest.xml +9 -0
  6. package/android/app/src/main/AndroidManifest.xml +1 -2
  7. package/android/app/src/main/java/com/microsoft/codepush/react/CodePush.java +14 -139
  8. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushConstants.java +0 -3
  9. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushNativeModule.java +108 -63
  10. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushUpdateManager.java +2 -33
  11. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushUpdateUtils.java +13 -109
  12. package/android/build.gradle +3 -0
  13. package/app.plugin.js +1 -0
  14. package/bin/code-push.js +6 -0
  15. package/cli/commands/bundleCommand/bundleCodePush.ts +118 -0
  16. package/cli/commands/bundleCommand/index.ts +34 -0
  17. package/cli/commands/createHistoryCommand/createReleaseHistory.ts +37 -0
  18. package/cli/commands/createHistoryCommand/createReleaseHistoryList.ts +40 -0
  19. package/cli/commands/createHistoryCommand/index.ts +44 -0
  20. package/cli/commands/createPullRequestHistoryCommand/createPullRequestHistory.ts +33 -0
  21. package/cli/commands/createPullRequestHistoryCommand/index.ts +31 -0
  22. package/cli/commands/createPullRequestReleaseCommand/addToPullRequestRelease.ts +71 -0
  23. package/cli/commands/createPullRequestReleaseCommand/createPullRequestRelease.ts +75 -0
  24. package/cli/commands/createPullRequestReleaseCommand/index.ts +74 -0
  25. package/cli/commands/getPackageHashCommand/index.ts +45 -0
  26. package/cli/commands/initCommand/index.ts +14 -0
  27. package/cli/commands/initCommand/initAndroid.ts +91 -0
  28. package/cli/commands/initCommand/initIos.ts +123 -0
  29. package/cli/commands/initCommand/test/initAndroid.test.ts +128 -0
  30. package/cli/commands/initCommand/test/initIos.test.ts +99 -0
  31. package/cli/commands/releaseCommand/addToReleaseHistory.ts +57 -0
  32. package/cli/commands/releaseCommand/index.ts +90 -0
  33. package/cli/commands/releaseCommand/release.ts +105 -0
  34. package/cli/commands/removePullRequestHistoryCommand/index.ts +37 -0
  35. package/cli/commands/removePullRequestHistoryCommand/removePullRequestHistory.ts +28 -0
  36. package/cli/commands/showHistoryCommand/index.ts +31 -0
  37. package/cli/commands/updateHistoryCommand/index.ts +55 -0
  38. package/cli/commands/updateHistoryCommand/updateReleaseHistory.ts +42 -0
  39. package/cli/constant.ts +4 -0
  40. package/cli/dist/commands/bundleCommand/bundleCodePush.js +65 -0
  41. package/cli/dist/commands/bundleCommand/index.js +15 -0
  42. package/cli/dist/commands/createHistoryCommand/createReleaseHistory.js +25 -0
  43. package/cli/dist/commands/createHistoryCommand/createReleaseHistoryList.js +27 -0
  44. package/cli/dist/commands/createHistoryCommand/index.js +20 -0
  45. package/cli/dist/commands/createPullRequestHistoryCommand/createPullRequestHistory.js +23 -0
  46. package/cli/dist/commands/createPullRequestHistoryCommand/index.js +15 -0
  47. package/cli/dist/commands/createPullRequestReleaseCommand/addToPullRequestRelease.js +51 -0
  48. package/cli/dist/commands/createPullRequestReleaseCommand/createPullRequestRelease.js +39 -0
  49. package/cli/dist/commands/createPullRequestReleaseCommand/index.js +35 -0
  50. package/cli/dist/commands/getPackageHashCommand/index.js +26 -0
  51. package/cli/dist/commands/initCommand/index.js +12 -0
  52. package/cli/dist/commands/initCommand/initAndroid.js +73 -0
  53. package/cli/dist/commands/initCommand/initIos.js +108 -0
  54. package/cli/dist/commands/initCommand/test/initAndroid.test.js +113 -0
  55. package/cli/dist/commands/initCommand/test/initIos.test.js +95 -0
  56. package/cli/dist/commands/releaseCommand/addToReleaseHistory.js +35 -0
  57. package/cli/dist/commands/releaseCommand/index.js +45 -0
  58. package/cli/dist/commands/releaseCommand/release.js +62 -0
  59. package/cli/dist/commands/removePullRequestHistoryCommand/index.js +19 -0
  60. package/cli/dist/commands/removePullRequestHistoryCommand/removePullRequestHistory.js +18 -0
  61. package/cli/dist/commands/showHistoryCommand/index.js +15 -0
  62. package/cli/dist/commands/updateHistoryCommand/index.js +31 -0
  63. package/cli/dist/commands/updateHistoryCommand/updateReleaseHistory.js +28 -0
  64. package/cli/dist/constant.js +4 -0
  65. package/cli/dist/functions/getReactTempDir.js +10 -0
  66. package/cli/{functions → dist/functions}/makeCodePushBundle.js +5 -11
  67. package/cli/{functions → dist/functions}/prepareToBundleJS.js +2 -5
  68. package/cli/dist/functions/runExpoBundleCommand.js +35 -0
  69. package/cli/{functions → dist/functions}/runHermesEmitBinaryCommand.js +36 -71
  70. package/cli/{functions → dist/functions}/runReactNativeBundleCommand.js +19 -24
  71. package/cli/dist/index.js +54 -0
  72. package/cli/dist/utils/datetime.js +17 -0
  73. package/cli/dist/utils/file-utils.js +19 -0
  74. package/cli/dist/utils/fsUtils.js +44 -0
  75. package/cli/{utils → dist/utils}/hash-utils.js +19 -130
  76. package/cli/{utils → dist/utils}/promisfied-fs.js +5 -16
  77. package/cli/dist/utils/showLogo.js +21 -0
  78. package/cli/dist/utils/unzip.js +41 -0
  79. package/cli/{utils → dist/utils}/zip.js +15 -51
  80. package/cli/functions/{getReactTempDir.js → getReactTempDir.ts} +2 -6
  81. package/cli/functions/makeCodePushBundle.ts +26 -0
  82. package/cli/functions/prepareToBundleJS.ts +10 -0
  83. package/cli/functions/runExpoBundleCommand.ts +45 -0
  84. package/cli/functions/runHermesEmitBinaryCommand.ts +203 -0
  85. package/cli/functions/runReactNativeBundleCommand.ts +67 -0
  86. package/cli/index.ts +68 -0
  87. package/cli/package.json +35 -0
  88. package/cli/utils/datetime.ts +19 -0
  89. package/cli/utils/{file-utils.js → file-utils.ts} +4 -21
  90. package/cli/utils/fsUtils.ts +50 -0
  91. package/cli/utils/hash-utils.ts +143 -0
  92. package/cli/utils/promisfied-fs.ts +19 -0
  93. package/cli/utils/{showLogo.js → showLogo.ts} +4 -6
  94. package/cli/utils/unzip.ts +46 -0
  95. package/cli/utils/zip.ts +65 -0
  96. package/expo/plugin/withCodePush.js +14 -0
  97. package/expo/plugin/withCodePushAndroid.js +92 -0
  98. package/expo/plugin/withCodePushIos.js +143 -0
  99. package/ios/CodePush/CodePush.h +0 -16
  100. package/ios/CodePush/CodePush.m +30 -20
  101. package/ios/CodePush/CodePushConfig.m +1 -11
  102. package/ios/CodePush/CodePushPackage.m +12 -69
  103. package/ios/CodePush/CodePushUpdateUtils.m +1 -91
  104. package/ios/CodePush/SSZipArchive/Info.plist +26 -0
  105. package/ios/CodePush/SSZipArchive/README.md +1 -1
  106. package/ios/CodePush/SSZipArchive/SSZipArchive.h +129 -27
  107. package/ios/CodePush/SSZipArchive/SSZipArchive.m +1119 -314
  108. package/ios/CodePush/SSZipArchive/SSZipCommon.h +71 -0
  109. package/ios/CodePush/SSZipArchive/Supporting Files/PrivacyInfo.xcprivacy +23 -0
  110. package/ios/CodePush/SSZipArchive/include/ZipArchive.h +25 -0
  111. package/ios/CodePush/SSZipArchive/minizip/LICENSE +17 -0
  112. package/ios/CodePush/SSZipArchive/minizip/mz.h +273 -0
  113. package/ios/CodePush/SSZipArchive/minizip/mz_compat.c +1306 -0
  114. package/ios/CodePush/SSZipArchive/minizip/mz_compat.h +346 -0
  115. package/ios/CodePush/SSZipArchive/minizip/mz_crypt.c +187 -0
  116. package/ios/CodePush/SSZipArchive/minizip/mz_crypt.h +65 -0
  117. package/ios/CodePush/SSZipArchive/minizip/mz_crypt_apple.c +526 -0
  118. package/ios/CodePush/SSZipArchive/minizip/mz_os.c +348 -0
  119. package/ios/CodePush/SSZipArchive/minizip/mz_os.h +176 -0
  120. package/ios/CodePush/SSZipArchive/minizip/mz_os_posix.c +350 -0
  121. package/ios/CodePush/SSZipArchive/minizip/mz_strm.c +556 -0
  122. package/ios/CodePush/SSZipArchive/minizip/mz_strm.h +132 -0
  123. package/ios/CodePush/SSZipArchive/minizip/mz_strm_buf.c +383 -0
  124. package/ios/CodePush/SSZipArchive/minizip/mz_strm_buf.h +42 -0
  125. package/ios/CodePush/SSZipArchive/minizip/mz_strm_mem.c +269 -0
  126. package/ios/CodePush/SSZipArchive/minizip/mz_strm_mem.h +48 -0
  127. package/ios/CodePush/SSZipArchive/minizip/mz_strm_os.h +40 -0
  128. package/ios/CodePush/SSZipArchive/minizip/mz_strm_os_posix.c +203 -0
  129. package/ios/CodePush/SSZipArchive/minizip/mz_strm_pkcrypt.c +334 -0
  130. package/ios/CodePush/SSZipArchive/minizip/mz_strm_pkcrypt.h +46 -0
  131. package/ios/CodePush/SSZipArchive/minizip/mz_strm_split.c +429 -0
  132. package/ios/CodePush/SSZipArchive/minizip/mz_strm_split.h +43 -0
  133. package/ios/CodePush/SSZipArchive/minizip/mz_strm_wzaes.c +360 -0
  134. package/ios/CodePush/SSZipArchive/minizip/mz_strm_wzaes.h +46 -0
  135. package/ios/CodePush/SSZipArchive/minizip/mz_strm_zlib.c +389 -0
  136. package/ios/CodePush/SSZipArchive/minizip/mz_strm_zlib.h +43 -0
  137. package/ios/CodePush/SSZipArchive/minizip/mz_zip.c +2782 -0
  138. package/ios/CodePush/SSZipArchive/minizip/mz_zip.h +262 -0
  139. package/ios/CodePush/SSZipArchive/minizip/mz_zip_rw.c +1942 -0
  140. package/ios/CodePush/SSZipArchive/minizip/mz_zip_rw.h +285 -0
  141. package/ios/CodePush.xcodeproj/project.pbxproj +244 -453
  142. package/ios/PrivacyInfo.xcprivacy +31 -0
  143. package/package.json +67 -41
  144. package/react-native.config.js +1 -1
  145. package/{AlertAdapter.js → src/AlertAdapter.js} +5 -5
  146. package/src/CodePush.js +947 -0
  147. package/{package-mixins.js → src/package-mixins.js} +1 -1
  148. package/{versioning → src/versioning}/BaseVersioning.js +12 -1
  149. package/{versioning → src/versioning}/SemverVersioning.test.js +78 -0
  150. package/typings/react-native-code-push.d.ts +559 -495
  151. package/CONTRIBUTING.md +0 -134
  152. package/CodePush.js +0 -972
  153. package/SECURITY.md +0 -41
  154. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushBuilder.java +0 -37
  155. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushInvalidPublicKeyException.java +0 -12
  156. package/android/app/src/main/java/com/microsoft/codepush/react/ReactInstanceHolder.java +0 -17
  157. package/android/codepush.gradle +0 -162
  158. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  159. package/android/gradle/wrapper/gradle-wrapper.properties +0 -5
  160. package/android/gradlew +0 -164
  161. package/android/gradlew.bat +0 -90
  162. package/babel.config.js +0 -3
  163. package/cli/commands/bundleCommand/bundleCodePush.js +0 -57
  164. package/cli/commands/bundleCommand/index.js +0 -55
  165. package/cli/commands/common.js +0 -245
  166. package/cli/commands/createHistoryCommand/createReleaseHistory.js +0 -42
  167. package/cli/commands/createHistoryCommand/createReleaseHistoryList.js +0 -52
  168. package/cli/commands/createHistoryCommand/index.js +0 -95
  169. package/cli/commands/createPullRequestHistoryCommand/createPullRequestHistory.js +0 -34
  170. package/cli/commands/createPullRequestHistoryCommand/index.js +0 -29
  171. package/cli/commands/createPullRequestReleaseCommand/addToPullRequestRelease.js +0 -74
  172. package/cli/commands/createPullRequestReleaseCommand/createPullRequestRelease.js +0 -91
  173. package/cli/commands/createPullRequestReleaseCommand/index.js +0 -68
  174. package/cli/commands/getPackageHashCommand/index.js +0 -42
  175. package/cli/commands/releaseCommand/addToReleaseHistory.js +0 -85
  176. package/cli/commands/releaseCommand/index.js +0 -151
  177. package/cli/commands/releaseCommand/release.js +0 -121
  178. package/cli/commands/removePullRequestHistoryCommand/index.js +0 -28
  179. package/cli/commands/removePullRequestHistoryCommand/removePullRequestHistory.js +0 -23
  180. package/cli/commands/showHistoryCommand/index.js +0 -88
  181. package/cli/commands/updateHistoryCommand/index.js +0 -123
  182. package/cli/commands/updateHistoryCommand/updateReleaseHistory.js +0 -69
  183. package/cli/constant.js +0 -8
  184. package/cli/index.js +0 -63
  185. package/cli/utils/datetime.js +0 -22
  186. package/cli/utils/fsUtils.js +0 -64
  187. package/cli/utils/version.js +0 -26
  188. package/code-push.config.example.supabase.ts +0 -114
  189. package/code-push.config.js +0 -229
  190. package/code-push.config.ts +0 -175
  191. package/docs/api-android.md +0 -83
  192. package/docs/api-ios.md +0 -31
  193. package/docs/api-js.md +0 -592
  194. package/docs/multi-deployment-testing-android.md +0 -148
  195. package/docs/multi-deployment-testing-ios.md +0 -59
  196. package/docs/setup-android.md +0 -482
  197. package/docs/setup-ios.md +0 -280
  198. package/eslint.config.mjs +0 -32
  199. package/ios/CodePush/Base64/Base64/MF_Base64Additions.h +0 -34
  200. package/ios/CodePush/Base64/Base64/MF_Base64Additions.m +0 -252
  201. package/ios/CodePush/Base64/README.md +0 -47
  202. package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithm.h +0 -69
  203. package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmFactory.h +0 -16
  204. package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmFactory.m +0 -51
  205. package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmNone.h +0 -15
  206. package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmNone.m +0 -55
  207. package/ios/CodePush/JWT/Core/Algorithms/ESFamily/JWTAlgorithmESBase.h +0 -24
  208. package/ios/CodePush/JWT/Core/Algorithms/ESFamily/JWTAlgorithmESBase.m +0 -41
  209. package/ios/CodePush/JWT/Core/Algorithms/HSFamily/JWTAlgorithmHSBase.h +0 -28
  210. package/ios/CodePush/JWT/Core/Algorithms/HSFamily/JWTAlgorithmHSBase.m +0 -205
  211. package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolder.h +0 -103
  212. package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolder.m +0 -322
  213. package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolderChain.h +0 -37
  214. package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolderChain.m +0 -145
  215. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTAlgorithmRSBase.h +0 -35
  216. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTAlgorithmRSBase.m +0 -551
  217. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTRSAlgorithm.h +0 -23
  218. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKey.h +0 -43
  219. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKey.m +0 -230
  220. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKeyExtractor.h +0 -31
  221. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKeyExtractor.m +0 -113
  222. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoSecurity.h +0 -38
  223. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoSecurity.m +0 -500
  224. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaim.h +0 -18
  225. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaim.m +0 -214
  226. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSet.h +0 -23
  227. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSet.m +0 -29
  228. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetSerializer.h +0 -19
  229. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetSerializer.m +0 -68
  230. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetVerifier.h +0 -18
  231. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetVerifier.m +0 -72
  232. package/ios/CodePush/JWT/Core/Coding/JWTCoding+ResultTypes.h +0 -67
  233. package/ios/CodePush/JWT/Core/Coding/JWTCoding+ResultTypes.m +0 -111
  234. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionOne.h +0 -119
  235. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionOne.m +0 -307
  236. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionThree.h +0 -94
  237. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionThree.m +0 -619
  238. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionTwo.h +0 -164
  239. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionTwo.m +0 -514
  240. package/ios/CodePush/JWT/Core/Coding/JWTCoding.h +0 -24
  241. package/ios/CodePush/JWT/Core/Coding/JWTCoding.m +0 -11
  242. package/ios/CodePush/JWT/Core/FrameworkSupplement/JWT.h +0 -52
  243. package/ios/CodePush/JWT/Core/FrameworkSupplement/Map.modulemap +0 -5
  244. package/ios/CodePush/JWT/Core/Supplement/JWTBase64Coder.h +0 -28
  245. package/ios/CodePush/JWT/Core/Supplement/JWTBase64Coder.m +0 -70
  246. package/ios/CodePush/JWT/Core/Supplement/JWTDeprecations.h +0 -22
  247. package/ios/CodePush/JWT/Core/Supplement/JWTErrorDescription.h +0 -34
  248. package/ios/CodePush/JWT/Core/Supplement/JWTErrorDescription.m +0 -73
  249. package/ios/CodePush/JWT/LICENSE +0 -19
  250. package/ios/CodePush/JWT/README.md +0 -489
  251. package/ios/CodePush/SSZipArchive/Common.h +0 -81
  252. package/ios/CodePush/SSZipArchive/aes/aes.h +0 -198
  253. package/ios/CodePush/SSZipArchive/aes/aes_via_ace.h +0 -541
  254. package/ios/CodePush/SSZipArchive/aes/aescrypt.c +0 -294
  255. package/ios/CodePush/SSZipArchive/aes/aeskey.c +0 -548
  256. package/ios/CodePush/SSZipArchive/aes/aesopt.h +0 -739
  257. package/ios/CodePush/SSZipArchive/aes/aestab.c +0 -391
  258. package/ios/CodePush/SSZipArchive/aes/aestab.h +0 -173
  259. package/ios/CodePush/SSZipArchive/aes/brg_endian.h +0 -126
  260. package/ios/CodePush/SSZipArchive/aes/brg_types.h +0 -219
  261. package/ios/CodePush/SSZipArchive/aes/entropy.c +0 -54
  262. package/ios/CodePush/SSZipArchive/aes/entropy.h +0 -16
  263. package/ios/CodePush/SSZipArchive/aes/fileenc.c +0 -144
  264. package/ios/CodePush/SSZipArchive/aes/fileenc.h +0 -121
  265. package/ios/CodePush/SSZipArchive/aes/hmac.c +0 -145
  266. package/ios/CodePush/SSZipArchive/aes/hmac.h +0 -103
  267. package/ios/CodePush/SSZipArchive/aes/prng.c +0 -155
  268. package/ios/CodePush/SSZipArchive/aes/prng.h +0 -82
  269. package/ios/CodePush/SSZipArchive/aes/pwd2key.c +0 -103
  270. package/ios/CodePush/SSZipArchive/aes/pwd2key.h +0 -57
  271. package/ios/CodePush/SSZipArchive/aes/sha1.c +0 -258
  272. package/ios/CodePush/SSZipArchive/aes/sha1.h +0 -73
  273. package/ios/CodePush/SSZipArchive/minizip/crypt.h +0 -130
  274. package/ios/CodePush/SSZipArchive/minizip/ioapi.c +0 -369
  275. package/ios/CodePush/SSZipArchive/minizip/ioapi.h +0 -175
  276. package/ios/CodePush/SSZipArchive/minizip/mztools.c +0 -284
  277. package/ios/CodePush/SSZipArchive/minizip/mztools.h +0 -31
  278. package/ios/CodePush/SSZipArchive/minizip/unzip.c +0 -1839
  279. package/ios/CodePush/SSZipArchive/minizip/unzip.h +0 -248
  280. package/ios/CodePush/SSZipArchive/minizip/zip.c +0 -1910
  281. package/ios/CodePush/SSZipArchive/minizip/zip.h +0 -202
  282. package/scripts/generateBundledResourcesHash.js +0 -125
  283. package/scripts/getFilesInFolder.js +0 -19
  284. package/scripts/recordFilesBeforeBundleCommand.js +0 -41
  285. package/tsconfig.json +0 -20
  286. package/tslint.json +0 -32
  287. /package/{logging.js → src/logging.js} +0 -0
  288. /package/{versioning → src/versioning}/BaseVersioning.test.js +0 -0
  289. /package/{versioning → src/versioning}/IncrementalVersioning.js +0 -0
  290. /package/{versioning → src/versioning}/IncrementalVersioning.test.js +0 -0
  291. /package/{versioning → src/versioning}/SemverVersioning.js +0 -0
  292. /package/{versioning → src/versioning}/index.js +0 -0
@@ -1,565 +1,573 @@
1
- export type DownloadProgressCallback = (progress: DownloadProgress) => void
2
- export type SyncStatusChangedCallback = (status: CodePush.SyncStatus) => void
3
- export type HandleBinaryVersionMismatchCallback = (
4
- update: RemotePackage
5
- ) => void
1
+ export type DownloadProgressCallback = (progress: DownloadProgress) => void;
2
+ export type SyncStatusChangedCallback = (status: CodePush.SyncStatus) => void;
3
+ export type HandleBinaryVersionMismatchCallback = (update: RemotePackage) => void;
6
4
 
7
- // from code-push SDK
8
5
  export interface UpdateCheckRequest {
9
- /** The native version, not in package.json. */
10
- app_version: string
11
- client_unique_id?: string
12
- deployment_key: string
13
- is_companion?: boolean
14
- label?: string
15
- package_hash?: string
6
+ /** The native version, not in package.json. */
7
+ app_version: string;
8
+ client_unique_id?: string;
9
+ is_companion?: boolean;
10
+ label?: string;
11
+ package_hash?: string;
16
12
  }
17
13
 
18
14
  /**
19
15
  * Alias for a string representing a released CodePush update version.
20
16
  */
21
- export type ReleaseVersion = string
17
+ export type ReleaseVersion = string;
22
18
 
23
19
  /**
24
20
  * The interface representing the release information that the `releaseHistoryFetcher` function must return.
25
21
  */
26
- export type ReleaseHistoryInterface = Record<ReleaseVersion, ReleaseInfo>
22
+ export type ReleaseHistoryInterface = Record<ReleaseVersion, ReleaseInfo>;
27
23
 
28
24
  /**
29
25
  * The interface that represents a single deployment history entry, which the `releaseHistoryFetcher` function should return.
30
26
  */
31
27
  export interface ReleaseInfo {
32
- enabled: boolean
33
- mandatory: boolean
34
- downloadUrl: string
35
- packageHash: string
28
+ enabled: boolean;
29
+ mandatory: boolean;
30
+ downloadUrl: string;
31
+ packageHash: string;
32
+ rollout?: number;
33
+ /** The binary version a PR preview release was built against. (PR preview releases only) */
34
+ binaryVersion?: string;
35
+ /** Release creation timestamp recorded by the CLI. (e.g. '2026-07-03 12:34:56') */
36
+ createdAt?: string;
37
+ /** Last `update-history` timestamp recorded by the CLI. ('-' if never updated) */
38
+ updatedAt?: string;
36
39
  }
37
40
 
38
41
  // from code-push SDK
39
42
  export interface UpdateCheckResponse {
40
- download_url?: string
41
- description?: string
42
- is_available: boolean
43
- is_disabled?: boolean
44
- target_binary_range: string
45
- /*generated*/ label?: string
46
- /*generated*/ package_hash?: string
47
- package_size?: number
48
- should_run_binary_version?: boolean
49
- update_app_version?: boolean
50
- is_mandatory?: boolean
43
+ download_url?: string;
44
+ description?: string;
45
+ is_available: boolean;
46
+ is_disabled?: boolean;
47
+ target_binary_range: string;
48
+ /*generated*/ label?: string;
49
+ /*generated*/ package_hash?: string;
50
+ package_size?: number;
51
+ should_run_binary_version?: boolean;
52
+ update_app_version?: boolean;
53
+ is_mandatory?: boolean;
51
54
  }
52
55
 
53
56
  export interface CodePushOptions extends SyncOptions {
54
- /**
55
- * Specifies when you would like to synchronize updates with the CodePush server.
56
- * Defaults to codePush.CheckFrequency.ON_APP_START.
57
- */
58
- checkFrequency: CodePush.CheckFrequency
59
- /**
60
- * Specifies a function to get the release history.
61
- *
62
- * If you want to use `updateChecker`, pass no-op function like below.
63
- * But it is deprecated and will be removed in the next major version.
64
- *
65
- * ```ts
66
- * const codePushOptions: {
67
- * releaseHistoryFetcher: async () => ({}), // This will not be called
68
- * }
69
- * ```
70
- */
71
- releaseHistoryFetcher: (
72
- updateRequest: UpdateCheckRequest
73
- ) => Promise<ReleaseHistoryInterface>
74
- /**
75
- * Specify a function to perform the update check.
76
- * It can be used for self-hosting.
77
- * Defaults to AppCenter update_check REST API request.
78
- *
79
- * @deprecated It will be removed in the next major version. Please migrate to `releaseHistoryFetcher`.
80
- */
81
- updateChecker?: (
82
- updateRequest: UpdateCheckRequest
83
- ) => Promise<{ update_info: UpdateCheckResponse }>
57
+ /**
58
+ * The `ignoreFailedUpdates` option is only available as an option for `CodePush.sync()`.
59
+ */
60
+ ignoreFailedUpdates?: never;
61
+ /**
62
+ * Specifies when you would like to synchronize updates with the CodePush server.
63
+ * Defaults to codePush.CheckFrequency.ON_APP_START.
64
+ */
65
+ checkFrequency: CodePush.CheckFrequency;
66
+ /**
67
+ * Specifies a function to get the release history.
68
+ *
69
+ * If you want to use `updateChecker`, pass no-op function like below.
70
+ * But it is deprecated and will be removed in the next major version.
71
+ *
72
+ * ```ts
73
+ * const codePushOptions: {
74
+ * releaseHistoryFetcher: async () => ({}), // This will not be called
75
+ * }
76
+ * ```
77
+ */
78
+ releaseHistoryFetcher: (updateRequest: UpdateCheckRequest) => Promise<ReleaseHistoryInterface>;
79
+ /**
80
+ * Specify a function to perform the update check.
81
+ * It can be used for self-hosting.
82
+ * Defaults to AppCenter update_check REST API request.
83
+ *
84
+ * @deprecated It will be removed in the next major version. Please migrate to `releaseHistoryFetcher`.
85
+ */
86
+ updateChecker?: (updateRequest: UpdateCheckRequest) => Promise<{ update_info: UpdateCheckResponse }>;
87
+ /**
88
+ * Callback function that is called when the update installation succeeds.
89
+ */
90
+ onUpdateSuccess?: (label: string) => void;
91
+ /**
92
+ * Callback function that is called when the update rolled back.
93
+ */
94
+ onUpdateRollback?: (label: string) => void;
95
+ /**
96
+ * Callback function that is called when download starts.
97
+ */
98
+ onDownloadStart?: (label: string) => void;
99
+ /**
100
+ * Callback function that is called when download finished successfully.
101
+ */
102
+ onDownloadSuccess?: (label: string) => void;
103
+ /**
104
+ * Callback function that is called when sync process failed.
105
+ */
106
+ onSyncError?: (label: string, error: Error) => void;
107
+ /**
108
+ * Callback function that is called when rollout is skipped.
109
+ */
110
+ onRolloutSkipped?: (label: string, error: Error) => void;
84
111
  }
85
112
 
86
113
  export interface DownloadProgress {
87
- /**
88
- * The total number of bytes expected to be received for this update.
89
- */
90
- totalBytes: number
91
-
92
- /**
93
- * The number of bytes downloaded thus far.
94
- */
95
- receivedBytes: number
114
+ /**
115
+ * The total number of bytes expected to be received for this update.
116
+ */
117
+ totalBytes: number;
118
+
119
+ /**
120
+ * The number of bytes downloaded thus far.
121
+ */
122
+ receivedBytes: number;
96
123
  }
97
124
 
98
125
  export interface LocalPackage extends Package {
99
- /**
100
- * Installs the update by saving it to the location on disk where the runtime expects to find the latest version of the app.
101
- *
102
- * @param installMode Indicates when you would like the update changes to take affect for the end-user.
103
- * @param minimumBackgroundDuration For resume-based installs, this specifies the number of seconds the app needs to be in the background before forcing a restart. Defaults to 0 if unspecified.
104
- */
105
- install(
106
- installMode: CodePush.InstallMode,
107
- minimumBackgroundDuration?: number
108
- ): Promise<void>
126
+ /**
127
+ * Installs the update by saving it to the location on disk where the runtime expects to find the latest version of the app.
128
+ *
129
+ * @param installMode Indicates when you would like the update changes to take affect for the end-user.
130
+ * @param minimumBackgroundDuration For resume-based installs, this specifies the number of seconds the app needs to be in the background before forcing a restart. Defaults to 0 if unspecified.
131
+ */
132
+ install(installMode: CodePush.InstallMode, minimumBackgroundDuration?: number): Promise<void>;
109
133
  }
110
134
 
111
135
  export interface Package {
112
- /**
113
- * The app binary version that this update is dependent on. This is the value that was
114
- * specified via the appStoreVersion parameter when calling the CLI's release command.
115
- */
116
- appVersion: string
117
-
118
- /**
119
- * The deployment key that was used to originally download this update.
120
- */
121
- deploymentKey: string
122
-
123
- /**
124
- * The description of the update. This is the same value that you specified in the CLI when you released the update.
125
- */
126
- description: string
127
-
128
- /**
129
- * Indicates whether this update has been previously installed but was rolled back.
130
- */
131
- failedInstall: boolean
132
-
133
- /**
134
- * Indicates whether this is the first time the update has been run after being installed.
135
- */
136
- isFirstRun: boolean
137
-
138
- /**
139
- * Indicates whether the update is considered mandatory. This is the value that was specified in the CLI when the update was released.
140
- */
141
- isMandatory: boolean
142
-
143
- /**
144
- * Indicates whether this update is in a "pending" state. When true, that means the update has been downloaded and installed, but the app restart
145
- * needed to apply it hasn't occurred yet, and therefore, its changes aren't currently visible to the end-user.
146
- */
147
- isPending: boolean
148
-
149
- /**
150
- * The internal label automatically given to the update by the CodePush server. This value uniquely identifies the update within its deployment.
151
- */
152
- label: string
153
-
154
- /**
155
- * The SHA hash value of the update.
156
- */
157
- packageHash: string
158
-
159
- /**
160
- * The size of the code contained within the update, in bytes.
161
- */
162
- packageSize: number
136
+ /**
137
+ * The app binary version that this update is dependent on. This is the value that was
138
+ * specified via the appStoreVersion parameter when calling the CLI's release command.
139
+ */
140
+ appVersion: string;
141
+
142
+ /**
143
+ * The deployment key that was used to originally download this update.
144
+ */
145
+ deploymentKey: string;
146
+
147
+ /**
148
+ * The description of the update. This is the same value that you specified in the CLI when you released the update.
149
+ */
150
+ description: string;
151
+
152
+ /**
153
+ * Indicates whether this update has been previously installed but was rolled back.
154
+ */
155
+ failedInstall: boolean;
156
+
157
+ /**
158
+ * Indicates whether this is the first time the update has been run after being installed.
159
+ */
160
+ isFirstRun: boolean;
161
+
162
+ /**
163
+ * Indicates whether the update is considered mandatory. This is the value that was specified in the CLI when the update was released.
164
+ */
165
+ isMandatory: boolean;
166
+
167
+ /**
168
+ * Indicates whether this update is in a "pending" state. When true, that means the update has been downloaded and installed, but the app restart
169
+ * needed to apply it hasn't occurred yet, and therefore, its changes aren't currently visible to the end-user.
170
+ */
171
+ isPending: boolean;
172
+
173
+ /**
174
+ * The internal label automatically given to the update by the CodePush server. This value uniquely identifies the update within its deployment.
175
+ */
176
+ label: string;
177
+
178
+ /**
179
+ * The SHA hash value of the update.
180
+ */
181
+ packageHash: string;
182
+
183
+ /**
184
+ * The size of the code contained within the update, in bytes.
185
+ */
186
+ packageSize: number;
163
187
  }
164
188
 
165
189
  export interface RemotePackage extends Package {
166
- /**
167
- * Downloads the available update from the CodePush service.
168
- *
169
- * @param downloadProgressCallback An optional callback that allows tracking the progress of the update while it is being downloaded.
170
- * @param downloadCompleteCallback An optional callback that is called when the HTTP download completes and post-processing begins (iOS only).
171
- */
172
- download(
173
- downloadProgressCallback?: DownloadProgressCallback,
174
- downloadCompleteCallback?: () => void
175
- ): Promise<LocalPackage>
176
-
177
- /**
178
- * The URL at which the package is available for download.
179
- */
180
- downloadUrl: string
190
+ /**
191
+ * Downloads the available update from the CodePush service.
192
+ *
193
+ * @param downloadProgressCallback An optional callback that allows tracking the progress of the update while it is being downloaded.
194
+ * @param downloadCompleteCallback An optional callback that is called when the HTTP download completes and post-processing begins (iOS only).
195
+ */
196
+ download(downloadProgressCallback?: DownloadProgressCallback, downloadCompleteCallback?: () => void): Promise<LocalPackage>;
197
+
198
+ /**
199
+ * The URL at which the package is available for download.
200
+ */
201
+ downloadUrl: string;
181
202
  }
182
203
 
183
204
  export interface SyncOptions {
184
- prNumber?: string
185
- packageHash?: string
186
- /**
187
- * Specifies the deployment key you want to query for an update against. By default, this value is derived from the Info.plist
188
- * file (iOS) and MainActivity.java file (Android), but this option allows you to override it from the script-side if you need to
189
- * dynamically use a different deployment for a specific call to sync.
190
- */
191
- deploymentKey?: string
192
-
193
- /**
194
- * Specifies when you would like to install optional updates (i.e. those that aren't marked as mandatory).
195
- * Defaults to codePush.InstallMode.ON_NEXT_RESTART.
196
- */
197
- installMode?: CodePush.InstallMode
198
-
199
- /**
200
- * Specifies when you would like to install updates which are marked as mandatory.
201
- * Defaults to codePush.InstallMode.IMMEDIATE.
202
- */
203
- mandatoryInstallMode?: CodePush.InstallMode
204
-
205
- /**
206
- * Specifies the minimum number of seconds that the app needs to have been in the background before restarting the app. This property
207
- * only applies to updates which are installed using `InstallMode.ON_NEXT_RESUME` or `InstallMode.ON_NEXT_SUSPEND`, and can be useful
208
- * for getting your update in front of end users sooner, without being too obtrusive. Defaults to `0`, which has the effect of applying
209
- * the update immediately after a resume or unless the app suspension is long enough to not matter, regardless how long it was in the background.
210
- */
211
- minimumBackgroundDuration?: number
212
-
213
- /**
214
- * An "options" object used to determine whether a confirmation dialog should be displayed to the end user when an update is available,
215
- * and if so, what strings to use. Defaults to null, which has the effect of disabling the dialog completely. Setting this to any truthy
216
- * value will enable the dialog with the default strings, and passing an object to this parameter allows enabling the dialog as well as
217
- * overriding one or more of the default strings.
218
- */
219
- updateDialog?: UpdateDialog | true
220
-
221
- /**
222
- * The rollback retry mechanism allows the application to attempt to reinstall an update that was previously rolled back (with the restrictions
223
- * specified in the options). It is an "options" object used to determine whether a rollback retry should occur, and if so, what settings to use
224
- * for the rollback retry. This defaults to null, which has the effect of disabling the retry mechanism. Setting this to any truthy value will enable
225
- * the retry mechanism with the default settings, and passing an object to this parameter allows enabling the rollback retry as well as overriding
226
- * one or more of the default values.
227
- */
228
- rollbackRetryOptions?: RollbackRetryOptions
229
-
230
- /**
231
- * Specifies whether to ignore the update if the installation fails.
232
- * If set to false, the update will be retried when the sync method is called, even if the previous installation attempt failed.
233
- * However, depending on the deployment strategy, if an update that cannot be successfully installed is deployed, this option could result in an infinite update retry loop.
234
- * Defaults to true.
235
- */
236
- ignoreFailedUpdates?: boolean
237
- }
205
+ /**
206
+ * Specifies the deployment key you want to query for an update against. By default, this value is derived from the Info.plist
207
+ * file (iOS) and MainActivity.java file (Android), but this option allows you to override it from the script-side if you need to
208
+ * dynamically use a different deployment for a specific call to sync.
209
+ */
210
+ deploymentKey?: string;
238
211
 
239
- export interface UpdateDialog {
240
- /**
241
- * Indicates whether you would like to append the description of an available release to the
242
- * notification message which is displayed to the end user. Defaults to false.
243
- */
244
- appendReleaseDescription?: boolean
245
-
246
- /**
247
- * Indicates the string you would like to prefix the release description with, if any, when
248
- * displaying the update notification to the end user. Defaults to " Description: "
249
- */
250
- descriptionPrefix?: string
251
-
252
- /**
253
- * The text to use for the button the end user must press in order to install a mandatory update. Defaults to "Continue".
254
- */
255
- mandatoryContinueButtonLabel?: string
256
-
257
- /**
258
- * The text used as the body of an update notification, when the update is specified as mandatory.
259
- * Defaults to "An update is available that must be installed.".
260
- */
261
- mandatoryUpdateMessage?: string
262
-
263
- /**
264
- * The text to use for the button the end user can press in order to ignore an optional update that is available. Defaults to "Ignore".
265
- */
266
- optionalIgnoreButtonLabel?: string
267
-
268
- /**
269
- * The text to use for the button the end user can press in order to install an optional update. Defaults to "Install".
270
- */
271
- optionalInstallButtonLabel?: string
272
-
273
- /**
274
- * The text used as the body of an update notification, when the update is optional. Defaults to "An update is available. Would you like to install it?".
275
- */
276
- optionalUpdateMessage?: string
277
-
278
- /**
279
- * The text used as the header of an update notification that is displayed to the end user. Defaults to "Update available".
280
- */
281
- title?: string
282
- }
212
+ /**
213
+ * Specifies when you would like to install optional updates (i.e. those that aren't marked as mandatory).
214
+ * Defaults to codePush.InstallMode.ON_NEXT_RESTART.
215
+ */
216
+ installMode?: CodePush.InstallMode;
283
217
 
284
- export interface RollbackRetryOptions {
285
- /**
286
- * Specifies the minimum time in hours that the app will wait after the latest rollback
287
- * before attempting to reinstall same rolled-back package. Defaults to `24`.
288
- */
289
- delayInHours?: number
290
-
291
- /**
292
- * Specifies the maximum number of retry attempts that the app can make before it stops trying.
293
- * Cannot be less than `1`. Defaults to `1`.
294
- */
295
- maxRetryAttempts?: number
296
- }
218
+ /**
219
+ * Specifies when you would like to install updates which are marked as mandatory.
220
+ * Defaults to codePush.InstallMode.IMMEDIATE.
221
+ */
222
+ mandatoryInstallMode?: CodePush.InstallMode;
297
223
 
298
- export interface StatusReport {
299
- /**
300
- * Whether the deployment succeeded or failed.
301
- */
302
- status: CodePush.DeploymentStatus
303
-
304
- /**
305
- * The version of the app that was deployed (for a native app upgrade).
306
- */
307
- appVersion?: string
308
-
309
- /**
310
- * Details of the package that was deployed (or attempted to).
311
- */
312
- package?: Package
313
-
314
- /**
315
- * Deployment key used when deploying the previous package.
316
- */
317
- previousDeploymentKey?: string
318
-
319
- /**
320
- * The label (v#) of the package that was upgraded from.
321
- */
322
- previousLabelOrAppVersion?: string
323
- }
224
+ /**
225
+ * Specifies the minimum number of seconds that the app needs to have been in the background before restarting the app. This property
226
+ * only applies to updates which are installed using `InstallMode.ON_NEXT_RESUME` or `InstallMode.ON_NEXT_SUSPEND`, and can be useful
227
+ * for getting your update in front of end users sooner, without being too obtrusive. Defaults to `0`, which has the effect of applying
228
+ * the update immediately after a resume or unless the app suspension is long enough to not matter, regardless how long it was in the background.
229
+ */
230
+ minimumBackgroundDuration?: number;
324
231
 
325
- /**
326
- * Decorates a React Component configuring it to sync for updates with the CodePush server.
327
- *
328
- * @param options Options used to configure the end-user sync and update experience (e.g. when to check for updates?, show an prompt?, install the update immediately?).
329
- */
330
- declare function CodePush(options?: CodePushOptions): (x: any) => any
232
+ /**
233
+ * An "options" object used to determine whether a confirmation dialog should be displayed to the end user when an update is available,
234
+ * and if so, what strings to use. Defaults to null, which has the effect of disabling the dialog completely. Setting this to any truthy
235
+ * value will enable the dialog with the default strings, and passing an object to this parameter allows enabling the dialog as well as
236
+ * overriding one or more of the default strings.
237
+ */
238
+ updateDialog?: UpdateDialog | true;
331
239
 
332
- /**
333
- * Decorates a React Component configuring it to sync for updates with the CodePush server.
334
- *
335
- * @param x the React Component that will decorated
336
- */
337
- declare function CodePush(x: any): any
240
+ /**
241
+ * The rollback retry mechanism allows the application to attempt to reinstall an update that was previously rolled back (with the restrictions
242
+ * specified in the options). It is an "options" object used to determine whether a rollback retry should occur, and if so, what settings to use
243
+ * for the rollback retry. This defaults to null, which has the effect of disabling the retry mechanism. Setting this to any truthy value will enable
244
+ * the retry mechanism with the default settings, and passing an object to this parameter allows enabling the rollback retry as well as overriding
245
+ * one or more of the default values.
246
+ */
247
+ rollbackRetryOptions?: RollbackRetryOptions;
338
248
 
339
- declare namespace CodePush {
340
- /**
341
- * Represents the default settings that will be used by the sync method if
342
- * an update dialog is configured to be displayed.
343
- */
344
- var DEFAULT_UPDATE_DIALOG: UpdateDialog
345
-
346
- /**
347
- * Asks the CodePush service whether the configured app deployment has an update available.
348
- *
349
- * @param prNumber The pull request number to use to query the CodePush server for an update.
350
- * @param packageHash The package hash to use to query the CodePush server for an update.
351
- * @param handleBinaryVersionMismatchCallback An optional callback for handling target binary version mismatch
352
- */
353
- function checkForUpdate(
354
- prNumber?: string,
355
- packageHash?: string,
356
- handleBinaryVersionMismatchCallback?: HandleBinaryVersionMismatchCallback
357
- ): Promise<RemotePackage | null>
358
-
359
- /**
360
- * Retrieves the metadata for an installed update (e.g. description, mandatory).
361
- *
362
- * @param updateState The state of the update you want to retrieve the metadata for. Defaults to UpdateState.RUNNING.
363
- */
364
- function getUpdateMetadata(
365
- updateState?: UpdateState
366
- ): Promise<LocalPackage | null>
249
+ /**
250
+ * Specifies whether to ignore the update if the installation fails.
251
+ * If set to false, the update will be retried when the sync method is called, even if the previous installation attempt failed.
252
+ * However, depending on the deployment strategy, if an update that cannot be successfully installed is deployed, this option could result in an infinite update retry loop.
253
+ * Defaults to true.
254
+ */
255
+ ignoreFailedUpdates?: boolean;
367
256
 
368
- /**
369
- * Notifies the CodePush runtime that an installed update is considered successful.
370
- */
371
- function notifyAppReady(): Promise<StatusReport | void>
257
+ /**
258
+ * (algocare PR preview release extension)
259
+ * When given, only PR preview releases (`{prNumber}-{semver}` keys in the release history)
260
+ * are considered during the update check. Normal releases are ignored.
261
+ */
262
+ prNumber?: string;
263
+ }
372
264
 
373
- /**
374
- * Allow CodePush to restart the app.
375
- */
376
- function allowRestart(): void
265
+ export interface UpdateDialog {
266
+ /**
267
+ * Indicates whether you would like to append the description of an available release to the
268
+ * notification message which is displayed to the end user. Defaults to false.
269
+ */
270
+ appendReleaseDescription?: boolean;
377
271
 
378
- /**
379
- * Forbid CodePush to restart the app.
380
- */
381
- function disallowRestart(): void
272
+ /**
273
+ * Indicates the string you would like to prefix the release description with, if any, when
274
+ * displaying the update notification to the end user. Defaults to " Description: "
275
+ */
276
+ descriptionPrefix?: string;
382
277
 
383
- /**
384
- * Clear all downloaded CodePush updates.
385
- * This is useful when switching to a different deployment which may have an older release than the current package.
386
- * Note: we don’t recommend to use this method in scenarios other than that (CodePush will call
387
- * this method automatically when needed in other cases) as it could lead to unpredictable behavior.
388
- */
389
- function clearUpdates(): void
278
+ /**
279
+ * The text to use for the button the end user must press in order to install a mandatory update. Defaults to "Continue".
280
+ */
281
+ mandatoryContinueButtonLabel?: string;
390
282
 
391
- /**
392
- * Immediately restarts the app.
393
- *
394
- * @param onlyIfUpdateIsPending Indicates whether you want the restart to no-op if there isn't currently a pending update.
395
- */
396
- function restartApp(onlyIfUpdateIsPending?: boolean): void
283
+ /**
284
+ * The text used as the body of an update notification, when the update is specified as mandatory.
285
+ * Defaults to "An update is available that must be installed.".
286
+ */
287
+ mandatoryUpdateMessage?: string;
397
288
 
398
- /**
399
- * Allows checking for an update, downloading it and installing it, all with a single call.
400
- *
401
- * @param options Options used to configure the end-user update experience (e.g. show an prompt?, install the update immediately?).
402
- * @param syncStatusChangedCallback An optional callback that allows tracking the status of the sync operation, as opposed to simply checking the resolved state via the returned Promise.
403
- * @param downloadProgressCallback An optional callback that allows tracking the progress of an update while it is being downloaded.
404
- * @param handleBinaryVersionMismatchCallback An optional callback for handling target binary version mismatch
405
- */
406
- function sync(
407
- options?: SyncOptions,
408
- syncStatusChangedCallback?: SyncStatusChangedCallback,
409
- downloadProgressCallback?: DownloadProgressCallback,
410
- handleBinaryVersionMismatchCallback?: HandleBinaryVersionMismatchCallback
411
- ): Promise<SyncStatus>
289
+ /**
290
+ * The text to use for the button the end user can press in order to ignore an optional update that is available. Defaults to "Ignore".
291
+ */
292
+ optionalIgnoreButtonLabel?: string;
412
293
 
413
- /**
414
- * Indicates when you would like an installed update to actually be applied.
415
- */
416
- enum InstallMode {
417
294
  /**
418
- * Indicates that you want to install the update and restart the app immediately.
295
+ * The text to use for the button the end user can press in order to install an optional update. Defaults to "Install".
419
296
  */
420
- IMMEDIATE,
297
+ optionalInstallButtonLabel?: string;
421
298
 
422
299
  /**
423
- * Indicates that you want to install the update, but not forcibly restart the app.
300
+ * The text used as the body of an update notification, when the update is optional. Defaults to "An update is available. Would you like to install it?".
424
301
  */
425
- ON_NEXT_RESTART,
302
+ optionalUpdateMessage?: string;
426
303
 
427
304
  /**
428
- * Indicates that you want to install the update, but don't want to restart the app until the next time
429
- * the end user resumes it from the background. This way, you don't disrupt their current session,
430
- * but you can get the update in front of them sooner then having to wait for the next natural restart.
431
- * This value is appropriate for silent installs that can be applied on resume in a non-invasive way.
305
+ * The text used as the header of an update notification that is displayed to the end user. Defaults to "Update available".
432
306
  */
433
- ON_NEXT_RESUME,
307
+ title?: string;
308
+ }
309
+
310
+ export interface RollbackRetryOptions {
311
+ /**
312
+ * Specifies the minimum time in hours that the app will wait after the latest rollback
313
+ * before attempting to reinstall same rolled-back package. Defaults to `24`.
314
+ */
315
+ delayInHours?: number;
316
+
317
+ /**
318
+ * Specifies the maximum number of retry attempts that the app can make before it stops trying.
319
+ * Cannot be less than `1`. Defaults to `1`.
320
+ */
321
+ maxRetryAttempts?: number;
322
+ }
434
323
 
324
+ export interface StatusReport {
435
325
  /**
436
- * Indicates that you want to install the update when the app is in the background,
437
- * but only after it has been in the background for "minimumBackgroundDuration" seconds (0 by default),
438
- * so that user context isn't lost unless the app suspension is long enough to not matter.
326
+ * Whether the deployment succeeded or failed.
439
327
  */
440
- ON_NEXT_SUSPEND,
441
- }
328
+ status: CodePush.DeploymentStatus;
442
329
 
443
- /**
444
- * Indicates the current status of a sync operation.
445
- */
446
- enum SyncStatus {
447
330
  /**
448
- * The app is up-to-date with the CodePush server.
331
+ * The version of the app that was deployed (for a native app upgrade).
449
332
  */
450
- UP_TO_DATE,
333
+ appVersion?: string;
451
334
 
452
335
  /**
453
- * An available update has been installed and will be run either immediately after the
454
- * syncStatusChangedCallback function returns or the next time the app resumes/restarts,
455
- * depending on the InstallMode specified in SyncOptions
336
+ * Details of the package that was deployed (or attempted to).
456
337
  */
457
- UPDATE_INSTALLED,
338
+ package?: Package;
458
339
 
459
340
  /**
460
- * The app had an optional update which the end user chose to ignore.
461
- * (This is only applicable when the updateDialog is used)
341
+ * Deployment key used when deploying the previous package.
462
342
  */
463
- UPDATE_IGNORED,
343
+ previousDeploymentKey?: string;
464
344
 
465
345
  /**
466
- * The sync operation encountered an unknown error.
346
+ * The label (v#) of the package that was upgraded from.
467
347
  */
468
- UNKNOWN_ERROR,
348
+ previousLabelOrAppVersion?: string;
349
+ }
469
350
 
351
+ /**
352
+ * Decorates a React Component configuring it to sync for updates with the CodePush server.
353
+ *
354
+ * @param options Options used to configure the end-user sync and update experience (e.g. when to check for updates?, show an prompt?, install the update immediately?).
355
+ */
356
+ declare function CodePush(options?: CodePushOptions): (x: any) => any;
357
+
358
+ declare namespace CodePush {
470
359
  /**
471
- * There is an ongoing sync operation running which prevents the current call from being executed.
360
+ * Represents the default settings that will be used by the sync method if
361
+ * an update dialog is configured to be displayed.
472
362
  */
473
- SYNC_IN_PROGRESS,
363
+ var DEFAULT_UPDATE_DIALOG: UpdateDialog;
474
364
 
475
365
  /**
476
- * The CodePush server is being queried for an update.
366
+ * Asks the CodePush service whether the configured app deployment has an update available.
367
+ *
368
+ * @param handleBinaryVersionMismatchCallback An optional callback for handling target binary version mismatch
369
+ * @param prNumber (algocare PR preview release extension) When given, only PR preview releases
370
+ * (`{prNumber}-{semver}` keys in the release history) are considered.
477
371
  */
478
- CHECKING_FOR_UPDATE,
372
+ function checkForUpdate(handleBinaryVersionMismatchCallback?: HandleBinaryVersionMismatchCallback, prNumber?: string): Promise<RemotePackage | null>;
479
373
 
480
374
  /**
481
- * An update is available, and a confirmation dialog was shown
482
- * to the end user. (This is only applicable when the updateDialog is used)
375
+ * Retrieves the metadata for an installed update (e.g. description, mandatory).
376
+ *
377
+ * @param updateState The state of the update you want to retrieve the metadata for. Defaults to UpdateState.RUNNING.
483
378
  */
484
- AWAITING_USER_ACTION,
379
+ function getUpdateMetadata(updateState?: UpdateState): Promise<LocalPackage|null>;
485
380
 
486
381
  /**
487
- * An available update is being downloaded from the CodePush server.
382
+ * Notifies the CodePush runtime that an installed update is considered successful.
488
383
  */
489
- DOWNLOADING_PACKAGE,
384
+ function notifyAppReady(): Promise<StatusReport|void>;
490
385
 
491
386
  /**
492
- * An available update was downloaded and is about to be installed.
387
+ * Allow CodePush to restart the app.
493
388
  */
494
- INSTALLING_UPDATE,
389
+ function allowRestart(): void;
495
390
 
496
391
  /**
497
- * The update has been downloaded and post-processing (unzip/file copy) is in progress.
498
- * This status is only reported on iOS when the native module supports it.
392
+ * Forbid CodePush to restart the app.
499
393
  */
500
- PREPARING_UPDATE,
501
- }
394
+ function disallowRestart(): void;
502
395
 
503
- /**
504
- * Indicates the state that an update is currently in.
505
- */
506
- enum UpdateState {
507
396
  /**
508
- * Indicates that an update represents the
509
- * version of the app that is currently running.
397
+ * Clear all downloaded CodePush updates.
398
+ * This is useful when switching to a different deployment which may have an older release than the current package.
399
+ * Note: we don’t recommend to use this method in scenarios other than that (CodePush will call
400
+ * this method automatically when needed in other cases) as it could lead to unpredictable behavior.
510
401
  */
511
- RUNNING,
402
+ function clearUpdates(): void;
512
403
 
513
404
  /**
514
- * Indicates than an update has been installed, but the
515
- * app hasn't been restarted yet in order to apply it.
405
+ * Immediately restarts the app.
406
+ *
407
+ * @param onlyIfUpdateIsPending Indicates whether you want the restart to no-op if there isn't currently a pending update.
516
408
  */
517
- PENDING,
409
+ function restartApp(onlyIfUpdateIsPending?: boolean): void;
518
410
 
519
411
  /**
520
- * Indicates than an update represents the latest available
521
- * release, and can be either currently running or pending.
412
+ * Allows checking for an update, downloading it and installing it, all with a single call.
413
+ *
414
+ * @param options Options used to configure the end-user update experience (e.g. show an prompt?, install the update immediately?).
415
+ * @param syncStatusChangedCallback An optional callback that allows tracking the status of the sync operation, as opposed to simply checking the resolved state via the returned Promise.
416
+ * @param downloadProgressCallback An optional callback that allows tracking the progress of an update while it is being downloaded.
417
+ * @param handleBinaryVersionMismatchCallback An optional callback for handling target binary version mismatch
522
418
  */
523
- LATEST,
524
- }
419
+ function sync(options?: SyncOptions, syncStatusChangedCallback?: SyncStatusChangedCallback, downloadProgressCallback?: DownloadProgressCallback, handleBinaryVersionMismatchCallback?: HandleBinaryVersionMismatchCallback): Promise<SyncStatus>;
525
420
 
526
- /**
527
- * Indicates the status of a deployment (after installing and restarting).
528
- */
529
- enum DeploymentStatus {
530
421
  /**
531
- * The deployment failed (and was rolled back).
422
+ * Indicates when you would like an installed update to actually be applied.
532
423
  */
533
- FAILED,
424
+ enum InstallMode {
425
+ /**
426
+ * Indicates that you want to install the update and restart the app immediately.
427
+ */
428
+ IMMEDIATE,
429
+
430
+ /**
431
+ * Indicates that you want to install the update, but not forcibly restart the app.
432
+ */
433
+ ON_NEXT_RESTART,
434
+
435
+ /**
436
+ * Indicates that you want to install the update, but don't want to restart the app until the next time
437
+ * the end user resumes it from the background. This way, you don't disrupt their current session,
438
+ * but you can get the update in front of them sooner then having to wait for the next natural restart.
439
+ * This value is appropriate for silent installs that can be applied on resume in a non-invasive way.
440
+ */
441
+ ON_NEXT_RESUME,
442
+
443
+ /**
444
+ * Indicates that you want to install the update when the app is in the background,
445
+ * but only after it has been in the background for "minimumBackgroundDuration" seconds (0 by default),
446
+ * so that user context isn't lost unless the app suspension is long enough to not matter.
447
+ */
448
+ ON_NEXT_SUSPEND
449
+ }
534
450
 
535
451
  /**
536
- * The deployment succeeded.
452
+ * Indicates the current status of a sync operation.
537
453
  */
538
- SUCCEEDED,
539
- }
454
+ enum SyncStatus {
455
+ /**
456
+ * The app is up-to-date with the CodePush server.
457
+ */
458
+ UP_TO_DATE,
459
+
460
+ /**
461
+ * An available update has been installed and will be run either immediately after the
462
+ * syncStatusChangedCallback function returns or the next time the app resumes/restarts,
463
+ * depending on the InstallMode specified in SyncOptions
464
+ */
465
+ UPDATE_INSTALLED,
466
+
467
+ /**
468
+ * The app had an optional update which the end user chose to ignore.
469
+ * (This is only applicable when the updateDialog is used)
470
+ */
471
+ UPDATE_IGNORED,
472
+
473
+ /**
474
+ * The sync operation encountered an unknown error.
475
+ */
476
+ UNKNOWN_ERROR,
477
+
478
+ /**
479
+ * There is an ongoing sync operation running which prevents the current call from being executed.
480
+ */
481
+ SYNC_IN_PROGRESS,
482
+
483
+ /**
484
+ * The CodePush server is being queried for an update.
485
+ */
486
+ CHECKING_FOR_UPDATE,
487
+
488
+ /**
489
+ * An update is available, and a confirmation dialog was shown
490
+ * to the end user. (This is only applicable when the updateDialog is used)
491
+ */
492
+ AWAITING_USER_ACTION,
493
+
494
+ /**
495
+ * An available update is being downloaded from the CodePush server.
496
+ */
497
+ DOWNLOADING_PACKAGE,
498
+
499
+ /**
500
+ * An available update was downloaded and is about to be installed.
501
+ */
502
+ INSTALLING_UPDATE,
503
+
504
+ /**
505
+ * The update has been downloaded and post-processing (unzip/file copy) is in progress.
506
+ * This status is only reported on iOS when the native module supports it.
507
+ */
508
+ PREPARING_UPDATE
509
+ }
540
510
 
541
- /**
542
- * Indicates when you would like to check for (and install) updates from the CodePush server.
543
- */
544
- enum CheckFrequency {
545
511
  /**
546
- * When the app is fully initialized (or more specifically, when the root component is mounted).
512
+ * Indicates the state that an update is currently in.
547
513
  */
548
- ON_APP_START,
514
+ enum UpdateState {
515
+ /**
516
+ * Indicates that an update represents the
517
+ * version of the app that is currently running.
518
+ */
519
+ RUNNING,
520
+
521
+ /**
522
+ * Indicates than an update has been installed, but the
523
+ * app hasn't been restarted yet in order to apply it.
524
+ */
525
+ PENDING,
526
+
527
+ /**
528
+ * Indicates than an update represents the latest available
529
+ * release, and can be either currently running or pending.
530
+ */
531
+ LATEST
532
+ }
549
533
 
550
534
  /**
551
- * When the app re-enters the foreground.
535
+ * Indicates the status of a deployment (after installing and restarting).
552
536
  */
553
- ON_APP_RESUME,
537
+ enum DeploymentStatus {
538
+ /**
539
+ * The deployment failed (and was rolled back).
540
+ */
541
+ FAILED,
542
+
543
+ /**
544
+ * The deployment succeeded.
545
+ */
546
+ SUCCEEDED
547
+ }
554
548
 
555
549
  /**
556
- * Don't automatically check for updates, but only do it when codePush.sync() is manully called inside app code.
550
+ * Indicates when you would like to check for (and install) updates from the CodePush server.
557
551
  */
558
- MANUAL,
559
- }
552
+ enum CheckFrequency {
553
+ /**
554
+ * When the app is fully initialized (or more specifically, when the root component is mounted).
555
+ */
556
+ ON_APP_START,
557
+
558
+ /**
559
+ * When the app re-enters the foreground.
560
+ */
561
+ ON_APP_RESUME,
562
+
563
+ /**
564
+ * Don't automatically check for updates, but only do it when codePush.sync() is manully called inside app code.
565
+ */
566
+ MANUAL
567
+ }
560
568
  }
561
569
 
562
- export default CodePush
570
+ export default CodePush;
563
571
 
564
572
  /**
565
573
  * Interface for the config file required for `npx code-push` CLI operation.
@@ -567,55 +575,111 @@ export default CodePush
567
575
  * Please refer to the example code for implementation guidance.
568
576
  */
569
577
  export interface CliConfigInterface {
570
- /**
571
- * Interface that must be implemented to upload CodePush bundle files to an arbitrary infrastructure.
572
- *
573
- * Used in the `release` command, and must return a URL that allows downloading the file after the upload is completed.
574
- * The URL is recorded in the ReleaseHistory, and the CodePush runtime library downloads the bundle file from this address.
575
- *
576
- * @param source The relative path of the generated bundle file. (e.g. build/bundleOutput/1087bc338fc45a961c...)
577
- * @param platform The target platform of the bundle file. This is the string passed when executing the CLI command. ('ios'/'android')
578
- * @param identifier An additional identifier string. This can be used to distinguish execution environments by incorporating it into the upload path or file name. This string is passed when executing the CLI command.
579
- */
580
- bundleUploader: (
581
- source: string,
582
- platform: 'ios' | 'android',
583
- identifier?: string
584
- ) => Promise<{ downloadUrl: string }>
585
-
586
- /**
587
- * Interface that must be implemented to retrieve ReleaseHistory information.
588
- *
589
- * Use `fetch`, `axios`, or similar methods to fetch the data and return it.
590
- *
591
- * @param targetBinaryVersion The target binary app version for which ReleaseHistory information is retrieved. This string is passed when executing the CLI command. (e.g., '1.0.0')
592
- * @param platform The target platform for which the information is retrieved. This string is passed when executing the CLI command. ('ios'/'android')
593
- * @param identifier An additional identifier string. This string is passed when executing the CLI command.
594
- */
595
- getReleaseHistory: (
596
- targetBinaryVersion: string,
597
- platform: 'ios' | 'android',
598
- identifier?: string
599
- ) => Promise<ReleaseHistoryInterface>
600
-
601
- /**
602
- * Interface that must be implemented to create or update ReleaseHistory information.
603
- *
604
- * Used in the `create-history`, `release`, and `update-history` commands.
605
- * The created or modified object and the JSON file path containing the result of the command execution are provided.
606
- * Implement this function to upload the file or call a REST API to update the release history.
607
- *
608
- * @param targetBinaryVersion The target binary app version for the ReleaseHistory. This string is passed when executing the CLI command. (e.g., '1.0.0')
609
- * @param jsonFilePath The absolute path to a JSON file following the `ReleaseHistoryInterface` structure. The file is created in the project's root directory and deleted when the command execution completes.
610
- * @param releaseInfo A plain object following the `ReleaseHistoryInterface` structure.
611
- * @param platform The target platform. This string is passed when executing the CLI command. ('ios'/'android')
612
- * @param identifier An additional identifier string. This string is passed when executing the CLI command.
613
- */
614
- setReleaseHistory: (
615
- targetBinaryVersion: string,
616
- jsonFilePath: string,
617
- releaseInfo: ReleaseHistoryInterface,
618
- platform: 'ios' | 'android',
619
- identifier?: string
620
- ) => Promise<void>
578
+ /**
579
+ * Interface that must be implemented to upload CodePush bundle files to an arbitrary infrastructure.
580
+ *
581
+ * Used in the `release` command, and must return a URL that allows downloading the file after the upload is completed.
582
+ * The URL is recorded in the ReleaseHistory, and the CodePush runtime library downloads the bundle file from this address.
583
+ *
584
+ * @param source The relative path of the generated bundle file. (e.g. build/bundleOutput/1087bc338fc45a961c...)
585
+ * @param platform The target platform of the bundle file. This is the string passed when executing the CLI command. ('ios'/'android')
586
+ * @return {Promise<{downloadUrl: string}>} An object containing the `downloadUrl` property, which is the URL from which the uploaded bundle file can be downloaded. This URL will be recorded in the release history.
587
+ */
588
+ bundleUploader: (
589
+ source: string,
590
+ platform: "ios" | "android",
591
+ identifier?: string,
592
+ app?: string,
593
+ ) => Promise<{downloadUrl: string}>;
594
+
595
+ /**
596
+ * Interface that must be implemented to retrieve ReleaseHistory information.
597
+ *
598
+ * Use `fetch`, `axios`, or similar methods to fetch the data and return it.
599
+ *
600
+ * @param targetBinaryVersion The target binary app version for which ReleaseHistory information is retrieved. This string is passed when executing the CLI command. (e.g., '1.0.0')
601
+ * @param platform The target platform for which the information is retrieved. This string is passed when executing the CLI command. ('ios'/'android')
602
+ * @param identifier An additional identifier string. This string is passed when executing the CLI command.
603
+ */
604
+ getReleaseHistory: (
605
+ targetBinaryVersion: string,
606
+ platform: "ios" | "android",
607
+ identifier?: string,
608
+ app?: string,
609
+ ) => Promise<ReleaseHistoryInterface>;
610
+
611
+ /**
612
+ * Interface that must be implemented to create or update ReleaseHistory information.
613
+ *
614
+ * Used in the `create-history`, `release`, and `update-history` commands.
615
+ * The created or modified object and the JSON file path containing the result of the command execution are provided.
616
+ * Implement this function to upload the file or call a REST API to update the release history.
617
+ *
618
+ * @param targetBinaryVersion The target binary app version for the ReleaseHistory. This string is passed when executing the CLI command. (e.g., '1.0.0')
619
+ * @param jsonFilePath The absolute path to a JSON file following the `ReleaseHistoryInterface` structure. The file is created in the project's root directory and deleted when the command execution completes.
620
+ * @param releaseInfo A plain object following the `ReleaseHistoryInterface` structure.
621
+ * @param platform The target platform. This string is passed when executing the CLI command. ('ios'/'android')
622
+ * @param identifier An additional identifier string. This string is passed when executing the CLI command.
623
+ */
624
+ setReleaseHistory: (
625
+ targetBinaryVersion: string,
626
+ jsonFilePath: string,
627
+ releaseInfo: ReleaseHistoryInterface,
628
+ platform: "ios" | "android",
629
+ identifier?: string,
630
+ app?: string,
631
+ ) => Promise<void>;
632
+
633
+ /**
634
+ * (Optional / algocare extension) Retrieves the binary version list file (`list.json`) that indexes
635
+ * all binary versions for which a release history exists.
636
+ *
637
+ * Used in the `create-history` command. If not implemented, the `list.json` update step is skipped.
638
+ *
639
+ * @param platform The target platform. ('ios'/'android')
640
+ * @param identifier An additional identifier string. (e.g. 'stg'/'prd')
641
+ * @param app The target app name. (e.g. 'home-mobile')
642
+ * @return An object mapping binary versions to their release history URLs. (e.g. { "1.0.0": "https://cdn/histories/home-mobile/ios/1.0.0.json" })
643
+ */
644
+ getBinaryVersionList?: (
645
+ platform: "ios" | "android",
646
+ identifier?: string,
647
+ app?: string,
648
+ ) => Promise<Record<string, string>>;
649
+
650
+ /**
651
+ * (Optional / algocare extension) Adds a binary version entry to the binary version list file (`list.json`).
652
+ *
653
+ * Used in the `create-history` command. If not implemented, the `list.json` update step is skipped.
654
+ *
655
+ * @param targetBinaryVersion The binary version to add to the list.
656
+ * @param jsonFilePath The absolute path to a JSON file containing the current list content (before adding the new version).
657
+ * @param platform The target platform. ('ios'/'android')
658
+ * @param identifier An additional identifier string. (e.g. 'stg'/'prd')
659
+ * @param app The target app name. (e.g. 'home-mobile')
660
+ */
661
+ setBinaryVersionList?: (
662
+ targetBinaryVersion: string,
663
+ jsonFilePath: string,
664
+ platform: "ios" | "android",
665
+ identifier?: string,
666
+ app?: string,
667
+ ) => Promise<void>;
668
+
669
+ /**
670
+ * (Optional / algocare extension) Removes a release history file.
671
+ *
672
+ * Used in the `remove-pr-history` command to clean up PR preview release histories.
673
+ *
674
+ * @param targetBinaryVersion The binary version (or PR number for PR preview histories) whose history should be removed.
675
+ * @param platform The target platform. ('ios'/'android')
676
+ * @param identifier An additional identifier string. (e.g. 'stg'/'prd')
677
+ * @param app The target app name. (e.g. 'home-mobile')
678
+ */
679
+ removeReleaseHistory?: (
680
+ targetBinaryVersion: string,
681
+ platform: "ios" | "android",
682
+ identifier?: string,
683
+ app?: string,
684
+ ) => Promise<void>;
621
685
  }