create-expo-updates-server 0.6.1 → 0.6.2
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.
- package/README.md +2 -2
- package/dist/template/README.md +1 -1
- package/dist/template/app/updates/devices/page.tsx +3 -3
- package/dist/template/docs/device-targeting.md +15 -0
- package/dist/template/docs/getting-started.md +1 -1
- package/dist/template/docs/migrations/2026-11-25-device-id-search.sql +159 -0
- package/dist/template/docs/migrations/schema.sql +160 -0
- package/dist/template/docs/npm-installer.md +3 -3
- package/dist/template/docs/ru/device-targeting.md +15 -0
- package/dist/template/docs/ru/getting-started.md +1 -1
- package/dist/template/docs/ru/npm-installer.md +3 -3
- package/dist/template/docs/ru/publishing-npm-installer.md +1 -1
- package/dist/template/docs/uk/device-targeting.md +15 -0
- package/dist/template/docs/uk/getting-started.md +1 -1
- package/dist/template/docs/uk/npm-installer.md +3 -3
- package/dist/template/docs/uk/publishing-npm-installer.md +1 -1
- package/dist/template/lib/audience-ids.ts +1 -0
- package/dist/template/scripts/tests/device-analytics-migrations.mjs +4 -0
- package/dist/template/scripts/tests/device-analytics.mjs +10 -1
- package/dist/template/scripts/tests/e2e/installations.mjs +7 -1
- package/dist/template/src/client/devices/registry.tsx +5 -0
- package/dist/template/src/client/devices/use-devices-report.ts +3 -2
- package/dist/template/src/client/i18n/en.json +2 -1
- package/dist/template/src/client/i18n/ru.json +2 -1
- package/dist/template/src/client/i18n/uk.json +2 -1
- package/dist/template/src/server/devices/report.test.ts +5 -1
- package/dist/template/src/server/devices/report.ts +2 -1
- package/dist/template-manifest.json +49 -44
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ Create a standalone, self-hosted Expo Updates Server project from the
|
|
|
4
4
|
versioned template bundled in this npm package.
|
|
5
5
|
|
|
6
6
|
```bash
|
|
7
|
-
npx create-expo-updates-server@0.6.
|
|
7
|
+
npx create-expo-updates-server@0.6.2 my-server
|
|
8
8
|
cd my-server
|
|
9
9
|
```
|
|
10
10
|
|
|
@@ -13,7 +13,7 @@ To scaffold into an empty current directory instead:
|
|
|
13
13
|
```bash
|
|
14
14
|
mkdir my-server
|
|
15
15
|
cd my-server
|
|
16
|
-
npx create-expo-updates-server@0.6.
|
|
16
|
+
npx create-expo-updates-server@0.6.2 .
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
The initializer performs no network requests, dependency installation, Git
|
package/dist/template/README.md
CHANGED
|
@@ -150,15 +150,15 @@ export default function DevicesPage() {
|
|
|
150
150
|
/>
|
|
151
151
|
<div className="grid gap-2">
|
|
152
152
|
<Label htmlFor="installation-search">
|
|
153
|
-
{t("Installation ID")}
|
|
153
|
+
{t("Device ID / Installation ID")}
|
|
154
154
|
</Label>
|
|
155
155
|
<Input
|
|
156
156
|
id="installation-search"
|
|
157
157
|
placeholder={t("ID или часть ID")}
|
|
158
158
|
value={filters.search}
|
|
159
|
-
maxLength={
|
|
159
|
+
maxLength={64}
|
|
160
160
|
pattern="[a-fA-F0-9\-]*"
|
|
161
|
-
title={t("
|
|
161
|
+
title={t("Enter a Device ID prefix or part of an Installation ID")}
|
|
162
162
|
onChange={(e) => update("search", e.target.value)}
|
|
163
163
|
className="bg-background/40"
|
|
164
164
|
/>
|
|
@@ -50,6 +50,21 @@ Official API references: [Expo Application](https://docs.expo.dev/versions/v58.0
|
|
|
50
50
|
[Expo SecureStore](https://docs.expo.dev/versions/v58.0.0/sdk/securestore/),
|
|
51
51
|
[Expo extra parameters](https://docs.expo.dev/versions/v58.0.0/sdk/updates/#updatessetextraparamasynckey-value).
|
|
52
52
|
|
|
53
|
+
Show the first 12 characters of the SDK Device ID in app settings.
|
|
54
|
+
|
|
55
|
+
```tsx
|
|
56
|
+
import { Text } from "react-native";
|
|
57
|
+
import { useOtaUpdates } from "expo-updates-server-client";
|
|
58
|
+
|
|
59
|
+
export function SettingsDeviceId() {
|
|
60
|
+
const { deviceId } = useOtaUpdates();
|
|
61
|
+
if (!deviceId) return null;
|
|
62
|
+
return <Text selectable>Device ID · {deviceId.slice(0, 12)}</Text>;
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
After a heartbeat, search for this prefix in **Installations → Registry**, open the matching installation, and copy the full Device ID into the release audience. If several devices match, verify the platform and installation details. Apply `docs/migrations/2026-11-25-device-id-search.sql` after the device targeting migration for existing databases.
|
|
67
|
+
|
|
53
68
|
## Client initialization
|
|
54
69
|
|
|
55
70
|
Generated entry calls `start()` automatically, persists installation identity and sets
|
|
@@ -13,7 +13,7 @@ SDK or macOS/Xcode. The server's Docker image does not provide the mobile toolch
|
|
|
13
13
|
Create the server files, or use an existing source checkout:
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
|
-
npx create-expo-updates-server@0.6.
|
|
16
|
+
npx create-expo-updates-server@0.6.2 my-server
|
|
17
17
|
cd my-server
|
|
18
18
|
```
|
|
19
19
|
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
-- Apply after device targeting. Match all installations sharing a Device ID prefix.
|
|
2
|
+
begin;
|
|
3
|
+
|
|
4
|
+
create or replace function public.ota_devices_report_v2(
|
|
5
|
+
p_days integer default 7, p_platform text default null, p_channel text default null,
|
|
6
|
+
p_runtime text default null, p_offset integer default 0,
|
|
7
|
+
p_launch_kind text default null, p_search text default null)
|
|
8
|
+
returns table(report jsonb) language sql stable set search_path = public as $$
|
|
9
|
+
with parameters as (
|
|
10
|
+
select (now() at time zone 'UTC')::date as today,
|
|
11
|
+
(now() at time zone 'UTC')::date - (p_days - 1) as first_day,
|
|
12
|
+
now() - make_interval(days => p_days) as window_start,
|
|
13
|
+
m.collection_started_at,
|
|
14
|
+
greatest((m.collection_started_at at time zone 'UTC')::date,
|
|
15
|
+
(now() at time zone 'UTC')::date - 89) as retained_from
|
|
16
|
+
from public.ota_device_analytics_metadata m where singleton
|
|
17
|
+
), matching_devices as (
|
|
18
|
+
select platform, installation_id from public.ota_device_state
|
|
19
|
+
where p_search is not null and starts_with(device_id, lower(p_search))
|
|
20
|
+
), recent as (
|
|
21
|
+
select s.* from public.ota_device_state s, parameters p
|
|
22
|
+
where s.last_sequence > 0 and s.last_seen_at >= p.window_start
|
|
23
|
+
), filtered as (
|
|
24
|
+
select * from recent
|
|
25
|
+
where (p_platform is null or platform = p_platform)
|
|
26
|
+
and (p_channel is null or channel = p_channel)
|
|
27
|
+
and (p_runtime is null or runtime_version = p_runtime)
|
|
28
|
+
and (p_launch_kind is null or launch_kind = p_launch_kind)
|
|
29
|
+
and (p_search is null or position(lower(p_search) in lower(installation_id)) > 0
|
|
30
|
+
or (platform, installation_id) in (select platform, installation_id from matching_devices))
|
|
31
|
+
), version_counts as (
|
|
32
|
+
select platform, channel, runtime_version, native_version, native_build, launch_kind,
|
|
33
|
+
coalesce(resolved_update_id, reported_update_id) as update_id,
|
|
34
|
+
max(update_label) as update_label, count(*) as installations
|
|
35
|
+
from filtered group by platform, channel, runtime_version, native_version, native_build,
|
|
36
|
+
launch_kind, coalesce(resolved_update_id, reported_update_id)
|
|
37
|
+
), versions as (
|
|
38
|
+
select v.*, case when v.launch_kind = 'ota' then coalesce(
|
|
39
|
+
case when jsonb_typeof(u.manifest #> '{extra,expoClient,version}') = 'string'
|
|
40
|
+
then nullif(btrim(u.manifest #>> '{extra,expoClient,version}'), '') end,
|
|
41
|
+
case when jsonb_typeof(u.manifest #> '{expoClient,version}') = 'string'
|
|
42
|
+
then nullif(btrim(u.manifest #>> '{expoClient,version}'), '') end
|
|
43
|
+
) when v.launch_kind = 'embedded' then coalesce(nullif(btrim(e.app_version), ''), v.native_version)
|
|
44
|
+
else null end as app_version
|
|
45
|
+
from version_counts v
|
|
46
|
+
left join public.ota_updates u on v.launch_kind = 'ota' and u.update_id = v.update_id
|
|
47
|
+
and u.runtime_version = v.runtime_version and u.channel = v.channel and u.platform = v.platform
|
|
48
|
+
left join public.ota_embedded_updates e on v.launch_kind = 'embedded' and e.embedded_update_id = v.update_id
|
|
49
|
+
and e.channel = v.channel and e.platform = v.platform
|
|
50
|
+
), page as (
|
|
51
|
+
select * from filtered order by last_seen_at desc, installation_id, platform limit 50 offset p_offset
|
|
52
|
+
), daily as (
|
|
53
|
+
select d.* from public.ota_device_activity_daily d, parameters p
|
|
54
|
+
where d.activity_date between greatest(p.first_day, p.retained_from) and p.today
|
|
55
|
+
), filtered_daily as (
|
|
56
|
+
select d.* from daily d
|
|
57
|
+
where (p_platform is null or d.platform = p_platform)
|
|
58
|
+
and (p_channel is null or d.channel = p_channel)
|
|
59
|
+
and (p_runtime is null or d.runtime_version = p_runtime)
|
|
60
|
+
and (p_launch_kind is null or d.launch_kind = p_launch_kind)
|
|
61
|
+
and (p_search is null or position(lower(p_search) in lower(d.installation_id)) > 0
|
|
62
|
+
or (d.platform, d.installation_id) in (select platform, installation_id from matching_devices))
|
|
63
|
+
), calendar as (
|
|
64
|
+
select p.first_day + n as date,
|
|
65
|
+
case when p.first_day + n < p.retained_from then 'unavailable'
|
|
66
|
+
when p.first_day + n = p.today
|
|
67
|
+
or ((p.first_day + n)::timestamp at time zone 'UTC') < p.collection_started_at then 'partial'
|
|
68
|
+
else 'complete' end as coverage
|
|
69
|
+
from parameters p cross join generate_series(0, p_days - 1) n
|
|
70
|
+
), day_counts as (
|
|
71
|
+
select d.activity_date, count(*) as active,
|
|
72
|
+
count(*) filter (where (c.first_observed_at at time zone 'UTC')::date = d.activity_date) as newly_observed
|
|
73
|
+
from filtered_daily d left join public.ota_device_activity_cohorts c
|
|
74
|
+
on c.installation_id = d.installation_id and c.platform = d.platform
|
|
75
|
+
group by d.activity_date
|
|
76
|
+
), activity as (
|
|
77
|
+
select c.date, c.coverage,
|
|
78
|
+
case when c.coverage <> 'unavailable' then coalesce(d.active, 0) end as active,
|
|
79
|
+
case when c.coverage <> 'unavailable' then coalesce(d.newly_observed, 0) end as newly_observed
|
|
80
|
+
from calendar c left join day_counts d on c.date = d.activity_date
|
|
81
|
+
), cohort_source as (
|
|
82
|
+
select c.*, (c.first_observed_at at time zone 'UTC')::date as first_day,
|
|
83
|
+
date_trunc('week', c.first_observed_at at time zone 'UTC')::date as week_start
|
|
84
|
+
from public.ota_device_activity_cohorts c, parameters p
|
|
85
|
+
where c.first_observed_at >= p.collection_started_at
|
|
86
|
+
and (c.first_observed_at at time zone 'UTC')::date between p.retained_from and p.today
|
|
87
|
+
), cohort_members as (
|
|
88
|
+
select * from cohort_source
|
|
89
|
+
where (p_platform is null or platform = p_platform)
|
|
90
|
+
and (p_channel is null or channel = p_channel)
|
|
91
|
+
and (p_runtime is null or runtime_version = p_runtime)
|
|
92
|
+
and (p_launch_kind is null or launch_kind = p_launch_kind)
|
|
93
|
+
and (p_search is null or position(lower(p_search) in lower(installation_id)) > 0
|
|
94
|
+
or (platform, installation_id) in (select platform, installation_id from matching_devices))
|
|
95
|
+
), cohort_sizes as (
|
|
96
|
+
select week_start, count(*) as installations from cohort_members group by week_start
|
|
97
|
+
), retention_members as (
|
|
98
|
+
select c.week_start, n.day,
|
|
99
|
+
(n.day = 0 or c.first_day + n.day < p.today) as eligible,
|
|
100
|
+
exists (select 1 from public.ota_device_activity_daily d
|
|
101
|
+
where d.installation_id = c.installation_id and d.platform = c.platform
|
|
102
|
+
and d.activity_date = c.first_day + n.day) as returned
|
|
103
|
+
from cohort_members c cross join (values (0), (1), (7), (14), (30)) n(day)
|
|
104
|
+
cross join parameters p
|
|
105
|
+
), retention_counts as (
|
|
106
|
+
select week_start, day, count(*) filter (where eligible) as eligible,
|
|
107
|
+
count(*) filter (where eligible and returned) as retained
|
|
108
|
+
from retention_members group by week_start, day
|
|
109
|
+
), retention_rows as (
|
|
110
|
+
select c.week_start, c.installations,
|
|
111
|
+
jsonb_agg(jsonb_build_object('day', r.day, 'eligibleInstallations', r.eligible,
|
|
112
|
+
'retainedInstallations', case when r.eligible > 0 then r.retained end,
|
|
113
|
+
'rate', case when r.eligible > 0 then r.retained::numeric / r.eligible end) order by r.day) as cells
|
|
114
|
+
from cohort_sizes c join retention_counts r using (week_start) group by c.week_start, c.installations
|
|
115
|
+
), adoption as (
|
|
116
|
+
select date_trunc('week', first_seen_at at time zone 'UTC')::date as week_start,
|
|
117
|
+
count(*) as installations,
|
|
118
|
+
count(*) filter (where launch_kind = 'ota') as ota,
|
|
119
|
+
count(*) filter (where launch_kind = 'embedded') as embedded,
|
|
120
|
+
count(*) filter (where launch_kind = 'unknown') as unknown
|
|
121
|
+
from filtered group by date_trunc('week', first_seen_at at time zone 'UTC')::date
|
|
122
|
+
), option_source as (
|
|
123
|
+
select platform, channel, runtime_version, launch_kind from recent
|
|
124
|
+
union select platform, channel, runtime_version, launch_kind from daily
|
|
125
|
+
union select platform, channel, runtime_version, launch_kind from cohort_source
|
|
126
|
+
)
|
|
127
|
+
select jsonb_build_object(
|
|
128
|
+
'total', (select count(*) from filtered), 'pageSize', 50, 'offset', p_offset,
|
|
129
|
+
'devices', coalesce((select jsonb_agg(to_jsonb(page) order by last_seen_at desc, installation_id, platform) from page), '[]'::jsonb),
|
|
130
|
+
'versions', coalesce((select jsonb_agg(to_jsonb(versions) order by installations desc, platform, channel, runtime_version,
|
|
131
|
+
native_version, native_build, launch_kind, update_id) from versions), '[]'::jsonb),
|
|
132
|
+
'filters', jsonb_build_object('days', p_days, 'platform', p_platform, 'channel', p_channel,
|
|
133
|
+
'runtime', p_runtime, 'launchKind', p_launch_kind, 'search', p_search),
|
|
134
|
+
'options', jsonb_build_object(
|
|
135
|
+
'platforms', coalesce((select jsonb_agg(v order by v) from (select distinct platform as v from option_source) t), '[]'::jsonb),
|
|
136
|
+
'channels', coalesce((select jsonb_agg(v order by v) from (select distinct channel as v from option_source) t), '[]'::jsonb),
|
|
137
|
+
'runtimes', coalesce((select jsonb_agg(v order by v) from (select distinct runtime_version as v from option_source) t), '[]'::jsonb),
|
|
138
|
+
'launchKinds', coalesce((select jsonb_agg(v order by v) from (select distinct launch_kind as v from option_source) t), '[]'::jsonb)),
|
|
139
|
+
'summary', (select jsonb_build_object('activeInstallations', count(*),
|
|
140
|
+
'newInstallations', count(*) filter (where first_seen_at >= (select window_start from parameters)),
|
|
141
|
+
'otaInstallations', count(*) filter (where launch_kind = 'ota'),
|
|
142
|
+
'embeddedInstallations', count(*) filter (where launch_kind = 'embedded'),
|
|
143
|
+
'unknownInstallations', count(*) filter (where launch_kind = 'unknown'),
|
|
144
|
+
'emergencyInstallations', count(*) filter (where emergency_launch),
|
|
145
|
+
'reportedVersions', (select count(*) from versions)) from filtered),
|
|
146
|
+
'activity', coalesce((select jsonb_agg(jsonb_build_object('date', date, 'activeInstallations', active,
|
|
147
|
+
'newInstallations', newly_observed, 'coverage', coverage) order by date) from activity), '[]'::jsonb),
|
|
148
|
+
'adoptionCohorts', coalesce((select jsonb_agg(jsonb_build_object('weekStart', week_start, 'installations', installations,
|
|
149
|
+
'otaInstallations', ota, 'embeddedInstallations', embedded, 'unknownInstallations', unknown) order by week_start) from adoption), '[]'::jsonb),
|
|
150
|
+
'cohorts', coalesce((select jsonb_agg(jsonb_build_object('weekStart', week_start, 'installations', installations,
|
|
151
|
+
'cells', cells) order by week_start) from retention_rows), '[]'::jsonb),
|
|
152
|
+
'coverage', (select jsonb_build_object('collectionStartedAt', collection_started_at, 'retainedFrom', retained_from,
|
|
153
|
+
'timezone', 'UTC', 'retentionDays', 90, 'cohortWindowDays', 90, 'activityBasis', 'accepted-heartbeat-receipt',
|
|
154
|
+
'cohortBasis', 'first-recorded-heartbeat', 'cohortFilters', 'entry-state', 'todayIsPartial', true,
|
|
155
|
+
'generatedAt', now(), 'windowStartedAt', window_start) from parameters)
|
|
156
|
+
);
|
|
157
|
+
$$;
|
|
158
|
+
|
|
159
|
+
commit;
|
|
@@ -2131,3 +2131,163 @@ alter table public.ota_updates
|
|
|
2131
2131
|
add constraint ota_updates_delivery_mode_chk
|
|
2132
2132
|
check (delivery_mode in ('manual', 'background', 'manual-postpone')
|
|
2133
2133
|
and (delivery_mode <> 'manual-postpone' or guard_action is null));
|
|
2134
|
+
|
|
2135
|
+
-- Apply after device targeting. Match all installations sharing a Device ID prefix.
|
|
2136
|
+
begin;
|
|
2137
|
+
|
|
2138
|
+
create or replace function public.ota_devices_report_v2(
|
|
2139
|
+
p_days integer default 7, p_platform text default null, p_channel text default null,
|
|
2140
|
+
p_runtime text default null, p_offset integer default 0,
|
|
2141
|
+
p_launch_kind text default null, p_search text default null)
|
|
2142
|
+
returns table(report jsonb) language sql stable set search_path = public as $$
|
|
2143
|
+
with parameters as (
|
|
2144
|
+
select (now() at time zone 'UTC')::date as today,
|
|
2145
|
+
(now() at time zone 'UTC')::date - (p_days - 1) as first_day,
|
|
2146
|
+
now() - make_interval(days => p_days) as window_start,
|
|
2147
|
+
m.collection_started_at,
|
|
2148
|
+
greatest((m.collection_started_at at time zone 'UTC')::date,
|
|
2149
|
+
(now() at time zone 'UTC')::date - 89) as retained_from
|
|
2150
|
+
from public.ota_device_analytics_metadata m where singleton
|
|
2151
|
+
), matching_devices as (
|
|
2152
|
+
select platform, installation_id from public.ota_device_state
|
|
2153
|
+
where p_search is not null and starts_with(device_id, lower(p_search))
|
|
2154
|
+
), recent as (
|
|
2155
|
+
select s.* from public.ota_device_state s, parameters p
|
|
2156
|
+
where s.last_sequence > 0 and s.last_seen_at >= p.window_start
|
|
2157
|
+
), filtered as (
|
|
2158
|
+
select * from recent
|
|
2159
|
+
where (p_platform is null or platform = p_platform)
|
|
2160
|
+
and (p_channel is null or channel = p_channel)
|
|
2161
|
+
and (p_runtime is null or runtime_version = p_runtime)
|
|
2162
|
+
and (p_launch_kind is null or launch_kind = p_launch_kind)
|
|
2163
|
+
and (p_search is null or position(lower(p_search) in lower(installation_id)) > 0
|
|
2164
|
+
or (platform, installation_id) in (select platform, installation_id from matching_devices))
|
|
2165
|
+
), version_counts as (
|
|
2166
|
+
select platform, channel, runtime_version, native_version, native_build, launch_kind,
|
|
2167
|
+
coalesce(resolved_update_id, reported_update_id) as update_id,
|
|
2168
|
+
max(update_label) as update_label, count(*) as installations
|
|
2169
|
+
from filtered group by platform, channel, runtime_version, native_version, native_build,
|
|
2170
|
+
launch_kind, coalesce(resolved_update_id, reported_update_id)
|
|
2171
|
+
), versions as (
|
|
2172
|
+
select v.*, case when v.launch_kind = 'ota' then coalesce(
|
|
2173
|
+
case when jsonb_typeof(u.manifest #> '{extra,expoClient,version}') = 'string'
|
|
2174
|
+
then nullif(btrim(u.manifest #>> '{extra,expoClient,version}'), '') end,
|
|
2175
|
+
case when jsonb_typeof(u.manifest #> '{expoClient,version}') = 'string'
|
|
2176
|
+
then nullif(btrim(u.manifest #>> '{expoClient,version}'), '') end
|
|
2177
|
+
) when v.launch_kind = 'embedded' then coalesce(nullif(btrim(e.app_version), ''), v.native_version)
|
|
2178
|
+
else null end as app_version
|
|
2179
|
+
from version_counts v
|
|
2180
|
+
left join public.ota_updates u on v.launch_kind = 'ota' and u.update_id = v.update_id
|
|
2181
|
+
and u.runtime_version = v.runtime_version and u.channel = v.channel and u.platform = v.platform
|
|
2182
|
+
left join public.ota_embedded_updates e on v.launch_kind = 'embedded' and e.embedded_update_id = v.update_id
|
|
2183
|
+
and e.channel = v.channel and e.platform = v.platform
|
|
2184
|
+
), page as (
|
|
2185
|
+
select * from filtered order by last_seen_at desc, installation_id, platform limit 50 offset p_offset
|
|
2186
|
+
), daily as (
|
|
2187
|
+
select d.* from public.ota_device_activity_daily d, parameters p
|
|
2188
|
+
where d.activity_date between greatest(p.first_day, p.retained_from) and p.today
|
|
2189
|
+
), filtered_daily as (
|
|
2190
|
+
select d.* from daily d
|
|
2191
|
+
where (p_platform is null or d.platform = p_platform)
|
|
2192
|
+
and (p_channel is null or d.channel = p_channel)
|
|
2193
|
+
and (p_runtime is null or d.runtime_version = p_runtime)
|
|
2194
|
+
and (p_launch_kind is null or d.launch_kind = p_launch_kind)
|
|
2195
|
+
and (p_search is null or position(lower(p_search) in lower(d.installation_id)) > 0
|
|
2196
|
+
or (d.platform, d.installation_id) in (select platform, installation_id from matching_devices))
|
|
2197
|
+
), calendar as (
|
|
2198
|
+
select p.first_day + n as date,
|
|
2199
|
+
case when p.first_day + n < p.retained_from then 'unavailable'
|
|
2200
|
+
when p.first_day + n = p.today
|
|
2201
|
+
or ((p.first_day + n)::timestamp at time zone 'UTC') < p.collection_started_at then 'partial'
|
|
2202
|
+
else 'complete' end as coverage
|
|
2203
|
+
from parameters p cross join generate_series(0, p_days - 1) n
|
|
2204
|
+
), day_counts as (
|
|
2205
|
+
select d.activity_date, count(*) as active,
|
|
2206
|
+
count(*) filter (where (c.first_observed_at at time zone 'UTC')::date = d.activity_date) as newly_observed
|
|
2207
|
+
from filtered_daily d left join public.ota_device_activity_cohorts c
|
|
2208
|
+
on c.installation_id = d.installation_id and c.platform = d.platform
|
|
2209
|
+
group by d.activity_date
|
|
2210
|
+
), activity as (
|
|
2211
|
+
select c.date, c.coverage,
|
|
2212
|
+
case when c.coverage <> 'unavailable' then coalesce(d.active, 0) end as active,
|
|
2213
|
+
case when c.coverage <> 'unavailable' then coalesce(d.newly_observed, 0) end as newly_observed
|
|
2214
|
+
from calendar c left join day_counts d on c.date = d.activity_date
|
|
2215
|
+
), cohort_source as (
|
|
2216
|
+
select c.*, (c.first_observed_at at time zone 'UTC')::date as first_day,
|
|
2217
|
+
date_trunc('week', c.first_observed_at at time zone 'UTC')::date as week_start
|
|
2218
|
+
from public.ota_device_activity_cohorts c, parameters p
|
|
2219
|
+
where c.first_observed_at >= p.collection_started_at
|
|
2220
|
+
and (c.first_observed_at at time zone 'UTC')::date between p.retained_from and p.today
|
|
2221
|
+
), cohort_members as (
|
|
2222
|
+
select * from cohort_source
|
|
2223
|
+
where (p_platform is null or platform = p_platform)
|
|
2224
|
+
and (p_channel is null or channel = p_channel)
|
|
2225
|
+
and (p_runtime is null or runtime_version = p_runtime)
|
|
2226
|
+
and (p_launch_kind is null or launch_kind = p_launch_kind)
|
|
2227
|
+
and (p_search is null or position(lower(p_search) in lower(installation_id)) > 0
|
|
2228
|
+
or (platform, installation_id) in (select platform, installation_id from matching_devices))
|
|
2229
|
+
), cohort_sizes as (
|
|
2230
|
+
select week_start, count(*) as installations from cohort_members group by week_start
|
|
2231
|
+
), retention_members as (
|
|
2232
|
+
select c.week_start, n.day,
|
|
2233
|
+
(n.day = 0 or c.first_day + n.day < p.today) as eligible,
|
|
2234
|
+
exists (select 1 from public.ota_device_activity_daily d
|
|
2235
|
+
where d.installation_id = c.installation_id and d.platform = c.platform
|
|
2236
|
+
and d.activity_date = c.first_day + n.day) as returned
|
|
2237
|
+
from cohort_members c cross join (values (0), (1), (7), (14), (30)) n(day)
|
|
2238
|
+
cross join parameters p
|
|
2239
|
+
), retention_counts as (
|
|
2240
|
+
select week_start, day, count(*) filter (where eligible) as eligible,
|
|
2241
|
+
count(*) filter (where eligible and returned) as retained
|
|
2242
|
+
from retention_members group by week_start, day
|
|
2243
|
+
), retention_rows as (
|
|
2244
|
+
select c.week_start, c.installations,
|
|
2245
|
+
jsonb_agg(jsonb_build_object('day', r.day, 'eligibleInstallations', r.eligible,
|
|
2246
|
+
'retainedInstallations', case when r.eligible > 0 then r.retained end,
|
|
2247
|
+
'rate', case when r.eligible > 0 then r.retained::numeric / r.eligible end) order by r.day) as cells
|
|
2248
|
+
from cohort_sizes c join retention_counts r using (week_start) group by c.week_start, c.installations
|
|
2249
|
+
), adoption as (
|
|
2250
|
+
select date_trunc('week', first_seen_at at time zone 'UTC')::date as week_start,
|
|
2251
|
+
count(*) as installations,
|
|
2252
|
+
count(*) filter (where launch_kind = 'ota') as ota,
|
|
2253
|
+
count(*) filter (where launch_kind = 'embedded') as embedded,
|
|
2254
|
+
count(*) filter (where launch_kind = 'unknown') as unknown
|
|
2255
|
+
from filtered group by date_trunc('week', first_seen_at at time zone 'UTC')::date
|
|
2256
|
+
), option_source as (
|
|
2257
|
+
select platform, channel, runtime_version, launch_kind from recent
|
|
2258
|
+
union select platform, channel, runtime_version, launch_kind from daily
|
|
2259
|
+
union select platform, channel, runtime_version, launch_kind from cohort_source
|
|
2260
|
+
)
|
|
2261
|
+
select jsonb_build_object(
|
|
2262
|
+
'total', (select count(*) from filtered), 'pageSize', 50, 'offset', p_offset,
|
|
2263
|
+
'devices', coalesce((select jsonb_agg(to_jsonb(page) order by last_seen_at desc, installation_id, platform) from page), '[]'::jsonb),
|
|
2264
|
+
'versions', coalesce((select jsonb_agg(to_jsonb(versions) order by installations desc, platform, channel, runtime_version,
|
|
2265
|
+
native_version, native_build, launch_kind, update_id) from versions), '[]'::jsonb),
|
|
2266
|
+
'filters', jsonb_build_object('days', p_days, 'platform', p_platform, 'channel', p_channel,
|
|
2267
|
+
'runtime', p_runtime, 'launchKind', p_launch_kind, 'search', p_search),
|
|
2268
|
+
'options', jsonb_build_object(
|
|
2269
|
+
'platforms', coalesce((select jsonb_agg(v order by v) from (select distinct platform as v from option_source) t), '[]'::jsonb),
|
|
2270
|
+
'channels', coalesce((select jsonb_agg(v order by v) from (select distinct channel as v from option_source) t), '[]'::jsonb),
|
|
2271
|
+
'runtimes', coalesce((select jsonb_agg(v order by v) from (select distinct runtime_version as v from option_source) t), '[]'::jsonb),
|
|
2272
|
+
'launchKinds', coalesce((select jsonb_agg(v order by v) from (select distinct launch_kind as v from option_source) t), '[]'::jsonb)),
|
|
2273
|
+
'summary', (select jsonb_build_object('activeInstallations', count(*),
|
|
2274
|
+
'newInstallations', count(*) filter (where first_seen_at >= (select window_start from parameters)),
|
|
2275
|
+
'otaInstallations', count(*) filter (where launch_kind = 'ota'),
|
|
2276
|
+
'embeddedInstallations', count(*) filter (where launch_kind = 'embedded'),
|
|
2277
|
+
'unknownInstallations', count(*) filter (where launch_kind = 'unknown'),
|
|
2278
|
+
'emergencyInstallations', count(*) filter (where emergency_launch),
|
|
2279
|
+
'reportedVersions', (select count(*) from versions)) from filtered),
|
|
2280
|
+
'activity', coalesce((select jsonb_agg(jsonb_build_object('date', date, 'activeInstallations', active,
|
|
2281
|
+
'newInstallations', newly_observed, 'coverage', coverage) order by date) from activity), '[]'::jsonb),
|
|
2282
|
+
'adoptionCohorts', coalesce((select jsonb_agg(jsonb_build_object('weekStart', week_start, 'installations', installations,
|
|
2283
|
+
'otaInstallations', ota, 'embeddedInstallations', embedded, 'unknownInstallations', unknown) order by week_start) from adoption), '[]'::jsonb),
|
|
2284
|
+
'cohorts', coalesce((select jsonb_agg(jsonb_build_object('weekStart', week_start, 'installations', installations,
|
|
2285
|
+
'cells', cells) order by week_start) from retention_rows), '[]'::jsonb),
|
|
2286
|
+
'coverage', (select jsonb_build_object('collectionStartedAt', collection_started_at, 'retainedFrom', retained_from,
|
|
2287
|
+
'timezone', 'UTC', 'retentionDays', 90, 'cohortWindowDays', 90, 'activityBasis', 'accepted-heartbeat-receipt',
|
|
2288
|
+
'cohortBasis', 'first-recorded-heartbeat', 'cohortFilters', 'entry-state', 'todayIsPartial', true,
|
|
2289
|
+
'generatedAt', now(), 'windowStartedAt', window_start) from parameters)
|
|
2290
|
+
);
|
|
2291
|
+
$$;
|
|
2292
|
+
|
|
2293
|
+
commit;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# Create a server with NPX
|
|
2
2
|
|
|
3
3
|
The npm initializer is the quickest way to create a standalone copy of Expo
|
|
4
|
-
Updates Server. Node.js 20.9 or newer is required. Version 0.6.
|
|
4
|
+
Updates Server. Node.js 20.9 or newer is required. Version 0.6.2 creates a server whose `configure-app` command installs `expo-updates-server-client@0.1.0` in your Expo application.
|
|
5
5
|
|
|
6
6
|
```bash
|
|
7
|
-
npx create-expo-updates-server@0.6.
|
|
7
|
+
npx create-expo-updates-server@0.6.2 my-server
|
|
8
8
|
cd my-server
|
|
9
9
|
```
|
|
10
10
|
|
|
@@ -13,7 +13,7 @@ You can also initialize an empty current directory:
|
|
|
13
13
|
```bash
|
|
14
14
|
mkdir my-server
|
|
15
15
|
cd my-server
|
|
16
|
-
npx create-expo-updates-server@0.6.
|
|
16
|
+
npx create-expo-updates-server@0.6.2 .
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
`npx` downloads the published initializer package from npm. After it starts,
|
|
@@ -24,6 +24,21 @@
|
|
|
24
24
|
|
|
25
25
|
Официальные справочники API: [Expo Application](https://docs.expo.dev/versions/v58.0.0/sdk/application/), [Expo SecureStore](https://docs.expo.dev/versions/v58.0.0/sdk/securestore/), [дополнительные параметры Expo](https://docs.expo.dev/versions/v58.0.0/sdk/updates/#updatessetextraparamasynckey-value).
|
|
26
26
|
|
|
27
|
+
В настройках приложения можно показать первые 12 символов Device ID из SDK.
|
|
28
|
+
|
|
29
|
+
```tsx
|
|
30
|
+
import { Text } from "react-native";
|
|
31
|
+
import { useOtaUpdates } from "expo-updates-server-client";
|
|
32
|
+
|
|
33
|
+
export function SettingsDeviceId() {
|
|
34
|
+
const { deviceId } = useOtaUpdates();
|
|
35
|
+
if (!deviceId) return null;
|
|
36
|
+
return <Text selectable>Device ID · {deviceId.slice(0, 12)}</Text>;
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
После heartbeat введите этот префикс в разделе **Установки → Реестр**, откройте подходящую установку и скопируйте полный ID устройства в аудиторию релиза. Если совпадений несколько, сверьте платформу и сведения об установке. Для существующей БД примените `docs/migrations/2026-11-25-device-id-search.sql` после миграции адресной раздачи.
|
|
41
|
+
|
|
27
42
|
## Инициализация клиента {#client-initialization}
|
|
28
43
|
|
|
29
44
|
Сгенерированная точка входа автоматически вызывает `start()`, сохраняет идентификатор установки и задаёт `installation_id` / `device_id` через `Updates.setExtraParamAsync`. Сигнал активности добавляет необязательный `deviceId`. Надёжная очередь и монотонная последовательность для каждой установки не меняются. Недоступный ID устройства не останавливает телеметрию установок; доставка по устройствам при этом закрыта. После временного сбоя Keychain чтение ID на iOS повторяется без замены исходного значения.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# Создание сервера через NPX {#create-a-server-with-npx}
|
|
2
2
|
|
|
3
|
-
npm-инициализатор — самый быстрый способ создать самостоятельную копию Expo Updates Server. Требуется Node.js 20.9 или новее. Версия 0.6.
|
|
3
|
+
npm-инициализатор — самый быстрый способ создать самостоятельную копию Expo Updates Server. Требуется Node.js 20.9 или новее. Версия 0.6.2 создаёт сервер, команда `configure-app` которого устанавливает `expo-updates-server-client@0.1.0` в приложение Expo.
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
|
-
npx create-expo-updates-server@0.6.
|
|
6
|
+
npx create-expo-updates-server@0.6.2 my-server
|
|
7
7
|
cd my-server
|
|
8
8
|
```
|
|
9
9
|
|
|
@@ -12,7 +12,7 @@ cd my-server
|
|
|
12
12
|
```bash
|
|
13
13
|
mkdir my-server
|
|
14
14
|
cd my-server
|
|
15
|
-
npx create-expo-updates-server@0.6.
|
|
15
|
+
npx create-expo-updates-server@0.6.2 .
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
`npx` скачивает опубликованный пакет инициализатора из npm. После запуска сам инициализатор не делает сетевых запросов: шаблон сервера и его манифест SHA-256 включены в пакет.
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
create-expo-updates-server-v<version>
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
-
Например, для версии пакета `0.6.
|
|
43
|
+
Например, для версии пакета `0.6.2` нужен тег `create-expo-updates-server-v0.6.2`.
|
|
44
44
|
|
|
45
45
|
Workflow, запускаемый только по тегу, сверяет тег с версией пакета, повторно собирает и тестирует детерминированный шаблон и проверяет, что отмеченный коммит является предком `origin/main`. Проверка выполняется до входа в защищённое окружение `npm-publish`. Создаётся один архив релиза; именно этот артефакт передаётся заданию публикации с защитой окружением и публикуется с публичным доступом и npm provenance через OIDC. Несовпадение тега, не включённый в main коммит или несовпадение SHA рабочей копии и события блокируют публикацию.
|
|
46
46
|
|
|
@@ -24,6 +24,21 @@
|
|
|
24
24
|
|
|
25
25
|
Офіційні довідники API: [Expo Application](https://docs.expo.dev/versions/v58.0.0/sdk/application/), [Expo SecureStore](https://docs.expo.dev/versions/v58.0.0/sdk/securestore/), [додаткові параметри Expo](https://docs.expo.dev/versions/v58.0.0/sdk/updates/#updatessetextraparamasynckey-value).
|
|
26
26
|
|
|
27
|
+
У налаштуваннях застосунку можна показати перші 12 символів Device ID із SDK.
|
|
28
|
+
|
|
29
|
+
```tsx
|
|
30
|
+
import { Text } from "react-native";
|
|
31
|
+
import { useOtaUpdates } from "expo-updates-server-client";
|
|
32
|
+
|
|
33
|
+
export function SettingsDeviceId() {
|
|
34
|
+
const { deviceId } = useOtaUpdates();
|
|
35
|
+
if (!deviceId) return null;
|
|
36
|
+
return <Text selectable>Device ID · {deviceId.slice(0, 12)}</Text>;
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Після heartbeat введіть цей префікс у розділі **Встановлення → Реєстр**, відкрийте потрібне встановлення й скопіюйте повний ID пристрою до аудиторії релізу. Якщо є кілька збігів, звірте платформу та відомості про встановлення. Для наявної БД застосуйте `docs/migrations/2026-11-25-device-id-search.sql` після міграції адресної доставки.
|
|
41
|
+
|
|
27
42
|
## Ініціалізація клієнта {#client-initialization}
|
|
28
43
|
|
|
29
44
|
Згенерована точка входу автоматично викликає `start()`, зберігає ідентифікатор встановлення й задає `installation_id` / `device_id` через `Updates.setExtraParamAsync`. Сигнал активності додає необов’язковий `deviceId`. Надійна черга та монотонна послідовність для кожного встановлення не змінюються. Недоступний ID пристрою не зупиняє телеметрію встановлень; доставка за пристроями при цьому закрита. Після тимчасового збою Keychain читання ID на iOS повторюється без заміни початкового значення.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# Створення сервера через NPX {#create-a-server-with-npx}
|
|
2
2
|
|
|
3
|
-
npm-ініціалізатор — найшвидший спосіб створити самостійну копію Expo Updates Server. Потрібен Node.js 20.9 або новіший. Версія 0.6.
|
|
3
|
+
npm-ініціалізатор — найшвидший спосіб створити самостійну копію Expo Updates Server. Потрібен Node.js 20.9 або новіший. Версія 0.6.2 створює сервер, команда `configure-app` якого встановлює `expo-updates-server-client@0.1.0` у застосунок Expo.
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
|
-
npx create-expo-updates-server@0.6.
|
|
6
|
+
npx create-expo-updates-server@0.6.2 my-server
|
|
7
7
|
cd my-server
|
|
8
8
|
```
|
|
9
9
|
|
|
@@ -12,7 +12,7 @@ cd my-server
|
|
|
12
12
|
```bash
|
|
13
13
|
mkdir my-server
|
|
14
14
|
cd my-server
|
|
15
|
-
npx create-expo-updates-server@0.6.
|
|
15
|
+
npx create-expo-updates-server@0.6.2 .
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
`npx` завантажує опублікований пакет ініціалізатора з npm. Після запуску сам ініціалізатор не робить мережевих запитів: шаблон сервера та його маніфест SHA-256 включені до пакета.
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
create-expo-updates-server-v<version>
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
-
Наприклад, для версії пакета `0.6.
|
|
43
|
+
Наприклад, для версії пакета `0.6.2` потрібен тег `create-expo-updates-server-v0.6.2`.
|
|
44
44
|
|
|
45
45
|
Workflow, що запускається лише за тегом, звіряє тег із версією пакета, повторно збирає й тестує детермінований шаблон і перевіряє, що позначений коміт є предком `origin/main`. Перевірка виконується до входу в захищене оточення `npm-publish`. Створюється один архів релізу; саме цей артефакт передається завданню публікації із захистом оточенням і публікується з публічним доступом та npm provenance через OIDC. Невідповідність тега, не включений до main коміт або невідповідність SHA робочої копії та події блокують публікацію.
|
|
46
46
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export const installationIdPattern =
|
|
2
2
|
/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;
|
|
3
|
+
export const registryIdSearchPattern = /^(?:[a-f0-9-]{1,36}|[a-f0-9]{1,64})$/i;
|
|
3
4
|
export const deviceIdPattern = /^[0-9a-f]{64}$/;
|
|
4
5
|
export const maxIdsPerKind = 100;
|
|
@@ -24,6 +24,8 @@ assert.ok(schema.includes(favoritesMigration.trim()), 'Canonical favorites SQL m
|
|
|
24
24
|
assert.ok(schema.includes(historyMigration.trim()), 'Canonical public distribution SQL must match migration');
|
|
25
25
|
assert.ok(schema.includes(targetingMigration.trim()), 'Canonical targeting SQL must match migration');
|
|
26
26
|
assert.ok(schema.includes(activationMigration.trim()), 'Canonical activation SQL must match migration');
|
|
27
|
+
const searchMigration = readFileSync(new URL('../../docs/migrations/2026-11-25-device-id-search.sql', import.meta.url), 'utf8');
|
|
28
|
+
assert.ok(schema.includes(searchMigration.trim()), 'Canonical Device ID search SQL must match migration');
|
|
27
29
|
const marker = '-- Daily device analytics (2026-10-22).';
|
|
28
30
|
assert.ok(schema.includes(marker), 'Canonical schema must contain the analytics migration marker');
|
|
29
31
|
assert.ok(schema.split(marker)[1].trimStart().startsWith(migration.trim()), 'Canonical analytics SQL must match the standalone migration');
|
|
@@ -67,6 +69,8 @@ try {
|
|
|
67
69
|
await pool.query(targetingMigration);
|
|
68
70
|
await pool.query(activationMigration);
|
|
69
71
|
await pool.query(activationMigration);
|
|
72
|
+
await pool.query(searchMigration);
|
|
73
|
+
await pool.query(searchMigration);
|
|
70
74
|
await pool.query(favoritesMigration);
|
|
71
75
|
await pool.query(historyMigration);
|
|
72
76
|
await pool.query(historyMigration);
|
|
@@ -33,7 +33,8 @@ try {
|
|
|
33
33
|
assert.equal(empty.activity.at(-1).activeInstallations, 0);
|
|
34
34
|
assert.equal(empty.activity[0].activeInstallations, null, 'Do not manufacture activity before collection');
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
const deviceId = 'a7b8c9d0e1f2' + '3'.repeat(52);
|
|
37
|
+
assert.equal(await send({ deviceId }), 'accepted');
|
|
37
38
|
const first = await facts();
|
|
38
39
|
assert.equal(first.length, 1);
|
|
39
40
|
assert.equal(first[0].activity_date, empty.activity.at(-1).date, 'Use receipt UTC day, not client timestamp');
|
|
@@ -68,6 +69,14 @@ try {
|
|
|
68
69
|
await pool.query("update ota_device_state set first_seen_at=now()-interval '50 days' where installation_id=$1", [ids[1]]);
|
|
69
70
|
await send({ installationId: ids[1], sequence: 2, eventId: randomUUID() });
|
|
70
71
|
assert.equal((await facts(ids[1])).length, 1);
|
|
72
|
+
for (const search of [deviceId, deviceId.slice(0, 12).toUpperCase()]) {
|
|
73
|
+
const matches = await report({ search });
|
|
74
|
+
assert.deepEqual(matches.devices.map(d => d.device_id), [deviceId]);
|
|
75
|
+
assert.equal(matches.total, 1);
|
|
76
|
+
assert.equal(matches.activity.at(-1).activeInstallations, 1);
|
|
77
|
+
assert.equal(matches.cohorts[0].installations, 1);
|
|
78
|
+
assert.equal((await report({ search, platform: 'ios' })).total, 0);
|
|
79
|
+
}
|
|
71
80
|
assert.equal((await pool.query('select count(*)::int as n from ota_device_activity_cohorts where installation_id=$1', [ids[1]])).rows[0].n, 0);
|
|
72
81
|
assert.equal((await report()).adoptionCohorts.reduce((sum, c) => sum + c.installations, 0), 2);
|
|
73
82
|
|
|
@@ -7,6 +7,7 @@ export async function exerciseInstallations(page) {
|
|
|
7
7
|
const origin = new URL(page.url()).origin;
|
|
8
8
|
const runtime = "browser-installations";
|
|
9
9
|
const id = randomUUID();
|
|
10
|
+
const deviceId = "123456789abc" + "f".repeat(52);
|
|
10
11
|
for (const [installationId, channel, nativeBuild] of [
|
|
11
12
|
[id, "analytics-ios", "12"],
|
|
12
13
|
[randomUUID(), "analytics-ios", "13"],
|
|
@@ -15,6 +16,7 @@ export async function exerciseInstallations(page) {
|
|
|
15
16
|
const response = await page.request.post(origin + "/api/device-heartbeat", {
|
|
16
17
|
data: {
|
|
17
18
|
installationId,
|
|
19
|
+
...(installationId === id ? { deviceId } : {}),
|
|
18
20
|
eventId: randomUUID(),
|
|
19
21
|
sequence: 1,
|
|
20
22
|
observedAt: new Date().toISOString(),
|
|
@@ -84,14 +86,18 @@ export async function exerciseInstallations(page) {
|
|
|
84
86
|
const detailsButton = page.getByRole("button", {
|
|
85
87
|
name: "Installation details " + id,
|
|
86
88
|
});
|
|
89
|
+
const search = page.getByLabel("Device ID / Installation ID", { exact: true });
|
|
90
|
+
await search.fill(deviceId.slice(0, 12));
|
|
91
|
+
await expect(page.getByRole("table", { name: "Installation registry" }).getByRole("row")).toHaveCount(2);
|
|
87
92
|
await detailsButton.click();
|
|
88
93
|
const sheet = page.getByRole("dialog", { name: "Installation details" });
|
|
89
94
|
await expect(sheet.getByText(id, { exact: true })).toBeVisible();
|
|
95
|
+
await expect(sheet.getByText(deviceId, { exact: true })).toBeVisible();
|
|
90
96
|
await page.keyboard.press("Escape");
|
|
91
97
|
await expect(sheet).toBeHidden();
|
|
92
98
|
await expect(detailsButton).toBeFocused();
|
|
93
99
|
|
|
94
|
-
await
|
|
100
|
+
await search.fill(randomUUID());
|
|
95
101
|
await expect(
|
|
96
102
|
page.getByText("No installations found", { exact: true }),
|
|
97
103
|
).toBeVisible();
|
|
@@ -146,6 +146,11 @@ export function Registry({
|
|
|
146
146
|
{d.installation_id.slice(0, 8)}…
|
|
147
147
|
{d.installation_id.slice(-4)}
|
|
148
148
|
</Button>
|
|
149
|
+
{d.device_id && (
|
|
150
|
+
<p className="font-mono text-xs text-muted-foreground">
|
|
151
|
+
{t("Device ID")} · {d.device_id.slice(0, 12)}
|
|
152
|
+
</p>
|
|
153
|
+
)}
|
|
149
154
|
<p className="mt-1 text-xs text-muted-foreground">
|
|
150
155
|
{t("С ")}
|
|
151
156
|
{calendarDate(d.first_seen_at)}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
+
import { registryIdSearchPattern } from "@/lib/audience-ids";
|
|
3
4
|
import { useFilteredResults } from "@/src/client/use-filtered-results";
|
|
4
5
|
import type { DevicesReport } from "@/src/server/devices/report-types";
|
|
5
6
|
export type Filters = {
|
|
@@ -24,8 +25,8 @@ async function loadReport(
|
|
|
24
25
|
query: typeof initialQuery,
|
|
25
26
|
signal: AbortSignal,
|
|
26
27
|
): Promise<DevicesReport> {
|
|
27
|
-
if (
|
|
28
|
-
throw new Error("
|
|
28
|
+
if (query.search.trim() && !registryIdSearchPattern.test(query.search.trim()))
|
|
29
|
+
throw new Error("Enter a Device ID prefix or part of an Installation ID");
|
|
29
30
|
|
|
30
31
|
const params = new URLSearchParams();
|
|
31
32
|
for (const [key, value] of Object.entries(query)) {
|
|
@@ -177,7 +177,8 @@
|
|
|
177
177
|
"Все runtime": "All runtimes",
|
|
178
178
|
"Все типы": "All launch types",
|
|
179
179
|
"ID или часть ID": "ID or part of an ID",
|
|
180
|
-
"
|
|
180
|
+
"Enter a Device ID prefix or part of an Installation ID": "Enter a Device ID prefix or part of an Installation ID",
|
|
181
|
+
"Device ID / Installation ID": "Device ID / Installation ID",
|
|
181
182
|
"Применить": "Apply",
|
|
182
183
|
"Сбросить": "Reset",
|
|
183
184
|
"Есть неприменённые изменения": "There are unapplied changes",
|
|
@@ -177,7 +177,8 @@
|
|
|
177
177
|
"Все runtime": "Все runtime",
|
|
178
178
|
"Все типы": "Все типы",
|
|
179
179
|
"ID или часть ID": "ID или часть ID",
|
|
180
|
-
"
|
|
180
|
+
"Enter a Device ID prefix or part of an Installation ID": "Введите начало ID устройства или часть ID установки",
|
|
181
|
+
"Device ID / Installation ID": "ID устройства / ID установки",
|
|
181
182
|
"Применить": "Применить",
|
|
182
183
|
"Сбросить": "Сбросить",
|
|
183
184
|
"Есть неприменённые изменения": "Есть неприменённые изменения",
|
|
@@ -177,7 +177,8 @@
|
|
|
177
177
|
"Все runtime": "Усі runtime",
|
|
178
178
|
"Все типы": "Усі типи",
|
|
179
179
|
"ID или часть ID": "ID або частина ID",
|
|
180
|
-
"
|
|
180
|
+
"Enter a Device ID prefix or part of an Installation ID": "Введіть початок ID пристрою або частину ID встановлення",
|
|
181
|
+
"Device ID / Installation ID": "ID пристрою / ID встановлення",
|
|
181
182
|
"Применить": "Застосувати",
|
|
182
183
|
"Сбросить": "Скинути",
|
|
183
184
|
"Есть неприменённые изменения": "Є незастосовані зміни",
|
|
@@ -14,10 +14,14 @@ describe("device analytics filters", () => {
|
|
|
14
14
|
expect(rpc).toHaveBeenCalledWith("ota_devices_report_v2", filters);
|
|
15
15
|
});
|
|
16
16
|
|
|
17
|
-
it.each(["days=7&days=30", "platform=ios&platform=android", "launchKind=all", "search=%25", "search=abcdef_", `search=${"a".repeat(
|
|
17
|
+
it.each(["days=7&days=30", "platform=ios&platform=android", "launchKind=all", "search=%25", "search=abcdef_", `search=${"a".repeat(65)}`, "search=%00", "runtime=%09", "offset=Infinity"])("rejects invalid or nonscalar filters: %s", (query) => {
|
|
18
18
|
expect(() => parseDeviceFilters(new URLSearchParams(query))).toThrow("Invalid filters");
|
|
19
19
|
});
|
|
20
20
|
|
|
21
|
+
it("accepts a full Device ID copied from the registry", () => {
|
|
22
|
+
expect(parseDeviceFilters(new URLSearchParams({ search: "AB".repeat(32) })).p_search).toBe("ab".repeat(32));
|
|
23
|
+
});
|
|
24
|
+
|
|
21
25
|
it("keeps empty optional controls unfiltered", () => {
|
|
22
26
|
expect(parseDeviceFilters(new URLSearchParams("launchKind=&search=%20%20"))).toMatchObject({ p_launch_kind: null, p_search: null });
|
|
23
27
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { registryIdSearchPattern } from "@/lib/audience-ids";
|
|
1
2
|
import { supabase } from "../lib/supabase.js";
|
|
2
3
|
import type { DevicesReport } from "./report-types";
|
|
3
4
|
|
|
@@ -17,7 +18,7 @@ export function parseDeviceFilters(params: URLSearchParams) {
|
|
|
17
18
|
(channel !== null && (channel.length > 64 || !/^[a-z0-9][a-z0-9._-]*$/.test(channel))) ||
|
|
18
19
|
(runtime !== null && (runtime.length > 100 || runtime.trim() !== runtime || /[\x00-\x1f\x7f]/.test(runtime))) ||
|
|
19
20
|
(launchKind !== null && !["ota", "embedded", "unknown"].includes(launchKind)) ||
|
|
20
|
-
(search !== null &&
|
|
21
|
+
(search !== null && !registryIdSearchPattern.test(search))) throw new Error("Invalid filters");
|
|
21
22
|
return { p_days: days, p_platform: platform, p_channel: channel, p_runtime: runtime, p_offset: offset, p_launch_kind: launchKind, p_search: search };
|
|
22
23
|
}
|
|
23
24
|
export async function getDevicesReport(filters: ReturnType<typeof parseDeviceFilters>): Promise<DevicesReport> {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
|
-
"installerVersion": "0.6.
|
|
4
|
-
"sourceCommit": "
|
|
5
|
-
"totalSize":
|
|
3
|
+
"installerVersion": "0.6.2",
|
|
4
|
+
"sourceCommit": "124dd162cbf0ad62cf007f123c94b99f2e75f006",
|
|
5
|
+
"totalSize": 2666460,
|
|
6
6
|
"files": [
|
|
7
7
|
{
|
|
8
8
|
"path": ".dockerignore",
|
|
@@ -272,8 +272,8 @@
|
|
|
272
272
|
},
|
|
273
273
|
{
|
|
274
274
|
"path": "app/updates/devices/page.tsx",
|
|
275
|
-
"size":
|
|
276
|
-
"sha256": "
|
|
275
|
+
"size": 11076,
|
|
276
|
+
"sha256": "32c3eba0a38ad928ce3332a37e1b05e71e842297d232f9d82afc66f255b3775c"
|
|
277
277
|
},
|
|
278
278
|
{
|
|
279
279
|
"path": "app/updates/embedded/page.tsx",
|
|
@@ -517,8 +517,8 @@
|
|
|
517
517
|
},
|
|
518
518
|
{
|
|
519
519
|
"path": "docs/device-targeting.md",
|
|
520
|
-
"size":
|
|
521
|
-
"sha256": "
|
|
520
|
+
"size": 9127,
|
|
521
|
+
"sha256": "c9f028bbc55391c6d96b6d8c4b5122d5c4a6c348a67c3f2b63a9e80eab0011db"
|
|
522
522
|
},
|
|
523
523
|
{
|
|
524
524
|
"path": "docs/doctor.md",
|
|
@@ -533,7 +533,7 @@
|
|
|
533
533
|
{
|
|
534
534
|
"path": "docs/getting-started.md",
|
|
535
535
|
"size": 15135,
|
|
536
|
-
"sha256": "
|
|
536
|
+
"sha256": "1530cbd718d9797c9460c0530f6e3f295e3dd60e23ac78f84c177fa0d51f54b9"
|
|
537
537
|
},
|
|
538
538
|
{
|
|
539
539
|
"path": "docs/getting-started.ru.md",
|
|
@@ -615,6 +615,11 @@
|
|
|
615
615
|
"size": 2756,
|
|
616
616
|
"sha256": "117bb6f645e7eba4332bd6c0480e2a1f320c3ebe056dee08b1b298314eda2708"
|
|
617
617
|
},
|
|
618
|
+
{
|
|
619
|
+
"path": "docs/migrations/2026-11-25-device-id-search.sql",
|
|
620
|
+
"size": 10483,
|
|
621
|
+
"sha256": "879fa117d1d5bb54461d3c103cd3faf28e85de35d09b4e63380c99cd952c65df"
|
|
622
|
+
},
|
|
618
623
|
{
|
|
619
624
|
"path": "docs/migrations/2026-11-25-download-on-postpone.sql",
|
|
620
625
|
"size": 280,
|
|
@@ -627,13 +632,13 @@
|
|
|
627
632
|
},
|
|
628
633
|
{
|
|
629
634
|
"path": "docs/migrations/schema.sql",
|
|
630
|
-
"size":
|
|
631
|
-
"sha256": "
|
|
635
|
+
"size": 111468,
|
|
636
|
+
"sha256": "4f7dc07a85a96146ca0ace49bfac0a806ee67edf71feace89d7b5c0f2b9b17fc"
|
|
632
637
|
},
|
|
633
638
|
{
|
|
634
639
|
"path": "docs/npm-installer.md",
|
|
635
640
|
"size": 5388,
|
|
636
|
-
"sha256": "
|
|
641
|
+
"sha256": "2b43ef183c1b636d3c986d1c323cc69bdeeb491529b6cd1e825186efdf9954b3"
|
|
637
642
|
},
|
|
638
643
|
{
|
|
639
644
|
"path": "docs/operations-guide.md",
|
|
@@ -662,8 +667,8 @@
|
|
|
662
667
|
},
|
|
663
668
|
{
|
|
664
669
|
"path": "docs/ru/device-targeting.md",
|
|
665
|
-
"size":
|
|
666
|
-
"sha256": "
|
|
670
|
+
"size": 16281,
|
|
671
|
+
"sha256": "5ff3fbda6ba0ab74670cfc03b923e4026916c69aee38b533fa50b2f37b940346"
|
|
667
672
|
},
|
|
668
673
|
{
|
|
669
674
|
"path": "docs/ru/doctor.md",
|
|
@@ -678,7 +683,7 @@
|
|
|
678
683
|
{
|
|
679
684
|
"path": "docs/ru/getting-started.md",
|
|
680
685
|
"size": 23875,
|
|
681
|
-
"sha256": "
|
|
686
|
+
"sha256": "6f4f6f43aab244a08dff86adfa94b54e6162607419d71ce1e66e762d05ee6bc7"
|
|
682
687
|
},
|
|
683
688
|
{
|
|
684
689
|
"path": "docs/ru/index.md",
|
|
@@ -693,7 +698,7 @@
|
|
|
693
698
|
{
|
|
694
699
|
"path": "docs/ru/npm-installer.md",
|
|
695
700
|
"size": 8937,
|
|
696
|
-
"sha256": "
|
|
701
|
+
"sha256": "9727d93be51ac222edd83229f9d18abae0f47ebbd55664a51a9f1640691ee010"
|
|
697
702
|
},
|
|
698
703
|
{
|
|
699
704
|
"path": "docs/ru/operations-guide.md",
|
|
@@ -718,7 +723,7 @@
|
|
|
718
723
|
{
|
|
719
724
|
"path": "docs/ru/publishing-npm-installer.md",
|
|
720
725
|
"size": 6156,
|
|
721
|
-
"sha256": "
|
|
726
|
+
"sha256": "9ba15be29f1cb07a6f7ab30b735f7ad411b5ece2081d706c80c0155bc087c287"
|
|
722
727
|
},
|
|
723
728
|
{
|
|
724
729
|
"path": "docs/ru/supabase-setup.md",
|
|
@@ -737,8 +742,8 @@
|
|
|
737
742
|
},
|
|
738
743
|
{
|
|
739
744
|
"path": "docs/uk/device-targeting.md",
|
|
740
|
-
"size":
|
|
741
|
-
"sha256": "
|
|
745
|
+
"size": 16005,
|
|
746
|
+
"sha256": "0b7e5dbda38a4bdbb90c9a21163ce0b0e7d8b92f5d36064061dd3d8cd951dc0a"
|
|
742
747
|
},
|
|
743
748
|
{
|
|
744
749
|
"path": "docs/uk/doctor.md",
|
|
@@ -753,7 +758,7 @@
|
|
|
753
758
|
{
|
|
754
759
|
"path": "docs/uk/getting-started.md",
|
|
755
760
|
"size": 23906,
|
|
756
|
-
"sha256": "
|
|
761
|
+
"sha256": "fe19bb15e79f1bcca70e4de478262293d4d5c288d368986a6395371f2ca6b1f9"
|
|
757
762
|
},
|
|
758
763
|
{
|
|
759
764
|
"path": "docs/uk/index.md",
|
|
@@ -768,7 +773,7 @@
|
|
|
768
773
|
{
|
|
769
774
|
"path": "docs/uk/npm-installer.md",
|
|
770
775
|
"size": 8814,
|
|
771
|
-
"sha256": "
|
|
776
|
+
"sha256": "1d8b6a431da085c105aaf279f600f8d1ecb8d414e60db12bde82bc2b0e71c33a"
|
|
772
777
|
},
|
|
773
778
|
{
|
|
774
779
|
"path": "docs/uk/operations-guide.md",
|
|
@@ -793,7 +798,7 @@
|
|
|
793
798
|
{
|
|
794
799
|
"path": "docs/uk/publishing-npm-installer.md",
|
|
795
800
|
"size": 6144,
|
|
796
|
-
"sha256": "
|
|
801
|
+
"sha256": "346de788d0031c5589470fa6a597f7a52969646e8f4847d17a5f8212b2e5ee5c"
|
|
797
802
|
},
|
|
798
803
|
{
|
|
799
804
|
"path": "docs/uk/supabase-setup.md",
|
|
@@ -812,8 +817,8 @@
|
|
|
812
817
|
},
|
|
813
818
|
{
|
|
814
819
|
"path": "lib/audience-ids.ts",
|
|
815
|
-
"size":
|
|
816
|
-
"sha256": "
|
|
820
|
+
"size": 279,
|
|
821
|
+
"sha256": "31e4c113a2ed48c5ffd031f20b52b50719ba978e03277a03a050d3c761e1037e"
|
|
817
822
|
},
|
|
818
823
|
{
|
|
819
824
|
"path": "lib/utils.ts",
|
|
@@ -873,7 +878,7 @@
|
|
|
873
878
|
{
|
|
874
879
|
"path": "README.md",
|
|
875
880
|
"size": 3737,
|
|
876
|
-
"sha256": "
|
|
881
|
+
"sha256": "7b4238e49f2aa89d2b32d1c0f97f3cc728fe79474fdd86d1953c992f0d67a5f3"
|
|
877
882
|
},
|
|
878
883
|
{
|
|
879
884
|
"path": "scripts/configure-expo-app.mjs",
|
|
@@ -997,13 +1002,13 @@
|
|
|
997
1002
|
},
|
|
998
1003
|
{
|
|
999
1004
|
"path": "scripts/tests/device-analytics-migrations.mjs",
|
|
1000
|
-
"size":
|
|
1001
|
-
"sha256": "
|
|
1005
|
+
"size": 6870,
|
|
1006
|
+
"sha256": "7f3fb1ea0d3f2b14de3c8b0d0bf44ae7a1b88bfa23490522aa300ddae212ed5c"
|
|
1002
1007
|
},
|
|
1003
1008
|
{
|
|
1004
1009
|
"path": "scripts/tests/device-analytics.mjs",
|
|
1005
|
-
"size":
|
|
1006
|
-
"sha256": "
|
|
1010
|
+
"size": 9751,
|
|
1011
|
+
"sha256": "263e144b463b40ee939fe654f66c3c1feba677b9b4c02d81db7af1a21616a456"
|
|
1007
1012
|
},
|
|
1008
1013
|
{
|
|
1009
1014
|
"path": "scripts/tests/device-heartbeat.mjs",
|
|
@@ -1057,8 +1062,8 @@
|
|
|
1057
1062
|
},
|
|
1058
1063
|
{
|
|
1059
1064
|
"path": "scripts/tests/e2e/installations.mjs",
|
|
1060
|
-
"size":
|
|
1061
|
-
"sha256": "
|
|
1065
|
+
"size": 5240,
|
|
1066
|
+
"sha256": "eabf59a5e8fa5dd4b877dee1b13e8a2496b6dfb0d53184837817f94288518ead"
|
|
1062
1067
|
},
|
|
1063
1068
|
{
|
|
1064
1069
|
"path": "scripts/tests/e2e/policy.mjs",
|
|
@@ -1137,8 +1142,8 @@
|
|
|
1137
1142
|
},
|
|
1138
1143
|
{
|
|
1139
1144
|
"path": "src/client/devices/registry.tsx",
|
|
1140
|
-
"size":
|
|
1141
|
-
"sha256": "
|
|
1145
|
+
"size": 16235,
|
|
1146
|
+
"sha256": "01377194743e65a2ab8967ee58b15580574166dd21ecccb843ea9935dbe15e4f"
|
|
1142
1147
|
},
|
|
1143
1148
|
{
|
|
1144
1149
|
"path": "src/client/devices/use-devices-report.test.tsx",
|
|
@@ -1147,8 +1152,8 @@
|
|
|
1147
1152
|
},
|
|
1148
1153
|
{
|
|
1149
1154
|
"path": "src/client/devices/use-devices-report.ts",
|
|
1150
|
-
"size":
|
|
1151
|
-
"sha256": "
|
|
1155
|
+
"size": 2390,
|
|
1156
|
+
"sha256": "7774f02260bd1ae9273046ed3ee4c5e7aefe516994ea0a248553f84e36879fe7"
|
|
1152
1157
|
},
|
|
1153
1158
|
{
|
|
1154
1159
|
"path": "src/client/devices/version-adoption-chart.tsx",
|
|
@@ -1202,8 +1207,8 @@
|
|
|
1202
1207
|
},
|
|
1203
1208
|
{
|
|
1204
1209
|
"path": "src/client/i18n/en.json",
|
|
1205
|
-
"size":
|
|
1206
|
-
"sha256": "
|
|
1210
|
+
"size": 47913,
|
|
1211
|
+
"sha256": "dc7ac5715e7455203dadb94c0da28af4cb59e3f1968f95e0e89f8101fa824d0b"
|
|
1207
1212
|
},
|
|
1208
1213
|
{
|
|
1209
1214
|
"path": "src/client/i18n/language-switching.test.tsx",
|
|
@@ -1227,13 +1232,13 @@
|
|
|
1227
1232
|
},
|
|
1228
1233
|
{
|
|
1229
1234
|
"path": "src/client/i18n/ru.json",
|
|
1230
|
-
"size":
|
|
1231
|
-
"sha256": "
|
|
1235
|
+
"size": 66486,
|
|
1236
|
+
"sha256": "828b8cee031f17aff46795ab1b347d48532e8718603c84e9358748d6568578ac"
|
|
1232
1237
|
},
|
|
1233
1238
|
{
|
|
1234
1239
|
"path": "src/client/i18n/uk.json",
|
|
1235
|
-
"size":
|
|
1236
|
-
"sha256": "
|
|
1240
|
+
"size": 65925,
|
|
1241
|
+
"sha256": "fffe01bfff752c4287d49bac8123cf8cdce94c1a7d9e4141448119a679315ee6"
|
|
1237
1242
|
},
|
|
1238
1243
|
{
|
|
1239
1244
|
"path": "src/client/i18n/use-formatters.ts",
|
|
@@ -1322,13 +1327,13 @@
|
|
|
1322
1327
|
},
|
|
1323
1328
|
{
|
|
1324
1329
|
"path": "src/server/devices/report.test.ts",
|
|
1325
|
-
"size":
|
|
1326
|
-
"sha256": "
|
|
1330
|
+
"size": 1947,
|
|
1331
|
+
"sha256": "dd4bba384cde147ec2468b3a8a64f2df1bc8d43e789380b1347f75cb489604ff"
|
|
1327
1332
|
},
|
|
1328
1333
|
{
|
|
1329
1334
|
"path": "src/server/devices/report.ts",
|
|
1330
|
-
"size":
|
|
1331
|
-
"sha256": "
|
|
1335
|
+
"size": 1826,
|
|
1336
|
+
"sha256": "b461ae193fb39ea18706f0f24eb63163acb8a71f0c612c4c691e6998ee799404"
|
|
1332
1337
|
},
|
|
1333
1338
|
{
|
|
1334
1339
|
"path": "src/server/lib/admin-access-tokens.ts",
|