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
@@ -1,321 +0,0 @@
1
- # Firebase Integration Tracker
2
-
3
- **Last Updated**: 2025-12-26
4
- **Scope**: Firebase is ONLY used in example-app, NOT in core plugin
5
-
6
- ---
7
-
8
- ## 🎯 Firebase Usage Scope
9
-
10
- ### ✅ WHERE Firebase IS Used
11
- - **example-app/firebase-backend/** - Example implementation showing how to build a backend with Firebase
12
-
13
- ### ❌ WHERE Firebase IS NOT Used
14
- - Core plugin (`src/`) - **NO Firebase dependencies**
15
- - CLI tools (`cli/`) - **NO Firebase dependencies** (only CLI command to generate Firebase backend template)
16
- - Production backend (`production-backend/`) - Uses SQLite, **NOT Firebase**
17
- - Backend template (`backend-template/`) - Simple Express server, **NOT Firebase**
18
-
19
- ---
20
-
21
- ## 📂 Firebase Files in example-app
22
-
23
- ### Configuration Files
24
- | File | Purpose | Status | Issues |
25
- |------|---------|--------|--------|
26
- | `firebase.json` | Firebase project config | ✅ Complete | None |
27
- | `firestore.indexes.json` | Firestore indexes definition | ✅ Complete | All indexes defined |
28
- | `firestore.rules` | Firestore security rules | ✅ Complete | Needs review |
29
- | `storage.rules` | Cloud Storage security rules | ✅ Complete | Needs review |
30
- | `package.json` | Dependencies | ✅ Complete | None |
31
- | `tsconfig.json` | TypeScript config | ✅ Complete | None |
32
- | `.nvmrc` | Node version | ✅ Complete | Uses Node 22 |
33
-
34
- ### Source Files
35
- | File | Purpose | Status | Firestore Queries | Indexes Needed |
36
- |------|---------|--------|-------------------|----------------|
37
- | `src/index.ts` | Main Functions entry | ✅ Complete | None | N/A |
38
- | `src/middleware/auth.ts` | Authentication middleware | ✅ Complete | None | N/A |
39
- | `src/routes/analytics.ts` | Analytics endpoints | ✅ Complete | ✅ Yes | ✅ Defined |
40
- | `src/routes/bundles.ts` | Bundle management | ✅ Complete | ✅ Yes | ✅ Defined |
41
- | `src/routes/updates.ts` | Update endpoints | ✅ Complete | ✅ Yes | ✅ Defined |
42
- | `src/utils/validation.ts` | Input validation | ✅ Complete | None | N/A |
43
- | `src/utils/version.ts` | Version comparison | ✅ Complete | None | N/A |
44
-
45
- ---
46
-
47
- ## 🔍 Firestore Indexes Verification
48
-
49
- ### Index 1: Bundles Collection
50
- **Purpose**: Query bundles by channel, version, and creation date
51
-
52
- ```json
53
- {
54
- "collectionGroup": "bundles",
55
- "queryScope": "COLLECTION",
56
- "fields": [
57
- { "fieldPath": "channel", "order": "ASCENDING" },
58
- { "fieldPath": "version", "order": "DESCENDING" },
59
- { "fieldPath": "createdAt", "order": "DESCENDING" }
60
- ]
61
- }
62
- ```
63
-
64
- **Used In**: `src/routes/bundles.ts`, `src/routes/updates.ts`
65
-
66
- **Queries This Index Supports**:
67
- - Get latest bundle for a channel: `WHERE channel == 'production' ORDER BY version DESC, createdAt DESC`
68
- - Get bundles by channel and version: `WHERE channel == 'production' AND version >= '1.0.0' ORDER BY version DESC`
69
-
70
- **Status**: ✅ Index defined correctly
71
-
72
- **Verified**: ✅ All queries in code match index definition
73
-
74
- ---
75
-
76
- ### Index 2: Update Logs Collection
77
- **Purpose**: Query update logs by app ID and timestamp
78
-
79
- ```json
80
- {
81
- "collectionGroup": "updateLogs",
82
- "queryScope": "COLLECTION",
83
- "fields": [
84
- { "fieldPath": "appId", "order": "ASCENDING" },
85
- { "fieldPath": "timestamp", "order": "DESCENDING" }
86
- ]
87
- }
88
- ```
89
-
90
- **Used In**: `src/routes/analytics.ts`
91
-
92
- **Queries This Index Supports**:
93
- - Get update logs for an app: `WHERE appId == 'com.example.app' ORDER BY timestamp DESC`
94
- - Get recent update logs: `WHERE appId == 'com.example.app' ORDER BY timestamp DESC LIMIT 100`
95
-
96
- **Status**: ✅ Index defined correctly
97
-
98
- **Verified**: ✅ All queries in code match index definition
99
-
100
- ---
101
-
102
- ### Index 3: Analytics Collection
103
- **Purpose**: Query analytics events by event name and timestamp
104
-
105
- ```json
106
- {
107
- "collectionGroup": "analytics",
108
- "queryScope": "COLLECTION",
109
- "fields": [
110
- { "fieldPath": "eventName", "order": "ASCENDING" },
111
- { "fieldPath": "timestamp", "order": "DESCENDING" }
112
- ]
113
- }
114
- ```
115
-
116
- **Used In**: `src/routes/analytics.ts`
117
-
118
- **Queries This Index Supports**:
119
- - Get analytics for specific event: `WHERE eventName == 'update_success' ORDER BY timestamp DESC`
120
- - Get recent analytics: `WHERE eventName == 'update_success' ORDER BY timestamp DESC LIMIT 1000`
121
-
122
- **Status**: ✅ Index defined correctly
123
-
124
- **Verified**: ✅ All queries in code match index definition
125
-
126
- ---
127
-
128
- ## 🔒 Firestore Security Rules Verification
129
-
130
- ### Current Rules Overview
131
-
132
- #### Bundles Collection
133
- ```javascript
134
- match /bundles/{bundleId} {
135
- allow read: if request.auth != null;
136
- allow write: if request.auth != null && request.auth.token.admin == true;
137
- }
138
- ```
139
-
140
- **Analysis**:
141
- - ✅ Read requires authentication
142
- - ✅ Write requires admin role
143
- - ⚠️ Consider: May want public read for distribution
144
-
145
- #### Update Logs Collection
146
- ```javascript
147
- match /updateLogs/{logId} {
148
- allow read: if request.auth != null;
149
- allow create: if request.auth != null;
150
- allow update, delete: if request.auth != null && request.auth.token.admin == true;
151
- }
152
- ```
153
-
154
- **Analysis**:
155
- - ✅ Read requires authentication
156
- - ✅ Create requires authentication (apps can log their updates)
157
- - ✅ Modify requires admin role
158
-
159
- #### Analytics Collection
160
- ```javascript
161
- match /analytics/{analyticsId} {
162
- allow read: if request.auth != null && request.auth.token.admin == true;
163
- allow create: if request.auth != null;
164
- allow update, delete: if false;
165
- }
166
- ```
167
-
168
- **Analysis**:
169
- - ✅ Read requires admin (analytics should be private)
170
- - ✅ Create requires authentication (apps can send analytics)
171
- - ✅ No updates/deletes (append-only for data integrity)
172
-
173
- **Overall Security Status**: ✅ Rules are properly defined and secure
174
-
175
- ---
176
-
177
- ## 📊 Firestore Queries Analysis
178
-
179
- ### bundles.ts Queries
180
-
181
- #### Query 1: Get Latest Bundle
182
- ```typescript
183
- db.collection('bundles')
184
- .where('channel', '==', channel)
185
- .orderBy('version', 'desc')
186
- .orderBy('createdAt', 'desc')
187
- .limit(1)
188
- ```
189
- **Index Required**: ✅ Index 1 (bundles)
190
- **Status**: ✅ Covered by existing index
191
-
192
- #### Query 2: Get Bundle by Version
193
- ```typescript
194
- db.collection('bundles')
195
- .where('channel', '==', channel)
196
- .where('version', '==', version)
197
- ```
198
- **Index Required**: ✅ Index 1 (bundles) - Composite index supports equality queries
199
- **Status**: ✅ Covered by existing index
200
-
201
- ---
202
-
203
- ### updates.ts Queries
204
-
205
- #### Query 1: Check for Updates
206
- ```typescript
207
- db.collection('bundles')
208
- .where('channel', '==', channel)
209
- .where('version', '>', currentVersion)
210
- .orderBy('version', 'desc')
211
- .limit(1)
212
- ```
213
- **Index Required**: ✅ Index 1 (bundles)
214
- **Status**: ✅ Covered by existing index
215
-
216
- ---
217
-
218
- ### analytics.ts Queries
219
-
220
- #### Query 1: Get Analytics by Event
221
- ```typescript
222
- db.collection('analytics')
223
- .where('eventName', '==', eventName)
224
- .orderBy('timestamp', 'desc')
225
- .limit(limit)
226
- ```
227
- **Index Required**: ✅ Index 3 (analytics)
228
- **Status**: ✅ Covered by existing index
229
-
230
- #### Query 2: Get Update Logs
231
- ```typescript
232
- db.collection('updateLogs')
233
- .where('appId', '==', appId)
234
- .orderBy('timestamp', 'desc')
235
- .limit(limit)
236
- ```
237
- **Index Required**: ✅ Index 2 (updateLogs)
238
- **Status**: ✅ Covered by existing index
239
-
240
- ---
241
-
242
- ## ✅ VERIFICATION SUMMARY
243
-
244
- ### Indexes
245
- - ✅ All 3 indexes are properly defined
246
- - ✅ All queries in code are covered by indexes
247
- - ✅ No missing indexes
248
- - ✅ No unnecessary indexes
249
-
250
- ### Security Rules
251
- - ✅ All collections have proper security rules
252
- - ✅ Authentication required for all operations
253
- - ✅ Admin-only operations properly restricted
254
- - ✅ Append-only analytics collection
255
-
256
- ### Code Quality
257
- - ✅ All Firestore operations use proper TypeScript types
258
- - ✅ Error handling implemented
259
- - ✅ Validation before database operations
260
-
261
- ---
262
-
263
- ## 🚀 Deployment Checklist
264
-
265
- ### Before Deploying Firebase Backend
266
-
267
- - [ ] Review and approve `firestore.rules`
268
- - [ ] Review and approve `storage.rules`
269
- - [ ] Deploy indexes: `firebase deploy --only firestore:indexes`
270
- - [ ] Deploy rules: `firebase deploy --only firestore:rules`
271
- - [ ] Deploy storage rules: `firebase deploy --only storage`
272
- - [ ] Deploy functions: `firebase deploy --only functions`
273
- - [ ] Test all API endpoints
274
- - [ ] Verify authentication works
275
- - [ ] Test bundle upload/download
276
- - [ ] Verify analytics collection
277
- - [ ] Monitor for errors in Firebase Console
278
-
279
- ---
280
-
281
- ## 📝 NOTES
282
-
283
- ### Important Reminders
284
-
285
- 1. **Firebase is OPTIONAL** - Core plugin works without Firebase
286
- 2. **Example Only** - Firebase backend is just one example implementation
287
- 3. **Alternatives Available**:
288
- - `production-backend/` - Node.js + SQLite backend
289
- - `backend-template/` - Simple Express server
290
- - Custom backend - Users can build their own
291
-
292
- ### Firebase-Specific Considerations
293
-
294
- 1. **Cost Management**:
295
- - Monitor Firestore reads/writes
296
- - Consider caching frequently accessed bundles
297
- - Use Cloud Storage for large bundles (cheaper than Firestore)
298
-
299
- 2. **Performance**:
300
- - All queries are properly indexed (no full scans)
301
- - Limit results to prevent excessive reads
302
- - Consider CDN for bundle distribution
303
-
304
- 3. **Security**:
305
- - All rules require authentication
306
- - Admin operations properly restricted
307
- - Consider IP allowlisting for admin operations
308
-
309
- ---
310
-
311
- ## 🎯 FINAL STATUS
312
-
313
- **Firebase Integration Status**: ✅ **COMPLETE & VERIFIED**
314
-
315
- - ✅ All indexes properly defined
316
- - ✅ All queries covered by indexes
317
- - ✅ Security rules properly implemented
318
- - ✅ No missing configurations
319
- - ✅ Ready for deployment (example purposes)
320
-
321
- **No Firebase-related errors or issues found in the project.**
@@ -1,221 +0,0 @@
1
- # Firebase Queries and Indexes Audit
2
-
3
- **Last Updated:** 2026-01-16
4
- **Audit Status:** ✅ COMPLETE
5
- **Build Status:** ✅ PASSING
6
-
7
- ---
8
-
9
- ## Overview
10
-
11
- This document tracks all Firebase Firestore queries in the project and verifies that appropriate indexes exist for each query.
12
-
13
- ---
14
-
15
- ## Collections Used
16
-
17
- | Collection | Purpose | Location |
18
- |------------|---------|----------|
19
- | `users` | User profiles and preferences | Website dashboard |
20
- | `apps` | Registered applications | Website dashboard |
21
- | `builds` | Build/release records | Website dashboard |
22
- | `drive_tokens` | Google Drive OAuth tokens | Google Drive integration |
23
- | `analytics` | Usage analytics events | Analytics tracking |
24
- | `manifests` | OTA update manifests | Rollouts page |
25
-
26
- ---
27
-
28
- ## Firestore Rules Audit
29
-
30
- ### Root `firestore.rules` and `website/firestore.rules`
31
-
32
- | Collection | Read | Write | Owner Check | Security Status |
33
- |------------|------|-------|-------------|-----------------|
34
- | `users/{userId}` | Owner only | Owner only | ✅ `userId == request.auth.uid` | ✅ Secure |
35
- | `apps/{appId}` | Owner only | Owner only | ✅ `resource.data.userId == request.auth.uid` | ✅ Secure |
36
- | `builds/{buildId}` | Owner only | Owner only | ✅ `resource.data.userId == request.auth.uid` | ✅ Secure |
37
- | `drive_tokens/{userId}` | Owner only | Owner only | ✅ `userId == request.auth.uid` | ✅ Secure |
38
- | `analytics/{eventId}` | Deny | Owner only | ✅ `request.resource.data.userId == request.auth.uid` | ✅ Secure (write-only) |
39
- | Default | Deny | Deny | N/A | ✅ Secure |
40
-
41
- ---
42
-
43
- ## Firestore Indexes Audit
44
-
45
- ### Root `firestore.indexes.json`
46
-
47
- | Index # | Collection | Fields | Query Purpose | Status |
48
- |---------|------------|--------|---------------|--------|
49
- | 1 | `apps` | `userId` ASC, `createdAt` DESC | List user's apps sorted by date | ✅ Exists |
50
- | 2 | `builds` | `userId` ASC, `createdAt` DESC | List user's builds sorted by date | ✅ Exists |
51
- | 3 | `builds` | `userId` ASC, `appId` ASC, `createdAt` DESC | Filter builds by app | ✅ Exists |
52
- | 4 | `builds` | `userId` ASC, `channel` ASC, `createdAt` DESC | Filter builds by channel | ✅ Exists |
53
- | 5 | `builds` | `userId` ASC, `status` ASC, `createdAt` DESC | Filter builds by status | ✅ Exists |
54
- | 6 | `builds` | `appId` ASC, `channel` ASC, `status` ASC, `createdAt` DESC | Complex build filtering | ✅ Exists |
55
- | 7 | `analytics` | `userId` ASC, `timestamp` DESC | User analytics history | ✅ Exists |
56
-
57
- ### Website `firestore.indexes.json`
58
-
59
- Contains same indexes as root (synchronized).
60
-
61
- ### Example App Firebase Backend `example-apps/firebase-backend/firestore.indexes.json`
62
-
63
- | Index # | Collection | Fields | Query Purpose | Status |
64
- |---------|------------|--------|---------------|--------|
65
- | 1 | `bundles` | `channel` ASC, `version` DESC, `createdAt` DESC | Get latest bundle by channel | ✅ Exists |
66
- | 2 | `updateLogs` | `appId` ASC, `timestamp` DESC | App update history | ✅ Exists |
67
- | 3 | `analytics` | `eventName` ASC, `timestamp` DESC | Analytics by event type | ✅ Exists |
68
-
69
- ---
70
-
71
- ## Query-to-Index Mapping
72
-
73
- ### Website Frontend Queries
74
-
75
- #### BuildsPage.tsx (Line 84-103)
76
- ```typescript
77
- query(buildsRef,
78
- where('userId', '==', user.uid),
79
- orderBy('uploadedAt', 'desc'),
80
- // Optional filters:
81
- where('appId', '==', filters.appId),
82
- where('channel', '==', filters.channel),
83
- where('platform', '==', filters.platform),
84
- where('status', '==', filters.status)
85
- )
86
- ```
87
- **Index Required:** Multiple composite indexes depending on filter combination
88
- **Index Status:** ✅ Covered by indexes 2-6
89
-
90
- #### UploadPage.tsx (Line 49-64)
91
- ```typescript
92
- // Apps query
93
- query(appsRef, where('userId', '==', user.uid))
94
-
95
- // Builds query
96
- query(buildsRef,
97
- where('userId', '==', user.uid),
98
- where('uploadedBy', '==', user.uid)
99
- )
100
- ```
101
- **Index Required:** Basic userId filter (auto-indexed), uploadedBy needs single-field index
102
- **Index Status:** ✅ Auto-indexed single field queries
103
-
104
- #### ConfigPage.tsx (Line 30-32)
105
- ```typescript
106
- query(appsRef, where('userId', '==', user.uid))
107
- ```
108
- **Index Required:** Single field userId (auto-indexed)
109
- **Index Status:** ✅ Auto-indexed
110
-
111
- #### AnalyticsPage.tsx (Line 101-103)
112
- ```typescript
113
- query(appsRef, where('userId', '==', user.uid))
114
- ```
115
- **Index Required:** Single field userId (auto-indexed)
116
- **Index Status:** ✅ Auto-indexed
117
-
118
- #### GoogleDrivePage.tsx (Line 42-43)
119
- ```typescript
120
- doc(db, 'users', user.uid)
121
- doc(db, 'drive_tokens', userId)
122
- ```
123
- **Index Required:** None (document reads by ID)
124
- **Index Status:** ✅ N/A
125
-
126
- #### SettingsPage.tsx (Line 70-71)
127
- ```typescript
128
- doc(db, 'users', user.uid)
129
- ```
130
- **Index Required:** None (document read by ID)
131
- **Index Status:** ✅ N/A
132
-
133
- #### RolloutsStore.ts (Line 63)
134
- ```typescript
135
- query(manifestsRef) // All manifests
136
- ```
137
- **Index Required:** None (collection scan)
138
- **Index Status:** ✅ N/A
139
-
140
- ### Website Firebase Functions Queries
141
-
142
- #### apps.ts (Line 111-115)
143
- ```typescript
144
- db.collection('apps')
145
- .where('userId', '==', user.uid)
146
- .orderBy('createdAt', 'desc')
147
- ```
148
- **Index Required:** Composite: userId ASC, createdAt DESC
149
- **Index Status:** ✅ Index #1
150
-
151
- #### builds.ts (Line 173-176)
152
- ```typescript
153
- db.collection('builds')
154
- .where('userId', '==', user.uid)
155
- .orderBy('createdAt', 'desc')
156
- // With optional filters for appId, platform, channel
157
- ```
158
- **Index Required:** Multiple composite indexes
159
- **Index Status:** ✅ Indexes #2-6
160
-
161
- #### users.ts (Line 129-137)
162
- ```typescript
163
- // Apps for user
164
- db.collection('apps').where('userId', '==', user.uid)
165
-
166
- // Builds for user
167
- db.collection('builds').where('userId', '==', user.uid)
168
- ```
169
- **Index Required:** Single field userId (auto-indexed)
170
- **Index Status:** ✅ Auto-indexed
171
-
172
- ---
173
-
174
- ## Missing Indexes Analysis
175
-
176
- After thorough audit, **NO missing indexes** were identified. All queries are covered by:
177
- 1. Auto-indexed single-field queries
178
- 2. Document ID reads (no index needed)
179
- 3. Composite indexes defined in `firestore.indexes.json`
180
-
181
- ---
182
-
183
- ## Security Recommendations Implemented
184
-
185
- 1. ✅ All collections have owner-only access rules
186
- 2. ✅ Analytics is write-only from client (prevents data exfiltration)
187
- 3. ✅ Drive tokens stored in separate collection with owner-only access
188
- 4. ✅ Default deny rule prevents unauthorized collection access
189
- 5. ✅ Server-side validation in Firebase Functions
190
-
191
- ---
192
-
193
- ## Deployment Commands
194
-
195
- ```bash
196
- # Deploy Firestore indexes
197
- firebase deploy --only firestore:indexes
198
-
199
- # Deploy Firestore rules
200
- firebase deploy --only firestore:rules
201
-
202
- # Deploy both
203
- firebase deploy --only firestore
204
- ```
205
-
206
- ---
207
-
208
- ## Verification Checklist
209
-
210
- - [x] All queries mapped to indexes
211
- - [x] Security rules reviewed
212
- - [x] Owner checks verified for all collections
213
- - [x] No missing composite indexes
214
- - [x] Index files synchronized between root and website
215
- - [x] Example app has separate indexes for its collections
216
-
217
- ---
218
-
219
- ## Last Verification Date
220
-
221
- **2026-01-16** - Full audit complete, all indexes verified
@@ -1,27 +0,0 @@
1
- # Firebase Backend Example
2
-
3
- This example describes a serverless backend approach using Firebase services for manifests and bundle delivery.
4
-
5
- ## What It Covers
6
-
7
- - Firestore-backed manifest strategy
8
- - Cloud Functions integration pattern
9
- - Firebase-centric deployment approach
10
-
11
- ## Recommended Setup Flow
12
-
13
- 1. Start with baseline architecture docs:
14
- https://nativeupdate.aoneahsan.com/docs/server-requirements
15
- 2. Review backend template guidance:
16
- https://nativeupdate.aoneahsan.com/docs/guides/BACKEND_TEMPLATES_GUIDE
17
- 3. Apply rollout and channel strategies:
18
- https://nativeupdate.aoneahsan.com/docs/guides/channel-management
19
-
20
- ## Related Docs
21
-
22
- - Dashboard Guide:
23
- https://nativeupdate.aoneahsan.com/docs/guides/dashboard-guide
24
- - End-to-End Workflow:
25
- https://nativeupdate.aoneahsan.com/docs/guides/end-to-end-workflow
26
- - Security Best Practices:
27
- https://nativeupdate.aoneahsan.com/docs/guides/security-best-practices
@@ -1,34 +0,0 @@
1
- # Laravel Nova Credentials (GITIGNORED)
2
-
3
- **File Pattern:** `*.ignore.*` - This file is excluded from git
4
-
5
- ---
6
-
7
- ## Nova License
8
-
9
- | Field | Value |
10
- |-------|-------|
11
- | Email | Sajawal.developer@gmail.com |
12
- | Key | koFe33Gb0rhbseLFlcUj4IGM0gKlLeWKGvQ64BxU4biZh4H4P6 |
13
-
14
- ---
15
-
16
- ## Usage
17
-
18
- When setting up Laravel project:
19
-
20
- ```bash
21
- # Add to composer.json
22
- composer config http-basic.nova.laravel.com Sajawal.developer@gmail.com koFe33Gb0rhbseLFlcUj4IGM0gKlLeWKGvQ64BxU4biZh4H4P6
23
-
24
- # Or set environment variables
25
- export NOVA_LICENSE_EMAIL="Sajawal.developer@gmail.com"
26
- export NOVA_LICENSE_KEY="koFe33Gb0rhbseLFlcUj4IGM0gKlLeWKGvQ64BxU4biZh4H4P6"
27
-
28
- # Then install Nova
29
- composer require laravel/nova
30
- ```
31
-
32
- ---
33
-
34
- **Saved:** 2026-03-28
@@ -1,77 +0,0 @@
1
- # No-Cost Backend Implementation Plan
2
-
3
- This document is the concrete production plan for the `website` sub-project using a no-cost backend built from browser code, Firestore, and Google Drive.
4
-
5
- ## Architecture
6
-
7
- - Dashboard: `website`
8
- - Metadata backend: Firestore
9
- - Bundle storage: user-owned Google Drive
10
- - App manifest read path: `apiKeys/{apiKey}/manifests/{channel}`
11
- - Compatibility read path: `manifests/{appId}_{channel}`
12
- - Human discovery endpoints: `/sitemap`, `/feed`
13
- - Machine discovery endpoints: `/sitemap.xml`, `/feed.xml`
14
-
15
- ## Publish Flow
16
-
17
- 1. User signs into the website dashboard.
18
- 2. User connects Google Drive.
19
- 3. User uploads a ZIP bundle from the dashboard.
20
- 4. The website computes bundle checksum and manifest metadata in-browser.
21
- 5. The website uploads the ZIP and generated manifest JSON to Google Drive.
22
- 6. The website writes build history to Firestore.
23
- 7. The website updates both manifest documents:
24
- - `apiKeys/{apiKey}/manifests/{channel}`
25
- - `manifests/{appId}_{channel}`
26
- 8. Apps configured with `backendType: 'firestore'` read the latest manifest and download the published ZIP from Google Drive.
27
-
28
- ## Firestore Collections
29
-
30
- - `apps/{appId}`
31
- - dashboard-owned app registry and channel settings
32
- - `builds/{buildId}`
33
- - uploaded build history, Drive URLs, release notes, checksums
34
- - `apiKeys/{apiKey}`
35
- - secret lookup key metadata for manifest access
36
- - `apiKeys/{apiKey}/manifests/{channel}`
37
- - primary manifest document for app update checks
38
- - `manifests/{appId}_{channel}`
39
- - compatibility manifest document for existing readers
40
-
41
- ## Security Model
42
-
43
- - Firestore rules allow public read only for manifest documents that apps need.
44
- - App, build, and API key documents stay owner-restricted.
45
- - Browser code does not hold server secrets.
46
- - Google Drive is used because the asset owner controls storage without paid compute.
47
-
48
- ## Website Responsibilities
49
-
50
- - Keep dashboard configuration examples aligned with Firestore backend usage.
51
- - Keep upload flow routed through `uploadBundle()`.
52
- - Keep footer links to `/sitemap` and `/feed`.
53
- - Keep `scripts/generate-sitemap.mjs` current whenever routes or public content change.
54
-
55
- ## Package Responsibilities
56
-
57
- - Support Firestore manifest reads through `backendType: 'firestore'`.
58
- - Accept `firestore.projectId` and optional `firestore.apiKey` in public config types.
59
- - Preserve HTTP backend support for users who self-host.
60
-
61
- ## When A Separate Backend Is Justified
62
-
63
- Only add Laravel or another backend if one of these becomes mandatory:
64
-
65
- - server-held private signing keys
66
- - private asset proxy/download authorization
67
- - scheduled rollout jobs or cleanup tasks
68
- - heavy processing such as delta generation outside the browser
69
-
70
- ## Production Checklist
71
-
72
- - Dashboard can connect Google Drive
73
- - ZIP publish updates Firestore manifest documents
74
- - App config snippets use `backendType: 'firestore'`
75
- - `/sitemap`, `/sitemap.xml`, `/feed`, and `/feed.xml` build successfully
76
- - Firestore rules are deployed
77
- - Google OAuth and Firebase environment variables are configured