create-expo-updates-server 0.1.6 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/dist/template/.dockerignore +16 -0
  2. package/dist/template/Dockerfile +5 -0
  3. package/dist/template/README.md +51 -660
  4. package/dist/template/app/api/admin/device-targets/route.test.ts +43 -0
  5. package/dist/template/app/api/admin/device-targets/route.ts +91 -0
  6. package/dist/template/app/api/admin/devices/route.test.ts +41 -0
  7. package/dist/template/app/api/admin/devices/route.ts +15 -0
  8. package/dist/template/app/api/admin/updates/[encodedKey]/audience/route.ts +75 -0
  9. package/dist/template/app/api/device-heartbeat/route.ts +2 -0
  10. package/dist/template/app/globals.css +114 -15
  11. package/dist/template/app/layout.tsx +12 -4
  12. package/dist/template/app/login/page.tsx +22 -18
  13. package/dist/template/app/updates/[encodedKey]/page.tsx +112 -88
  14. package/dist/template/app/updates/devices/page.tsx +264 -0
  15. package/dist/template/app/updates/embedded/page.tsx +102 -68
  16. package/dist/template/app/updates/emergency-redirects/page.tsx +144 -111
  17. package/dist/template/app/updates/layout.tsx +6 -1
  18. package/dist/template/app/updates/page.tsx +262 -212
  19. package/dist/template/components/admin/admin-shell.tsx +196 -0
  20. package/dist/template/components/admin/language-switcher.tsx +25 -0
  21. package/dist/template/components/admin/theme-provider.tsx +15 -0
  22. package/dist/template/components/ui/alert.tsx +65 -0
  23. package/dist/template/components/ui/badge.tsx +47 -0
  24. package/dist/template/components/ui/button.tsx +63 -0
  25. package/dist/template/components/ui/card.tsx +91 -0
  26. package/dist/template/components/ui/chart.tsx +373 -0
  27. package/dist/template/components/ui/checkbox.tsx +31 -0
  28. package/dist/template/components/ui/dialog.tsx +158 -0
  29. package/dist/template/components/ui/dropdown-menu.tsx +256 -0
  30. package/dist/template/components/ui/input.tsx +20 -0
  31. package/dist/template/components/ui/label.tsx +23 -0
  32. package/dist/template/components/ui/native-select.tsx +61 -0
  33. package/dist/template/components/ui/popover.tsx +88 -0
  34. package/dist/template/components/ui/scroll-area.tsx +57 -0
  35. package/dist/template/components/ui/select.tsx +189 -0
  36. package/dist/template/components/ui/separator.tsx +27 -0
  37. package/dist/template/components/ui/sheet.tsx +142 -0
  38. package/dist/template/components/ui/sidebar.tsx +736 -0
  39. package/dist/template/components/ui/skeleton.tsx +13 -0
  40. package/dist/template/components/ui/switch.tsx +34 -0
  41. package/dist/template/components/ui/table.tsx +115 -0
  42. package/dist/template/components/ui/tabs.tsx +90 -0
  43. package/dist/template/components/ui/textarea.tsx +17 -0
  44. package/dist/template/components/ui/tooltip.tsx +56 -0
  45. package/dist/template/components.json +22 -0
  46. package/dist/template/docker/minio.Dockerfile +11 -0
  47. package/dist/template/docker-compose.yml +7 -9
  48. package/dist/template/docs/admin-ui.md +35 -0
  49. package/dist/template/docs/device-targeting.md +129 -0
  50. package/dist/template/docs/doctor.md +137 -0
  51. package/dist/template/docs/expo-app-setup.md +174 -47
  52. package/dist/template/docs/getting-started.md +109 -146
  53. package/dist/template/docs/getting-started.ru.md +110 -193
  54. package/dist/template/docs/index.md +14 -33
  55. package/dist/template/docs/installation-telemetry.md +233 -0
  56. package/dist/template/docs/migrations/2026-10-16-manifest-identity.sql +89 -0
  57. package/dist/template/docs/migrations/2026-10-19-device-heartbeat.sql +131 -0
  58. package/dist/template/docs/migrations/2026-10-22-device-analytics.sql +264 -0
  59. package/dist/template/docs/migrations/2026-10-22-device-targeting-activation.sql +108 -0
  60. package/dist/template/docs/migrations/2026-10-22-device-targeting.sql +130 -0
  61. package/dist/template/docs/migrations/2026-10-22-device-version-metadata.sql +154 -0
  62. package/dist/template/docs/migrations/schema.sql +868 -6
  63. package/dist/template/docs/npm-installer.md +15 -30
  64. package/dist/template/docs/operations-guide.md +87 -0
  65. package/dist/template/docs/ota-client-lifecycle.md +263 -0
  66. package/dist/template/docs/ota-update-policy.md +36 -2
  67. package/dist/template/docs/supabase-setup.md +4 -0
  68. package/dist/template/hooks/use-mobile.ts +21 -0
  69. package/dist/template/lib/utils.ts +6 -0
  70. package/dist/template/package-lock.json +2325 -101
  71. package/dist/template/package.json +13 -3
  72. package/dist/template/scripts/configure-expo-app.mjs +11 -15
  73. package/dist/template/scripts/doctor.mjs +51 -0
  74. package/dist/template/scripts/ensure-storage-bucket.mjs +25 -0
  75. package/dist/template/scripts/ensure-test-bucket.mjs +21 -0
  76. package/dist/template/scripts/lib/device-identity.test.ts +29 -0
  77. package/dist/template/scripts/lib/doctor-probes.mjs +139 -0
  78. package/dist/template/scripts/lib/doctor.mjs +208 -0
  79. package/dist/template/scripts/lib/doctor.test.mjs +262 -0
  80. package/dist/template/scripts/lib/expo-app-configurator.mjs +14 -9
  81. package/dist/template/scripts/lib/expo-app-configurator.test.ts +3 -2
  82. package/dist/template/scripts/lib/ota-client-configurator.mjs +69 -0
  83. package/dist/template/scripts/lib/ota-client-configurator.test.ts +88 -0
  84. package/dist/template/scripts/lib/ota-client.test.ts +55 -0
  85. package/dist/template/scripts/lib/ota-root-hook-patcher.mjs +173 -0
  86. package/dist/template/scripts/lib/ota-root-hook-patcher.test.ts +123 -0
  87. package/dist/template/scripts/lib/ota-update-controller.test.ts +231 -0
  88. package/dist/template/scripts/tests/device-analytics-migrations.mjs +80 -0
  89. package/dist/template/scripts/tests/device-analytics.mjs +126 -0
  90. package/dist/template/scripts/tests/device-heartbeat.mjs +86 -0
  91. package/dist/template/scripts/tests/device-targeting-activation.mjs +111 -0
  92. package/dist/template/scripts/tests/device-targeting.mjs +39 -0
  93. package/dist/template/scripts/tests/device-version-metadata.mjs +31 -0
  94. package/dist/template/scripts/tests/manifest-identity-concurrency.mjs +106 -0
  95. package/dist/template/scripts/tests/manifest-identity.sql +204 -0
  96. package/dist/template/src/client/admin-types.ts +1 -0
  97. package/dist/template/src/client/devices/analytics.tsx +429 -0
  98. package/dist/template/src/client/devices/device-name.tsx +82 -0
  99. package/dist/template/src/client/devices/registry.tsx +399 -0
  100. package/dist/template/src/client/devices/use-devices-report.ts +108 -0
  101. package/dist/template/src/client/devices/version-adoption-chart.tsx +269 -0
  102. package/dist/template/src/client/devices/version-groups.test.ts +57 -0
  103. package/dist/template/src/client/devices/version-groups.ts +101 -0
  104. package/dist/template/src/client/distribution-control.tsx +135 -81
  105. package/dist/template/src/client/guard-action-combobox.tsx +13 -24
  106. package/dist/template/src/client/i18n/en.json +286 -0
  107. package/dist/template/src/client/i18n/messages.test.ts +42 -0
  108. package/dist/template/src/client/i18n/messages.ts +31 -0
  109. package/dist/template/src/client/i18n/provider.tsx +55 -0
  110. package/dist/template/src/client/i18n/use-formatters.ts +38 -0
  111. package/dist/template/src/client/logout-button.tsx +3 -1
  112. package/dist/template/src/client/update-audience-editor.tsx +285 -0
  113. package/dist/template/src/client/update-policy-editor.tsx +53 -41
  114. package/dist/template/src/server/controllers/manifest.test.ts +250 -7
  115. package/dist/template/src/server/controllers/manifest.ts +39 -31
  116. package/dist/template/src/server/devices/audience.test.ts +48 -0
  117. package/dist/template/src/server/devices/audience.ts +86 -0
  118. package/dist/template/src/server/devices/heartbeat.test.ts +39 -0
  119. package/dist/template/src/server/devices/heartbeat.ts +75 -0
  120. package/dist/template/src/server/devices/report-types.ts +114 -0
  121. package/dist/template/src/server/devices/report.test.ts +29 -0
  122. package/dist/template/src/server/devices/report.ts +27 -0
  123. package/dist/template/src/server/lib/admin-audience-activation.test.ts +94 -0
  124. package/dist/template/src/server/lib/admin-updates.ts +32 -168
  125. package/dist/template/src/server/lib/supabase.js +10 -10
  126. package/dist/template/src/server/lib/supabase.test.ts +11 -0
  127. package/dist/template/src/server/manifest/manifest-identity.test.ts +30 -0
  128. package/dist/template/src/server/manifest/manifest-identity.ts +24 -0
  129. package/dist/template/src/server/manifest/manifest-repository.ts +31 -102
  130. package/dist/template/src/server/manifest/manifest-response.ts +1 -1
  131. package/dist/template/templates/expo-app/ota-client/README.md +59 -0
  132. package/dist/template/templates/expo-app/ota-client/controller.js +60 -0
  133. package/dist/template/templates/expo-app/ota-client/device-identity.js +26 -0
  134. package/dist/template/templates/expo-app/ota-client/docs/update-lifecycle.md +52 -0
  135. package/dist/template/templates/expo-app/ota-client/index.d.ts +47 -0
  136. package/dist/template/templates/expo-app/ota-client/index.js +3 -0
  137. package/dist/template/templates/expo-app/ota-client/model/hooks/useOtaUpdates.js +48 -0
  138. package/dist/template/templates/expo-app/ota-client/model/update-controller.js +182 -0
  139. package/dist/template/templates/expo-app/ota-client/runtime.js +112 -0
  140. package/dist/template/templates/expo-app/ota-client/ui/ota-update-gate.js +56 -0
  141. package/dist/template-manifest.json +592 -77
  142. package/lib/cli.mjs +4 -6
  143. package/package.json +1 -1
@@ -1,15 +1,27 @@
1
1
  "use client";
2
+ import { useI18n } from "@/src/client/i18n/provider";
3
+
4
+ import { Button } from "@/components/ui/button";
5
+ import { Card } from "@/components/ui/card";
6
+ import { Badge } from "@/components/ui/badge";
7
+ import {
8
+ Table,
9
+ TableHeader,
10
+ TableBody,
11
+ TableRow,
12
+ TableHead,
13
+ TableCell,
14
+ } from "@/components/ui/table";
2
15
 
3
16
  import {
4
17
  deleteEmbeddedUpdate,
5
18
  getEmbeddedUpdates,
6
19
  } from "@/src/client/admin-api";
7
20
  import { EmbeddedUpdateItem } from "@/src/client/admin-types";
8
- import LogoutButton from "@/src/client/logout-button";
9
- import Link from "next/link";
10
21
  import { useCallback, useEffect, useState } from "react";
11
22
 
12
23
  export default function EmbeddedUpdatesPage() {
24
+ const { t, formatLocale } = useI18n();
13
25
  const [items, setItems] = useState<EmbeddedUpdateItem[]>([]);
14
26
  const [loading, setLoading] = useState(true);
15
27
  const [deletingId, setDeletingId] = useState<string | null>(null);
@@ -39,7 +51,7 @@ export default function EmbeddedUpdatesPage() {
39
51
 
40
52
  const handleDelete = async (embeddedUpdateId: string) => {
41
53
  const confirmed = window.confirm(
42
- `Удалить запись embedded update ${embeddedUpdateId}?`,
54
+ t("Удалить запись embedded update {0}?", [embeddedUpdateId]),
43
55
  );
44
56
  if (!confirmed) {
45
57
  return;
@@ -51,7 +63,7 @@ export default function EmbeddedUpdatesPage() {
51
63
 
52
64
  try {
53
65
  await deleteEmbeddedUpdate(embeddedUpdateId);
54
- setSuccess(`Запись удалена: ${embeddedUpdateId}`);
66
+ setSuccess(t("Запись удалена: {0}", [embeddedUpdateId]));
55
67
  await loadItems();
56
68
  } catch (deleteError: unknown) {
57
69
  setError(
@@ -64,29 +76,25 @@ export default function EmbeddedUpdatesPage() {
64
76
  };
65
77
 
66
78
  return (
67
- <main className="min-h-screen bg-zinc-50 p-4 dark:bg-zinc-950 md:p-8">
68
- <div className="mx-auto max-w-7xl space-y-4">
69
- <header className="flex flex-col gap-3 rounded-xl border border-zinc-200 bg-white p-4 dark:border-zinc-800 dark:bg-zinc-900 md:flex-row md:items-center md:justify-between">
70
- <div>
71
- <h1 className="text-xl font-semibold">Embedded Updates</h1>
72
- <p className="text-sm text-zinc-600 dark:text-zinc-400">
73
- Записей: {items.length}
79
+ <div className="mx-auto max-w-[1600px] space-y-6 p-4 md:p-8">
80
+ <div className="space-y-6">
81
+ <header className="flex flex-wrap items-start justify-between gap-4">
82
+ <div className="space-y-1">
83
+ <h1 className="text-2xl font-semibold tracking-tight">
84
+ Embedded builds
85
+ </h1>
86
+ <p className="text-sm text-muted-foreground">
87
+ {t("Встроенные версии приложения и регистрация нативных сборок.")}
74
88
  </p>
75
89
  </div>
76
- <div className="flex items-center gap-2">
77
- <Link
78
- href="/updates"
79
- className="rounded-md border border-zinc-300 px-4 py-4 text-sm hover:bg-zinc-100 dark:border-zinc-700 dark:hover:bg-zinc-800"
80
- >
81
- OTA Updates
82
- </Link>
83
- <LogoutButton />
84
- </div>
90
+ <Badge variant="secondary" className="px-3 py-1">
91
+ {items.length} {t(" сборок")}
92
+ </Badge>
85
93
  </header>
86
94
 
87
95
  {error ? (
88
96
  <div className="rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-700 dark:border-red-900 dark:bg-red-950/40 dark:text-red-300">
89
- {error}
97
+ {t(error)}
90
98
  </div>
91
99
  ) : null}
92
100
 
@@ -96,73 +104,99 @@ export default function EmbeddedUpdatesPage() {
96
104
  </div>
97
105
  ) : null}
98
106
 
99
- <section className="overflow-hidden rounded-xl border border-zinc-200 bg-white dark:border-zinc-800 dark:bg-zinc-900">
107
+ <Card className="gap-0 overflow-hidden py-0 shadow-none">
100
108
  <div className="overflow-x-auto">
101
- <table className="min-w-full text-sm">
102
- <thead className="bg-zinc-100 dark:bg-zinc-800">
103
- <tr>
104
- <th className="px-4 py-4 text-left">Created At</th>
105
- <th className="px-4 py-4 text-left">App version</th>
106
- <th className="px-4 py-4 text-left">Platform</th>
107
- <th className="px-4 py-4 text-left">Channel</th>
108
- <th className="px-4 py-4 text-left">Embedded ID</th>
109
- <th className="px-4 py-4 text-left">Action</th>
110
- </tr>
111
- </thead>
112
- <tbody>
109
+ <Table className="min-w-full text-sm">
110
+ <TableHeader className="bg-muted/40">
111
+ <TableRow>
112
+ <TableHead className="px-4 py-3 text-left">
113
+ Created At
114
+ </TableHead>
115
+ <TableHead className="px-4 py-3 text-left">
116
+ App version
117
+ </TableHead>
118
+ <TableHead className="px-4 py-3 text-left">
119
+ Platform
120
+ </TableHead>
121
+ <TableHead className="px-4 py-3 text-left">Channel</TableHead>
122
+ <TableHead className="px-4 py-3 text-left">
123
+ Embedded ID
124
+ </TableHead>
125
+ <TableHead className="px-4 py-3 text-left">Action</TableHead>
126
+ </TableRow>
127
+ </TableHeader>
128
+ <TableBody>
113
129
  {loading ? (
114
- <tr>
115
- <td className="px-3 py-4 text-zinc-500" colSpan={6}>
116
- Загрузка...
117
- </td>
118
- </tr>
130
+ <TableRow>
131
+ <TableCell
132
+ className="h-36 px-3 py-4 text-center text-muted-foreground"
133
+ colSpan={6}
134
+ >
135
+ {t("Загрузка...")}
136
+ </TableCell>
137
+ </TableRow>
119
138
  ) : null}
120
139
 
121
140
  {!loading && items.length === 0 ? (
122
- <tr>
123
- <td className="px-3 py-4 text-zinc-500" colSpan={6}>
124
- Embedded записи не найдены
125
- </td>
126
- </tr>
141
+ <TableRow>
142
+ <TableCell
143
+ className="h-36 px-3 py-4 text-center text-muted-foreground"
144
+ colSpan={6}
145
+ >
146
+ {t("Embedded записи не найдены")}
147
+ </TableCell>
148
+ </TableRow>
127
149
  ) : null}
128
150
 
129
151
  {!loading
130
152
  ? items.map((item) => (
131
- <tr
153
+ <TableRow
132
154
  key={item.embeddedUpdateId}
133
- className="border-t border-zinc-200 dark:border-zinc-800"
155
+ className="border-t border-border "
134
156
  >
135
- <td className="px-4 py-4">
136
- {new Date(item.createdAt).toLocaleString("uk-UA")}
137
- </td>
138
- <td className="px-4 py-4">
157
+ <TableCell className="px-4 py-3">
158
+ {new Date(item.createdAt).toLocaleString(
159
+ formatLocale,
160
+ )}
161
+ </TableCell>
162
+ <TableCell className="px-4 py-3">
139
163
  {item.appVersion || "—"}
140
- </td>
141
- <td className="px-4 py-4">{item.platform}</td>
142
- <td className="px-4 py-4">{item.channel}</td>
143
- <td className="px-4 py-4 font-mono text-xs">
144
- {item.embeddedUpdateId}
145
- </td>
146
- <td className="px-4 py-4">
147
- <button
164
+ </TableCell>
165
+ <TableCell className="px-4 py-3">
166
+ {item.platform}
167
+ </TableCell>
168
+ <TableCell className="px-4 py-3">
169
+ <Badge variant="outline">{item.channel}</Badge>
170
+ </TableCell>
171
+ <TableCell className="px-4 py-3 font-mono text-xs">
172
+ <span
173
+ className="block max-w-64 truncate select-all"
174
+ title={item.embeddedUpdateId}
175
+ >
176
+ {item.embeddedUpdateId}
177
+ </span>
178
+ </TableCell>
179
+ <TableCell className="px-4 py-3">
180
+ <Button
181
+ variant="destructive"
182
+ size="sm"
148
183
  type="button"
149
184
  onClick={() => handleDelete(item.embeddedUpdateId)}
150
185
  disabled={deletingId === item.embeddedUpdateId}
151
- className="rounded-md border border-red-300 px-3 py-1.5 text-xs text-red-700 hover:bg-red-50 disabled:cursor-not-allowed disabled:opacity-60 dark:border-red-700 dark:text-red-300 dark:hover:bg-red-950/40"
152
186
  >
153
187
  {deletingId === item.embeddedUpdateId
154
- ? "Удаление..."
155
- : "Удалить"}
156
- </button>
157
- </td>
158
- </tr>
188
+ ? t("Удаление...")
189
+ : t("Удалить")}
190
+ </Button>
191
+ </TableCell>
192
+ </TableRow>
159
193
  ))
160
194
  : null}
161
- </tbody>
162
- </table>
195
+ </TableBody>
196
+ </Table>
163
197
  </div>
164
- </section>
198
+ </Card>
165
199
  </div>
166
- </main>
200
+ </div>
167
201
  );
168
202
  }