native-update 2.0.0 → 3.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (304) hide show
  1. package/Readme.md +28 -14
  2. package/android/manifest-additions.xml +28 -0
  3. package/android/src/main/AndroidManifest.xml +3 -7
  4. package/android/src/main/java/com/aoneahsan/nativeupdate/BackgroundNotificationManager.kt +21 -13
  5. package/android/src/main/java/com/aoneahsan/nativeupdate/LiveUpdatePlugin.kt +196 -29
  6. package/android/src/main/java/com/aoneahsan/nativeupdate/NativeUpdatePlugin.kt +21 -36
  7. package/cli/AGENTS.md +24 -1
  8. package/cli/CLAUDE.md +24 -1
  9. package/cli/commands/backend-create.js +56 -15
  10. package/cli/commands/bundle-create.js +39 -7
  11. package/cli/commands/monitor.js +72 -51
  12. package/cli/index.js +10 -24
  13. package/cli/package.json +11 -3
  14. package/dist/esm/app-review/app-review-manager.js +0 -1
  15. package/dist/esm/app-review/index.js +0 -1
  16. package/dist/esm/app-review/platform-review-handler.js +0 -1
  17. package/dist/esm/app-review/review-conditions-checker.js +0 -1
  18. package/dist/esm/app-review/review-rate-limiter.js +0 -1
  19. package/dist/esm/app-review/types.js +0 -1
  20. package/dist/esm/app-update/app-update-checker.d.ts +19 -0
  21. package/dist/esm/app-update/app-update-checker.js +19 -1
  22. package/dist/esm/app-update/app-update-installer.d.ts +1 -0
  23. package/dist/esm/app-update/app-update-installer.js +19 -8
  24. package/dist/esm/app-update/app-update-manager.js +0 -1
  25. package/dist/esm/app-update/app-update-notifier.js +0 -1
  26. package/dist/esm/app-update/index.js +0 -1
  27. package/dist/esm/app-update/platform-app-update.js +12 -3
  28. package/dist/esm/app-update/types.js +0 -1
  29. package/dist/esm/background-update/background-scheduler.d.ts +21 -0
  30. package/dist/esm/background-update/background-scheduler.js +47 -25
  31. package/dist/esm/background-update/index.js +0 -1
  32. package/dist/esm/background-update/notification-manager.js +0 -1
  33. package/dist/esm/config/support.js +0 -1
  34. package/dist/esm/core/analytics.d.ts +13 -0
  35. package/dist/esm/core/analytics.js +15 -1
  36. package/dist/esm/core/cache-manager.js +0 -1
  37. package/dist/esm/core/config.d.ts +0 -15
  38. package/dist/esm/core/config.js +0 -4
  39. package/dist/esm/core/errors.d.ts +1 -0
  40. package/dist/esm/core/errors.js +1 -1
  41. package/dist/esm/core/event-emitter.d.ts +0 -3
  42. package/dist/esm/core/event-emitter.js +8 -3
  43. package/dist/esm/core/logger.js +0 -1
  44. package/dist/esm/core/performance.js +0 -1
  45. package/dist/esm/core/plugin-manager.js +3 -1
  46. package/dist/esm/core/security.d.ts +11 -0
  47. package/dist/esm/core/security.js +27 -1
  48. package/dist/esm/core/update-check.d.ts +89 -0
  49. package/dist/esm/core/update-check.js +86 -0
  50. package/dist/esm/definitions.d.ts +11 -12
  51. package/dist/esm/definitions.js +0 -1
  52. package/dist/esm/index.d.ts +3 -2
  53. package/dist/esm/index.js +3 -1
  54. package/dist/esm/live-update/bundle-manager.d.ts +8 -0
  55. package/dist/esm/live-update/bundle-manager.js +20 -1
  56. package/dist/esm/live-update/certificate-pinning.js +0 -1
  57. package/dist/esm/live-update/delta-processor.d.ts +1 -1
  58. package/dist/esm/live-update/delta-processor.js +3 -1
  59. package/dist/esm/live-update/download-manager.js +9 -2
  60. package/dist/esm/live-update/rollout-checker.d.ts +1 -1
  61. package/dist/esm/live-update/rollout-checker.js +5 -6
  62. package/dist/esm/live-update/update-manager.js +0 -1
  63. package/dist/esm/live-update/version-manager.d.ts +0 -12
  64. package/dist/esm/live-update/version-manager.js +43 -95
  65. package/dist/esm/plugin.js +71 -51
  66. package/dist/esm/security/crypto.js +11 -7
  67. package/dist/esm/security/validator.js +0 -1
  68. package/dist/esm/types/rollout.d.ts +91 -0
  69. package/dist/esm/types/rollout.js +25 -0
  70. package/dist/esm/web.d.ts +8 -0
  71. package/dist/esm/web.js +148 -54
  72. package/dist/plugin.cjs.js +1 -2
  73. package/dist/plugin.esm.js +1 -2
  74. package/dist/plugin.js +2 -3
  75. package/docs/AGENTS.md +9 -0
  76. package/docs/CHANGELOG.md +140 -0
  77. package/docs/CLAUDE.md +10 -1
  78. package/docs/DEPLOY_NOTES.md +117 -0
  79. package/docs/MANUAL-TASKS.md +30 -0
  80. package/docs/MARKETING_WEBSITE_TRACKER.md +18 -2
  81. package/docs/MIGRATION.md +83 -0
  82. package/docs/PACKAGES.md +167 -0
  83. package/docs/PERFORMANCE.md +110 -0
  84. package/docs/PROJECT_COMPLETION_TRACKER.md +4 -35
  85. package/docs/README.md +0 -1
  86. package/docs/REMAINING_FEATURES.md +123 -76
  87. package/docs/ROADMAP.md +200 -120
  88. package/docs/SECURITY-IF-REPO-PUBLIC.md +232 -0
  89. package/docs/TESTING_REQUIREMENTS.md +1 -112
  90. package/docs/ai-knowledge-base/00-project-profile.md +38 -0
  91. package/docs/ai-knowledge-base/01-features.md +46 -0
  92. package/docs/ai-knowledge-base/02-routes.md +72 -0
  93. package/docs/ai-knowledge-base/03-tech-stack.md +57 -0
  94. package/docs/ai-knowledge-base/README.md +23 -0
  95. package/docs/analytics-tracking.md +37 -0
  96. package/docs/api/background-update-api.md +14 -1
  97. package/docs/capacitor-official-plugins.md +46 -0
  98. package/docs/capawesome-plugins.md +29 -0
  99. package/docs/deployment/HOSTINGER_DEPLOY.md +75 -34
  100. package/docs/deployment/PRODUCTION-DEPLOY-CHECKLIST.md +184 -0
  101. package/docs/docs-site/plan.md +201 -0
  102. package/docs/docs-site/scope.md +127 -0
  103. package/docs/docs-site/tracker.json +235 -0
  104. package/docs/error-handling-tracking.md +37 -0
  105. package/docs/features/e2e-full-verification/00-overview.md +99 -0
  106. package/docs/features/e2e-full-verification/00-tracker.json +284 -0
  107. package/docs/features/e2e-full-verification/phase01-backend-schema-fixes.md +183 -0
  108. package/docs/features/e2e-full-verification/phase02-test-auth.md +176 -0
  109. package/docs/features/e2e-full-verification/phase03-api-test-coverage.md +63 -0
  110. package/docs/features/e2e-full-verification/phase04-frontend-package-contract-audit.md +73 -0
  111. package/docs/features/e2e-full-verification/phase05-browser-e2e-matrix.md +69 -0
  112. package/docs/features/e2e-full-verification/phase06-deploy-prod-smoke.md +51 -0
  113. package/docs/features/e2e-full-verification/results/phase01-drift-report.md +50 -0
  114. package/docs/features/e2e-full-verification/results/phase03-coverage-matrix.md +215 -0
  115. package/docs/features/e2e-full-verification/results/phase04-frontend-contract.md +139 -0
  116. package/docs/features/e2e-full-verification/results/phase05-e2e-results.md +99 -0
  117. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-01-dashboard.png +0 -0
  118. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-02-signup.png +0 -0
  119. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-03-settings-persisted.png +0 -0
  120. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-04a-app-created.png +0 -0
  121. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-04b-duplicate-bundle-422.png +0 -0
  122. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-05-plan-limit-403.png +0 -0
  123. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-08a-upload-graceful-fail.png +0 -0
  124. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-08b-builds-list.png +0 -0
  125. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-10-rollout-25pct.png +0 -0
  126. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-11-analytics.png +0 -0
  127. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-12-drive-disconnected.png +0 -0
  128. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-13-pricing.png +0 -0
  129. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-14-isolation-403.png +0 -0
  130. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-15a-admin-overview.png +0 -0
  131. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-15b-regular-user-admin-redirect.png +0 -0
  132. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-16a-delete-dialog.png +0 -0
  133. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-17-mobile-375.png +0 -0
  134. package/docs/features/e2e-full-verification/results/route-list.json +1 -0
  135. package/docs/features/queues-and-emails/00-overview.md +41 -0
  136. package/docs/features/queues-and-emails/00-tracker.json +99 -0
  137. package/docs/features/queues-and-emails/phase01-foundation.md +15 -0
  138. package/docs/features/queues-and-emails/phase02-queued-jobs.md +19 -0
  139. package/docs/features/queues-and-emails/phase03-transactional-emails.md +16 -0
  140. package/docs/features/queues-and-emails/phase04-quota-ops.md +17 -0
  141. package/docs/features/queues-and-emails/phase05-async-build-processing-DECISION.md +16 -0
  142. package/docs/features/queues-and-emails/phase06-verify-deploy.md +17 -0
  143. package/docs/guides/testing-guide.md +15 -41
  144. package/docs/package-audit.md +41 -0
  145. package/docs/play-store/ASO-METADATA.md +5 -0
  146. package/docs/play-store/DATA-SAFETY.md +5 -0
  147. package/docs/play-store/DECLARATIONS.md +5 -0
  148. package/docs/play-store/README.md +27 -0
  149. package/docs/play-store/RELEASE-NOTES.md +99 -0
  150. package/docs/play-store/RELEASE-STEPS.md +6 -0
  151. package/docs/play-store/STORE-LISTING.md +7 -0
  152. package/docs/play-store/SUBMISSION-CHECKLIST.md +5 -0
  153. package/docs/production-readiness.md +1 -1
  154. package/docs/project-audit/2026-05-16/00-FINALIZATION-PLAN.md +123 -0
  155. package/docs/project-audit/2026-05-16/01-BATCH-PLAN.md +227 -0
  156. package/docs/project-audit/2026-05-16/02-AUDIT-FINDINGS.md +144 -0
  157. package/docs/project-audit/2026-05-16/sessions/batch-01.md +42 -0
  158. package/docs/project-audit/2026-05-16/sessions/batch-02.md +74 -0
  159. package/docs/project-audit/2026-05-16/sessions/batch-03.md +71 -0
  160. package/docs/project-audit/2026-05-16/sessions/batch-04.md +88 -0
  161. package/docs/project-audit/2026-05-16/sessions/batch-05.md +63 -0
  162. package/docs/project-audit/2026-05-16/sessions/batch-06.md +103 -0
  163. package/docs/project-audit/2026-05-16/sessions/batch-07.md +61 -0
  164. package/docs/project-audit/2026-05-16/sessions/batch-08.md +101 -0
  165. package/docs/project-audit/2026-05-16/sessions/batch-09.md +105 -0
  166. package/docs/project-audit/2026-05-16/sessions/batch-10.md +102 -0
  167. package/docs/project-audit/AUDIT-HISTORY.md +74 -0
  168. package/docs/project-audit/BATCH-PLAN.md +168 -0
  169. package/docs/project-audit/MARKETING-WEBSITE-FINDINGS-2026-05-11.md +73 -0
  170. package/docs/project-audit/PRODUCTION-READINESS-AUDIT-2026-05-08.md +275 -0
  171. package/docs/project-finalization/00-tracker.json +60 -0
  172. package/docs/project-knowledge-base/01-system-overview.md +39 -30
  173. package/docs/project-knowledge-base/02-routes-pages-forms-users.md +87 -81
  174. package/docs/project-knowledge-base/03-tech-stack-modules-services.md +140 -108
  175. package/docs/project-knowledge-base/04-data-models-integrations.md +191 -254
  176. package/docs/project-knowledge-base/05-docs-corpus-inventory.md +83 -20
  177. package/docs/project-knowledge-base/06-operations-testing-legal-content.md +67 -29
  178. package/docs/project-knowledge-base/README.md +27 -14
  179. package/docs/project-profiles/native-update-capacitor-update-platform-project-profile-last-updated-2026-05-19.md +81 -0
  180. package/docs/rules-tracker.md +102 -0
  181. package/docs/security/PRE-LAUNCH-PENTEST-CHECKLIST.md +116 -0
  182. package/docs/server-requirements.md +41 -11
  183. package/docs/social-media-marketing/README.md +81 -0
  184. package/docs/social-media-marketing/posts-batch-01.md +613 -0
  185. package/docs/social-media-marketing/posts-batch-02.md +528 -0
  186. package/docs/social-media-marketing/whatsapp-messages-batch-01.md +458 -0
  187. package/docs/social-media-marketing/whatsapp-status-batch-01.md +355 -0
  188. package/docs/tracking/finalization-2026-05-16-tracker.json +346 -0
  189. package/docs/tracking/full-audit-tracker.json +121 -0
  190. package/docs/tracking/production-readiness-audit-tracker.json +429 -0
  191. package/ios/Plugin/BackgroundUpdate/BackgroundUpdatePlugin.swift +16 -3
  192. package/ios/Plugin/LiveUpdate/LiveUpdatePlugin.swift +71 -47
  193. package/ios/Plugin/NativeUpdatePlugin.swift +14 -9
  194. package/package.json +29 -29
  195. package/cli/node_modules/.yarn-integrity +0 -16
  196. package/cli/node_modules/commander/LICENSE +0 -22
  197. package/cli/node_modules/commander/Readme.md +0 -1148
  198. package/cli/node_modules/commander/esm.mjs +0 -16
  199. package/cli/node_modules/commander/index.js +0 -26
  200. package/cli/node_modules/commander/lib/argument.js +0 -145
  201. package/cli/node_modules/commander/lib/command.js +0 -2179
  202. package/cli/node_modules/commander/lib/error.js +0 -43
  203. package/cli/node_modules/commander/lib/help.js +0 -462
  204. package/cli/node_modules/commander/lib/option.js +0 -329
  205. package/cli/node_modules/commander/lib/suggestSimilar.js +0 -100
  206. package/cli/node_modules/commander/package-support.json +0 -16
  207. package/cli/node_modules/commander/package.json +0 -80
  208. package/cli/node_modules/commander/typings/esm.d.mts +0 -3
  209. package/cli/node_modules/commander/typings/index.d.ts +0 -884
  210. package/cli/yarn.lock +0 -8
  211. package/dist/esm/__tests__/bundle-manager.test.d.ts +0 -1
  212. package/dist/esm/__tests__/bundle-manager.test.js +0 -151
  213. package/dist/esm/__tests__/bundle-manager.test.js.map +0 -1
  214. package/dist/esm/__tests__/config.test.d.ts +0 -1
  215. package/dist/esm/__tests__/config.test.js +0 -70
  216. package/dist/esm/__tests__/config.test.js.map +0 -1
  217. package/dist/esm/__tests__/delta-processor.test.d.ts +0 -1
  218. package/dist/esm/__tests__/delta-processor.test.js +0 -77
  219. package/dist/esm/__tests__/delta-processor.test.js.map +0 -1
  220. package/dist/esm/__tests__/firestore-schema.test.d.ts +0 -1
  221. package/dist/esm/__tests__/firestore-schema.test.js +0 -74
  222. package/dist/esm/__tests__/firestore-schema.test.js.map +0 -1
  223. package/dist/esm/__tests__/integration.test.d.ts +0 -1
  224. package/dist/esm/__tests__/integration.test.js +0 -78
  225. package/dist/esm/__tests__/integration.test.js.map +0 -1
  226. package/dist/esm/__tests__/manifest-reader.test.d.ts +0 -1
  227. package/dist/esm/__tests__/manifest-reader.test.js +0 -271
  228. package/dist/esm/__tests__/manifest-reader.test.js.map +0 -1
  229. package/dist/esm/__tests__/rollout-checker.test.d.ts +0 -1
  230. package/dist/esm/__tests__/rollout-checker.test.js +0 -210
  231. package/dist/esm/__tests__/rollout-checker.test.js.map +0 -1
  232. package/dist/esm/__tests__/security-enforcement.test.d.ts +0 -1
  233. package/dist/esm/__tests__/security-enforcement.test.js +0 -95
  234. package/dist/esm/__tests__/security-enforcement.test.js.map +0 -1
  235. package/dist/esm/__tests__/security.test.d.ts +0 -1
  236. package/dist/esm/__tests__/security.test.js +0 -54
  237. package/dist/esm/__tests__/security.test.js.map +0 -1
  238. package/dist/esm/__tests__/version-manager.test.d.ts +0 -1
  239. package/dist/esm/__tests__/version-manager.test.js +0 -45
  240. package/dist/esm/__tests__/version-manager.test.js.map +0 -1
  241. package/dist/esm/app-review/app-review-manager.js.map +0 -1
  242. package/dist/esm/app-review/index.js.map +0 -1
  243. package/dist/esm/app-review/platform-review-handler.js.map +0 -1
  244. package/dist/esm/app-review/review-conditions-checker.js.map +0 -1
  245. package/dist/esm/app-review/review-rate-limiter.js.map +0 -1
  246. package/dist/esm/app-review/types.js.map +0 -1
  247. package/dist/esm/app-update/app-update-checker.js.map +0 -1
  248. package/dist/esm/app-update/app-update-installer.js.map +0 -1
  249. package/dist/esm/app-update/app-update-manager.js.map +0 -1
  250. package/dist/esm/app-update/app-update-notifier.js.map +0 -1
  251. package/dist/esm/app-update/index.js.map +0 -1
  252. package/dist/esm/app-update/platform-app-update.js.map +0 -1
  253. package/dist/esm/app-update/types.js.map +0 -1
  254. package/dist/esm/background-update/background-scheduler.js.map +0 -1
  255. package/dist/esm/background-update/index.js.map +0 -1
  256. package/dist/esm/background-update/notification-manager.js.map +0 -1
  257. package/dist/esm/config/support.js.map +0 -1
  258. package/dist/esm/core/analytics.js.map +0 -1
  259. package/dist/esm/core/cache-manager.js.map +0 -1
  260. package/dist/esm/core/config.js.map +0 -1
  261. package/dist/esm/core/errors.js.map +0 -1
  262. package/dist/esm/core/event-emitter.js.map +0 -1
  263. package/dist/esm/core/logger.js.map +0 -1
  264. package/dist/esm/core/performance.js.map +0 -1
  265. package/dist/esm/core/plugin-manager.js.map +0 -1
  266. package/dist/esm/core/security.js.map +0 -1
  267. package/dist/esm/definitions.js.map +0 -1
  268. package/dist/esm/firestore/firestore-client.d.ts +0 -109
  269. package/dist/esm/firestore/firestore-client.js +0 -264
  270. package/dist/esm/firestore/firestore-client.js.map +0 -1
  271. package/dist/esm/firestore/index.d.ts +0 -11
  272. package/dist/esm/firestore/index.js +0 -11
  273. package/dist/esm/firestore/index.js.map +0 -1
  274. package/dist/esm/firestore/manifest-reader.d.ts +0 -87
  275. package/dist/esm/firestore/manifest-reader.js +0 -294
  276. package/dist/esm/firestore/manifest-reader.js.map +0 -1
  277. package/dist/esm/firestore/schema.d.ts +0 -507
  278. package/dist/esm/firestore/schema.js +0 -73
  279. package/dist/esm/firestore/schema.js.map +0 -1
  280. package/dist/esm/index.js.map +0 -1
  281. package/dist/esm/live-update/bundle-manager.js.map +0 -1
  282. package/dist/esm/live-update/certificate-pinning.js.map +0 -1
  283. package/dist/esm/live-update/delta-processor.js.map +0 -1
  284. package/dist/esm/live-update/download-manager.js.map +0 -1
  285. package/dist/esm/live-update/rollout-checker.js.map +0 -1
  286. package/dist/esm/live-update/update-manager.js.map +0 -1
  287. package/dist/esm/live-update/version-manager.js.map +0 -1
  288. package/dist/esm/plugin.js.map +0 -1
  289. package/dist/esm/security/crypto.js.map +0 -1
  290. package/dist/esm/security/validator.js.map +0 -1
  291. package/dist/esm/web.js.map +0 -1
  292. package/dist/plugin.cjs.js.map +0 -1
  293. package/dist/plugin.esm.js.map +0 -1
  294. package/dist/plugin.js.map +0 -1
  295. package/docs/FIREBASE_INTEGRATION_TRACKER.md +0 -321
  296. package/docs/FIREBASE_QUERIES_AND_INDEXES_AUDIT.md +0 -221
  297. package/docs/examples/firebase-backend-example.md +0 -27
  298. package/docs/features/laravel-nova-backend/credentials.ignore.md +0 -34
  299. package/docs/guides/no-cost-backend-implementation-plan.md +0 -77
  300. package/docs/guides/no-cost-firestore-google-drive-backend.md +0 -60
  301. package/docs/project-profiles/native-update-capacitor-update-platform-project-profile-last-updated-2026-03-16.md +0 -454
  302. package/docs/project-profiles/native-update-capacitor-update-platform-project-profile-last-updated-2026-03-24.md +0 -66
  303. package/docs/project-profiles/native-update-capacitor-update-platform-project-profile-last-updated-2026-03-25.md +0 -67
  304. /package/docs/{MARKETING_WEBSITE_PLAN.md → archive/MARKETING_WEBSITE_PLAN.md} +0 -0
@@ -197,9 +197,13 @@ export interface UpdateConfig {
197
197
  }
198
198
  export interface LiveUpdateConfig {
199
199
  appId: string;
200
+ /**
201
+ * Base URL of the Native Update backend. OTA update checks are issued as
202
+ * `GET {serverUrl}/v1/updates/check` (API-key auth via `X-API-Key`); the
203
+ * self-host contract for that endpoint is in `docs/server-requirements.md`.
204
+ * Must be HTTPS in production (the plugin rejects non-HTTPS base URLs).
205
+ */
200
206
  serverUrl?: string;
201
- backendType?: 'http' | 'firestore';
202
- firestore?: FirestoreConfig;
203
207
  channel?: string;
204
208
  autoUpdate?: boolean;
205
209
  updateStrategy?: UpdateStrategy;
@@ -705,15 +709,11 @@ export interface PluginInitConfig {
705
709
  */
706
710
  enableLogging?: boolean;
707
711
  /**
708
- * Backend type for update checks
709
- */
710
- backendType?: 'http' | 'firestore';
711
- /**
712
- * Firestore configuration for no-cost manifest reads
713
- */
714
- firestore?: FirestoreConfig;
715
- /**
716
- * Server URL for update checks
712
+ * Base URL of the Native Update backend for OTA update checks.
713
+ * The plugin appends the versioned path: `GET {serverUrl}/v1/updates/check`
714
+ * with `X-API-Key` / `X-Device-ID` / `X-Current-Version` / `X-Platform`
715
+ * headers. See `docs/server-requirements.md` for the full wire contract
716
+ * (and `core/update-check.ts`, the single implementation of it).
717
717
  */
718
718
  serverUrl?: string;
719
719
  /**
@@ -789,4 +789,3 @@ export interface NativeUpdatePlugin extends NativeUpdateCombinedPlugin, NativeUp
789
789
  */
790
790
  cleanup(): Promise<void>;
791
791
  }
792
- import type { FirestoreConfig } from './firestore/schema';
@@ -102,4 +102,3 @@ export var UpdateErrorCode;
102
102
  UpdateErrorCode["NOT_CONFIGURED"] = "NOT_CONFIGURED";
103
103
  UpdateErrorCode["UNKNOWN_ERROR"] = "UNKNOWN_ERROR";
104
104
  })(UpdateErrorCode || (UpdateErrorCode = {}));
105
- //# sourceMappingURL=definitions.js.map
@@ -1,6 +1,7 @@
1
1
  export { NativeUpdate } from './plugin';
2
- export type { NativeUpdatePlugin, NativeUpdateCombinedPlugin, NativeUpdateListeners, LiveUpdatePlugin, AppUpdatePlugin, AppReviewPlugin, PluginConfig, UpdateConfig, LiveUpdateConfig, AppUpdateConfig, AppReviewConfig, BundleInfo, BundleStatus, UpdateStrategy, InstallMode, DownloadOptions, DownloadProgressEvent, SyncOptions, SyncResult, DeleteOptions, LatestVersion, ValidateOptions, ValidationResult, CheckForUpdateResult, DownloadUpdateOptions, AppUpdateInfo, OpenAppStoreOptions, ReviewResult, CanRequestReviewResult, UpdateStateChangedEvent, AppUpdateStateChangedEvent, AppUpdateProgressEvent, AppUpdateAvailableEvent, AppUpdateReadyEvent, AppUpdateFailedEvent, AppUpdateNotificationClickedEvent, AppUpdateInstallClickedEvent, BackgroundUpdateProgressEvent, BackgroundUpdateNotificationEvent, UpdateError, UpdateErrorCode, BackgroundUpdatePlugin, BackgroundUpdateConfig, BackgroundUpdateStatus, BackgroundCheckResult, BackgroundUpdateType, NotificationPreferences, NotificationPermissionStatus, NotificationPriority, SecurityConfig, SecurityInfo, CertificatePinning, CertificatePin, PluginInitConfig, PluginListenerHandle, SyncStatus, InstallStatus, UpdateMode, ChecksumAlgorithm, } from './definitions';
3
- export type { FirestoreConfig } from './firestore/schema';
2
+ export { BackgroundUpdateType, NotificationPriority, UpdateStrategy, UpdateMode, InstallMode, ChecksumAlgorithm, SyncStatus, BundleStatus, InstallStatus, UpdateErrorCode, } from './definitions';
3
+ export type { NativeUpdatePlugin, NativeUpdateCombinedPlugin, NativeUpdateListeners, LiveUpdatePlugin, AppUpdatePlugin, AppReviewPlugin, PluginConfig, UpdateConfig, LiveUpdateConfig, AppUpdateConfig, AppReviewConfig, BundleInfo, DownloadOptions, DownloadProgressEvent, SyncOptions, SyncResult, DeleteOptions, LatestVersion, ValidateOptions, ValidationResult, CheckForUpdateResult, DownloadUpdateOptions, AppUpdateInfo, OpenAppStoreOptions, ReviewResult, CanRequestReviewResult, UpdateStateChangedEvent, AppUpdateStateChangedEvent, AppUpdateProgressEvent, AppUpdateAvailableEvent, AppUpdateReadyEvent, AppUpdateFailedEvent, AppUpdateNotificationClickedEvent, AppUpdateInstallClickedEvent, BackgroundUpdateProgressEvent, BackgroundUpdateNotificationEvent, UpdateError, BackgroundUpdatePlugin, BackgroundUpdateConfig, BackgroundUpdateStatus, BackgroundCheckResult, NotificationPreferences, NotificationPermissionStatus, SecurityConfig, SecurityInfo, CertificatePinning, CertificatePin, PluginInitConfig, PluginListenerHandle, } from './definitions';
4
+ export type { RolloutConfig, RolloutTargetSegments, RolloutSchedule, RolloutTimestamp, DeviceInfo, UpdateCheckResponse, } from './types/rollout';
4
5
  export { ErrorCode, NativeUpdateError, ConfigurationError, DownloadError, ValidationError, StorageError, UpdateError as UpdateErrorClass, } from './core/errors';
5
6
  export { ConfigManager } from './core/config';
6
7
  export { Logger, LogLevel } from './core/logger';
package/dist/esm/index.js CHANGED
@@ -1,5 +1,8 @@
1
1
  // Main plugin export
2
2
  export { NativeUpdate } from './plugin';
3
+ // Runtime enums — MUST be `export {}` not `export type {}` so they survive
4
+ // TypeScript erasure and reach the published bundle.
5
+ export { BackgroundUpdateType, NotificationPriority, UpdateStrategy, UpdateMode, InstallMode, ChecksumAlgorithm, SyncStatus, BundleStatus, InstallStatus, UpdateErrorCode, } from './definitions';
3
6
  // Error exports
4
7
  export { ErrorCode, NativeUpdateError, ConfigurationError, DownloadError, ValidationError, StorageError, UpdateError as UpdateErrorClass, } from './core/errors';
5
8
  // Core exports for advanced users
@@ -13,4 +16,3 @@ export { BundleManager } from './live-update/bundle-manager';
13
16
  export { DownloadManager } from './live-update/download-manager';
14
17
  export { VersionManager } from './live-update/version-manager';
15
18
  export { UpdateManager } from './live-update/update-manager';
16
- //# sourceMappingURL=index.js.map
@@ -1,4 +1,5 @@
1
1
  import type { BundleInfo } from '../definitions';
2
+ import type { DownloadManager } from './download-manager';
2
3
  /**
3
4
  * Manages bundle storage and lifecycle
4
5
  */
@@ -10,7 +11,14 @@ export declare class BundleManager {
10
11
  private readonly configManager;
11
12
  private cache;
12
13
  private cacheExpiry;
14
+ private downloadManager;
13
15
  constructor();
16
+ /**
17
+ * Wire the DownloadManager so deleteBundle can also remove the
18
+ * persisted bundle file. Without this, deleted bundles leave their
19
+ * blob on disk forever.
20
+ */
21
+ setDownloadManager(downloadManager: DownloadManager): void;
14
22
  /**
15
23
  * Initialize the bundle manager with preferences
16
24
  */
@@ -11,9 +11,18 @@ export class BundleManager {
11
11
  this.preferences = null;
12
12
  this.cache = new Map();
13
13
  this.cacheExpiry = 0;
14
+ this.downloadManager = null;
14
15
  this.logger = Logger.getInstance();
15
16
  this.configManager = ConfigManager.getInstance();
16
17
  }
18
+ /**
19
+ * Wire the DownloadManager so deleteBundle can also remove the
20
+ * persisted bundle file. Without this, deleted bundles leave their
21
+ * blob on disk forever.
22
+ */
23
+ setDownloadManager(downloadManager) {
24
+ this.downloadManager = downloadManager;
25
+ }
17
26
  /**
18
27
  * Initialize the bundle manager with preferences
19
28
  */
@@ -127,6 +136,17 @@ export class BundleManager {
127
136
  if (activeBundleId === bundleId) {
128
137
  await this.clearActiveBundle();
129
138
  }
139
+ // Remove the persisted bundle file from filesystem. Failure to delete
140
+ // metadata earlier was a storage leak: the on-disk zip stayed forever
141
+ // because deleteBundle only cleaned the metadata cache.
142
+ if (this.downloadManager) {
143
+ try {
144
+ await this.downloadManager.deleteBlob(bundleId);
145
+ }
146
+ catch (error) {
147
+ this.logger.warn('Failed to delete bundle file', { bundleId, error });
148
+ }
149
+ }
130
150
  this.logger.info('Bundle deleted', { bundleId });
131
151
  }
132
152
  /**
@@ -322,4 +342,3 @@ export class BundleManager {
322
342
  }
323
343
  }
324
344
  }
325
- //# sourceMappingURL=bundle-manager.js.map
@@ -75,4 +75,3 @@ export class CertificatePinning {
75
75
  };
76
76
  }
77
77
  }
78
- //# sourceMappingURL=certificate-pinning.js.map
@@ -7,7 +7,7 @@
7
7
  * For production, a WASM-based bsdiff/bspatch implementation can be added
8
8
  * for better performance on binary files.
9
9
  */
10
- import type { UpdateCheckResponse } from '../firestore/schema';
10
+ import type { UpdateCheckResponse } from '../types/rollout';
11
11
  /**
12
12
  * Delta patch information
13
13
  */
@@ -10,6 +10,7 @@
10
10
  import { Logger } from '../core/logger';
11
11
  import { ConfigManager } from '../core/config';
12
12
  import { DownloadError, ErrorCode, ValidationError } from '../core/errors';
13
+ import { SecurityValidator } from '../core/security';
13
14
  /**
14
15
  * Delta processor for applying patch updates
15
16
  */
@@ -92,6 +93,7 @@ export class DeltaProcessor {
92
93
  * Download a delta patch file
93
94
  */
94
95
  async downloadPatch(url) {
96
+ SecurityValidator.validateDownloadUrl(url);
95
97
  const response = await fetch(url);
96
98
  if (!response.ok) {
97
99
  throw new DownloadError(ErrorCode.DOWNLOAD_FAILED, `Failed to download delta patch: ${response.status}`);
@@ -102,6 +104,7 @@ export class DeltaProcessor {
102
104
  * Download full bundle
103
105
  */
104
106
  async downloadFull(url, onProgress) {
107
+ SecurityValidator.validateDownloadUrl(url);
105
108
  const response = await fetch(url);
106
109
  if (!response.ok) {
107
110
  throw new DownloadError(ErrorCode.DOWNLOAD_FAILED, `Failed to download bundle: ${response.status}`);
@@ -296,4 +299,3 @@ export class DeltaProcessor {
296
299
  export function createDeltaProcessor() {
297
300
  return new DeltaProcessor();
298
301
  }
299
- //# sourceMappingURL=delta-processor.js.map
@@ -335,7 +335,15 @@ export class DownloadManager {
335
335
  throw new DownloadError(ErrorCode.MISSING_DEPENDENCY, 'Filesystem not initialized');
336
336
  }
337
337
  const arrayBuffer = await this.blobToArrayBuffer(blob);
338
- const base64 = btoa(String.fromCharCode(...new Uint8Array(arrayBuffer)));
338
+ // Spreading a 100MB Uint8Array into String.fromCharCode is a stack
339
+ // overflow on most engines. Chunk the conversion in 32KB blocks.
340
+ const bytes = new Uint8Array(arrayBuffer);
341
+ const chunkSize = 0x8000;
342
+ let binary = '';
343
+ for (let i = 0; i < bytes.length; i += chunkSize) {
344
+ binary += String.fromCharCode.apply(null, Array.from(bytes.subarray(i, i + chunkSize)));
345
+ }
346
+ const base64 = btoa(binary);
339
347
  const path = `bundles/${bundleId}/bundle.zip`;
340
348
  await this.filesystem.writeFile({
341
349
  path,
@@ -402,4 +410,3 @@ export class DownloadManager {
402
410
  }
403
411
  }
404
412
  }
405
- //# sourceMappingURL=download-manager.js.map
@@ -4,7 +4,7 @@
4
4
  * Client-side rollout eligibility checking for staged deployments.
5
5
  * Uses deterministic hashing for consistent rollout decisions.
6
6
  */
7
- import type { RolloutConfig, DeviceInfo } from '../firestore/schema';
7
+ import type { RolloutConfig, DeviceInfo } from '../types/rollout';
8
8
  /**
9
9
  * Rollout eligibility result
10
10
  */
@@ -4,7 +4,7 @@
4
4
  * Client-side rollout eligibility checking for staged deployments.
5
5
  * Uses deterministic hashing for consistent rollout decisions.
6
6
  */
7
- import { timestampToDate } from '../firestore/schema';
7
+ import { toEpochMs } from '../types/rollout';
8
8
  import { Logger } from '../core/logger';
9
9
  import { ConfigManager } from '../core/config';
10
10
  /**
@@ -77,7 +77,7 @@ export class RolloutChecker {
77
77
  */
78
78
  checkTimeWindow(rollout) {
79
79
  const now = Date.now();
80
- const startTime = timestampToDate(rollout.startTime).getTime();
80
+ const startTime = toEpochMs(rollout.startTime);
81
81
  if (now < startTime) {
82
82
  return {
83
83
  eligible: false,
@@ -85,7 +85,7 @@ export class RolloutChecker {
85
85
  };
86
86
  }
87
87
  if (rollout.endTime) {
88
- const endTime = timestampToDate(rollout.endTime).getTime();
88
+ const endTime = toEpochMs(rollout.endTime);
89
89
  if (now > endTime) {
90
90
  return {
91
91
  eligible: false,
@@ -100,7 +100,7 @@ export class RolloutChecker {
100
100
  */
101
101
  checkScheduled(scheduledTime) {
102
102
  const now = Date.now();
103
- const scheduled = timestampToDate(scheduledTime).getTime();
103
+ const scheduled = toEpochMs(scheduledTime);
104
104
  if (now < scheduled) {
105
105
  return {
106
106
  eligible: false,
@@ -170,7 +170,7 @@ export class RolloutChecker {
170
170
  if (!gradualSteps || !gradualInterval) {
171
171
  return rollout.percentage;
172
172
  }
173
- const startTime = timestampToDate(rollout.startTime).getTime();
173
+ const startTime = toEpochMs(rollout.startTime);
174
174
  const elapsedHours = (Date.now() - startTime) / (1000 * 60 * 60);
175
175
  const stepIndex = Math.floor(elapsedHours / gradualInterval);
176
176
  if (stepIndex >= gradualSteps.length) {
@@ -302,4 +302,3 @@ export async function collectDeviceInfo() {
302
302
  region: undefined, // Could be determined via geolocation or timezone
303
303
  };
304
304
  }
305
- //# sourceMappingURL=rollout-checker.js.map
@@ -319,4 +319,3 @@ export class UpdateManager {
319
319
  this.currentState = null;
320
320
  }
321
321
  }
322
- //# sourceMappingURL=update-manager.js.map
@@ -1,5 +1,4 @@
1
1
  import type { LatestVersion } from '../definitions';
2
- import type { DeviceInfo, UpdateCheckResponse } from '../firestore/schema';
3
2
  /**
4
3
  * Manages version checking and comparison
5
4
  */
@@ -11,8 +10,6 @@ export declare class VersionManager {
11
10
  private readonly securityValidator;
12
11
  private preferences;
13
12
  private memoryCache;
14
- private firestoreClient;
15
- private manifestReader;
16
13
  constructor();
17
14
  /**
18
15
  * Compare two semantic versions
@@ -30,15 +27,6 @@ export declare class VersionManager {
30
27
  * Initialize the version manager
31
28
  */
32
29
  initialize(): Promise<void>;
33
- /**
34
- * Check for updates from Firestore backend
35
- * Uses ManifestReader for efficient single-document reads
36
- */
37
- checkForUpdatesFromFirestore(currentVersion: string, deviceInfo: DeviceInfo): Promise<UpdateCheckResponse | null>;
38
- /**
39
- * Get the appropriate update checker based on backend type
40
- */
41
- checkForUpdatesAuto(currentVersion: string, deviceInfo?: DeviceInfo): Promise<LatestVersion | UpdateCheckResponse | null>;
42
30
  /**
43
31
  * Check for latest version from server
44
32
  */
@@ -2,8 +2,7 @@ import { ConfigManager } from '../core/config';
2
2
  import { Logger } from '../core/logger';
3
3
  import { SecurityValidator } from '../core/security';
4
4
  import { ValidationError, ErrorCode } from '../core/errors';
5
- import { FirestoreClient } from '../firestore/firestore-client';
6
- import { ManifestReader } from '../firestore/manifest-reader';
5
+ import { checkForUpdate } from '../core/update-check';
7
6
  /**
8
7
  * Manages version checking and comparison
9
8
  */
@@ -13,8 +12,6 @@ export class VersionManager {
13
12
  this.CACHE_DURATION = 5 * 60 * 1000; // 5 minutes
14
13
  this.preferences = null;
15
14
  this.memoryCache = new Map();
16
- this.firestoreClient = null;
17
- this.manifestReader = null;
18
15
  this.logger = Logger.getInstance();
19
16
  this.configManager = ConfigManager.getInstance();
20
17
  this.securityValidator = SecurityValidator.getInstance();
@@ -78,74 +75,12 @@ export class VersionManager {
78
75
  if (!this.preferences) {
79
76
  throw new ValidationError(ErrorCode.MISSING_DEPENDENCY, 'Preferences not configured. Please configure the plugin first.');
80
77
  }
81
- // Initialize Firestore client if configured
82
- const backendType = this.configManager.get('backendType');
83
- if (backendType === 'firestore') {
84
- const firestoreConfig = this.configManager.get('firestore');
85
- if (!firestoreConfig) {
86
- throw new ValidationError(ErrorCode.INVALID_CONFIG, 'Firestore configuration required when using firestore backend');
87
- }
88
- this.firestoreClient = new FirestoreClient(firestoreConfig);
89
- this.manifestReader = new ManifestReader(this.firestoreClient);
90
- this.logger.debug('Firestore backend initialized');
91
- }
92
- }
93
- /**
94
- * Check for updates from Firestore backend
95
- * Uses ManifestReader for efficient single-document reads
96
- */
97
- async checkForUpdatesFromFirestore(currentVersion, deviceInfo) {
98
- if (!this.manifestReader) {
99
- throw new ValidationError(ErrorCode.INVALID_CONFIG, 'Firestore backend not initialized. Call initialize() first or configure firestore backend.');
100
- }
101
- // Validate current version
102
- this.securityValidator.validateVersion(currentVersion);
103
- const options = {
104
- currentVersion,
105
- deviceInfo,
106
- checkDeltas: this.configManager.get('enableDeltaUpdates'),
107
- };
108
- try {
109
- const response = await this.manifestReader.checkForUpdates(options);
110
- if (response) {
111
- this.logger.info('Firestore update check completed', {
112
- currentVersion,
113
- latestVersion: response.version,
114
- updateAvailable: response.updateAvailable,
115
- eligible: response.rolloutEligible,
116
- });
117
- }
118
- return response;
119
- }
120
- catch (error) {
121
- this.logger.error('Failed to check for updates from Firestore', error);
122
- return null;
123
- }
124
- }
125
- /**
126
- * Get the appropriate update checker based on backend type
127
- */
128
- async checkForUpdatesAuto(currentVersion, deviceInfo) {
129
- const backendType = this.configManager.get('backendType') || 'http';
130
- if (backendType === 'firestore') {
131
- if (!deviceInfo) {
132
- throw new ValidationError(ErrorCode.INVALID_CONFIG, 'Device info is required for Firestore backend');
133
- }
134
- return this.checkForUpdatesFromFirestore(currentVersion, deviceInfo);
135
- }
136
- // Fall back to HTTP-based update check
137
- const serverUrl = this.configManager.get('serverUrl');
138
- const channel = this.configManager.get('channel') || 'production';
139
- const appId = this.configManager.get('appId');
140
- if (!serverUrl || !appId) {
141
- throw new ValidationError(ErrorCode.INVALID_CONFIG, 'Server URL and App ID are required for HTTP backend');
142
- }
143
- return this.checkForUpdates(serverUrl, channel, currentVersion, appId);
144
78
  }
145
79
  /**
146
80
  * Check for latest version from server
147
81
  */
148
82
  async checkForUpdates(serverUrl, channel, currentVersion, appId) {
83
+ var _a;
149
84
  // Validate inputs
150
85
  this.securityValidator.validateUrl(serverUrl);
151
86
  this.securityValidator.validateVersion(currentVersion);
@@ -164,46 +99,60 @@ export class VersionManager {
164
99
  });
165
100
  return cached.data;
166
101
  }
102
+ // The Native Update backend serves update checks at
103
+ // `/v1/updates/check` (API-key auth), NOT `/check`. Route through the
104
+ // shared helper so this path matches plugin.checkForUpdate() exactly.
105
+ // Without an API key the backend returns 401, so bail early with null.
106
+ const apiKey = this.configManager.get('apiKey');
107
+ if (!apiKey) {
108
+ this.logger.warn('VersionManager.checkForUpdates: no apiKey configured — the Native Update backend requires X-API-Key');
109
+ return null;
110
+ }
167
111
  try {
168
- const url = new URL(`${serverUrl}/check`);
169
- url.searchParams.append('channel', channel);
170
- url.searchParams.append('version', currentVersion);
171
- url.searchParams.append('appId', appId);
172
- url.searchParams.append('platform', 'web'); // Will be overridden by native platforms
173
- const response = await fetch(url.toString(), {
174
- method: 'GET',
175
- headers: {
176
- 'Content-Type': 'application/json',
177
- 'X-App-Version': currentVersion,
178
- 'X-App-Id': appId,
179
- },
112
+ const data = await checkForUpdate(serverUrl, {
113
+ apiKey,
114
+ channel,
115
+ currentVersion,
116
+ // JS-layer fallback identity; native background checks run through
117
+ // the native scheduler with the real device id + platform.
118
+ deviceId: 'web-client',
119
+ platform: 'web',
120
+ appVersion: currentVersion,
180
121
  signal: AbortSignal.timeout(this.configManager.get('downloadTimeout')),
181
122
  });
182
- if (!response.ok) {
183
- throw new Error(`Version check failed: ${response.status}`);
123
+ const latest = {
124
+ available: data.available,
125
+ version: data.version,
126
+ url: data.downloadUrl,
127
+ mandatory: data.mandatory,
128
+ notes: (_a = data.releaseNotes) !== null && _a !== void 0 ? _a : undefined,
129
+ size: data.size,
130
+ checksum: data.checksum,
131
+ };
132
+ // No update is a normal, non-error outcome — return it as-is.
133
+ if (!latest.available) {
134
+ return latest;
184
135
  }
185
- const data = await response.json();
186
- // Validate response
187
- if (!data.version) {
136
+ // Validate the actionable fields before we cache/return them.
137
+ if (!latest.version) {
188
138
  throw new ValidationError(ErrorCode.INVALID_BUNDLE_FORMAT, 'No version in server response');
189
139
  }
190
- this.securityValidator.validateVersion(data.version);
191
- // Additional validation
192
- if (data.bundleUrl) {
193
- this.securityValidator.validateUrl(data.bundleUrl);
140
+ this.securityValidator.validateVersion(latest.version);
141
+ if (latest.url) {
142
+ this.securityValidator.validateUrl(latest.url);
194
143
  }
195
- if (data.minAppVersion) {
196
- this.securityValidator.validateVersion(data.minAppVersion);
144
+ if (data.minNativeVersion) {
145
+ this.securityValidator.validateVersion(data.minNativeVersion);
197
146
  }
198
147
  // Cache the result
199
- await this.cacheVersionInfo(cacheKey, channel, data);
148
+ await this.cacheVersionInfo(cacheKey, channel, latest);
200
149
  this.logger.info('Version check completed', {
201
150
  channel,
202
151
  currentVersion,
203
- latestVersion: data.version,
204
- updateAvailable: this.isNewerVersion(data.version, currentVersion),
152
+ latestVersion: latest.version,
153
+ updateAvailable: this.isNewerVersion(latest.version, currentVersion),
205
154
  });
206
- return data;
155
+ return latest;
207
156
  }
208
157
  catch (error) {
209
158
  this.logger.error('Failed to check for updates', error);
@@ -439,4 +388,3 @@ export class VersionManager {
439
388
  }
440
389
  }
441
390
  }
442
- //# sourceMappingURL=version-manager.js.map