@gfean/react-native-bundle-drop 0.12.0 → 0.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,6 +6,8 @@ export type OtaResolveRequest = {
6
6
  runtimeVersion: string | null;
7
7
  environment: string | null;
8
8
  currentHash: string | null;
9
+ /** Known source channel of the running hash; omitted for unknown/legacy metadata. */
10
+ currentChannelName?: string;
9
11
  currentUserProperties: UserProperties;
10
12
  rejectedHashes: string[];
11
13
  installId: string;
@@ -27,6 +29,7 @@ export type OtaArtifactAuthorizationRequest = {
27
29
  mode: 'full' | 'patch';
28
30
  patchArtifactRef: string | null;
29
31
  currentHash: string | null;
32
+ currentChannelName?: string;
30
33
  rejectedHashes: string[];
31
34
  installId: string;
32
35
  transport: OtaResolveRequest['transport'];
@@ -59,7 +62,7 @@ export type OtaPatchSet = {
59
62
  };
60
63
  export type OtaResolveResponse = {
61
64
  action: 'NOOP';
62
- reason?: 'UP_TO_DATE' | 'ROLLOUT_PAUSED' | 'ROLLOUT_NOT_ELIGIBLE' | 'TARGETING_NOT_MATCHED' | 'NO_PUBLISHED_BUNDLE' | 'NO_COMPATIBLE_BUNDLE';
65
+ reason?: 'UP_TO_DATE' | 'CURRENT_BUNDLE_NEWER' | 'ROLLOUT_PAUSED' | 'ROLLOUT_NOT_ELIGIBLE' | 'TARGETING_NOT_MATCHED' | 'NO_PUBLISHED_BUNDLE' | 'NO_COMPATIBLE_BUNDLE';
63
66
  requestedRuntimeVersion?: string;
64
67
  latestRuntimeVersionOnChannel?: string;
65
68
  } | {
package/lib/index.d.ts CHANGED
@@ -8,7 +8,7 @@ export { BundleDropError, isBundleDropError } from './errors';
8
8
  export { getCurrentUserProperties, getUserProperties, setUserProperty, removeUserProperty, resetUserProperties, } from './fs/userProperties';
9
9
  export type { UserProperties, UserPropertyValue } from './fs/userProperties';
10
10
  export type { BundleInfo } from './bundleInfo';
11
- export type { UpdatePolicy } from './types';
11
+ export type { UpdatePhase, UpdatePolicy } from './types';
12
12
  export type { BundleListItem } from './api/types';
13
13
  export type { BundleDropProjectConfig } from './loadConfig';
14
14
  export type { BundleDropConfig } from './context';
@@ -19,6 +19,7 @@ export type DownloadUpdateResult = {
19
19
  };
20
20
  type DownloadOptions = {
21
21
  channelName?: string;
22
+ onDownloadStart?: () => void;
22
23
  resolvedTarget?: {
23
24
  hash: string;
24
25
  downloadUrl?: string;
@@ -40,6 +41,7 @@ export declare const downloadUpdate: (options?: DownloadOptions, onStatusUpdate?
40
41
  export type InstallBundleOptions = {
41
42
  channelName?: string;
42
43
  onStatusUpdate?: (status: string) => void;
44
+ onDownloadStart?: () => void;
43
45
  };
44
46
  export declare const installBundle: (hash: string, downloadUrl: string, bundleVersion?: number, version?: string, runtimeVersion?: string, options?: InstallBundleOptions) => Promise<DownloadUpdateResult>;
45
47
  export {};
@@ -9,6 +9,7 @@ const updateCheck_1 = require("./updateCheck");
9
9
  const errors_1 = require("../errors");
10
10
  const rollbackState_1 = require("./rollbackState");
11
11
  const artifactCapability_1 = require("../runtime-delivery/artifactCapability");
12
+ const UP_TO_DATE_STATUS = '✅ You have the latest version';
12
13
  function isSameRuntimeDeliverySelection(selected, refreshed) {
13
14
  if (!refreshed ||
14
15
  refreshed.action !== 'INSTALL' ||
@@ -75,7 +76,7 @@ async function downloadAndStageUpdate(options, onStatusUpdate) {
75
76
  if (checkResult.action === 'NOOP') {
76
77
  statusCb?.(checkResult.skippedFailedBundle
77
78
  ? '✅ Current bundle retained; requested update previously failed on this device'
78
- : '✅ You have the latest version');
79
+ : UP_TO_DATE_STATUS);
79
80
  return checkResult.skippedFailedBundle
80
81
  ? {
81
82
  status: 'upToDate',
@@ -127,6 +128,9 @@ async function downloadAndStageUpdate(options, onStatusUpdate) {
127
128
  context: { channelName, platform, projectSlug: project.slug },
128
129
  });
129
130
  }
131
+ if (!capabilityRefreshAttempted) {
132
+ options?.onDownloadStart?.();
133
+ }
130
134
  try {
131
135
  installResult = patchFallbackSelected ? null : await (0, patchTransport_1.tryInstallPatchTransport)({
132
136
  target: {
@@ -179,6 +183,10 @@ async function downloadAndStageUpdate(options, onStatusUpdate) {
179
183
  capabilityRefreshAttempted = true;
180
184
  statusCb?.('🔐 Download authorization expired; refreshing once...');
181
185
  const refreshed = await (0, updateCheck_1.authorizeRuntimeDeliveryUpdate)(unresolvedCheckResult);
186
+ if (refreshed?.action === 'NOOP' && refreshed.reason === 'CURRENT_BUNDLE_NEWER') {
187
+ statusCb?.(UP_TO_DATE_STATUS);
188
+ return { status: 'upToDate', reason: refreshed.reason };
189
+ }
182
190
  if (!isSameRuntimeDeliverySelection(unresolvedCheckResult, refreshed)) {
183
191
  throw new errors_1.BundleDropError({
184
192
  message: 'Refreshed download authorization changed update identity',
@@ -287,6 +295,7 @@ exports.downloadUpdate = downloadUpdate;
287
295
  const installBundle = async (hash, downloadUrl, bundleVersion, version, runtimeVersion, options) => {
288
296
  return downloadAndStageUpdate({
289
297
  channelName: options?.channelName,
298
+ onDownloadStart: options?.onDownloadStart,
290
299
  resolvedTarget: { hash, downloadUrl, bundleVersion, version, runtimeVersion },
291
300
  }, options?.onStatusUpdate);
292
301
  };
@@ -74,17 +74,30 @@ async function getAvailableChannels() {
74
74
  }
75
75
  async function readResolveContext(channelName) {
76
76
  const selectedHash = (0, bundleDropNative_1.getStartupRecoverySelectedHashNative)();
77
- const [pointerHash, nativeBundlePath, userProperties, installId, rejectedHashes] = await Promise.all([
77
+ const [pointerHash, nativeBundlePath, userProperties, installId, rejectedHashes, bundleInfo] = await Promise.all([
78
78
  (0, bundlePointer_1.readCurrentBundleHash)(),
79
79
  (0, bundleDropNative_1.getDownloadedBundlePathNative)(),
80
80
  (0, userProperties_1.getCurrentUserProperties)(),
81
81
  (0, installId_1.getOrCreateInstallId)(),
82
82
  (0, rollbackState_1.getFailedBundleHashes)(),
83
+ selectedHash ? (0, bundleInfo_1.readBundleInfo)() : Promise.resolve(null),
83
84
  ]);
84
85
  const supportsXdelta = await Promise.resolve()
85
86
  .then(() => require('../native/fs'))
86
87
  .then(module => module.default.supportsXdelta())
87
88
  .catch(() => false);
89
+ // bundle-info/current.json may already describe a staged candidate. Only
90
+ // metadata for this React runtime's native-selected hash can prevent a
91
+ // same-lane downgrade; an explicit channel change remains eligible.
92
+ const currentChannelName = selectedHash && bundleInfo?.hash === selectedHash &&
93
+ bundleInfo.platform === context_1.platform && context_1.runtimeVersion && bundleInfo.runtimeVersion === context_1.runtimeVersion &&
94
+ typeof bundleInfo.channelName === 'string' && bundleInfo.channelName.length > 0
95
+ ? bundleInfo.channelName
96
+ : undefined;
97
+ const currentBundleVersion = currentChannelName === channelName &&
98
+ Number.isSafeInteger(bundleInfo.bundleVersion) && bundleInfo.bundleVersion >= 0
99
+ ? bundleInfo.bundleVersion
100
+ : undefined;
88
101
  return {
89
102
  channelName,
90
103
  // Only adapters that predate startupRecoverySelectedHash infer the running
@@ -93,6 +106,8 @@ async function readResolveContext(channelName) {
93
106
  currentHash: selectedHash === undefined
94
107
  ? nativeBundlePath && pointerHash ? pointerHash : null
95
108
  : selectedHash,
109
+ currentBundleVersion,
110
+ currentChannelName,
96
111
  rejectedHashes,
97
112
  installId,
98
113
  patchAlgorithms: (0, patchOperations_1.advertisedPatchAlgorithms)(supportsXdelta),
@@ -159,6 +174,7 @@ async function resolveWithServer(context, onStatusUpdate, options = {}) {
159
174
  runtimeVersion: context_1.runtimeVersion ?? null,
160
175
  environment: context.environment,
161
176
  currentHash: context.currentHash,
177
+ ...(context.currentChannelName ? { currentChannelName: context.currentChannelName } : {}),
162
178
  currentUserProperties: context.userProperties,
163
179
  rejectedHashes: context.rejectedHashes,
164
180
  installId: context.installId,
@@ -256,6 +272,7 @@ async function authorizeRuntimeDeliveryUpdate(decision) {
256
272
  mode: decision.runtimeDelivery.selectedMode,
257
273
  patchArtifactRef: decision.runtimeDelivery.patchArtifactRef ?? null,
258
274
  currentHash: context.currentHash,
275
+ ...(context.currentChannelName ? { currentChannelName: context.currentChannelName } : {}),
259
276
  rejectedHashes: context.rejectedHashes,
260
277
  installId: context.installId,
261
278
  transport: {
@@ -28,4 +28,4 @@ export declare const reconcileAppliedBundleOnLaunch: (cached?: {
28
28
  bundlePath?: string | null;
29
29
  currentHash?: string | null;
30
30
  }) => Promise<BundleInfo | null>;
31
- export declare const applyUpdate: (onStatusUpdate?: (status: string) => void, onBeforeRestart?: () => void) => Promise<ApplyUpdateResult>;
31
+ export declare const applyUpdate: (onStatusUpdate?: (status: string) => void, onBeforeRestart?: () => void, onApplyStart?: () => void) => Promise<ApplyUpdateResult>;
@@ -87,7 +87,7 @@ const reconcileAppliedBundleOnLaunch = async (cached) => {
87
87
  return appliedInfo;
88
88
  };
89
89
  exports.reconcileAppliedBundleOnLaunch = reconcileAppliedBundleOnLaunch;
90
- const applyUpdate = async (onStatusUpdate, onBeforeRestart) => {
90
+ const applyUpdate = async (onStatusUpdate, onBeforeRestart, onApplyStart) => {
91
91
  try {
92
92
  const info = await (0, bundleInfo_1.readBundleInfo)();
93
93
  const path = await (0, bundleDropNative_1.getDownloadedBundlePathNative)();
@@ -107,6 +107,7 @@ const applyUpdate = async (onStatusUpdate, onBeforeRestart) => {
107
107
  skippedHash: info?.hash,
108
108
  };
109
109
  }
110
+ onApplyStart?.();
110
111
  onStatusUpdate?.('♻️ Applying downloaded bundle...');
111
112
  await (0, bundleInfo_1.updateBundleInfo)({ pendingApply: false, installedAt: new Date().toISOString() });
112
113
  onBeforeRestart?.();
@@ -3,10 +3,12 @@ import type { BundleListItem, UpdateCheckResponse } from '../api/types';
3
3
  import type { DownloadUpdateResult } from '../manager/downloadAndInstall';
4
4
  import type { ApplyUpdateResult } from '../manager/updateState';
5
5
  import type { AvailableBundlesPage, GetAvailableBundlesOptions } from '../manager/updateCheck';
6
+ import type { UpdatePhase } from '../types';
6
7
  import { type BundleDropInitOptions } from './initState';
7
8
  type BundleDropRuntimeSnapshot = {
8
9
  status: string;
9
10
  isBusy: boolean;
11
+ updatePhase: UpdatePhase;
10
12
  isEnabled: boolean;
11
13
  channelName: string;
12
14
  installedInfo: BundleInfo | null;
@@ -58,6 +58,7 @@ let hasWarnedAboutExpoDevelopmentFallback = false;
58
58
  let snapshot = {
59
59
  status: DISABLED_STATUS,
60
60
  isBusy: false,
61
+ updatePhase: 'idle',
61
62
  isEnabled: false,
62
63
  channelName: context_1.defaultChannel,
63
64
  installedInfo: null,
@@ -80,6 +81,7 @@ function setDisabledSnapshot(channelName = snapshot.channelName) {
80
81
  patchSnapshot({
81
82
  status: DISABLED_STATUS,
82
83
  isBusy: false,
84
+ updatePhase: 'idle',
83
85
  isEnabled: false,
84
86
  channelName,
85
87
  installedInfo: null,
@@ -174,7 +176,23 @@ function requestRuntimeRestart() {
174
176
  runtimeRestartRequested = true;
175
177
  (0, bundleDropNative_1.restartReactNativeNative)();
176
178
  }
179
+ function checkChannelForUpdate(...args) {
180
+ patchSnapshot({ updatePhase: 'checking' });
181
+ return (0, updateCheck_1.checkForUpdate)(...args);
182
+ }
183
+ function startDownloading() {
184
+ patchSnapshot({ updatePhase: 'downloading' });
185
+ }
186
+ function startApplying() {
187
+ patchSnapshot({ updatePhase: 'applying' });
188
+ }
189
+ function applyStagedBundle(onStatusUpdate) {
190
+ return (0, updateState_1.applyUpdate)(onStatusUpdate, () => {
191
+ runtimeRestartRequested = true;
192
+ }, startApplying);
193
+ }
177
194
  async function applyAuthoritativeRollback(reason) {
195
+ startApplying();
178
196
  const result = await (0, rollbackState_1.rollbackStartupBundle)(isCurrentRevokedRollback(reason));
179
197
  if (!result)
180
198
  return { status: 'blocked', reason: 'ROLLBACK_REVALIDATION_FAILED' };
@@ -211,7 +229,7 @@ async function applyPendingRollback() {
211
229
  return { status: 'blocked', reason: 'ROLLBACK_REVALIDATION_FAILED' };
212
230
  }
213
231
  // Refresh authority before native atomically selects and verifies the fallback.
214
- const decision = await (0, updateCheck_1.checkForUpdate)(runtime.channelName);
232
+ const decision = await checkChannelForUpdate(runtime.channelName);
215
233
  if (decision?.action === 'ROLLBACK' && isCurrentRevokedRollback(decision.reason)) {
216
234
  return applyAuthoritativeRollback(decision.reason);
217
235
  }
@@ -261,7 +279,7 @@ async function withBusy(fn) {
261
279
  }
262
280
  finally {
263
281
  updateFlowActive = false;
264
- patchSnapshot({ isBusy: false });
282
+ patchSnapshot({ isBusy: false, updatePhase: 'idle' });
265
283
  }
266
284
  }
267
285
  async function waitForStartupIfNeeded() {
@@ -311,9 +329,7 @@ async function runStartupFlow() {
311
329
  if (pendingState.pendingApply && !pendingState.pendingRollback) {
312
330
  if (runtime.policy === 'immediate') {
313
331
  emitStatus('♻️ Applying previously downloaded update...');
314
- const applied = await (0, updateState_1.applyUpdate)(statusCb, () => {
315
- runtimeRestartRequested = true;
316
- });
332
+ const applied = await applyStagedBundle(statusCb);
317
333
  if (applied.status === 'applied') {
318
334
  return;
319
335
  }
@@ -326,7 +342,7 @@ async function runStartupFlow() {
326
342
  if (runtime.policy === 'manual' && !runtime.checkOnly) {
327
343
  return;
328
344
  }
329
- const decision = await (0, updateCheck_1.checkForUpdate)(runtime.channelName, statusCb);
345
+ const decision = await checkChannelForUpdate(runtime.channelName, statusCb);
330
346
  const finalStatus = getCheckStatus(decision);
331
347
  if (!isSameStatus(snapshot.status, finalStatus)) {
332
348
  emitStatus(finalStatus);
@@ -366,6 +382,7 @@ async function runStartupFlow() {
366
382
  };
367
383
  const downloadResult = await (0, downloadAndInstall_1.downloadUpdate)({
368
384
  channelName: runtime.channelName,
385
+ onDownloadStart: startDownloading,
369
386
  resolvedTarget,
370
387
  }, statusCb);
371
388
  if (downloadResult.status === 'rollback') {
@@ -384,9 +401,7 @@ async function runStartupFlow() {
384
401
  return;
385
402
  }
386
403
  if (downloadResult.status === 'staged') {
387
- await (0, updateState_1.applyUpdate)(statusCb, () => {
388
- runtimeRestartRequested = true;
389
- });
404
+ await applyStagedBundle(statusCb);
390
405
  return;
391
406
  }
392
407
  const nextStatus = getDownloadStatus(downloadResult);
@@ -493,7 +508,7 @@ async function checkLatest(extraStatusHandler) {
493
508
  }
494
509
  await waitForStartupIfNeeded();
495
510
  return withBusy(async () => {
496
- const response = await (0, updateCheck_1.checkForUpdate)(runtime.channelName, status => emitStatus(status, extraStatusHandler));
511
+ const response = await checkChannelForUpdate(runtime.channelName, status => emitStatus(status, extraStatusHandler));
497
512
  const status = getCheckStatus(response);
498
513
  if (!isSameStatus(snapshot.status, status)) {
499
514
  emitStatus(status, extraStatusHandler);
@@ -511,7 +526,8 @@ async function downloadAndStage(extraStatusHandler) {
511
526
  }
512
527
  await waitForStartupIfNeeded();
513
528
  return withBusy(async () => {
514
- const downloadResult = await (0, downloadAndInstall_1.downloadUpdate)({ channelName: runtime.channelName }, status => emitStatus(status, extraStatusHandler));
529
+ patchSnapshot({ updatePhase: 'checking' });
530
+ const downloadResult = await (0, downloadAndInstall_1.downloadUpdate)({ channelName: runtime.channelName, onDownloadStart: startDownloading }, status => emitStatus(status, extraStatusHandler));
515
531
  const result = await handleDownloadRollback(downloadResult);
516
532
  const status = getDownloadStatus(result);
517
533
  if (status) {
@@ -530,7 +546,7 @@ async function applyDownloadedUpdate(extraStatusHandler) {
530
546
  await waitForStartupIfNeeded();
531
547
  await nativeOtaEnabledPromise;
532
548
  return withBusy(async () => {
533
- const result = await applyPendingRollback() ?? await (0, updateState_1.applyUpdate)(status => emitStatus(status, extraStatusHandler), () => { runtimeRestartRequested = true; });
549
+ const result = await applyPendingRollback() ?? await applyStagedBundle(status => emitStatus(status, extraStatusHandler));
534
550
  const status = getApplyStatus(result);
535
551
  if (status) {
536
552
  emitStatus(status, extraStatusHandler);
@@ -603,7 +619,7 @@ async function installBundleFromListItem(bundle) {
603
619
  return { result: { status: 'incompatible' }, status };
604
620
  }
605
621
  return withBusy(async () => {
606
- const resolvedDecision = await (0, updateCheck_1.checkForUpdate)(runtime.channelName, emitStatus).catch(() => null);
622
+ const resolvedDecision = await checkChannelForUpdate(runtime.channelName, emitStatus).catch(() => null);
607
623
  const usesManagedRuntimeDelivery = (0, loadConfig_1.isRuntimeDeliveryConfigured)(context_1.config.runtimeDelivery);
608
624
  const canUseResolvedTransport = resolvedDecision?.action === 'INSTALL' &&
609
625
  (resolvedDecision.bundleHash ?? resolvedDecision.hash) === bundle.hash;
@@ -627,6 +643,7 @@ async function installBundleFromListItem(bundle) {
627
643
  let result = canUseResolvedTransport
628
644
  ? await (0, downloadAndInstall_1.downloadUpdate)({
629
645
  channelName: runtime.channelName,
646
+ onDownloadStart: startDownloading,
630
647
  resolvedTarget: {
631
648
  hash: bundle.hash,
632
649
  downloadUrl: resolvedDecision.mode === 'patch'
@@ -648,6 +665,7 @@ async function installBundleFromListItem(bundle) {
648
665
  : await (0, downloadAndInstall_1.installBundle)(bundle.hash, downloadUrl, bundle.bundleVersion, bundle.version, bundle.runtimeVersion, {
649
666
  channelName: runtime.channelName,
650
667
  onStatusUpdate: emitStatus,
668
+ onDownloadStart: startDownloading,
651
669
  });
652
670
  result = await handleDownloadRollback(result);
653
671
  if (result.status === 'staged') {
@@ -782,6 +800,7 @@ async function installBundle(hash, downloadUrl, bundleVersion, version, runtimeV
782
800
  const downloadResult = await (0, downloadAndInstall_1.installBundle)(hash, downloadUrl, bundleVersion, version, runtimeVersion, {
783
801
  channelName: runtime.channelName,
784
802
  onStatusUpdate: status => emitStatus(status, onStatusUpdate),
803
+ onDownloadStart: startDownloading,
785
804
  });
786
805
  const result = await handleDownloadRollback(downloadResult);
787
806
  const status = getDownloadStatus(result);
@@ -799,6 +818,7 @@ function resetBundleDropRuntimeServiceForTests() {
799
818
  snapshot = {
800
819
  status: DISABLED_STATUS,
801
820
  isBusy: false,
821
+ updatePhase: 'idle',
802
822
  isEnabled: false,
803
823
  channelName: context_1.defaultChannel,
804
824
  installedInfo: null,
@@ -13,6 +13,9 @@ export type LocalResolution = {
13
13
  };
14
14
  export type LocalResolutionInput = {
15
15
  currentHash: string | null;
16
+ /** Trusted running version, supplied only after matching the current hash and lane. */
17
+ currentBundleVersion?: number;
18
+ currentChannelName?: string;
16
19
  rejectedHashes: string[];
17
20
  installId: string;
18
21
  patchAlgorithms: string[];
@@ -71,6 +71,17 @@ async function resolveRuntimeDeliveryLane(manifest, input) {
71
71
  ? { action: 'ROLLBACK', reason: 'CURRENT_REVOKED_NO_COMPATIBLE_TARGET' }
72
72
  : { action: 'NOOP', reason: 'UP_TO_DATE' };
73
73
  }
74
+ // Pausing or narrowing a rollout changes offers to other installs, not the
75
+ // healthy bundle already running here. Revocation and native failure recovery
76
+ // still allow a safe older target, even if the current release is no longer
77
+ // present in this manifest's candidate set.
78
+ if (manifest.publishingMode === 'managed' &&
79
+ input.currentHash && !currentRevoked && !rejected.has(input.currentHash) &&
80
+ input.currentChannelName === manifest.channelName &&
81
+ Number.isSafeInteger(input.currentBundleVersion) &&
82
+ input.currentBundleVersion >= 0 && input.currentBundleVersion > selected.bundleVersion) {
83
+ return { action: 'NOOP', reason: 'CURRENT_BUNDLE_NEWER' };
84
+ }
74
85
  const patchEdge = currentRevoked ? undefined : selectPatchEdge(manifest, input, selected, now);
75
86
  return {
76
87
  action: 'INSTALL',
@@ -4,6 +4,10 @@ import type { RuntimeDeliveryLaneIdentity, RuntimeDeliveryLaneManifest } from '.
4
4
  export type RuntimeDeliveryResolveContext = {
5
5
  channelName: string;
6
6
  currentHash: string | null;
7
+ /** Hash-matched running metadata for this lane; never a staged candidate's version. */
8
+ currentBundleVersion?: number;
9
+ /** Source channel of the hash-matched running bundle, including across channel changes. */
10
+ currentChannelName?: string;
7
11
  rejectedHashes: string[];
8
12
  installId: string;
9
13
  patchAlgorithms: string[];
@@ -303,6 +303,8 @@ async function fetchRuntimeDeliveryManifest(channelName) {
303
303
  async function resolveFromRuntimeDeliveryManifest(manifest, context) {
304
304
  const decision = await (0, localResolver_1.resolveRuntimeDeliveryLane)(manifest, {
305
305
  currentHash: context.currentHash,
306
+ currentBundleVersion: context.currentBundleVersion,
307
+ currentChannelName: context.currentChannelName,
306
308
  rejectedHashes: context.rejectedHashes,
307
309
  installId: context.installId,
308
310
  patchAlgorithms: context.patchAlgorithms,
@@ -312,7 +314,7 @@ async function resolveFromRuntimeDeliveryManifest(manifest, context) {
312
314
  const incompatible = decision.reason === 'NO_COMPATIBLE_BUNDLE';
313
315
  return {
314
316
  action: 'NOOP',
315
- upToDate: decision.reason === 'UP_TO_DATE',
317
+ upToDate: decision.reason === 'UP_TO_DATE' || decision.reason === 'CURRENT_BUNDLE_NEWER',
316
318
  channelName: context.channelName,
317
319
  reason: decision.reason,
318
320
  incompatible: incompatible || undefined,
package/lib/types.d.ts CHANGED
@@ -2,3 +2,5 @@
2
2
  * Startup policy controlling what BundleDrop does after local state hydration.
3
3
  */
4
4
  export type UpdatePolicy = 'manual' | 'immediate' | 'on-next-launch';
5
+ /** The current phase of the BundleDrop update flow. */
6
+ export type UpdatePhase = 'idle' | 'checking' | 'downloading' | 'applying';
@@ -2,6 +2,7 @@ import type { BundleInfo } from './bundleInfo';
2
2
  import type { AvailableBundlesPage, GetAvailableBundlesOptions } from './manager/updateCheck';
3
3
  import type { DownloadUpdateResult } from './manager/downloadAndInstall';
4
4
  import type { ApplyUpdateResult } from './manager/updateState';
5
+ import type { UpdatePhase } from './types';
5
6
  import type { UpdateCheckResponse, BundleListItem } from './api/types';
6
7
  /**
7
8
  * Live BundleDrop runtime state plus UI-facing actions for manual OTA flows.
@@ -13,6 +14,8 @@ export type UseBundleDropReturn = {
13
14
  isEnabled: boolean;
14
15
  /** True while any bundle-drop action is running; use to disable UI. */
15
16
  isBusy: boolean;
17
+ /** Current update phase. Downloading includes verification and staging. Applying includes rollback. */
18
+ updatePhase: UpdatePhase;
16
19
  /** Active runtime channel used by singleton OTA actions. */
17
20
  channelName: string;
18
21
  /** Locally stored bundle metadata (bundleVersion, hash, etc.), if any. */
@@ -17,6 +17,7 @@ function useBundleDrop() {
17
17
  status: state.status,
18
18
  isEnabled: state.isEnabled,
19
19
  isBusy: state.isBusy,
20
+ updatePhase: state.updatePhase,
20
21
  channelName: state.channelName,
21
22
  installedInfo: state.installedInfo,
22
23
  pendingApply: state.pendingApply,
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@gfean/react-native-bundle-drop",
3
- "version": "0.12.0",
3
+ "version": "0.12.1",
4
4
  "nativeVersion": "0.6.4",
5
- "description": "Over-the-air updates for Expo and bare React Native apps, with channels, staged rollouts, patch delivery, and rollback.",
5
+ "description": "Over-the-air (OTA) updates for Expo and bare React Native with staged rollouts, smaller patch downloads, and rollback.",
6
6
  "main": "lib/index.js",
7
7
  "types": "lib/index.d.ts",
8
8
  "author": {
@@ -72,8 +72,7 @@
72
72
  "react": "^18.3.1",
73
73
  "react-native": ">=0.71.0",
74
74
  "react-test-renderer": "^18.3.1",
75
- "rimraf": "^6.1.3",
76
- "rn-cli-platform-android-078": "npm:@react-native-community/cli-platform-android@15.0.1",
75
+ "rimraf": "^6.1.4",
77
76
  "ts-jest": "^29.4.15",
78
77
  "ts-node": "^10.9.2",
79
78
  "typescript": "^5.9.3"
@@ -125,41 +124,26 @@
125
124
  "keywords": [
126
125
  "react-native",
127
126
  "expo",
128
- "expo-sdk",
129
127
  "expo-router",
130
128
  "react-native-ota",
129
+ "expo-ota",
131
130
  "ota",
132
131
  "ota-updates",
133
132
  "over-the-air",
134
133
  "over-the-air-updates",
134
+ "react-native-updates",
135
+ "hot-update",
135
136
  "codepush",
136
137
  "codepush-alternative",
137
138
  "react-native-code-push",
138
- "app-center-codepush",
139
139
  "eas-update-alternative",
140
140
  "expo-updates-alternative",
141
- "expo-eas-update-alternative",
142
- "react-native-update",
143
- "react-native-updates",
144
- "hot-update",
145
- "live-updates",
146
- "instant-updates",
147
- "hotfix",
148
- "bundle-updates",
149
- "js-bundle",
150
141
  "delta-updates",
151
142
  "patch-updates",
152
143
  "staged-rollout",
153
- "feature-rollout",
154
144
  "rollback",
155
- "react-native-deployment",
156
- "react-native-release",
157
- "react-native-ci",
158
- "react-native-production",
159
- "mobile-updates",
160
- "app-updates",
161
- "react-native-ios",
162
- "react-native-android"
145
+ "source-maps",
146
+ "bundle-analysis"
163
147
  ],
164
148
  "peerDependencies": {
165
149
  "expo": ">=54.0.0 <58.0.0",
@@ -31,7 +31,7 @@
31
31
  "diff@^4.0.1": "4.0.4",
32
32
  "@xmldom/xmldom@^0.8.8": "0.8.13"
33
33
  },
34
- "lockfileSha256": "bcf47a1e070b0c9144ec6700f4edd51e8eeb39534b0e64a190b7011069c28f5c",
34
+ "lockfileSha256": "7eafd7d3c189c7eeba674e7c15e22dd97b58e8d68f3a6445185f19b67c65b50d",
35
35
  "sourceFiles": {
36
36
  "scripts/build-fingerprint.cjs": "5f2e6ac05b330e61e81ae5a3919d742e47b547b85ed408e163723d93f979757a",
37
37
  "scripts/check-fingerprint-contract.cjs": "741373a90854cadabfc1d86d3104841a326371ee894f9aa6ac11eeed56638b32",