create-expo-updates-server 0.4.0 → 0.6.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 (175) hide show
  1. package/README.md +4 -2
  2. package/dist/template/Dockerfile +4 -6
  3. package/dist/template/README.md +4 -9
  4. package/dist/template/app/api/admin/device-favorites/route.test.ts +125 -0
  5. package/dist/template/app/api/admin/device-favorites/route.ts +91 -0
  6. package/dist/template/app/api/admin/distribution-history/restore/route.ts +39 -0
  7. package/dist/template/app/api/admin/distribution-history/route.test.ts +55 -0
  8. package/dist/template/app/api/admin/distribution-history/route.ts +24 -0
  9. package/dist/template/app/api/admin/updates/[encodedKey]/deactivate/route.ts +2 -1
  10. package/dist/template/app/api/admin/updates/[encodedKey]/promote/route.ts +2 -1
  11. package/dist/template/app/api/admin/updates/[encodedKey]/rollback/route.ts +2 -1
  12. package/dist/template/app/api/admin/updates/[encodedKey]/route.ts +2 -1
  13. package/dist/template/app/api/admin/updates/route.test.ts +21 -0
  14. package/dist/template/app/api/admin/updates/route.ts +12 -1
  15. package/dist/template/app/globals.css +65 -68
  16. package/dist/template/app/login/page.tsx +66 -42
  17. package/dist/template/app/updates/[encodedKey]/page.tsx +375 -263
  18. package/dist/template/app/updates/devices/page.tsx +188 -152
  19. package/dist/template/app/updates/embedded/page.tsx +63 -29
  20. package/dist/template/app/updates/emergency-redirects/page.tsx +93 -58
  21. package/dist/template/app/updates/layout.tsx +2 -1
  22. package/dist/template/app/updates/page.tsx +381 -283
  23. package/dist/template/app/updates/releases.test.tsx +156 -0
  24. package/dist/template/components/admin/admin-role.ts +5 -0
  25. package/dist/template/components/admin/admin-shell.tsx +166 -101
  26. package/dist/template/components/admin/confirm-action.tsx +123 -0
  27. package/dist/template/components/admin/language-switcher.tsx +25 -17
  28. package/dist/template/components/admin/release-badges.test.tsx +50 -0
  29. package/dist/template/components/admin/release-badges.tsx +101 -0
  30. package/dist/template/components/ui/alert.tsx +10 -3
  31. package/dist/template/components/ui/avatar.tsx +108 -0
  32. package/dist/template/components/ui/badge.tsx +2 -2
  33. package/dist/template/components/ui/breadcrumb.tsx +108 -0
  34. package/dist/template/components/ui/button.tsx +5 -5
  35. package/dist/template/components/ui/card.tsx +2 -2
  36. package/dist/template/components/ui/chart.tsx +1 -1
  37. package/dist/template/components/ui/collapsible.tsx +7 -0
  38. package/dist/template/components/ui/empty.tsx +103 -0
  39. package/dist/template/components/ui/field.tsx +248 -0
  40. package/dist/template/components/ui/input-group.tsx +170 -0
  41. package/dist/template/components/ui/input.tsx +1 -1
  42. package/dist/template/components/ui/native-select.tsx +1 -1
  43. package/dist/template/components/ui/radio-group.tsx +41 -0
  44. package/dist/template/components/ui/status-tones.ts +15 -0
  45. package/dist/template/components/ui/table.tsx +1 -1
  46. package/dist/template/components/ui/textarea.tsx +1 -1
  47. package/dist/template/docs/admin-ui.md +7 -3
  48. package/dist/template/docs/device-targeting.md +2 -7
  49. package/dist/template/docs/doctor.md +2 -2
  50. package/dist/template/docs/expo-app-setup.md +9 -27
  51. package/dist/template/docs/getting-started.md +3 -4
  52. package/dist/template/docs/installation-telemetry.md +2 -8
  53. package/dist/template/docs/migrations/2026-10-16-manifest-identity.sql +5 -0
  54. package/dist/template/docs/migrations/2026-11-25-device-favorites.sql +53 -0
  55. package/dist/template/docs/migrations/2026-11-25-download-on-postpone.sql +5 -0
  56. package/dist/template/docs/migrations/2026-11-25-public-distribution-history.sql +283 -0
  57. package/dist/template/docs/migrations/schema.sql +349 -0
  58. package/dist/template/docs/npm-installer.md +3 -3
  59. package/dist/template/docs/operations-guide.md +8 -6
  60. package/dist/template/docs/ota-client-lifecycle.md +30 -68
  61. package/dist/template/docs/ota-update-policy.md +9 -20
  62. package/dist/template/docs/ru/admin-ui.md +7 -3
  63. package/dist/template/docs/ru/device-targeting.md +2 -2
  64. package/dist/template/docs/ru/doctor.md +2 -2
  65. package/dist/template/docs/ru/expo-app-setup.md +9 -9
  66. package/dist/template/docs/ru/getting-started.md +3 -3
  67. package/dist/template/docs/ru/installation-telemetry.md +2 -2
  68. package/dist/template/docs/ru/npm-installer.md +3 -3
  69. package/dist/template/docs/ru/operations-guide.md +8 -3
  70. package/dist/template/docs/ru/ota-client-lifecycle.md +30 -35
  71. package/dist/template/docs/ru/ota-update-policy.md +9 -7
  72. package/dist/template/docs/ru/publishing-npm-installer.md +2 -2
  73. package/dist/template/docs/uk/admin-ui.md +7 -3
  74. package/dist/template/docs/uk/device-targeting.md +2 -2
  75. package/dist/template/docs/uk/doctor.md +2 -2
  76. package/dist/template/docs/uk/expo-app-setup.md +9 -9
  77. package/dist/template/docs/uk/getting-started.md +3 -3
  78. package/dist/template/docs/uk/installation-telemetry.md +2 -2
  79. package/dist/template/docs/uk/npm-installer.md +3 -3
  80. package/dist/template/docs/uk/operations-guide.md +8 -3
  81. package/dist/template/docs/uk/ota-client-lifecycle.md +30 -35
  82. package/dist/template/docs/uk/ota-update-policy.md +9 -7
  83. package/dist/template/docs/uk/publishing-npm-installer.md +2 -2
  84. package/dist/template/lib/audience-ids.ts +4 -0
  85. package/dist/template/package-lock.json +46 -0
  86. package/dist/template/package.json +3 -1
  87. package/dist/template/scripts/configure-expo-app.mjs +3 -3
  88. package/dist/template/scripts/create-access-token.mjs +1 -1
  89. package/dist/template/scripts/lib/doctor.mjs +10 -7
  90. package/dist/template/scripts/lib/doctor.test.mjs +7 -5
  91. package/dist/template/scripts/lib/embedded-update-registrar.test.ts +22 -7
  92. package/dist/template/scripts/lib/expo-app-configurator.mjs +25 -22
  93. package/dist/template/scripts/lib/expo-app-configurator.test.ts +37 -2
  94. package/dist/template/scripts/lib/ota-client-configurator.mjs +152 -55
  95. package/dist/template/scripts/lib/ota-client-configurator.test.ts +60 -20
  96. package/dist/template/scripts/lib/ota-client-package.mjs +25 -0
  97. package/dist/template/scripts/lib/ota-root-hook-patcher.mjs +90 -32
  98. package/dist/template/scripts/lib/ota-root-hook-patcher.test.ts +49 -6
  99. package/dist/template/scripts/tests/device-analytics-migrations.mjs +12 -1
  100. package/dist/template/scripts/tests/device-targeting-activation.mjs +2 -3
  101. package/dist/template/scripts/tests/e2e/client-lifecycle.mjs +161 -0
  102. package/dist/template/scripts/tests/e2e/client-lifecycle.scenario.jsx +465 -0
  103. package/dist/template/scripts/tests/e2e/client-vitest.mts +18 -0
  104. package/dist/template/scripts/tests/e2e/console.mjs +86 -0
  105. package/dist/template/scripts/tests/e2e/delivery.mjs +296 -0
  106. package/dist/template/scripts/tests/e2e/device-favorites.mjs +309 -0
  107. package/dist/template/scripts/tests/e2e/installations.mjs +132 -0
  108. package/dist/template/scripts/tests/e2e/policy.mjs +253 -0
  109. package/dist/template/scripts/tests/e2e/registrar-token.mjs +59 -0
  110. package/dist/template/scripts/tests/e2e/release-matrix.mjs +307 -0
  111. package/dist/template/scripts/tests/e2e/releases.mjs +162 -0
  112. package/dist/template/scripts/tests/e2e/run.mjs +224 -0
  113. package/dist/template/scripts/tests/manifest-identity.sql +7 -5
  114. package/dist/template/scripts/tests/public-distribution-history.mjs +102 -0
  115. package/dist/template/src/client/admin-api.ts +45 -10
  116. package/dist/template/src/client/admin-types.ts +35 -1
  117. package/dist/template/src/client/devices/analytics.tsx +168 -231
  118. package/dist/template/src/client/devices/cohorts.tsx +181 -0
  119. package/dist/template/src/client/devices/device-name.tsx +37 -23
  120. package/dist/template/src/client/devices/favorite-targets.tsx +381 -0
  121. package/dist/template/src/client/devices/registry.tsx +258 -245
  122. package/dist/template/src/client/devices/use-devices-report.test.tsx +98 -0
  123. package/dist/template/src/client/devices/use-devices-report.ts +53 -82
  124. package/dist/template/src/client/devices/version-adoption-chart.tsx +47 -49
  125. package/dist/template/src/client/distribution-control.tsx +89 -57
  126. package/dist/template/src/client/distribution-history.tsx +353 -0
  127. package/dist/template/src/client/guard-action-catalog.tsx +183 -0
  128. package/dist/template/src/client/guard-action-combobox.test.ts +16 -22
  129. package/dist/template/src/client/guard-action-combobox.tsx +133 -239
  130. package/dist/template/src/client/guard-action-options.ts +4 -6
  131. package/dist/template/src/client/i18n/en.json +133 -2
  132. package/dist/template/src/client/i18n/language-switching.test.tsx +12 -3
  133. package/dist/template/src/client/i18n/ru.json +133 -2
  134. package/dist/template/src/client/i18n/uk.json +133 -2
  135. package/dist/template/src/client/logout-button.tsx +3 -3
  136. package/dist/template/src/client/policy-draft.ts +138 -0
  137. package/dist/template/src/client/update-audience-editor.tsx +597 -206
  138. package/dist/template/src/client/update-policy-editor.test.ts +101 -29
  139. package/dist/template/src/client/update-policy-editor.tsx +454 -320
  140. package/dist/template/src/client/use-filtered-results.ts +55 -0
  141. package/dist/template/src/server/controllers/manifest.test.ts +23 -3
  142. package/dist/template/src/server/controllers/manifest.ts +15 -1
  143. package/dist/template/src/server/devices/audience.ts +9 -5
  144. package/dist/template/src/server/lib/admin-audience-activation.test.ts +37 -90
  145. package/dist/template/src/server/lib/admin-release-history.test.ts +138 -0
  146. package/dist/template/src/server/lib/admin-updates.ts +160 -534
  147. package/dist/template/src/server/lib/distribution-history.ts +97 -0
  148. package/dist/template/src/server/lib/supabase.js +24 -0
  149. package/dist/template/src/server/lib/supabase.test.ts +38 -1
  150. package/dist/template/src/server/lib/update-policy.test.ts +20 -0
  151. package/dist/template/src/server/lib/update-policy.ts +23 -10
  152. package/dist/template/src/server/manifest/manifest-repository.ts +11 -3
  153. package/dist/template/src/server/manifest/manifest-values.test.ts +2 -0
  154. package/dist/template/src/server/manifest/manifest-values.ts +21 -13
  155. package/dist/template/templates/expo-app/scripts/ota-publish/api/database-client.mjs +7 -30
  156. package/dist/template/templates/expo-app/scripts/ota-register-embedded/index.mjs +2 -1
  157. package/dist/template/tsconfig.json +2 -2
  158. package/dist/template-manifest.json +446 -301
  159. package/package.json +1 -1
  160. package/dist/template/scripts/lib/device-identity.test.ts +0 -29
  161. package/dist/template/scripts/lib/ota-client.test.ts +0 -55
  162. package/dist/template/scripts/lib/ota-update-controller.test.ts +0 -232
  163. package/dist/template/scripts/lib/ota-updates-ui.test.tsx +0 -154
  164. package/dist/template/scripts/tests/ota-client-types.mjs +0 -69
  165. package/dist/template/templates/expo-app/ota-client/README.md +0 -73
  166. package/dist/template/templates/expo-app/ota-client/controller.ts +0 -107
  167. package/dist/template/templates/expo-app/ota-client/device-identity.ts +0 -48
  168. package/dist/template/templates/expo-app/ota-client/docs/update-lifecycle.md +0 -61
  169. package/dist/template/templates/expo-app/ota-client/index.ts +0 -16
  170. package/dist/template/templates/expo-app/ota-client/model/hooks/useOtaUpdates.ts +0 -97
  171. package/dist/template/templates/expo-app/ota-client/model/update-controller.ts +0 -293
  172. package/dist/template/templates/expo-app/ota-client/runtime.ts +0 -153
  173. package/dist/template/templates/expo-app/ota-client/types.ts +0 -85
  174. package/dist/template/templates/expo-app/ota-client/ui/ota-update-gate.tsx +0 -25
  175. package/dist/template/templates/expo-app/ota-client/ui/ota-updates.tsx +0 -196
@@ -186,6 +186,9 @@ begin
186
186
  new.served_manifest_changed_at := greatest(
187
187
  clock_timestamp(),
188
188
  old.served_manifest_changed_at + interval '1 millisecond',
189
+ -- The publishing clock may be ahead of the database server.
190
+ old.latest_created_at + interval '1 millisecond',
191
+ new.latest_created_at,
189
192
  old.active_changed_at + interval '1 millisecond',
190
193
  new.active_changed_at
191
194
  );
@@ -947,6 +950,8 @@ begin
947
950
  served_manifest_changed_at = greatest(
948
951
  clock_timestamp(),
949
952
  served_manifest_changed_at + interval '1 millisecond',
953
+ latest_created_at + interval '1 millisecond',
954
+ new.created_at,
950
955
  active_changed_at + interval '1 millisecond'
951
956
  )
952
957
  where runtime_version = new.runtime_version
@@ -1673,6 +1678,60 @@ do $$ begin
1673
1678
  end $$;
1674
1679
  commit;
1675
1680
 
1681
+ -- Personal favorites for the release audience picker. Apply after device targeting.
1682
+ begin;
1683
+
1684
+ create table if not exists public.ota_device_favorites (
1685
+ user_id uuid not null references public.ota_admin_users(id) on delete cascade,
1686
+ platform text not null check (platform in ('ios', 'android')),
1687
+ target_kind text not null,
1688
+ target_id text not null,
1689
+ name text not null check (length(name) between 1 and 80 and name = btrim(name) and name !~ '[[:cntrl:]]'),
1690
+ primary key (user_id, platform, target_kind, target_id),
1691
+ check ((target_kind = 'device' and target_id ~ '^[0-9a-f]{64}$')
1692
+ or (target_kind = 'installation' and target_id ~ '^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$'))
1693
+ );
1694
+
1695
+ -- Preserve the bookmark when telemetry expires. Resolve against the full registry,
1696
+ -- including installations outside the audience picker's recent-results window.
1697
+ create or replace function public.ota_list_device_favorites(p_user uuid, p_platform text)
1698
+ returns table(target_kind text, target_id text, name text, last_seen_at timestamptz)
1699
+ language sql stable security invoker set search_path = public, pg_temp as $$
1700
+ select f.target_kind, f.target_id, f.name,
1701
+ case when f.target_kind = 'device' then (
1702
+ select max(s.last_seen_at) from public.ota_device_state s
1703
+ where s.platform = f.platform and s.device_id = f.target_id
1704
+ ) else (
1705
+ select s.last_seen_at from public.ota_device_state s
1706
+ where s.platform = f.platform and s.installation_id = f.target_id
1707
+ ) end
1708
+ from public.ota_device_favorites f
1709
+ where f.user_id = p_user and f.platform = p_platform
1710
+ order by lower(f.name), f.target_kind, f.target_id
1711
+ $$;
1712
+
1713
+ alter table public.ota_device_favorites enable row level security;
1714
+ revoke all on public.ota_device_favorites from public;
1715
+ revoke all on function public.ota_list_device_favorites(uuid, text) from public;
1716
+ do $$
1717
+ declare role_name text;
1718
+ begin
1719
+ foreach role_name in array array['anon', 'authenticated'] loop
1720
+ if exists (select from pg_roles where rolname = role_name) then
1721
+ execute format('revoke all on public.ota_device_favorites from %I', role_name);
1722
+ execute format('revoke all on function public.ota_list_device_favorites(uuid, text) from %I', role_name);
1723
+ end if;
1724
+ end loop;
1725
+ if exists (select from pg_roles where rolname = 'service_role') then
1726
+ grant select, insert, update, delete on public.ota_device_favorites to service_role;
1727
+ grant execute on function public.ota_list_device_favorites(uuid, text) to service_role;
1728
+ drop policy if exists ota_device_favorites_service on public.ota_device_favorites;
1729
+ create policy ota_device_favorites_service on public.ota_device_favorites
1730
+ to service_role using (true) with check (true);
1731
+ end if;
1732
+ end $$;
1733
+ commit;
1734
+
1676
1735
  -- Atomic audience activation and incident deactivation (2026-10-22).
1677
1736
  -- Apply after 2026-10-22-device-targeting.sql. Repeatable; no release backfill.
1678
1737
  begin;
@@ -1782,3 +1841,293 @@ $$;
1782
1841
 
1783
1842
 
1784
1843
  commit;
1844
+ -- Apply after device-targeting-activation. Safe to reapply.
1845
+ begin;
1846
+ select public.lock_ota_distribution_control();
1847
+
1848
+ -- Deletion may need multiple requests to remove remote objects. A release
1849
+ -- being removed remains available to retry cleanup, but can no longer serve.
1850
+ alter table public.ota_updates add column if not exists deletion_pending boolean not null default false;
1851
+ alter table public.ota_updates drop constraint if exists ota_deleting_update_inactive;
1852
+ alter table public.ota_updates add constraint ota_deleting_update_inactive check (not deletion_pending or not is_active);
1853
+
1854
+ -- Keep the identity of a deleted artifact: deleting the last release must not
1855
+ -- make its predecessor look like the release that an operator just stopped.
1856
+ create table if not exists public.ota_public_distribution_events (
1857
+ id bigint generated always as identity primary key,
1858
+ runtime_version text not null,
1859
+ channel text not null,
1860
+ platform text not null,
1861
+ update_id uuid not null,
1862
+ event text not null check (event in ('baseline', 'activated', 'stopped')),
1863
+ recorded_at timestamptz not null default clock_timestamp()
1864
+ );
1865
+ create index if not exists idx_public_events_scope
1866
+ on public.ota_public_distribution_events(runtime_version, channel, platform, id desc);
1867
+ alter table public.ota_public_distribution_events enable row level security;
1868
+ revoke all on public.ota_public_distribution_events from public;
1869
+
1870
+ -- Old widening semantics could leave multiple public rows active. Retain only
1871
+ -- the one the anonymous manifest selector actually preferred. Existing rows
1872
+ -- with no serving pointer could never serve an anonymous client.
1873
+ with ranked as (
1874
+ select u.update_id, c.latest_update_id is not null or c.active_update_id is not null as has_pointer,
1875
+ row_number() over (partition by u.runtime_version, u.channel, u.platform order by
1876
+ (u.update_id = c.active_update_id) desc nulls last,
1877
+ (u.update_id = c.latest_update_id) desc nulls last, u.created_at desc, u.update_id desc) as n
1878
+ from public.ota_updates u
1879
+ left join public.ota_update_channels c using (runtime_version, channel, platform)
1880
+ where u.is_active and u.audience_mode = 'all'
1881
+ )
1882
+ update public.ota_updates u set is_active=false, disabled_at=clock_timestamp(), updated_at=clock_timestamp()
1883
+ from ranked r where r.update_id=u.update_id and (r.n>1 or not r.has_pointer);
1884
+ -- A baseline observes the live public artifact. Publication timestamps, upload
1885
+ -- order and device manifests cannot establish when or to whom older builds were activated.
1886
+ insert into public.ota_public_distribution_events(runtime_version,channel,platform,update_id,event)
1887
+ select u.runtime_version,u.channel,u.platform,u.update_id,'baseline'
1888
+ from public.ota_updates u where u.is_active and u.audience_mode='all' and not exists (
1889
+ select 1 from public.ota_public_distribution_events e
1890
+ where (e.runtime_version,e.channel,e.platform)=(u.runtime_version,u.channel,u.platform)
1891
+ );
1892
+ create unique index if not exists idx_ota_one_public_release
1893
+ on public.ota_updates(runtime_version,channel,platform) where is_active and audience_mode='all';
1894
+
1895
+ create or replace function public.ota_activate_audience()
1896
+ returns trigger language plpgsql security definer set search_path=public,pg_temp as $$
1897
+ begin
1898
+ if new.is_active and new.audience_mode='all'
1899
+ and not (old.is_active and old.audience_mode='all') then
1900
+ perform public.assert_ota_distribution_mutation_allowed('starting public distribution');
1901
+ update public.ota_updates set is_active=false, disabled_at=clock_timestamp(), updated_at=clock_timestamp()
1902
+ where (runtime_version,channel,platform)=(new.runtime_version,new.channel,new.platform)
1903
+ and update_id<>new.update_id and is_active and audience_mode='all';
1904
+ end if;
1905
+ return new;
1906
+ end $$;
1907
+ drop trigger if exists trg_ota_updates_activate_audience on public.ota_updates;
1908
+ create trigger trg_ota_updates_activate_audience before update of is_active,audience_mode on public.ota_updates
1909
+ for each row execute function public.ota_activate_audience();
1910
+ drop trigger if exists trg_ota_history_serialize_audience on public.ota_updates;
1911
+ create trigger trg_ota_history_serialize_audience before update of audience_mode or delete on public.ota_updates
1912
+ for each statement execute function public.serialize_ota_distribution_statement();
1913
+
1914
+ -- Every upload is a draft. A legacy publisher setting true must still complete
1915
+ -- as a draft and must not retire a live release or lock the draft policy.
1916
+ create or replace function public.ota_insert_draft()
1917
+ returns trigger language plpgsql set search_path=public,pg_temp as $$
1918
+ begin
1919
+ new.is_active:=false;
1920
+ new.policy_published_at:=null;
1921
+ return new;
1922
+ end $$;
1923
+ drop trigger if exists trg_00_ota_insert_draft on public.ota_updates;
1924
+ create trigger trg_00_ota_insert_draft before insert on public.ota_updates
1925
+ for each row execute function public.ota_insert_draft();
1926
+
1927
+ create or replace function public.ota_record_public_transition()
1928
+ returns trigger language plpgsql security definer set search_path=public,pg_temp as $$
1929
+ declare was_public boolean := old.is_active and old.audience_mode='all';
1930
+ now_public boolean := false;
1931
+ begin
1932
+ if tg_op <> 'DELETE' then
1933
+ now_public:=new.is_active and new.audience_mode='all';
1934
+ -- The writer creates an empty channel. Explicit SQL activation of its first
1935
+ -- draft also needs a pointer so that an intentional stop can stay fail-closed.
1936
+ if new.is_active and not old.is_active then
1937
+ update public.ota_update_channels set latest_update_id=new.update_id,latest_created_at=new.created_at,
1938
+ latest_created_at_path=new.created_at_path
1939
+ where (runtime_version,channel,platform)=(new.runtime_version,new.channel,new.platform)
1940
+ and latest_update_id is null and active_update_id is null;
1941
+ end if;
1942
+ end if;
1943
+ if was_public is distinct from now_public then
1944
+ insert into public.ota_public_distribution_events(runtime_version,channel,platform,update_id,event)
1945
+ values(old.runtime_version,old.channel,old.platform,old.update_id,
1946
+ case when now_public then 'activated' else 'stopped' end);
1947
+ end if;
1948
+ return null;
1949
+ end $$;
1950
+ revoke all on function public.ota_record_public_transition() from public;
1951
+ drop trigger if exists trg_ota_record_public_transition on public.ota_updates;
1952
+ create trigger trg_ota_record_public_transition after update of is_active,audience_mode or delete on public.ota_updates
1953
+ for each row execute function public.ota_record_public_transition();
1954
+
1955
+ -- Pick the previous *distinct activation*, even if the last release has been
1956
+ -- stopped or deleted. Never restore a release that is currently device-only.
1957
+ create or replace view public.ota_distribution_history as
1958
+ select c.id,c.runtime_version,c.channel,c.platform,
1959
+ coalesce(latest_event.id,0)::text as revision,
1960
+ case when curr.is_active then curr.release end as current_release,
1961
+ prev.release as previous_release
1962
+ from public.ota_update_channels c
1963
+ left join lateral (
1964
+ select e.id from public.ota_public_distribution_events e
1965
+ where (e.runtime_version,e.channel,e.platform)=(c.runtime_version,c.channel,c.platform)
1966
+ order by e.id desc limit 1
1967
+ ) latest_event on true
1968
+ left join lateral (
1969
+ select e.update_id from public.ota_public_distribution_events e
1970
+ where (e.runtime_version,e.channel,e.platform)=(c.runtime_version,c.channel,c.platform)
1971
+ and e.event <> 'stopped' order by e.id desc limit 1
1972
+ ) last_activation on true
1973
+ left join lateral (
1974
+ select u.is_active, jsonb_build_object('updateId',u.update_id,'comment',u.comment,'createdAt',u.created_at,
1975
+ 'appVersion',coalesce(nullif(btrim(u.manifest#>>'{extra,expoClient,version}'),''),
1976
+ nullif(btrim(u.manifest#>>'{expoClient,version}'),'')),
1977
+ 'activatedAt',case when e.event='activated' then e.recorded_at end) as release
1978
+ from public.ota_updates u join public.ota_public_distribution_events e using(update_id,runtime_version,channel,platform)
1979
+ where u.update_id=last_activation.update_id and u.audience_mode='all' and e.event<>'stopped'
1980
+ order by e.id desc limit 1
1981
+ ) curr on true
1982
+ left join lateral (
1983
+ select jsonb_build_object('updateId',u.update_id,'comment',u.comment,'createdAt',u.created_at,
1984
+ 'appVersion',coalesce(nullif(btrim(u.manifest#>>'{extra,expoClient,version}'),''),
1985
+ nullif(btrim(u.manifest#>>'{expoClient,version}'),'')),
1986
+ 'activatedAt',case when e.event='activated' then e.recorded_at end) as release
1987
+ from public.ota_public_distribution_events e join public.ota_updates u using(update_id,runtime_version,channel,platform)
1988
+ where (e.runtime_version,e.channel,e.platform)=(c.runtime_version,c.channel,c.platform)
1989
+ and e.event<>'stopped' and u.update_id<>last_activation.update_id and u.audience_mode='all' and not u.is_active and not u.deletion_pending
1990
+ order by e.id desc limit 1
1991
+ ) prev on true;
1992
+ revoke all on public.ota_distribution_history from public;
1993
+
1994
+ -- The switch, validation, activation, public history and serving pointers use
1995
+ -- one transaction and the same lock as audience edits and publisher INSERTs.
1996
+ create or replace function public.ota_change_distribution(p_update uuid,p_action text,p_revision text default null)
1997
+ returns table(result jsonb) language plpgsql security definer set search_path=public,pg_temp as $$
1998
+ declare
1999
+ u public.ota_updates%rowtype;
2000
+ c public.ota_update_channels%rowtype;
2001
+ newest public.ota_updates%rowtype;
2002
+ serving public.ota_updates%rowtype;
2003
+ latest public.ota_updates%rowtype;
2004
+ pinned uuid;
2005
+ history public.ota_distribution_history%rowtype;
2006
+ changed_at timestamptz;
2007
+ begin
2008
+ perform public.lock_ota_distribution_control();
2009
+ if p_action is null or p_action not in ('activate','stop','restore','rollback','promote','select-latest','retire','delete') then
2010
+ raise exception 'Invalid distribution action';
2011
+ end if;
2012
+ if p_action not in ('stop','retire','delete') then
2013
+ perform public.assert_ota_distribution_mutation_allowed(p_action);
2014
+ end if;
2015
+ select * into u from public.ota_updates where update_id=p_update for update;
2016
+ if not found then raise exception 'DISTRIBUTION_CONFLICT: Release no longer exists'; end if;
2017
+ if u.deletion_pending and p_action not in ('stop','retire','delete') then
2018
+ raise exception 'DISTRIBUTION_CONFLICT: This release is being deleted';
2019
+ end if;
2020
+ insert into public.ota_update_channels(runtime_version,channel,platform)
2021
+ values(u.runtime_version,u.channel,u.platform) on conflict(runtime_version,channel,platform) do nothing;
2022
+ select * into strict c from public.ota_update_channels
2023
+ where (runtime_version,channel,platform)=(u.runtime_version,u.channel,u.platform) for update;
2024
+ select * into newest from public.ota_updates
2025
+ where (runtime_version,channel,platform)=(u.runtime_version,u.channel,u.platform)
2026
+ order by created_at desc,update_id desc limit 1;
2027
+ pinned:=c.active_update_id;
2028
+ if pinned=c.latest_update_id then pinned:=null; end if;
2029
+ if p_action='restore' then
2030
+ select * into history from public.ota_distribution_history where id=c.id;
2031
+ if p_revision is distinct from history.revision or
2032
+ p_update is distinct from (history.previous_release->>'updateId')::uuid then
2033
+ raise exception 'DISTRIBUTION_CONFLICT: Previous release changed. Refresh and try again.';
2034
+ end if;
2035
+ elsif p_action='activate' then
2036
+ if p_update<>newest.update_id or pinned is not null then
2037
+ raise exception 'DISTRIBUTION_CONFLICT: Direct activation requires the newest release and no active rollback';
2038
+ end if;
2039
+ elsif p_action='promote' then
2040
+ if pinned is null or p_update is distinct from c.latest_update_id then
2041
+ raise exception 'DISTRIBUTION_CONFLICT: Promote requires the latest release and an active rollback';
2042
+ end if;
2043
+ elsif p_action='rollback' then
2044
+ select * into serving from public.ota_updates
2045
+ where (runtime_version,channel,platform)=(u.runtime_version,u.channel,u.platform) and is_active
2046
+ and (u.audience_mode='devices' or audience_mode='all')
2047
+ order by (update_id=pinned) desc nulls last, (update_id=c.latest_update_id) desc nulls last,
2048
+ created_at desc,update_id desc limit 1;
2049
+ if serving.update_id is null or serving.created_at<=u.created_at then
2050
+ raise exception 'DISTRIBUTION_CONFLICT: Rollback requires a newer active release in this scope';
2051
+ end if;
2052
+ elsif p_action='select-latest' then
2053
+ if not u.is_active or pinned is not null then
2054
+ raise exception 'DISTRIBUTION_CONFLICT: Latest must be active and rollback must be off';
2055
+ end if;
2056
+ end if;
2057
+ changed_at:=clock_timestamp();
2058
+ if p_action in ('stop','retire','delete') then
2059
+ if u.is_active or p_action='retire' then
2060
+ update public.ota_updates set is_active=false,disabled_at=coalesce(disabled_at,changed_at),updated_at=changed_at,
2061
+ deletion_pending=deletion_pending or p_action='retire' where update_id=p_update;
2062
+ end if;
2063
+ if c.active_update_id=p_update or c.latest_update_id=p_update then
2064
+ select * into latest from public.ota_updates
2065
+ where (runtime_version,channel,platform)=(u.runtime_version,u.channel,u.platform) and is_active
2066
+ order by created_at desc,update_id desc limit 1;
2067
+ if pinned=p_update or pinned=latest.update_id then pinned:=null; end if;
2068
+ update public.ota_update_channels set latest_update_id=latest.update_id,latest_created_at=latest.created_at,
2069
+ latest_created_at_path=latest.created_at_path,active_update_id=pinned,active_changed_at=changed_at
2070
+ where id=c.id returning * into c;
2071
+ end if;
2072
+ if p_action='delete' then delete from public.ota_updates where update_id=p_update; end if;
2073
+ else
2074
+ if not u.is_active then
2075
+ update public.ota_updates set is_active=true,disabled_at=null,updated_at=changed_at,
2076
+ rolled_back_from_update_id=case when p_action='rollback' then serving.update_id else rolled_back_from_update_id end
2077
+ where update_id=p_update returning * into u;
2078
+ end if;
2079
+ latest:=u;
2080
+ pinned:=null;
2081
+ if p_action='rollback' then
2082
+ latest:=newest; pinned:=p_update;
2083
+ elsif p_action='restore' then
2084
+ -- A newer active smoke stays selected for its allowed identities. The
2085
+ -- anonymous eligibility lookup resolves the manually restored public row.
2086
+ select * into latest from public.ota_updates
2087
+ where (runtime_version,channel,platform)=(u.runtime_version,u.channel,u.platform) and is_active
2088
+ order by created_at desc,update_id desc limit 1;
2089
+ end if;
2090
+ update public.ota_update_channels set latest_update_id=latest.update_id,latest_created_at=latest.created_at,
2091
+ latest_created_at_path=latest.created_at_path,active_update_id=pinned,active_changed_at=changed_at
2092
+ where id=c.id and (latest_update_id,active_update_id) is distinct from (latest.update_id,pinned)
2093
+ returning * into c;
2094
+ if not found then
2095
+ select * into c from public.ota_update_channels where (runtime_version,channel,platform)=(u.runtime_version,u.channel,u.platform);
2096
+ end if;
2097
+ end if;
2098
+ return query select jsonb_build_object('updated',true,'disabled',p_action in ('stop','retire','delete'),
2099
+ 'state',case when p_action in ('stop','retire','delete') then 'disabled' else 'active' end,
2100
+ 'fallbackApplied',p_action in ('stop','retire','delete') and u.audience_mode='devices' and c.latest_update_id is not null,
2101
+ 'activeUpdateId',c.active_update_id,'latestUpdateId',c.latest_update_id,'activeChangedAt',c.active_changed_at,
2102
+ 'rollbackActive',c.active_update_id is not null and c.active_update_id<>c.latest_update_id,
2103
+ 'rollbackAssigned',p_action='rollback','promoted',p_action='promote',
2104
+ 'id',u.update_id,'updateId',u.update_id,'buildId',u.build_id,'runtimeVersion',u.runtime_version,
2105
+ 'platform',u.platform,'channel',u.channel,'createdAt',u.created_at,'createdAtPath',u.created_at_path,
2106
+ 'updatedAt',u.updated_at,'isActive',p_action not in ('stop','retire','delete'),'reason',p_action);
2107
+ end $$;
2108
+ revoke all on function public.ota_change_distribution(uuid,text,text) from public;
2109
+ do $$ begin
2110
+ if exists(select from pg_roles where rolname='anon') then
2111
+ revoke all on public.ota_distribution_history, public.ota_public_distribution_events from anon;
2112
+ revoke all on function public.ota_change_distribution(uuid,text,text) from anon;
2113
+ end if;
2114
+ if exists(select from pg_roles where rolname='authenticated') then
2115
+ revoke all on public.ota_distribution_history, public.ota_public_distribution_events from authenticated;
2116
+ revoke all on function public.ota_change_distribution(uuid,text,text) from authenticated;
2117
+ end if;
2118
+ if exists(select from pg_roles where rolname='service_role') then
2119
+ -- The invoker-security audience RPC checks the global stop before the
2120
+ -- trigger promotes a live smoke to public distribution.
2121
+ grant execute on function public.assert_ota_distribution_mutation_allowed(text) to service_role;
2122
+ grant select on public.ota_distribution_history to service_role;
2123
+ grant execute on function public.ota_change_distribution(uuid,text,text) to service_role;
2124
+ end if;
2125
+ end $$;
2126
+ commit;
2127
+
2128
+ -- Optional background download after a manual postponement.
2129
+ alter table public.ota_updates
2130
+ drop constraint if exists ota_updates_delivery_mode_chk,
2131
+ add constraint ota_updates_delivery_mode_chk
2132
+ check (delivery_mode in ('manual', 'background', 'manual-postpone')
2133
+ and (delivery_mode <> 'manual-postpone' or guard_action is null));
@@ -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.
4
+ Updates Server. Node.js 20.9 or newer is required. Version 0.6.0 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@latest my-server
7
+ npx create-expo-updates-server@0.6.0 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@latest .
16
+ npx create-expo-updates-server@0.6.0 .
17
17
  ```
18
18
 
19
19
  `npx` downloads the published initializer package from npm. After it starts,
@@ -339,6 +339,8 @@ Activation advances the channel epoch even if its latest pointer is unchanged.
339
339
  Pointer changes and repeated rollback operations advance the epoch clock by
340
340
  at least one millisecond, so successive publications remain ordered for Expo.
341
341
 
342
+ Reapply this repeatable migration when upgrading an existing installation. It also orders a fallback after a disabled patch when the publishing machine’s clock runs ahead of the server. Devices already on the fallback receive a no-update response.
343
+
342
344
  The server records the manifest-to-update mapping before returning a manifest.
343
345
  Missing mapping tables, lookup errors, or failed mapping writes now fail the
344
346
  request instead of silently changing IDs or losing history. Identical mapping
@@ -382,17 +384,17 @@ psql "$DATABASE_URL" -v ON_ERROR_STOP=1 \
382
384
  -f docs/migrations/2026-10-22-device-analytics.sql \
383
385
  -f docs/migrations/2026-10-22-device-version-metadata.sql \
384
386
  -f docs/migrations/2026-10-22-device-targeting.sql \
385
- -f docs/migrations/2026-10-22-device-targeting-activation.sql
387
+ -f docs/migrations/2026-10-22-device-targeting-activation.sql \
388
+ -f docs/migrations/2026-11-25-device-favorites.sql \
389
+ -f docs/migrations/2026-11-25-public-distribution-history.sql \
390
+ -f docs/migrations/2026-11-25-download-on-postpone.sql
386
391
  ```
387
392
 
388
393
  Fresh installations use only `schema.sql`, which includes these changes. Reapplying
389
394
  these migrations preserves collection start, installation records and release audiences.
390
- The final migration moves public-versus-targeted activation into an atomic database
391
- operation, allows deactivation cleanup during the global stop, and adds the separate
392
- `ota-force-update` catalog entry. Apply it before deploying the matching server.
395
+ The activation migration adds the separate `ota-force-update` catalog entry. The next two migrations enable personal device favorites and record public activations. Existing scopes start with their observed public release. Where older configurations allowed several public releases to remain active, the history migration keeps the one preferred by the anonymous manifest selector.
393
396
 
394
- Rerun the stock app configurator to install the generated identity/telemetry client and
395
- root `useOtaUpdates`/`OtaUpdateGate` integration. Adding SecureStore or the other native
397
+ Run the app configurator to install `expo-updates-server-client`, initialize telemetry and mount `<OtaUpdates />` in the app root. Adding SecureStore or the other native
396
398
  client dependencies requires a native rebuild with a compatible runtime; do not publish
397
399
  JavaScript that imports unavailable native modules to an older runtime. Existing clients
398
400
  already sending heartbeats can populate analytics without a native rebuild, but the new
@@ -1,9 +1,6 @@
1
- # Generated OTA client lifecycle
1
+ # OTA client lifecycle {#generated-ota-client-lifecycle}
2
2
 
3
- `configure-app` generates a formatted TypeScript client and renders `<OtaUpdates />`
4
- beside navigation in the root layout/App. The component calls `useOtaUpdates`
5
- internally; it does not wrap the app or provide React context. Mount it once in a
6
- persistent root, including loading/early-return paths.
3
+ `configure-app` installs `expo-updates-server-client` and mounts its `<OtaUpdates />` component beside navigation. The component calls `useOtaUpdates` internally. Mount it once in a persistent root, including loading and early-return paths.
7
4
 
8
5
  By default it checks automatically and shows **Download / Later** for an ordinary
9
6
  update, then **Restart / Later** when downloaded. `autoUpdate={false}` disables
@@ -27,8 +24,10 @@ Expo Go, web and disabled-updates builds leave automation off.
27
24
  | autoCheck | Check on mount and foreground, minimum interval 60 seconds |
28
25
  | autoUpdate | Also download eligible manual candidates |
29
26
  | autoReload | Reload a pending non-background bundle while app is active |
30
- | delivery=background | Download silently; apply on next cold launch or manual reload |
31
- | guard=ota-force-update | Block with gate, download automatically; restart button when ready |
27
+ | Download on postpone | Offer Download or Postpone even with autoUpdate enabled. Postpone silently caches the update for the next full launch and suppresses autoReload. An interrupted download retries at the next successful check. |
28
+ | delivery=background, guard=∅ | Download silently; apply on next cold launch or manual reload |
29
+ | manual + ota-force-update | Block with gate, download automatically; restart button when ready |
30
+ | background + ota-force-update | Download silently and restart the active app as soon as the update is ready, even with autoReload disabled |
32
31
  | guard=ota-force-store-update | Block with gate; open store, never download this candidate |
33
32
  | custom/unknown guard | Block until guardHandlers[action] explicitly returns `allow` |
34
33
 
@@ -60,10 +59,12 @@ Legacy exports `checkForUpdateAsync`/`fetchUpdateAsync` remain identity-aware lo
60
59
  APIs for existing integrations. They intentionally do not implement hook policies.
61
60
  No database/admin credentials are shipped: the server persists public heartbeat reports.
62
61
 
62
+ Native crash recovery depends on the bundles retained by Expo Updates. In the SDK 56 release tests on Android and iOS, an early JavaScript crash terminated the first launch. On the next launch the embedded bundle ran, and the failed manifest ID was excluded. Keep the embedded release usable. Choose an explicit server rollback when operators need a particular previous release.
63
+
63
64
  ## Integration and customization
64
65
 
65
66
  Use the stock `npm run configure-app -- ...` command from the server project. It
66
- preserves the original app entry, generates the client and inserts the standalone component in
67
+ preserves the original app entry, installs the npm package and inserts the standalone component in
67
68
  supported root components. For Expo Router this is `src/app/_layout` (preferred when
68
69
  `src/app` exists) or `app/_layout`, including platform variants. For the default entry
69
70
  it is `App`, provided no custom `index` registers a different root. Synchronous function
@@ -81,52 +82,21 @@ return (
81
82
  );
82
83
  ```
83
84
 
84
- Adjust these options in the root component. Use `useOtaUpdates()` in other screens for
85
- manual controls and shared state. The configurator selects the appropriate import path;
86
- no database or admin credentials belong in the application. Generated source includes
87
- `ota-client/docs/update-lifecycle.md` with this contract for application developers.
88
-
89
- For an already configured project, review generated-file changes and rerun with
90
- `--force`. This replaces the legacy JavaScript files with TypeScript, removes stale
91
- `.js`/`.d.ts` copies that could shadow the new modules, and migrates the stock root
92
- hook/gate while preserving its options. Custom code that uses the old root controller
93
- or a custom gate must be migrated manually; the preflight stops before any writes.
94
- Use `.tsx` for TypeScript JSX roots. Existing `OtaUpdateGate` consumers remain supported. Native dependencies need a new binary;
95
- use a new runtime when older installed binaries lack those modules. Publishing remains
96
- the generated `npm run ota:publish` workflow. See [device targeting](./device-targeting.md)
97
- for selecting a smoke-test audience and [installation telemetry](./installation-telemetry.md)
98
- for receipt/analytics semantics.
85
+ Configure automation in the root component. Other screens can use `useOtaUpdates()` for manual controls and shared state. Rebuild the native app after adding native modules and use a compatible runtime for OTA releases.
99
86
 
100
87
  ## Manual integration
101
88
 
102
- Use this path when `configure-app` cannot patch your root component, your project
103
- uses dynamic `app.config.*`, or you want to integrate the client yourself. The hook
104
- is source code supplied by this repository, **not an npm package**. Do not import
105
- it from `expo-updates`.
89
+ Use this path for a custom root or dynamic `app.config.*` project. If the configurator already installed the package, configured the native app and created the bootstrap, continue with step 2.
106
90
 
107
91
  ### 1. Prepare the client and native configuration
108
92
 
109
- If `ota-client/index.ts`, `ota-client/types.ts` and `ota-client/config.json` already
110
- exist after configuration, keep them and continue with step 2. A warning about an
111
- unidentified custom root means the bootstrap/client were installed; an unsupported
112
- root error stops configuration before writes, so check which files actually exist.
113
-
114
- For an application with no generated client, run from the application directory:
93
+ From the Expo application directory, install the package and its native dependencies.
115
94
 
116
95
  ```bash
117
- npx expo install expo-updates expo-application expo-crypto expo-secure-store @react-native-async-storage/async-storage
96
+ npx expo install expo-updates-server-client@0.1.0 expo-updates expo-application expo-crypto expo-secure-store @react-native-async-storage/async-storage
118
97
  ```
119
98
 
120
- Copy the **whole** `templates/expo-app/ota-client/` directory from the OTA server
121
- repository to `<application>/ota-client/`. Keep its nested `model/`, `ui/`, runtime,
122
- identity, telemetry and type declaration files together. For example, when the
123
- application does not already contain that directory:
124
-
125
- ```bash
126
- cp -R /full/path/to/expo-updates-server/templates/expo-app/ota-client ./ota-client
127
- ```
128
-
129
- Create `<application>/ota-client/config.json`:
99
+ Create `ota-client/config.json` in the application with your public server settings.
130
100
 
131
101
  ```json
132
102
  {
@@ -148,6 +118,17 @@ Set `updates.checkAutomatically` to `NEVER`; checks must wait for identity setup
148
118
  Keep the signing private key and publisher credentials outside the mobile bundle.
149
119
  A dynamic config must resolve the same channel used in `ota-client/config.json`.
150
120
 
121
+ Initialize the client before loading your existing app entry. For Expo Router, create `app-bootstrap.js` at the application root and set `main` in `package.json` to `app-bootstrap.js`. If you use a custom entry, replace the last line with a call to load your original entry or register your root component.
122
+
123
+ ```js
124
+ const { initializeOtaClient, start } = require('expo-updates-server-client');
125
+ const config = require('./ota-client/config.json');
126
+
127
+ initializeOtaClient(config);
128
+ start();
129
+ require('expo-router/entry');
130
+ ```
131
+
151
132
  ### 2. Connect the root layout or App
152
133
 
153
134
  For Expo Router, render the component beside navigation in the existing
@@ -157,7 +138,7 @@ such as `Stack.Screen`/`Tabs.Screen`.
157
138
 
158
139
  ```tsx
159
140
  import { Stack } from 'expo-router';
160
- import { OtaUpdates } from '../../ota-client';
141
+ import { OtaUpdates } from 'expo-updates-server-client';
161
142
 
162
143
  export default function RootLayout() {
163
144
  return (
@@ -169,30 +150,11 @@ export default function RootLayout() {
169
150
  }
170
151
  ```
171
152
 
172
- Adjust the relative import to the file location:
173
-
174
- | Root file | Import from |
175
- | --- | --- |
176
- | `src/app/_layout.tsx` | `../../ota-client` |
177
- | `app/_layout.tsx` | `../ota-client` |
178
- | `App.tsx` at the application root | `./ota-client` |
179
-
180
153
  For a non-Router application, render the same component beside the existing app
181
154
  content. It can be a sibling of a class component too. Mount one instance, including
182
155
  loading/early-return paths. A custom entry still registers the original root.
183
156
 
184
- Keep an existing generated `ota-entry.js` and its `package.json.main` setting.
185
- When integrating entirely by hand, changing the entry is **not required**: the
186
- mounted hook calls the idempotent telemetry `start()` itself. Identity is persisted
187
- before hook update requests; heartbeat network failures do not block rendering or
188
- checks. Do not add another heartbeat implementation or call Expo checks at module
189
- initialization. For an app that needs registration before its root mounts, the
190
- public `start()` can also be called in its existing entry without replacing the
191
- original registration code.
192
-
193
- `OtaUpdates` supplies the default force-update UI. Using the hook without it
194
- requires your own UI to enforce `blocked`. A custom gate view is supported through
195
- `renderBlocked`; this does not change the controller's guard decision.
157
+ For a headless integration, call `useOtaUpdates({ autoCheck: true })` in the persistent root. The hook provides state and actions. Your UI must handle `blocked`, required-update actions and any download or restart prompts. With `OtaUpdates`, you can customize the supplied UI through `renderBlocked` and `renderAvailable`.
196
158
 
197
159
  ### 3. Add manual update controls
198
160
 
@@ -202,7 +164,7 @@ optional and can subscribe without enabling another automatic workflow. For exam
202
164
  ```tsx
203
165
  import { useState } from 'react';
204
166
  import { Button, Text, View } from 'react-native';
205
- import { useOtaUpdates } from '../../ota-client';
167
+ import { useOtaUpdates } from 'expo-updates-server-client';
206
168
 
207
169
  export function OtaControls() {
208
170
  const ota = useOtaUpdates();
@@ -239,7 +201,7 @@ export function OtaControls() {
239
201
  The gate supplies required-update actions while these ordinary screen controls are
240
202
  blocked. To download ordinary updates automatically, set `autoUpdate: true` in the
241
203
  root; add `autoReload: true` only when automatic foreground restarts suit your app.
242
- Server `background` delivery still prevents an automatic immediate restart. Custom
204
+ An unguarded `background` release waits for the next launch. Custom
243
205
  guards need an explicit `guardHandlers[action]` decision; returning `allow` should
244
206
  follow your actual application condition, not simply silence an unknown action.
245
207
 
@@ -258,7 +220,7 @@ exercise this client's telemetry/update lifecycle.
258
220
  Device ID persistence has the [platform limitations](./device-targeting.md).
259
221
  6. Check background delivery, force OTA, store upgrade and your custom guards separately.
260
222
 
261
- Copying `ota-client/` and adding the hook does not install publisher scripts or
223
+ Installing the client package does not install publisher scripts or
262
224
  embedded-build registration. Those are separate setup steps in the
263
225
  [application guide](./expo-app-setup.md#_6-register-embedded-updates). If the automatic
264
226
  configurator already installed them, keep using its `npm run ota:publish` command.