native-update 3.1.1 → 3.1.3

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 (203) hide show
  1. package/AI-INTEGRATION-GUIDE.md +98 -63
  2. package/Readme.md +89 -120
  3. package/android/src/main/java/com/aoneahsan/nativeupdate/LiveUpdatePlugin.kt +88 -12
  4. package/android/src/main/java/com/aoneahsan/nativeupdate/NativeUpdatePlugin.kt +45 -18
  5. package/cli/package.json +2 -2
  6. package/dist/esm/definitions.d.ts +8 -0
  7. package/dist/esm/plugin.js +16 -2
  8. package/dist/plugin.cjs.js +1 -1
  9. package/dist/plugin.esm.js +1 -1
  10. package/dist/plugin.js +2 -2
  11. package/docs/CHANGELOG.md +108 -0
  12. package/docs/KNOWN_LIMITATIONS.md +2 -2
  13. package/docs/MIGRATION.md +1 -1
  14. package/ios/Plugin/LiveUpdate/LiveUpdatePlugin.swift +64 -8
  15. package/ios/Plugin/NativeUpdatePlugin.swift +39 -13
  16. package/package.json +8 -3
  17. package/docs/AGENTS.md +0 -47
  18. package/docs/APP_REVIEW_GUIDE.md +0 -768
  19. package/docs/BUNDLE_SIGNING.md +0 -277
  20. package/docs/CLAUDE.md +0 -110
  21. package/docs/COMPREHENSIVE_AUDIT_REPORT.md +0 -526
  22. package/docs/DEPLOY_NOTES.md +0 -117
  23. package/docs/EXAMPLE_APPS_SIMPLIFICATION_PLAN.md +0 -384
  24. package/docs/EXAMPLE_APPS_SIMPLIFICATION_TRACKER.md +0 -390
  25. package/docs/LIVE_UPDATES_GUIDE.md +0 -675
  26. package/docs/MANUAL-TASKS.md +0 -30
  27. package/docs/MARKETING_WEBSITE_TRACKER.md +0 -677
  28. package/docs/NATIVE_UPDATES_GUIDE.md +0 -695
  29. package/docs/PACKAGES.md +0 -167
  30. package/docs/PERFORMANCE.md +0 -110
  31. package/docs/PROJECT_COMPLETION_TRACKER.md +0 -411
  32. package/docs/QUICK_START.md +0 -595
  33. package/docs/README.md +0 -130
  34. package/docs/REMAINING_FEATURES.md +0 -192
  35. package/docs/ROADMAP.md +0 -295
  36. package/docs/SECURITY-IF-REPO-PUBLIC.md +0 -232
  37. package/docs/SECURITY.md +0 -356
  38. package/docs/TESTING_REQUIREMENTS.md +0 -201
  39. package/docs/ai-knowledge-base/00-project-profile.md +0 -38
  40. package/docs/ai-knowledge-base/01-features.md +0 -46
  41. package/docs/ai-knowledge-base/02-routes.md +0 -72
  42. package/docs/ai-knowledge-base/03-tech-stack.md +0 -57
  43. package/docs/ai-knowledge-base/README.md +0 -23
  44. package/docs/analytics-tracking.md +0 -37
  45. package/docs/api/API.md +0 -558
  46. package/docs/api/FEATURES.md +0 -414
  47. package/docs/api/app-review-api.md +0 -239
  48. package/docs/api/app-update-api.md +0 -154
  49. package/docs/api/background-update-api.md +0 -170
  50. package/docs/api/events-api.md +0 -323
  51. package/docs/api/live-update-api.md +0 -258
  52. package/docs/archive/MARKETING_WEBSITE_PLAN.md +0 -659
  53. package/docs/background-updates.md +0 -392
  54. package/docs/capacitor-official-plugins.md +0 -46
  55. package/docs/capawesome-plugins.md +0 -29
  56. package/docs/cli-reference.md +0 -321
  57. package/docs/deployment/HOSTINGER_DEPLOY.md +0 -370
  58. package/docs/deployment/PRODUCTION-DEPLOY-CHECKLIST.md +0 -184
  59. package/docs/docs-site/plan.md +0 -201
  60. package/docs/docs-site/scope.md +0 -127
  61. package/docs/docs-site/tracker.json +0 -235
  62. package/docs/error-handling-tracking.md +0 -37
  63. package/docs/examples/advanced-scenarios.md +0 -394
  64. package/docs/examples/android-manifest-example.xml +0 -77
  65. package/docs/examples/basic-usage.md +0 -206
  66. package/docs/examples/node-express-backend-example.md +0 -28
  67. package/docs/examples/react-capacitor-example.md +0 -29
  68. package/docs/features/app-reviews.md +0 -975
  69. package/docs/features/app-updates.md +0 -785
  70. package/docs/features/e2e-full-verification/00-overview.md +0 -99
  71. package/docs/features/e2e-full-verification/00-tracker.json +0 -284
  72. package/docs/features/e2e-full-verification/phase01-backend-schema-fixes.md +0 -183
  73. package/docs/features/e2e-full-verification/phase02-test-auth.md +0 -176
  74. package/docs/features/e2e-full-verification/phase03-api-test-coverage.md +0 -63
  75. package/docs/features/e2e-full-verification/phase04-frontend-package-contract-audit.md +0 -73
  76. package/docs/features/e2e-full-verification/phase05-browser-e2e-matrix.md +0 -69
  77. package/docs/features/e2e-full-verification/phase06-deploy-prod-smoke.md +0 -51
  78. package/docs/features/e2e-full-verification/results/phase01-drift-report.md +0 -50
  79. package/docs/features/e2e-full-verification/results/phase03-coverage-matrix.md +0 -215
  80. package/docs/features/e2e-full-verification/results/phase04-frontend-contract.md +0 -139
  81. package/docs/features/e2e-full-verification/results/phase05-e2e-results.md +0 -99
  82. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-01-dashboard.png +0 -0
  83. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-02-signup.png +0 -0
  84. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-03-settings-persisted.png +0 -0
  85. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-04a-app-created.png +0 -0
  86. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-04b-duplicate-bundle-422.png +0 -0
  87. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-05-plan-limit-403.png +0 -0
  88. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-08a-upload-graceful-fail.png +0 -0
  89. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-08b-builds-list.png +0 -0
  90. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-10-rollout-25pct.png +0 -0
  91. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-11-analytics.png +0 -0
  92. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-12-drive-disconnected.png +0 -0
  93. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-13-pricing.png +0 -0
  94. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-14-isolation-403.png +0 -0
  95. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-15a-admin-overview.png +0 -0
  96. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-15b-regular-user-admin-redirect.png +0 -0
  97. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-16a-delete-dialog.png +0 -0
  98. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-17-mobile-375.png +0 -0
  99. package/docs/features/e2e-full-verification/results/route-list.json +0 -1
  100. package/docs/features/laravel-nova-backend/ASSESSMENT-SUMMARY.md +0 -96
  101. package/docs/features/laravel-nova-backend/IMPLEMENTATION-PLAN.md +0 -504
  102. package/docs/features/laravel-nova-backend/progress-tracker.json +0 -184
  103. package/docs/features/live-updates.md +0 -642
  104. package/docs/features/queues-and-emails/00-overview.md +0 -41
  105. package/docs/features/queues-and-emails/00-tracker.json +0 -99
  106. package/docs/features/queues-and-emails/phase01-foundation.md +0 -15
  107. package/docs/features/queues-and-emails/phase02-queued-jobs.md +0 -19
  108. package/docs/features/queues-and-emails/phase03-transactional-emails.md +0 -16
  109. package/docs/features/queues-and-emails/phase04-quota-ops.md +0 -17
  110. package/docs/features/queues-and-emails/phase05-async-build-processing-DECISION.md +0 -16
  111. package/docs/features/queues-and-emails/phase06-verify-deploy.md +0 -17
  112. package/docs/getting-started/configuration.md +0 -469
  113. package/docs/getting-started/installation.md +0 -300
  114. package/docs/getting-started/quick-start.md +0 -430
  115. package/docs/guides/BACKEND_TEMPLATES_GUIDE.md +0 -183
  116. package/docs/guides/admin-panel.md +0 -268
  117. package/docs/guides/channel-management.md +0 -343
  118. package/docs/guides/dashboard-guide.md +0 -365
  119. package/docs/guides/deployment-guide.md +0 -335
  120. package/docs/guides/end-to-end-workflow.md +0 -491
  121. package/docs/guides/key-management.md +0 -284
  122. package/docs/guides/migration-from-codepush.md +0 -145
  123. package/docs/guides/security-best-practices.md +0 -1057
  124. package/docs/guides/testing-guide.md +0 -346
  125. package/docs/guides/troubleshooting.md +0 -482
  126. package/docs/package-audit.md +0 -41
  127. package/docs/plans/PLANNING_COMPLETE_SUMMARY.md +0 -361
  128. package/docs/plans/TASK_1_ANDROID_EXAMPLE_APP.md +0 -401
  129. package/docs/plans/TASK_2_API_ENDPOINTS.md +0 -856
  130. package/docs/plans/TASK_2_DASHBOARD_UI_UX.md +0 -820
  131. package/docs/plans/TASK_2_DATABASE_SCHEMA.md +0 -704
  132. package/docs/plans/TASK_2_GOOGLE_DRIVE_INTEGRATION.md +0 -646
  133. package/docs/plans/TASK_2_SAAS_ARCHITECTURE.md +0 -587
  134. package/docs/plans/TASK_2_USER_AUTHENTICATION.md +0 -600
  135. package/docs/play-store/ASO-METADATA.md +0 -5
  136. package/docs/play-store/DATA-SAFETY.md +0 -5
  137. package/docs/play-store/DECLARATIONS.md +0 -5
  138. package/docs/play-store/README.md +0 -27
  139. package/docs/play-store/RELEASE-NOTES.md +0 -99
  140. package/docs/play-store/RELEASE-STEPS.md +0 -6
  141. package/docs/play-store/STORE-LISTING.md +0 -7
  142. package/docs/play-store/SUBMISSION-CHECKLIST.md +0 -5
  143. package/docs/production-readiness.md +0 -475
  144. package/docs/project-audit/2026-05-16/00-FINALIZATION-PLAN.md +0 -123
  145. package/docs/project-audit/2026-05-16/01-BATCH-PLAN.md +0 -227
  146. package/docs/project-audit/2026-05-16/02-AUDIT-FINDINGS.md +0 -144
  147. package/docs/project-audit/2026-05-16/sessions/batch-01.md +0 -42
  148. package/docs/project-audit/2026-05-16/sessions/batch-02.md +0 -74
  149. package/docs/project-audit/2026-05-16/sessions/batch-03.md +0 -71
  150. package/docs/project-audit/2026-05-16/sessions/batch-04.md +0 -88
  151. package/docs/project-audit/2026-05-16/sessions/batch-05.md +0 -63
  152. package/docs/project-audit/2026-05-16/sessions/batch-06.md +0 -103
  153. package/docs/project-audit/2026-05-16/sessions/batch-07.md +0 -61
  154. package/docs/project-audit/2026-05-16/sessions/batch-08.md +0 -101
  155. package/docs/project-audit/2026-05-16/sessions/batch-09.md +0 -105
  156. package/docs/project-audit/2026-05-16/sessions/batch-10.md +0 -102
  157. package/docs/project-audit/AUDIT-HISTORY.md +0 -74
  158. package/docs/project-audit/BATCH-PLAN.md +0 -168
  159. package/docs/project-audit/MARKETING-WEBSITE-FINDINGS-2026-05-11.md +0 -73
  160. package/docs/project-audit/PRODUCTION-READINESS-AUDIT-2026-05-08.md +0 -275
  161. package/docs/project-finalization/00-tracker.json +0 -60
  162. package/docs/project-knowledge-base/01-system-overview.md +0 -227
  163. package/docs/project-knowledge-base/02-routes-pages-forms-users.md +0 -352
  164. package/docs/project-knowledge-base/03-tech-stack-modules-services.md +0 -379
  165. package/docs/project-knowledge-base/04-data-models-integrations.md +0 -244
  166. package/docs/project-knowledge-base/05-docs-corpus-inventory.md +0 -256
  167. package/docs/project-knowledge-base/06-operations-testing-legal-content.md +0 -208
  168. package/docs/project-knowledge-base/README.md +0 -103
  169. package/docs/project-profiles/native-update-capacitor-update-platform-project-profile-last-updated-2026-05-19.md +0 -81
  170. package/docs/reports/AUDIT_SUMMARY_2025-12-26.md +0 -203
  171. package/docs/reports/CLAUDE-CODE-COMPLETION-PROMPT.md +0 -403
  172. package/docs/reports/CLAUDE_CODE_PROMPT.md +0 -29
  173. package/docs/reports/CODEBASE_STATUS_REPORT.md +0 -272
  174. package/docs/reports/COMPLETE_VERIFICATION.md +0 -106
  175. package/docs/reports/COMPREHENSIVE-PROJECT-AUDIT-2026-02-24.md +0 -747
  176. package/docs/reports/EVENT_FLOW_VERIFICATION.md +0 -80
  177. package/docs/reports/EXAMPLE_APPS_SIMPLIFICATION_COMPLETE.md +0 -369
  178. package/docs/reports/FINAL_STATUS.md +0 -122
  179. package/docs/reports/FINAL_VERIFICATION_CHECKLIST.md +0 -425
  180. package/docs/reports/MARKETING_WEBSITE_COMPLETE.md +0 -466
  181. package/docs/reports/PACKAGE_COMPLETENESS_REPORT.md +0 -130
  182. package/docs/reports/PRODUCTION_STATUS.md +0 -115
  183. package/docs/reports/PROJECT_RESTRUCTURE_2025-12-27.md +0 -287
  184. package/docs/reports/PROJECT_RESTRUCTURE_FINAL_SUMMARY.md +0 -464
  185. package/docs/reports/PUBLISHING_VERIFICATION.md +0 -144
  186. package/docs/reports/RELEASE_READY_SUMMARY.md +0 -99
  187. package/docs/reports/claude-completion.json +0 -241
  188. package/docs/rules-tracker.md +0 -102
  189. package/docs/security/PRE-LAUNCH-PENTEST-CHECKLIST.md +0 -116
  190. package/docs/security/certificate-pinning.md +0 -122
  191. package/docs/seo-aeo-rules.json +0 -3043
  192. package/docs/social-media-marketing/README.md +0 -81
  193. package/docs/social-media-marketing/posts-batch-01.md +0 -613
  194. package/docs/social-media-marketing/posts-batch-02.md +0 -528
  195. package/docs/social-media-marketing/whatsapp-messages-batch-01.md +0 -458
  196. package/docs/social-media-marketing/whatsapp-status-batch-01.md +0 -355
  197. package/docs/tracking/IMPLEMENTATION_TRACKER.md +0 -303
  198. package/docs/tracking/capacitor-rollout-note-2026-03-01.md +0 -21
  199. package/docs/tracking/completion-tracker-2026-02-24.json +0 -174
  200. package/docs/tracking/finalization-2026-05-16-tracker.json +0 -346
  201. package/docs/tracking/full-audit-tracker.json +0 -121
  202. package/docs/tracking/production-readiness-audit-tracker.json +0 -429
  203. package/docs/tracking/seo-checklist-tracker.json +0 -333
@@ -1,379 +0,0 @@
1
- # Native Update Tech Stack, Modules, and Services
2
-
3
- ## Metadata
4
-
5
- - **Reference Date:** 2026-05-18
6
- - **Last Updated:** 2026-05-18
7
-
8
- ## Monorepo Structure
9
-
10
- | Path | Purpose |
11
- |------|---------|
12
- | `src/` | Main TypeScript plugin implementation |
13
- | `android/` | Android native plugin implementation in Kotlin |
14
- | `ios/` | iOS native plugin implementation in Swift |
15
- | `cli/` | CLI package and commands |
16
- | `website/` | Marketing site and dashboard application (React 19 + Vite + Capacitor wrapper) |
17
- | `backend/` | Laravel 11 + Nova 5 SaaS backend (only backend; canonical persistence layer) |
18
- | `example-apps/` | Example frontend (`react-capacitor/`) and backend (`node-express/`) projects |
19
- | `docs/` | Public docs, planning, reports, and knowledge artifacts |
20
-
21
- ## Root Package Tech Stack
22
-
23
- - Node.js `>=24.13.0`
24
- - TypeScript
25
- - Rollup
26
- - Capacitor 8 ecosystem packages
27
- - ESLint (`@typescript-eslint/*` flat config; `@eslint/js` is BANNED)
28
- - Prettier
29
- - Commander
30
- - Express
31
- - Archiver
32
- - Chalk
33
- - Ora
34
- - Prompts
35
-
36
- ## Website Tech Stack
37
-
38
- - React 19 + TypeScript
39
- - Vite 7
40
- - Tailwind CSS v4
41
- - Google OAuth via Laravel Socialite (backend-driven; no Firebase Auth in the SPA)
42
- - Sanctum bearer tokens persisted via `@capacitor/preferences` (native) / `localStorage` (web)
43
- - TanStack Query (data plane with hierarchical keys + URL-state pagination + keepPreviousData)
44
- - Axios (`src/lib/api.ts` with 401-clear-and-redirect interceptor)
45
- - Zustand (local UI state)
46
- - Framer Motion (animations)
47
- - Radix UI primitives (Dialog, Tooltip, etc.)
48
- - D3 (charts)
49
- - React Router
50
- - React Markdown
51
- - Capacitor 8 (mobile wrapper for the dashboard)
52
-
53
- ## Backend Tech Stack
54
-
55
- - Laravel 11
56
- - Laravel Nova 5 (admin UI at `/nova`)
57
- - Laravel Socialite (Google OAuth)
58
- - Laravel Sanctum (personal access tokens for the SPA)
59
- - `spatie/laravel-permission` (RBAC; `sanctum` guard; roles `super-admin`, `admin`, `user`)
60
- - MySQL (single source of persistence — no Firestore branch)
61
- - PHP 8.2+
62
- - Composer
63
- - Pest / PHPUnit (~136 tests at last finalization audit)
64
- - Google Drive PHP SDK (server-side OAuth; tokens encrypted via Laravel's encrypter)
65
-
66
- ## CLI Package
67
-
68
- ### Entry
69
-
70
- - `cli/index.js`
71
-
72
- ### Commands
73
-
74
- - `init`
75
- - `bundle-create`
76
- - `bundle-sign`
77
- - `bundle-verify`
78
- - `keys-generate`
79
- - `backend-create` (emits scaffolds with `TODO[SCAFFOLD-IMPLEMENT-BEFORE-DEPLOY]` markers)
80
- - `server-start`
81
- - `monitor`
82
-
83
- ### CLI Value
84
-
85
- - scaffolds projects
86
- - generates bundles
87
- - signs and verifies release artifacts (RSA-2048 / RSA-4096 / EC P-256 / EC P-384)
88
- - generates keypairs
89
- - starts local server flow
90
- - supports deployment monitoring (interval+spinner cleanup, signal handlers, failure bail)
91
-
92
- ## Core Plugin Module Inventory
93
-
94
- ### `src/live-update/`
95
-
96
- - `bundle-manager.ts`
97
- - `certificate-pinning.ts`
98
- - `delta-processor.ts`
99
- - `download-manager.ts`
100
- - `rollout-checker.ts`
101
- - `update-manager.ts`
102
- - `version-manager.ts`
103
-
104
- **Purpose:** runtime live update logic, version checks, download/install handling, delta support, and rollout-aware decisions.
105
-
106
- ### `src/app-update/`
107
-
108
- - `app-update-checker.ts`
109
- - `app-update-installer.ts`
110
- - `app-update-manager.ts`
111
- - `app-update-notifier.ts`
112
- - `platform-app-update.ts`
113
- - `types.ts`
114
- - `index.ts`
115
-
116
- **Purpose:** native binary update checks, install flows, platform-specific update behavior, and notifications.
117
-
118
- ### `src/app-review/`
119
-
120
- - `app-review-manager.ts`
121
- - `platform-review-handler.ts`
122
- - `review-conditions-checker.ts`
123
- - `review-rate-limiter.ts`
124
- - `types.ts`
125
- - `index.ts`
126
-
127
- **Purpose:** smart in-app review prompting, timing/eligibility checks, platform-specific review invocation.
128
-
129
- ### `src/background-update/`
130
-
131
- - `background-scheduler.ts`
132
- - `notification-manager.ts`
133
- - `index.ts`
134
-
135
- **Purpose:** scheduling, notifications, and background update orchestration.
136
-
137
- ### `src/core/`
138
-
139
- - `analytics.ts`
140
- - `cache-manager.ts`
141
- - `config.ts`
142
- - `errors.ts`
143
- - `event-emitter.ts`
144
- - `logger.ts`
145
- - `performance.ts`
146
- - `plugin-manager.ts`
147
- - `security.ts`
148
-
149
- **Purpose:** shared foundations for config, events, logging, analytics, errors, caching, and general plugin behavior.
150
-
151
- ### `src/security/`
152
-
153
- - `crypto.ts`
154
- - `validator.ts`
155
-
156
- **Purpose:** cryptographic helpers and validation utilities (SHA-256, RSA-SHA256 verify).
157
-
158
- ### Root Entry Files
159
-
160
- - `src/index.ts`
161
- - `src/plugin.ts`
162
- - `src/definitions.ts`
163
- - `src/web.ts`
164
-
165
- **Purpose:** export surface, Capacitor plugin bindings, typings, and web fallback behavior.
166
-
167
- Note: `src/firestore/` was removed in v3.0.0 (2026-05-04). The plugin no longer carries any Firestore code; manifest reads happen over plain HTTPS against any user-controlled endpoint.
168
-
169
- ## Native Android Modules
170
-
171
- | File | Role |
172
- |------|------|
173
- | `NativeUpdatePlugin.kt` | Main Android plugin entry |
174
- | `LiveUpdatePlugin.kt` | OTA/live update Android implementation |
175
- | `AppUpdatePlugin.kt` | App update Android integration (Play Core) |
176
- | `AppReviewPlugin.kt` | In-app review Android integration (Play Review) |
177
- | `BackgroundUpdatePlugin.kt` | Background update orchestration |
178
- | `BackgroundUpdateManager.kt` | Background scheduling/management logic |
179
- | `BackgroundUpdateWorker.kt` | WorkManager-based background task execution |
180
- | `BackgroundNotificationManager.kt` | Notification support |
181
- | `NotificationActionReceiver.kt` | Notification action handling |
182
- | `SecurityManager.kt` | Android security helpers |
183
-
184
- ## Native iOS Modules
185
-
186
- | File | Role |
187
- |------|------|
188
- | `NativeUpdatePlugin.swift` | Main iOS plugin entry |
189
- | `NativeUpdatePlugin.m` | Objective-C bridge/registration layer |
190
- | `LiveUpdatePlugin.swift` | OTA/live update implementation |
191
- | `WebViewConfiguration.swift` | web view config support for live updates |
192
- | `AppUpdatePlugin.swift` | App update iOS behavior |
193
- | `AppReviewPlugin.swift` | StoreKit `SKStoreReviewController` handling |
194
- | `BackgroundUpdatePlugin.swift` | BGTaskScheduler background update behavior |
195
- | `BackgroundNotificationManager.swift` | notification support |
196
- | `SecurityManager.swift` | iOS security helpers |
197
-
198
- ## Frontend Services (`website/src/services/`)
199
-
200
- ### `auth-service.ts`
201
-
202
- - Initiates Laravel Socialite redirect for Google sign-in
203
- - handles `/auth/callback` token persistence via `lib/auth-token.ts`
204
- - logout flow (deletes Sanctum token, broadcasts event, clears Drive cache)
205
-
206
- ### `apps-api-service.ts`
207
-
208
- - TanStack Query hooks for App CRUD against `/api/dashboard/apps/*`
209
-
210
- ### `google-drive-service.ts`
211
-
212
- - starts the server-side Drive OAuth flow (no browser SDK)
213
- - requests Drive auth URL from the backend
214
- - posts callback code back to the backend
215
- - reads Drive connection status from `/api/dashboard/me`
216
- - lists files via backend proxy endpoints
217
-
218
- ### `bundle-upload-service.ts`
219
-
220
- - validates ZIP file (size, type)
221
- - multipart POST to `/api/dashboard/apps/{app}/builds` with progress tracking
222
- - triggers TanStack Query cache invalidation on success
223
-
224
- ### `manifest-generator.ts`
225
-
226
- - derives per-file manifest from ZIP (client-side, for delta hints)
227
- - compares old/new manifests
228
- - estimates delta size
229
- - decides if delta is worthwhile
230
-
231
- ### `themeSync.ts`
232
-
233
- - syncs theme preferences to `users.preferences` JSON via `/api/dashboard/preferences`
234
-
235
- ### Other Frontend Services
236
-
237
- - capacitor service wrappers under `website/src/services/capacitor/`
238
-
239
- ## Frontend State Stores
240
-
241
- ### `appsStore`
242
-
243
- - TanStack-Query-backed cache for user apps (hierarchical keys)
244
- - selected-app tracking + error surface
245
-
246
- ### `buildsStore`
247
-
248
- - TanStack-Query-backed cache for builds per app/user/channel
249
- - pagination + filter state encoded in URL search params
250
-
251
- ### `rolloutsStore`
252
-
253
- - fetches rollout state from Build rows
254
- - pause/resume/percentage mutations
255
-
256
- ### `analyticsStore`
257
-
258
- - fetches aggregated events from `/api/dashboard/analytics`
259
- - builds platform/version summaries
260
- - manages date range
261
-
262
- ## Backend Source Tree (`backend/`)
263
-
264
- ### Controllers (`app/Http/Controllers/`)
265
-
266
- - `Auth/OAuthController` (Socialite redirect + callback + Sanctum token issuance)
267
- - `Dashboard/AnalyticsDashboardController`
268
- - `Dashboard/ApiKeyController`
269
- - `Dashboard/AppController`
270
- - `Dashboard/BuildController`
271
- - `Dashboard/GoogleDriveController`
272
- - `Dashboard/MeController`
273
- - `Dashboard/PreferencesController`
274
- - `Dashboard/RolloutController`
275
- - `Dashboard/SigningKeyController`
276
- - `Dashboard/SubscriptionController`
277
- - `Api/UpdateController` (mobile `/api/v1/updates/check`)
278
- - `Api/BundleController` (signed `/api/v1/bundles/{build}/download`)
279
- - `Api/AnalyticsController` (mobile `/api/v1/analytics/*`)
280
-
281
- ### Eloquent Models (`app/Models/`)
282
-
283
- - `User`
284
- - `App`
285
- - `ApiKey`
286
- - `SigningKey`
287
- - `Build`
288
- - `Subscription`
289
- - `DeviceActivity`
290
- - `AnalyticsEvent`
291
-
292
- ### FormRequest Validators (`app/Http/Requests/`)
293
-
294
- - `UpdateBuildRequest` and related Create/Update FormRequests for App, ApiKey, SigningKey
295
-
296
- ### Routes
297
-
298
- - `routes/api.php` (all `/api/*` routes)
299
- - `routes/web.php` (Nova mounts + OAuth callback HTML stubs)
300
- - `routes/console.php` (Artisan commands including `native-update:role-assign`)
301
-
302
- ### Policies + Gates
303
-
304
- - `User`, `App`, `Build`, `ApiKey`, `SigningKey` policies registered in `AuthServiceProvider`
305
- - `Gate::before` returns `true` for `super-admin` (full bypass)
306
- - `Nova/User.php` carries `canSee` guards for admin-only resources
307
-
308
- ## Example Apps
309
-
310
- ### `example-apps/react-capacitor/`
311
-
312
- - frontend example demonstrating plugin use in a Capacitor app
313
- - React 18 (stable downstream target; explained in its README "React 18 vs React 19" section)
314
- - capability cards: OTA basic, app-update (`getAppUpdateInfo`/`openAppStore`), app-review (`canRequestReview`/`requestReview`), background-update (toggle with `allowMeteredConnection`/`nextCheckTime`)
315
-
316
- ### `example-apps/node-express/`
317
-
318
- - minimal Node.js + Express backend example
319
- - ~160 lines, dissected in `docs/backend/node-express-minimal.md`
320
- - demonstrates the manifest-endpoint contract without a full SaaS
321
-
322
- Note: `example-apps/firebase-backend/` was removed in v3.0.0 (2026-05-04).
323
-
324
- ## Testing Modules Present
325
-
326
- ### TypeScript Tests (root plugin)
327
-
328
- - bundle manager
329
- - config
330
- - delta processor
331
- - integration (live-update flow)
332
- - manifest reader
333
- - rollout checker
334
- - security
335
- - version manager
336
- - 62/62 passing at last verification
337
-
338
- ### Backend Tests (`backend/tests/`)
339
-
340
- - OAuth + Sanctum + Spatie + UpdateBuildRequest FormRequest + PayPal webhook + BundleUpload + UserLicense
341
- - ~136 tests passing (`php artisan test`)
342
-
343
- ### iOS Tests
344
-
345
- - app update tests
346
- - app review tests
347
- - background update tests
348
- - live update tests
349
- - security tests
350
-
351
- ### Android Tests
352
-
353
- - app review plugin tests
354
- - app update plugin tests
355
- - background notification manager tests
356
- - background worker tests
357
- - live update plugin tests
358
- - security manager tests
359
-
360
- ### E2E (`e2e/`)
361
-
362
- - OTA update flow
363
- - download progress
364
- - channel switching
365
- - error handling
366
-
367
- ### Microbenchmarks (`tools/bench/`)
368
-
369
- - `verify-checksum.bench.ts` (SHA-256 over 1/5/20 MB)
370
- - `verify-signature.bench.ts` (RSA-2048 + RSA-4096 SHA-256 verify over 5 MB)
371
-
372
- ## Important Architectural Direction
373
-
374
- - Treat the plugin as runtime infrastructure.
375
- - Treat the website as management and distribution tooling.
376
- - Treat Laravel + MySQL as the single source of truth for App, Build, and User data.
377
- - Treat Sanctum personal access tokens as the only credential the SPA holds; the dashboard reads its identity from `/api/dashboard/me`.
378
- - Treat Google Drive as the canonical storage destination for uploaded bundle ZIPs (server-side OAuth tokens, encrypted at rest).
379
- - Treat the mobile API plane (`/api/v1/*`) as a separate auth surface (per-app API keys, not Sanctum).
@@ -1,244 +0,0 @@
1
- # Native Update Data Models and Integrations
2
-
3
- ## Metadata
4
-
5
- - **Reference Date:** 2026-05-18
6
- - **Last Updated:** 2026-05-18
7
-
8
- ## Main Integration Surfaces
9
-
10
- - Google OAuth via Laravel Socialite (auth provider)
11
- - Laravel Sanctum (token plane for the SPA)
12
- - `spatie/laravel-permission` (RBAC inside MySQL)
13
- - Google Drive API (server-side OAuth; bundle storage)
14
- - FilesHub (`https://fileshub.zaions.com`) for miscellaneous user-uploaded assets
15
- - PayPal (webhook for subscription events)
16
- - Capacitor runtime APIs
17
- - Android native APIs (Play Core update, Play Review, WorkManager)
18
- - iOS native APIs (StoreKit SKStoreReviewController, BGTaskScheduler)
19
-
20
- ## Authentication Model
21
-
22
- ### Sign-In Method
23
-
24
- - Only auth flow is Google OAuth via Laravel Socialite
25
- - SPA navigates to `${VITE_API_URL}/auth/google/redirect`
26
- - Laravel's `OAuthController` redirects to Google, receives the callback, exchanges the code, and creates/updates the `users` row keyed by `google_id`
27
- - On success, Laravel issues a Sanctum personal access token and redirects to `${FRONTEND_URL}/auth/callback?token=…`
28
- - SPA's `CallbackPage` stores the plain-text token (shown once) via `setAuthToken()` and navigates to `/dashboard`
29
-
30
- ### Role Assignment
31
-
32
- - First sign-in → assigns the `user` role (default)
33
- - Emails in `ADMIN_EMAILS` env → auto-assigned `super-admin`
34
- - Manual: `php artisan native-update:role-assign <email> <role>` (revokes existing tokens to force re-login with new role)
35
- - Seeder: `php artisan db:seed --class=RolesPermissionsSeeder` (idempotent)
36
-
37
- ### Token Lifecycle
38
-
39
- - Default TTL: 7 days (configurable via `SANCTUM_TOKEN_EXPIRATION`)
40
- - Stored as `Bearer` header on every `/api/dashboard/*` and `/api/admin/*` request
41
- - 401 from any endpoint → axios interceptor clears the token, broadcasts a logout event, redirects to `/login`
42
- - Logout: `DELETE /api/dashboard/me/token` revokes the current token; on multi-device logout, all of the user's tokens are revoked
43
-
44
- ## MySQL Schema (Laravel migrations)
45
-
46
- Migrations live in `backend/database/migrations/`. The following tables exist:
47
-
48
- ### `users`
49
-
50
- - Standard Laravel fields plus:
51
- - `google_id` (unique; primary identity key)
52
- - `name`, `email`, `avatar_url`
53
- - `google_drive_access_token`, `google_drive_refresh_token`, `google_drive_token_expires_at` (encrypted via Laravel encrypter)
54
- - `google_drive_email`, `google_drive_connected_at`
55
- - `preferences` (JSON: email notifications, update notifications, theme, language, accent color, etc.)
56
- - admin-control flags (block, suspend, notes)
57
- - `apps_count`, `builds_count`, `storage_used` (denormalized counters)
58
- - standard timestamps + soft-delete
59
-
60
- ### `apps`
61
-
62
- - `user_id` (foreign key to `users`)
63
- - `name`, `package_id` (unique per user), `description`, `icon_url`
64
- - `platforms` (JSON array: android/ios/web)
65
- - `channels` (JSON config)
66
- - `total_builds`, `active_users`, `last_build_at`
67
- - standard timestamps + soft-delete
68
-
69
- ### `api_keys`
70
-
71
- - `app_id` (foreign key)
72
- - `key` (random token; used for mobile `/api/v1/*` plane)
73
- - `name`, `is_active`, `last_used_at`
74
- - standard timestamps
75
-
76
- ### `signing_keys`
77
-
78
- - `app_id` (foreign key)
79
- - `name`
80
- - `algorithm` (RSA-2048 / RSA-4096 / EC P-256 / EC P-384)
81
- - `public_key` (PEM)
82
- - `private_key` (encrypted; backend-side only — never sent to the SPA)
83
- - `is_active`, `rotated_at`
84
- - standard timestamps
85
-
86
- ### `builds`
87
-
88
- - `id`
89
- - `user_id`, `app_id`
90
- - `version`, `build_number`
91
- - `channel`, `platform`
92
- - `file_name`, `file_size`, `mime_type`
93
- - `checksum` (SHA-256)
94
- - `signature` (RSA-SHA256 base64)
95
- - `drive_file_id`, `drive_file_url`, `drive_folder_id`
96
- - `fileshub_object_id` (when FilesHub used instead of Drive)
97
- - `file_manifest` (JSON: per-entry checksums for delta hints)
98
- - `release_notes`, `release_type`, `is_pre_release`
99
- - `min_native_version`
100
- - `uploaded_at`, `uploaded_by`, `upload_duration`
101
- - `status` (uploading / processing / active / archived / failed)
102
- - `processing_steps` (JSON; multi-step state)
103
- - `analytics` (JSON snapshot)
104
- - rollout config inline:
105
- - `rollout_enabled`
106
- - `rollout_percentage`
107
- - `rollout_start_time`, `rollout_end_time`
108
- - `target_segments` (JSON; optional)
109
- - standard timestamps + soft-delete
110
-
111
- ### `subscriptions` + `subscription_items`
112
-
113
- - billing model (Stripe-style + PayPal provider added 2026-04-18)
114
- - `provider` (stripe / paypal), `provider_id`
115
- - `status`, `current_period_start`, `current_period_end`
116
- - per-item quantities + plan refs
117
-
118
- ### `device_activities`
119
-
120
- - mobile-side telemetry (one row per active device)
121
- - last-seen, version installed, channel, platform metadata
122
-
123
- ### `analytics_events`
124
-
125
- - per-event analytics (update checks, downloads, installs, rollbacks, errors)
126
- - `app_id`, `channel`, `platform`, `event_type`, `payload` (JSON)
127
- - aggregated by `AnalyticsDashboardController` for the dashboard
128
-
129
- ### `personal_access_tokens` (Sanctum)
130
-
131
- - Sanctum's default token table
132
- - `tokenable_type`, `tokenable_id`, `name`, `token` (hashed), `abilities`, `last_used_at`, `expires_at`
133
-
134
- ### Spatie permission tables
135
-
136
- - `roles`, `permissions`, `model_has_roles`, `model_has_permissions`, `role_has_permissions`
137
- - guard name: `sanctum`
138
-
139
- ## Build Status Values
140
-
141
- - `uploading`
142
- - `processing`
143
- - `active`
144
- - `archived`
145
- - `failed`
146
-
147
- ## Manifest Shape (returned by `/api/v1/updates/check`)
148
-
149
- Returned for each `appId + channel` combination, derived from the active Build row:
150
-
151
- ```jsonc
152
- {
153
- "appId": "com.example.myapp",
154
- "channel": "production",
155
- "current": {
156
- "version": "1.2.0",
157
- "bundleId": "<build uuid>",
158
- "bundleUrl": "https://<signed-drive-or-fileshub-url>",
159
- "manifestUrl": "<self-link>",
160
- "checksum": "sha256-…",
161
- "signature": "<base64 RSA-SHA256>",
162
- "size": 1234567,
163
- "releaseNotes": "…",
164
- "releaseDate": "ISO-8601",
165
- "mandatory": false,
166
- "minNativeVersion": "1.0.0"
167
- },
168
- "deltas": [],
169
- "rollout": {
170
- "enabled": true,
171
- "percentage": 25,
172
- "startTime": "ISO-8601",
173
- "endTime": null,
174
- "targetSegments": null
175
- },
176
- "previousVersions": [],
177
- "updatedAt": "ISO-8601",
178
- "updatedBy": "<user id>"
179
- }
180
- ```
181
-
182
- ## Rollout Config
183
-
184
- - `enabled` (boolean)
185
- - `percentage` (0–100)
186
- - `startTime` / `endTime` (ISO-8601; optional bounds)
187
- - `targetSegments` (optional JSON; reserved for future segmentation)
188
- - `schedule` strategy (immediate / gradual / scheduled)
189
-
190
- ## Delta Shape
191
-
192
- Used when the plugin asks for an incremental patch between two known versions:
193
-
194
- - `appId`
195
- - `fromVersion`, `toVersion`
196
- - `channel`
197
- - `patchUrl`, `patchSize`, `patchChecksum`
198
- - `sourceChecksum`, `targetChecksum`
199
- - `algorithm`, `compressionRatio`
200
- - `status`
201
-
202
- ## Google Drive Integration Flow (server-side)
203
-
204
- ### Connect Flow
205
-
206
- 1. User clicks "Connect Google Drive" on `/dashboard/drive`
207
- 2. SPA calls `GET /api/dashboard/google-drive/auth-url` → backend returns Google OAuth URL with Drive scope
208
- 3. Browser does full-window redirect to Google
209
- 4. Google redirects to `${FRONTEND_URL}/oauth/google-drive/callback?code=…`
210
- 5. SPA `DriveCallbackPage` POSTs the code to `POST /api/dashboard/google-drive/callback`
211
- 6. Backend exchanges the code, encrypts access + refresh tokens, persists on the `users` row
212
- 7. Backend writes `google_drive_email` + `google_drive_connected_at` for UI display
213
-
214
- ### Upload Flow (Laravel-driven)
215
-
216
- 1. User selects ZIP on `/dashboard/upload`
217
- 2. SPA multipart-POSTs to `POST /api/dashboard/apps/{app}/builds`
218
- 3. `UpdateBuildRequest` FormRequest validates app ownership, version, build_number, file presence, file size, Drive-connected precondition
219
- 4. Laravel computes SHA-256 of the uploaded ZIP
220
- 5. Laravel signs the checksum with the app's active signing key (RSA-SHA256)
221
- 6. Laravel uploads the ZIP to the user's Drive folder via encrypted tokens
222
- 7. Laravel inserts the Build row in MySQL with `status='active'`
223
- 8. Laravel returns the Build resource to the SPA
224
- 9. TanStack Query invalidates the relevant cache keys → UploadPage navigates to app detail
225
-
226
- ## App-Facing Manifest Paths
227
-
228
- - `GET /api/v1/updates/check?appId=…&channel=…&apiKey=…` → returns the active manifest
229
- - `GET /api/v1/bundles/{build}/download` → returns a short-lived signed URL to the bundle (default 30 min)
230
-
231
- ## Security-Relevant Data Points
232
-
233
- - SHA-256 checksums are stored on every Build and verified on every download
234
- - RSA-SHA256 signatures are stored alongside checksums; plugin verifies against the configured public key (or array of public keys during a key rotation window)
235
- - Signing-key private keys never leave the Laravel host
236
- - Drive OAuth tokens are encrypted at rest using Laravel's encrypter (per-row, not per-app)
237
- - Sanctum token strings are hashed in the DB; the plain-text token is shown to the SPA exactly once at issuance
238
-
239
- ## Data Ownership Notes
240
-
241
- - The website messaging emphasizes that user build files are stored in the user's Google Drive
242
- - All other data (account, app metadata, builds, analytics, signing keys, subscriptions) lives in the Laravel MySQL database
243
- - Account deletion soft-deletes the User row, revokes all Sanctum tokens, clears encrypted Drive tokens, cascades to apps/builds, and surfaces a confirmation page documenting what was removed
244
- - Privacy policy + data-deletion page reflect this exact architecture