@absolutejs/absolute 0.20.0-beta.87 → 0.20.0-beta.89

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/dist/cli/index.js CHANGED
@@ -203,7 +203,7 @@ if (command === "dev") {
203
203
  sendTelemetryEvent("cli:command", {
204
204
  command: `mobile:${workspaceCommand ?? "unknown"}`
205
205
  });
206
- const { runMobile } = await import("./mobile-c94a5y9k.js");
206
+ const { runMobile } = await import("./mobile-bg1jy34n.js");
207
207
  try {
208
208
  await runMobile(args);
209
209
  } catch (error) {
@@ -17519,9 +17519,12 @@ public final class AbsoluteMobileUpdateWatchdogPlugin: CAPPlugin, CAPBridgedPlug
17519
17519
  private static func recover(_ reason: String) -> (String, String?, Bool)? {
17520
17520
  var value = state()
17521
17521
  guard let release = value["pendingRelease"] as? String, validRelease(release) else { return nil }
17522
- let previous = value["previousPath"] as? String
17523
17522
  let active = value["activeRelease"] as? String
17524
- let hasActive = active.map(validRelease) ?? false
17523
+ let activePath = active.flatMap { candidate in
17524
+ validRelease(candidate) ? snapshotRoot()?.appendingPathComponent(candidate, isDirectory: true).path : nil
17525
+ }
17526
+ let hasActive = activePath.map { FileManager.default.fileExists(atPath: $0) } ?? false
17527
+ let previous = hasActive ? activePath : nil
17525
17528
  let started = value["pendingStartedAt"] as? Double ?? Date().timeIntervalSince1970 * 1000
17526
17529
  let duration = max(0, Date().timeIntervalSince1970 * 1000 - started)
17527
17530
  value.removeValue(forKey: "pendingRelease")
@@ -17693,8 +17696,10 @@ public final class AbsoluteMobileUpdateWatchdogPlugin extends Plugin {
17693
17696
  JSONObject value = state(context);
17694
17697
  String release = value.optString("pendingRelease", "");
17695
17698
  if (!validRelease(release)) return null;
17696
- String previous = value.optString("previousPath", "");
17697
- boolean hasActive = validRelease(value.optString("activeRelease", ""));
17699
+ String activeRelease = value.optString("activeRelease", "");
17700
+ File activePath = new File(snapshotRoot(context), activeRelease);
17701
+ boolean hasActive = validRelease(activeRelease) && activePath.isDirectory();
17702
+ String previous = hasActive ? activePath.getAbsolutePath() : "";
17698
17703
  long started = value.optLong("pendingStartedAt", System.currentTimeMillis());
17699
17704
  long duration = Math.max(0, System.currentTimeMillis() - started);
17700
17705
  value.remove("pendingRelease");
@@ -18888,7 +18893,7 @@ var connectTarget = async (target) => {
18888
18893
  };
18889
18894
  var isTransientEvaluationError = (error) => {
18890
18895
  const message = error instanceof Error ? error.message : String(error);
18891
- return /execution context|cannot find context|inspected target navigated|context.*destroyed/iu.test(message);
18896
+ return /execution context|cannot find context|inspected target navigated|context.*destroyed|CDP Runtime\.evaluate timed out/iu.test(message);
18892
18897
  };
18893
18898
  var createWaitFor = (evaluate) => async (expression, options = {}) => {
18894
18899
  const timeoutMs = options.timeoutMs ?? CDP_COMMAND_TIMEOUT_MS;
package/dist/index.js CHANGED
@@ -12722,6 +12722,17 @@ var MOBILE_UPDATE_REGISTRY_FORMAT = 1, DEFAULT_PREFIX = "absolutejs/mobile-updat
12722
12722
  });
12723
12723
  return value;
12724
12724
  };
12725
+ const readHealthPause = async (channel) => {
12726
+ if (!channel.releaseId)
12727
+ return null;
12728
+ const promotionId = healthPromotionId(channel);
12729
+ const value = await readVerifiedObject(pauseKey(channel.appId, promotionId, channel.releaseId), "health pause");
12730
+ if (value === null)
12731
+ return null;
12732
+ if (!object3(value) || value.format !== 1 || value.appId !== channel.appId || value.channel !== channel.channel || value.promotionId !== promotionId || value.releaseId !== channel.releaseId || typeof value.failureRate !== "number" || !Number.isFinite(value.failureRate) || value.failureRate < 0 || value.failureRate > 1 || !Number.isSafeInteger(value.failures) || Number(value.failures) < 0 || !Number.isSafeInteger(value.reports) || Number(value.reports) < 1 || !iso(value.pausedAt))
12733
+ throw new MobileUpdateRegistryError("Stored mobile update health pause is invalid");
12734
+ return value;
12735
+ };
12725
12736
  const rolloutContext = async (channel) => {
12726
12737
  if (!options.store.list || !channel.releaseId)
12727
12738
  return null;
@@ -12753,18 +12764,31 @@ var MOBILE_UPDATE_REGISTRY_FORMAT = 1, DEFAULT_PREFIX = "absolutejs/mobile-updat
12753
12764
  throw new MobileUpdateRegistryError("Stored mobile update rollout control is invalid");
12754
12765
  parsedControls.push(value);
12755
12766
  }
12767
+ parsedControls.sort((left, right) => left.createdAt.localeCompare(right.createdAt) || left.id.localeCompare(right.id));
12756
12768
  const cancelled = parsedControls.some(({ action }) => action === "cancel");
12757
12769
  const resumedPauseIds = new Set(parsedControls.flatMap((control) => control.resumedPauseIds ?? []));
12758
- const activePauseIds = parsedControls.filter(({ action, id }) => action === "pause" && !resumedPauseIds.has(id)).map(({ id }) => id);
12770
+ const activePauseControls = parsedControls.filter(({ action, id }) => action === "pause" && !resumedPauseIds.has(id));
12771
+ const activePauseIds = activePauseControls.map(({ id }) => id);
12759
12772
  const operatorPaused = activePauseIds.length > 0;
12760
- const fleetPaused = Boolean(await options.store.head(pauseKey(channel.appId, promotionId, channel.releaseId)));
12773
+ const fleetPause = await readHealthPause(channel);
12774
+ const fleetPaused = fleetPause !== null;
12775
+ const transitionControl = parsedControls.find(({ action }) => action === "cancel") ?? activePauseControls.at(-1) ?? parsedControls.findLast(({ action }) => action === "resume");
12776
+ const latestTransition = fleetPause && (!transitionControl || fleetPause.pausedAt > transitionControl.createdAt) ? {
12777
+ activatedAt: fleetPause.pausedAt,
12778
+ activationId: digest(new TextEncoder().encode(`${promotionId}\x00fleet-pause\x00${fleetPause.pausedAt}`))
12779
+ } : transitionControl ? {
12780
+ activatedAt: transitionControl.createdAt,
12781
+ activationId: digest(new TextEncoder().encode(`${promotionId}\x00control\x00${transitionControl.id}\x00${transitionControl.action}`))
12782
+ } : undefined;
12761
12783
  return {
12784
+ ...latestTransition,
12762
12785
  cancelled,
12763
12786
  activePauseIds,
12764
12787
  channel,
12765
12788
  currentStage,
12766
12789
  enteredAt,
12767
12790
  fleetPaused,
12791
+ fleetPause,
12768
12792
  operatorPaused,
12769
12793
  plan,
12770
12794
  promotionId,
@@ -12833,6 +12857,7 @@ var MOBILE_UPDATE_REGISTRY_FORMAT = 1, DEFAULT_PREFIX = "absolutejs/mobile-updat
12833
12857
  if (!channel?.releaseId)
12834
12858
  return { status: "empty" };
12835
12859
  const rolloutState = await rolloutContext(channel);
12860
+ const healthPause = rolloutState?.fleetPause ?? (health ? await readHealthPause(channel) : null);
12836
12861
  let selected = rolloutMember({
12837
12862
  appId: input.appId,
12838
12863
  channel: input.channel,
@@ -12840,7 +12865,7 @@ var MOBILE_UPDATE_REGISTRY_FORMAT = 1, DEFAULT_PREFIX = "absolutejs/mobile-updat
12840
12865
  releaseId: channel.releaseId,
12841
12866
  rollout: rolloutState?.rollout ?? channel.rollout
12842
12867
  }) ? channel.releaseId : channel.fallbackReleaseId;
12843
- if (selected === channel.releaseId && (rolloutState?.cancelled || rolloutState?.fleetPaused || rolloutState?.operatorPaused || health && await options.store.head(pauseKey(input.appId, healthPromotionId(channel), channel.releaseId))))
12868
+ if (selected === channel.releaseId && (rolloutState?.cancelled || rolloutState?.fleetPaused || rolloutState?.operatorPaused || healthPause))
12844
12869
  selected = channel.fallbackReleaseId;
12845
12870
  if (!selected)
12846
12871
  return { status: "empty" };
@@ -12848,7 +12873,13 @@ var MOBILE_UPDATE_REGISTRY_FORMAT = 1, DEFAULT_PREFIX = "absolutejs/mobile-updat
12848
12873
  if (!release || release.manifest.runtimeFingerprint !== input.runtimeFingerprint)
12849
12874
  return { status: "incompatible" };
12850
12875
  return {
12851
- ...selected === channel.releaseId && channel.activationId && channel.activatedAt ? {
12876
+ ...rolloutState?.activationId && rolloutState.activatedAt ? {
12877
+ activationId: rolloutState.activationId,
12878
+ activatedAt: rolloutState.activatedAt
12879
+ } : healthPause ? {
12880
+ activatedAt: healthPause.pausedAt,
12881
+ activationId: digest(new TextEncoder().encode(`${healthPromotionId(channel)}\x00fleet-pause\x00${healthPause.pausedAt}`))
12882
+ } : selected === channel.releaseId && channel.activationId && channel.activatedAt ? {
12852
12883
  activationId: channel.activationId,
12853
12884
  activatedAt: channel.activatedAt
12854
12885
  } : {},
@@ -13732,7 +13763,9 @@ var MOBILE_UPDATE_REGISTRY_FORMAT = 1, DEFAULT_PREFIX = "absolutejs/mobile-updat
13732
13763
  const platform2 = request.headers.get("expo-platform");
13733
13764
  if (platform2 !== "android" && platform2 !== "ios")
13734
13765
  return new Response(null, { status: 400 });
13735
- const updateId = expoUpdateId((resolution?.status === "selected" ? resolution.activationId : undefined) ?? selected.manifest.releaseId);
13766
+ const activationId = resolution?.status === "selected" ? resolution.activationId : undefined;
13767
+ const activatedAt = resolution?.status === "selected" ? resolution.activatedAt : undefined;
13768
+ const updateId = expoUpdateId(activationId ?? selected.manifest.releaseId);
13736
13769
  if (request.headers.get("expo-current-update-id") === updateId)
13737
13770
  return new Response(null, { status: 204 });
13738
13771
  const descriptorFile = await options.registry.readUpdateFile({
@@ -13762,7 +13795,7 @@ var MOBILE_UPDATE_REGISTRY_FORMAT = 1, DEFAULT_PREFIX = "absolutejs/mobile-updat
13762
13795
  };
13763
13796
  const manifest = JSON.stringify({
13764
13797
  assets: platformUpdate.assets.map((asset2) => protocolAsset(asset2)),
13765
- createdAt: (resolution?.status === "selected" ? resolution.activatedAt : undefined) ?? selected.manifest.createdAt,
13798
+ createdAt: activatedAt ?? selected.manifest.createdAt,
13766
13799
  extra: {
13767
13800
  absolutejs: {
13768
13801
  channel: selected.manifest.channel,
@@ -45534,5 +45567,5 @@ export {
45534
45567
  wrapPageHandlerWithStreamingSlots
45535
45568
  };
45536
45569
 
45537
- //# debugId=95E12D596BC2404464756E2164756E21
45570
+ //# debugId=C72C9985AAD6064264756E2164756E21
45538
45571
  //# sourceMappingURL=index.js.map