native-update 2.0.0 → 3.1.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 (258) 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 +15 -1
  8. package/cli/CLAUDE.md +15 -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.js +0 -1
  21. package/dist/esm/app-update/app-update-installer.d.ts +1 -0
  22. package/dist/esm/app-update/app-update-installer.js +19 -8
  23. package/dist/esm/app-update/app-update-manager.js +0 -1
  24. package/dist/esm/app-update/app-update-notifier.js +0 -1
  25. package/dist/esm/app-update/index.js +0 -1
  26. package/dist/esm/app-update/platform-app-update.js +12 -3
  27. package/dist/esm/app-update/types.js +0 -1
  28. package/dist/esm/background-update/background-scheduler.js +0 -1
  29. package/dist/esm/background-update/index.js +0 -1
  30. package/dist/esm/background-update/notification-manager.js +0 -1
  31. package/dist/esm/config/support.js +0 -1
  32. package/dist/esm/core/analytics.d.ts +13 -0
  33. package/dist/esm/core/analytics.js +15 -1
  34. package/dist/esm/core/cache-manager.js +0 -1
  35. package/dist/esm/core/config.d.ts +0 -15
  36. package/dist/esm/core/config.js +0 -4
  37. package/dist/esm/core/errors.d.ts +1 -0
  38. package/dist/esm/core/errors.js +1 -1
  39. package/dist/esm/core/event-emitter.d.ts +0 -3
  40. package/dist/esm/core/event-emitter.js +8 -3
  41. package/dist/esm/core/logger.js +0 -1
  42. package/dist/esm/core/performance.js +0 -1
  43. package/dist/esm/core/plugin-manager.js +3 -1
  44. package/dist/esm/core/security.d.ts +11 -0
  45. package/dist/esm/core/security.js +27 -1
  46. package/dist/esm/definitions.d.ts +0 -11
  47. package/dist/esm/definitions.js +0 -1
  48. package/dist/esm/index.d.ts +3 -2
  49. package/dist/esm/index.js +3 -1
  50. package/dist/esm/live-update/bundle-manager.d.ts +8 -0
  51. package/dist/esm/live-update/bundle-manager.js +20 -1
  52. package/dist/esm/live-update/certificate-pinning.js +0 -1
  53. package/dist/esm/live-update/delta-processor.d.ts +1 -1
  54. package/dist/esm/live-update/delta-processor.js +3 -1
  55. package/dist/esm/live-update/download-manager.js +9 -2
  56. package/dist/esm/live-update/rollout-checker.d.ts +1 -1
  57. package/dist/esm/live-update/rollout-checker.js +5 -6
  58. package/dist/esm/live-update/update-manager.js +0 -1
  59. package/dist/esm/live-update/version-manager.d.ts +0 -12
  60. package/dist/esm/live-update/version-manager.js +0 -68
  61. package/dist/esm/plugin.js +69 -43
  62. package/dist/esm/security/crypto.js +11 -7
  63. package/dist/esm/security/validator.js +0 -1
  64. package/dist/esm/types/rollout.d.ts +85 -0
  65. package/dist/esm/types/rollout.js +25 -0
  66. package/dist/esm/web.d.ts +8 -0
  67. package/dist/esm/web.js +148 -54
  68. package/dist/plugin.cjs.js +1 -2
  69. package/dist/plugin.esm.js +1 -2
  70. package/dist/plugin.js +2 -3
  71. package/docs/CHANGELOG.md +124 -0
  72. package/docs/CLAUDE.md +1 -1
  73. package/docs/MANUAL-TASKS.md +17 -0
  74. package/docs/MARKETING_WEBSITE_TRACKER.md +18 -2
  75. package/docs/MIGRATION.md +83 -0
  76. package/docs/PACKAGES.md +167 -0
  77. package/docs/PERFORMANCE.md +110 -0
  78. package/docs/PROJECT_COMPLETION_TRACKER.md +4 -35
  79. package/docs/README.md +0 -1
  80. package/docs/REMAINING_FEATURES.md +123 -76
  81. package/docs/ROADMAP.md +200 -120
  82. package/docs/SECURITY-IF-REPO-PUBLIC.md +232 -0
  83. package/docs/TESTING_REQUIREMENTS.md +1 -112
  84. package/docs/ai-knowledge-base/00-project-profile.md +38 -0
  85. package/docs/ai-knowledge-base/01-features.md +46 -0
  86. package/docs/ai-knowledge-base/02-routes.md +72 -0
  87. package/docs/ai-knowledge-base/03-tech-stack.md +57 -0
  88. package/docs/ai-knowledge-base/README.md +23 -0
  89. package/docs/analytics-tracking.md +37 -0
  90. package/docs/capacitor-official-plugins.md +46 -0
  91. package/docs/capawesome-plugins.md +29 -0
  92. package/docs/deployment/HOSTINGER_DEPLOY.md +75 -34
  93. package/docs/deployment/PRODUCTION-DEPLOY-CHECKLIST.md +184 -0
  94. package/docs/docs-site/plan.md +201 -0
  95. package/docs/docs-site/scope.md +127 -0
  96. package/docs/docs-site/tracker.json +235 -0
  97. package/docs/error-handling-tracking.md +37 -0
  98. package/docs/guides/testing-guide.md +15 -41
  99. package/docs/package-audit.md +41 -0
  100. package/docs/play-store/ASO-METADATA.md +5 -0
  101. package/docs/play-store/DATA-SAFETY.md +5 -0
  102. package/docs/play-store/DECLARATIONS.md +5 -0
  103. package/docs/play-store/README.md +27 -0
  104. package/docs/play-store/RELEASE-NOTES.md +99 -0
  105. package/docs/play-store/RELEASE-STEPS.md +6 -0
  106. package/docs/play-store/STORE-LISTING.md +7 -0
  107. package/docs/play-store/SUBMISSION-CHECKLIST.md +5 -0
  108. package/docs/production-readiness.md +1 -1
  109. package/docs/project-audit/2026-05-16/00-FINALIZATION-PLAN.md +123 -0
  110. package/docs/project-audit/2026-05-16/01-BATCH-PLAN.md +227 -0
  111. package/docs/project-audit/2026-05-16/02-AUDIT-FINDINGS.md +144 -0
  112. package/docs/project-audit/2026-05-16/sessions/batch-01.md +42 -0
  113. package/docs/project-audit/2026-05-16/sessions/batch-02.md +74 -0
  114. package/docs/project-audit/2026-05-16/sessions/batch-03.md +71 -0
  115. package/docs/project-audit/2026-05-16/sessions/batch-04.md +88 -0
  116. package/docs/project-audit/2026-05-16/sessions/batch-05.md +63 -0
  117. package/docs/project-audit/2026-05-16/sessions/batch-06.md +103 -0
  118. package/docs/project-audit/2026-05-16/sessions/batch-07.md +61 -0
  119. package/docs/project-audit/2026-05-16/sessions/batch-08.md +101 -0
  120. package/docs/project-audit/2026-05-16/sessions/batch-09.md +105 -0
  121. package/docs/project-audit/2026-05-16/sessions/batch-10.md +102 -0
  122. package/docs/project-audit/AUDIT-HISTORY.md +74 -0
  123. package/docs/project-audit/BATCH-PLAN.md +168 -0
  124. package/docs/project-audit/MARKETING-WEBSITE-FINDINGS-2026-05-11.md +73 -0
  125. package/docs/project-audit/PRODUCTION-READINESS-AUDIT-2026-05-08.md +275 -0
  126. package/docs/project-finalization/00-tracker.json +60 -0
  127. package/docs/project-knowledge-base/01-system-overview.md +39 -30
  128. package/docs/project-knowledge-base/02-routes-pages-forms-users.md +87 -81
  129. package/docs/project-knowledge-base/03-tech-stack-modules-services.md +140 -108
  130. package/docs/project-knowledge-base/04-data-models-integrations.md +191 -254
  131. package/docs/project-knowledge-base/05-docs-corpus-inventory.md +83 -20
  132. package/docs/project-knowledge-base/06-operations-testing-legal-content.md +67 -29
  133. package/docs/project-knowledge-base/README.md +27 -14
  134. package/docs/project-profiles/native-update-capacitor-update-platform-project-profile-last-updated-2026-05-19.md +81 -0
  135. package/docs/rules-tracker.md +102 -0
  136. package/docs/security/PRE-LAUNCH-PENTEST-CHECKLIST.md +116 -0
  137. package/docs/social-media-marketing/README.md +81 -0
  138. package/docs/social-media-marketing/posts-batch-01.md +613 -0
  139. package/docs/social-media-marketing/posts-batch-02.md +528 -0
  140. package/docs/social-media-marketing/whatsapp-messages-batch-01.md +458 -0
  141. package/docs/social-media-marketing/whatsapp-status-batch-01.md +355 -0
  142. package/docs/tracking/finalization-2026-05-16-tracker.json +346 -0
  143. package/docs/tracking/full-audit-tracker.json +121 -0
  144. package/docs/tracking/production-readiness-audit-tracker.json +429 -0
  145. package/ios/Plugin/BackgroundUpdate/BackgroundUpdatePlugin.swift +16 -3
  146. package/ios/Plugin/LiveUpdate/LiveUpdatePlugin.swift +71 -47
  147. package/ios/Plugin/NativeUpdatePlugin.swift +14 -9
  148. package/package.json +29 -29
  149. package/cli/node_modules/.yarn-integrity +0 -16
  150. package/cli/node_modules/commander/LICENSE +0 -22
  151. package/cli/node_modules/commander/Readme.md +0 -1148
  152. package/cli/node_modules/commander/esm.mjs +0 -16
  153. package/cli/node_modules/commander/index.js +0 -26
  154. package/cli/node_modules/commander/lib/argument.js +0 -145
  155. package/cli/node_modules/commander/lib/command.js +0 -2179
  156. package/cli/node_modules/commander/lib/error.js +0 -43
  157. package/cli/node_modules/commander/lib/help.js +0 -462
  158. package/cli/node_modules/commander/lib/option.js +0 -329
  159. package/cli/node_modules/commander/lib/suggestSimilar.js +0 -100
  160. package/cli/node_modules/commander/package-support.json +0 -16
  161. package/cli/node_modules/commander/package.json +0 -80
  162. package/cli/node_modules/commander/typings/esm.d.mts +0 -3
  163. package/cli/node_modules/commander/typings/index.d.ts +0 -884
  164. package/cli/yarn.lock +0 -8
  165. package/dist/esm/__tests__/bundle-manager.test.d.ts +0 -1
  166. package/dist/esm/__tests__/bundle-manager.test.js +0 -151
  167. package/dist/esm/__tests__/bundle-manager.test.js.map +0 -1
  168. package/dist/esm/__tests__/config.test.d.ts +0 -1
  169. package/dist/esm/__tests__/config.test.js +0 -70
  170. package/dist/esm/__tests__/config.test.js.map +0 -1
  171. package/dist/esm/__tests__/delta-processor.test.d.ts +0 -1
  172. package/dist/esm/__tests__/delta-processor.test.js +0 -77
  173. package/dist/esm/__tests__/delta-processor.test.js.map +0 -1
  174. package/dist/esm/__tests__/firestore-schema.test.d.ts +0 -1
  175. package/dist/esm/__tests__/firestore-schema.test.js +0 -74
  176. package/dist/esm/__tests__/firestore-schema.test.js.map +0 -1
  177. package/dist/esm/__tests__/integration.test.d.ts +0 -1
  178. package/dist/esm/__tests__/integration.test.js +0 -78
  179. package/dist/esm/__tests__/integration.test.js.map +0 -1
  180. package/dist/esm/__tests__/manifest-reader.test.d.ts +0 -1
  181. package/dist/esm/__tests__/manifest-reader.test.js +0 -271
  182. package/dist/esm/__tests__/manifest-reader.test.js.map +0 -1
  183. package/dist/esm/__tests__/rollout-checker.test.d.ts +0 -1
  184. package/dist/esm/__tests__/rollout-checker.test.js +0 -210
  185. package/dist/esm/__tests__/rollout-checker.test.js.map +0 -1
  186. package/dist/esm/__tests__/security-enforcement.test.d.ts +0 -1
  187. package/dist/esm/__tests__/security-enforcement.test.js +0 -95
  188. package/dist/esm/__tests__/security-enforcement.test.js.map +0 -1
  189. package/dist/esm/__tests__/security.test.d.ts +0 -1
  190. package/dist/esm/__tests__/security.test.js +0 -54
  191. package/dist/esm/__tests__/security.test.js.map +0 -1
  192. package/dist/esm/__tests__/version-manager.test.d.ts +0 -1
  193. package/dist/esm/__tests__/version-manager.test.js +0 -45
  194. package/dist/esm/__tests__/version-manager.test.js.map +0 -1
  195. package/dist/esm/app-review/app-review-manager.js.map +0 -1
  196. package/dist/esm/app-review/index.js.map +0 -1
  197. package/dist/esm/app-review/platform-review-handler.js.map +0 -1
  198. package/dist/esm/app-review/review-conditions-checker.js.map +0 -1
  199. package/dist/esm/app-review/review-rate-limiter.js.map +0 -1
  200. package/dist/esm/app-review/types.js.map +0 -1
  201. package/dist/esm/app-update/app-update-checker.js.map +0 -1
  202. package/dist/esm/app-update/app-update-installer.js.map +0 -1
  203. package/dist/esm/app-update/app-update-manager.js.map +0 -1
  204. package/dist/esm/app-update/app-update-notifier.js.map +0 -1
  205. package/dist/esm/app-update/index.js.map +0 -1
  206. package/dist/esm/app-update/platform-app-update.js.map +0 -1
  207. package/dist/esm/app-update/types.js.map +0 -1
  208. package/dist/esm/background-update/background-scheduler.js.map +0 -1
  209. package/dist/esm/background-update/index.js.map +0 -1
  210. package/dist/esm/background-update/notification-manager.js.map +0 -1
  211. package/dist/esm/config/support.js.map +0 -1
  212. package/dist/esm/core/analytics.js.map +0 -1
  213. package/dist/esm/core/cache-manager.js.map +0 -1
  214. package/dist/esm/core/config.js.map +0 -1
  215. package/dist/esm/core/errors.js.map +0 -1
  216. package/dist/esm/core/event-emitter.js.map +0 -1
  217. package/dist/esm/core/logger.js.map +0 -1
  218. package/dist/esm/core/performance.js.map +0 -1
  219. package/dist/esm/core/plugin-manager.js.map +0 -1
  220. package/dist/esm/core/security.js.map +0 -1
  221. package/dist/esm/definitions.js.map +0 -1
  222. package/dist/esm/firestore/firestore-client.d.ts +0 -109
  223. package/dist/esm/firestore/firestore-client.js +0 -264
  224. package/dist/esm/firestore/firestore-client.js.map +0 -1
  225. package/dist/esm/firestore/index.d.ts +0 -11
  226. package/dist/esm/firestore/index.js +0 -11
  227. package/dist/esm/firestore/index.js.map +0 -1
  228. package/dist/esm/firestore/manifest-reader.d.ts +0 -87
  229. package/dist/esm/firestore/manifest-reader.js +0 -294
  230. package/dist/esm/firestore/manifest-reader.js.map +0 -1
  231. package/dist/esm/firestore/schema.d.ts +0 -507
  232. package/dist/esm/firestore/schema.js +0 -73
  233. package/dist/esm/firestore/schema.js.map +0 -1
  234. package/dist/esm/index.js.map +0 -1
  235. package/dist/esm/live-update/bundle-manager.js.map +0 -1
  236. package/dist/esm/live-update/certificate-pinning.js.map +0 -1
  237. package/dist/esm/live-update/delta-processor.js.map +0 -1
  238. package/dist/esm/live-update/download-manager.js.map +0 -1
  239. package/dist/esm/live-update/rollout-checker.js.map +0 -1
  240. package/dist/esm/live-update/update-manager.js.map +0 -1
  241. package/dist/esm/live-update/version-manager.js.map +0 -1
  242. package/dist/esm/plugin.js.map +0 -1
  243. package/dist/esm/security/crypto.js.map +0 -1
  244. package/dist/esm/security/validator.js.map +0 -1
  245. package/dist/esm/web.js.map +0 -1
  246. package/dist/plugin.cjs.js.map +0 -1
  247. package/dist/plugin.esm.js.map +0 -1
  248. package/dist/plugin.js.map +0 -1
  249. package/docs/FIREBASE_INTEGRATION_TRACKER.md +0 -321
  250. package/docs/FIREBASE_QUERIES_AND_INDEXES_AUDIT.md +0 -221
  251. package/docs/examples/firebase-backend-example.md +0 -27
  252. package/docs/features/laravel-nova-backend/credentials.ignore.md +0 -34
  253. package/docs/guides/no-cost-backend-implementation-plan.md +0 -77
  254. package/docs/guides/no-cost-firestore-google-drive-backend.md +0 -60
  255. package/docs/project-profiles/native-update-capacitor-update-platform-project-profile-last-updated-2026-03-16.md +0 -454
  256. package/docs/project-profiles/native-update-capacitor-update-platform-project-profile-last-updated-2026-03-24.md +0 -66
  257. package/docs/project-profiles/native-update-capacitor-update-platform-project-profile-last-updated-2026-03-25.md +0 -67
  258. /package/docs/{MARKETING_WEBSITE_PLAN.md → archive/MARKETING_WEBSITE_PLAN.md} +0 -0
@@ -307,4 +307,3 @@ export class BackgroundScheduler {
307
307
  return 0;
308
308
  }
309
309
  }
310
- //# sourceMappingURL=background-scheduler.js.map
@@ -1,3 +1,2 @@
1
1
  export { BackgroundScheduler } from './background-scheduler';
2
2
  export { NotificationManager } from './notification-manager';
3
- //# sourceMappingURL=index.js.map
@@ -86,4 +86,3 @@ export class NotificationManager {
86
86
  return (_a = this.preferences.vibrationEnabled) !== null && _a !== void 0 ? _a : true;
87
87
  }
88
88
  }
89
- //# sourceMappingURL=notification-manager.js.map
@@ -7,4 +7,3 @@ export const SUPPORT_CONFIG = {
7
7
  label: 'Support the Project',
8
8
  description: 'Help us keep native-update free and improving',
9
9
  };
10
- //# sourceMappingURL=support.js.map
@@ -60,6 +60,19 @@ export declare class Analytics {
60
60
  /**
61
61
  * Console analytics provider for development
62
62
  */
63
+ /**
64
+ * Default analytics provider that writes events directly to the
65
+ * browser/native console. Production apps should swap this for a real
66
+ * provider (Firebase Analytics, Amplitude, Sentry, …) via
67
+ * `setAnalyticsProvider()`.
68
+ *
69
+ * The two `console.*` calls below are intentional and on-brand for this
70
+ * class — `ConsoleAnalyticsProvider` IS the "send to console" sink. They
71
+ * are NOT a violation of the centralized-logger rule (which targets
72
+ * incidental logging, not analytics dispatch). Do not replace with the
73
+ * Logger — it would create a circular relationship between analytics
74
+ * and logging surfaces.
75
+ */
63
76
  export declare class ConsoleAnalyticsProvider implements AnalyticsProvider {
64
77
  private userId?;
65
78
  private properties;
@@ -111,14 +111,29 @@ export class Analytics {
111
111
  /**
112
112
  * Console analytics provider for development
113
113
  */
114
+ /**
115
+ * Default analytics provider that writes events directly to the
116
+ * browser/native console. Production apps should swap this for a real
117
+ * provider (Firebase Analytics, Amplitude, Sentry, …) via
118
+ * `setAnalyticsProvider()`.
119
+ *
120
+ * The two `console.*` calls below are intentional and on-brand for this
121
+ * class — `ConsoleAnalyticsProvider` IS the "send to console" sink. They
122
+ * are NOT a violation of the centralized-logger rule (which targets
123
+ * incidental logging, not analytics dispatch). Do not replace with the
124
+ * Logger — it would create a circular relationship between analytics
125
+ * and logging surfaces.
126
+ */
114
127
  export class ConsoleAnalyticsProvider {
115
128
  constructor() {
116
129
  this.properties = {};
117
130
  }
118
131
  async trackEvent(event) {
132
+ // ConsoleAnalyticsProvider intentionally writes to console — see class header.
119
133
  console.log('[Analytics]', event.type, Object.assign(Object.assign({}, event), { userId: this.userId, properties: this.properties }));
120
134
  }
121
135
  async trackError(error, context) {
136
+ // ConsoleAnalyticsProvider intentionally writes to console — see class header.
122
137
  console.error('[Analytics Error]', {
123
138
  error: error.message,
124
139
  stack: error.stack,
@@ -134,4 +149,3 @@ export class ConsoleAnalyticsProvider {
134
149
  this.properties = Object.assign(Object.assign({}, this.properties), properties);
135
150
  }
136
151
  }
137
- //# sourceMappingURL=analytics.js.map
@@ -272,4 +272,3 @@ export class CacheManager {
272
272
  }
273
273
  }
274
274
  }
275
- //# sourceMappingURL=cache-manager.js.map
@@ -1,11 +1,6 @@
1
1
  import type { Filesystem } from '@capacitor/filesystem';
2
2
  import type { Preferences } from '@capacitor/preferences';
3
3
  import type { UpdateStrategy, ChecksumAlgorithm, SecurityConfig } from '../definitions';
4
- import type { FirestoreConfig } from '../firestore/schema';
5
- /**
6
- * Backend type for update checking
7
- */
8
- export type BackendType = 'http' | 'firestore';
9
4
  export interface PluginConfig {
10
5
  filesystem?: typeof Filesystem;
11
6
  preferences?: typeof Preferences;
@@ -44,16 +39,6 @@ export interface PluginConfig {
44
39
  packageName?: string;
45
40
  webReviewUrl?: string;
46
41
  minimumVersion?: string;
47
- /**
48
- * Backend type for update checking
49
- * - 'http': Traditional HTTP server (default)
50
- * - 'firestore': Google Firestore (free tier)
51
- */
52
- backendType?: BackendType;
53
- /**
54
- * Firestore configuration (required if backendType is 'firestore')
55
- */
56
- firestore?: FirestoreConfig;
57
42
  /**
58
43
  * Enable delta updates (binary patching)
59
44
  * Reduces download size by 50-90%
@@ -49,9 +49,6 @@ export class ConfigManager {
49
49
  packageName: '',
50
50
  webReviewUrl: '',
51
51
  minimumVersion: '1.0.0',
52
- // Firestore backend configuration
53
- backendType: 'http',
54
- firestore: null,
55
52
  enableDeltaUpdates: true,
56
53
  enableStagedRollouts: true,
57
54
  };
@@ -91,4 +88,3 @@ export class ConfigManager {
91
88
  return !!(this.config.filesystem && this.config.preferences);
92
89
  }
93
90
  }
94
- //# sourceMappingURL=config.js.map
@@ -7,6 +7,7 @@ export declare enum ErrorCode {
7
7
  DOWNLOAD_FAILED = "DOWNLOAD_FAILED",
8
8
  DOWNLOAD_TIMEOUT = "DOWNLOAD_TIMEOUT",
9
9
  INVALID_URL = "INVALID_URL",
10
+ INSECURE_URL = "INSECURE_URL",
10
11
  UNAUTHORIZED_HOST = "UNAUTHORIZED_HOST",
11
12
  BUNDLE_TOO_LARGE = "BUNDLE_TOO_LARGE",
12
13
  CHECKSUM_MISMATCH = "CHECKSUM_MISMATCH",
@@ -11,6 +11,7 @@ export var ErrorCode;
11
11
  ErrorCode["DOWNLOAD_FAILED"] = "DOWNLOAD_FAILED";
12
12
  ErrorCode["DOWNLOAD_TIMEOUT"] = "DOWNLOAD_TIMEOUT";
13
13
  ErrorCode["INVALID_URL"] = "INVALID_URL";
14
+ ErrorCode["INSECURE_URL"] = "INSECURE_URL";
14
15
  ErrorCode["UNAUTHORIZED_HOST"] = "UNAUTHORIZED_HOST";
15
16
  ErrorCode["BUNDLE_TOO_LARGE"] = "BUNDLE_TOO_LARGE";
16
17
  // Validation errors
@@ -82,4 +83,3 @@ export class UpdateError extends NativeUpdateError {
82
83
  this.name = 'UpdateError';
83
84
  }
84
85
  }
85
- //# sourceMappingURL=errors.js.map
@@ -1,6 +1,3 @@
1
- /**
2
- * Centralized event emitter for the Native Update plugin
3
- */
4
1
  export declare class EventEmitter {
5
2
  private static instance;
6
3
  private listeners;
@@ -1,6 +1,12 @@
1
1
  /**
2
- * Centralized event emitter for the Native Update plugin
2
+ * Centralized event emitter for the Native Update plugin.
3
+ *
4
+ * Listener errors are sent to the plugin Logger so they respect the
5
+ * runtime log-level switch and the secret-redaction filter — never raw
6
+ * console.* calls. See src/core/logger.ts.
3
7
  */
8
+ import { Logger } from './logger';
9
+ const logger = new Logger('NativeUpdate.EventEmitter');
4
10
  export class EventEmitter {
5
11
  constructor() {
6
12
  this.listeners = new Map();
@@ -41,7 +47,7 @@ export class EventEmitter {
41
47
  listener(data);
42
48
  }
43
49
  catch (error) {
44
- console.error(`Error in event listener for ${eventName}:`, error);
50
+ logger.error(`Error in event listener for ${eventName}`, error);
45
51
  }
46
52
  });
47
53
  }
@@ -72,4 +78,3 @@ export class EventEmitter {
72
78
  return Array.from(this.listeners.keys());
73
79
  }
74
80
  }
75
- //# sourceMappingURL=event-emitter.js.map
@@ -106,4 +106,3 @@ export class Logger {
106
106
  this.logWithLevel(LogLevel.ERROR, message, errorData);
107
107
  }
108
108
  }
109
- //# sourceMappingURL=logger.js.map
@@ -151,4 +151,3 @@ export class PerformanceMonitor {
151
151
  };
152
152
  }
153
153
  }
154
- //# sourceMappingURL=performance.js.map
@@ -56,6 +56,9 @@ export class PluginManager {
56
56
  await this.bundleManager.initialize();
57
57
  this.downloadManager = new DownloadManager();
58
58
  await this.downloadManager.initialize();
59
+ // Bundle manager needs the download manager so deleteBundle can
60
+ // also remove the on-disk blob (otherwise old bundles leak forever).
61
+ this.bundleManager.setDownloadManager(this.downloadManager);
59
62
  this.versionManager = new VersionManager();
60
63
  await this.versionManager.initialize();
61
64
  this.appUpdateManager = new AppUpdateManager({
@@ -217,4 +220,3 @@ export class PluginManager {
217
220
  });
218
221
  }
219
222
  }
220
- //# sourceMappingURL=plugin-manager.js.map
@@ -8,6 +8,17 @@ export declare class SecurityValidator {
8
8
  * Validate URL is HTTPS
9
9
  */
10
10
  static validateUrl(url: string): boolean;
11
+ /**
12
+ * Reject any URL that is not HTTPS (or known native-app schemes
13
+ * `market:` / `itms-apps:` for opening the app store). Throws so
14
+ * callers can't silently fall through to a `javascript:` payload.
15
+ */
16
+ static validateDownloadUrl(url: string): void;
17
+ /**
18
+ * Validate URL whose only acceptable schemes are HTTPS, `market:` (Play
19
+ * Store), or `itms-apps:` (App Store). Used by `openAppStore`.
20
+ */
21
+ static validateStoreUrl(url: string): void;
11
22
  /**
12
23
  * Validate checksum format
13
24
  */
@@ -24,6 +24,33 @@ export class SecurityValidator {
24
24
  return false;
25
25
  }
26
26
  }
27
+ /**
28
+ * Reject any URL that is not HTTPS (or known native-app schemes
29
+ * `market:` / `itms-apps:` for opening the app store). Throws so
30
+ * callers can't silently fall through to a `javascript:` payload.
31
+ */
32
+ static validateDownloadUrl(url) {
33
+ if (!this.validateUrl(url)) {
34
+ throw new ValidationError(ErrorCode.INSECURE_URL, `Refusing non-HTTPS URL: ${url}`);
35
+ }
36
+ }
37
+ /**
38
+ * Validate URL whose only acceptable schemes are HTTPS, `market:` (Play
39
+ * Store), or `itms-apps:` (App Store). Used by `openAppStore`.
40
+ */
41
+ static validateStoreUrl(url) {
42
+ let parsed;
43
+ try {
44
+ parsed = new URL(url);
45
+ }
46
+ catch (_a) {
47
+ throw new ValidationError(ErrorCode.INSECURE_URL, `Invalid URL: ${url}`);
48
+ }
49
+ const allowed = ['https:', 'market:', 'itms-apps:'];
50
+ if (!allowed.includes(parsed.protocol)) {
51
+ throw new ValidationError(ErrorCode.INSECURE_URL, `Refusing URL scheme ${parsed.protocol}`);
52
+ }
53
+ }
27
54
  /**
28
55
  * Validate checksum format
29
56
  */
@@ -335,4 +362,3 @@ export class SecurityValidator {
335
362
  }
336
363
  }
337
364
  }
338
- //# sourceMappingURL=security.js.map
@@ -198,8 +198,6 @@ export interface UpdateConfig {
198
198
  export interface LiveUpdateConfig {
199
199
  appId: string;
200
200
  serverUrl?: string;
201
- backendType?: 'http' | 'firestore';
202
- firestore?: FirestoreConfig;
203
201
  channel?: string;
204
202
  autoUpdate?: boolean;
205
203
  updateStrategy?: UpdateStrategy;
@@ -704,14 +702,6 @@ export interface PluginInitConfig {
704
702
  * Enable debug logging (default: false)
705
703
  */
706
704
  enableLogging?: boolean;
707
- /**
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
705
  /**
716
706
  * Server URL for update checks
717
707
  */
@@ -789,4 +779,3 @@ export interface NativeUpdatePlugin extends NativeUpdateCombinedPlugin, NativeUp
789
779
  */
790
780
  cleanup(): Promise<void>;
791
781
  }
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
  */