@wix/himalaya-cli 0.1910.0 → 0.1911.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.
package/dist/cli.mjs CHANGED
@@ -42864,7 +42864,6 @@ function resolveIdiom(tokens2, ctx = {}) {
42864
42864
  var IDIOM_CONTEXTS, UNSAFE_KEYS;
42865
42865
  var init_idiom = __esm({
42866
42866
  "../../core/ts/src/idiom.ts"() {
42867
- "use strict";
42868
42867
  init_define_HHP_CATALOG();
42869
42868
  IDIOM_CONTEXTS = {
42870
42869
  ios: { native: ["ios"] },
@@ -44117,6 +44116,18 @@ function adoptedIdentity(config) {
44117
44116
  }
44118
44117
  androidSigning = adopt.androidSigning;
44119
44118
  }
44119
+ let androidUploadKeySha256;
44120
+ if (adopt.androidUploadKeySha256 !== void 0) {
44121
+ const raw2 = adopt.androidUploadKeySha256;
44122
+ const hex2 = typeof raw2 === "string" ? raw2.replace(/:/g, "").toLowerCase() : "";
44123
+ if (typeof raw2 !== "string" || !/^[0-9a-f]{64}$/.test(hex2) || raw2.includes(":") && !/^([0-9A-Fa-f]{2}:){31}[0-9A-Fa-f]{2}$/.test(raw2)) {
44124
+ fail2("androidUploadKeySha256", "must be a SHA-256 certificate fingerprint: 64 hex digits, optionally colon-separated.");
44125
+ }
44126
+ androidUploadKeySha256 = hex2;
44127
+ }
44128
+ if (androidSigning === "upload-keystore" && androidUploadKeySha256 === void 0) {
44129
+ fail2("androidUploadKeySha256", 'is required with androidSigning "upload-keystore": the store build cannot otherwise prove its key is the one Play expects.');
44130
+ }
44120
44131
  const iosAppGroups = stringList(adopt, "iosAppGroups");
44121
44132
  const seenGroups = /* @__PURE__ */ new Set();
44122
44133
  for (const g2 of iosAppGroups) {
@@ -44169,6 +44180,7 @@ function adoptedIdentity(config) {
44169
44180
  ...appStoreId !== void 0 ? { appStoreId } : {},
44170
44181
  androidApplicationId,
44171
44182
  ...androidSigning !== void 0 ? { androidSigning } : {},
44183
+ ...androidUploadKeySha256 !== void 0 ? { androidUploadKeySha256 } : {},
44172
44184
  iosAppGroups,
44173
44185
  urlSchemes,
44174
44186
  associatedDomains,
@@ -44195,6 +44207,7 @@ var init_store_adopt = __esm({
44195
44207
  "associatedDomains",
44196
44208
  "iosExtensionBundleIds",
44197
44209
  "androidSigning",
44210
+ "androidUploadKeySha256",
44198
44211
  "dropExtensions"
44199
44212
  ]);
44200
44213
  IOS_BUNDLE_ID = /^[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)+$/;
@@ -168323,7 +168336,7 @@ function withAdoptedIdentity(cfg, adopted, app2 = "<app>") {
168323
168336
  if (want === void 0) continue;
168324
168337
  const have = out2[section3][key4];
168325
168338
  if (isSet(have) && have.trim() !== want) {
168326
- throw new Error(
168339
+ throw new AdoptedConfigConflictError(
168327
168340
  `apps/${app2}/store/store.config.yaml ${section3}.${key4} "${have.trim()}" disagrees with config.ts store.adopt.${field} "${want}" \u2014 make them equal, or drop ${section3}.${key4} so it defaults from store.adopt`
168328
168341
  );
168329
168342
  }
@@ -168338,7 +168351,7 @@ function assertTeamMatchesAdopted(adopted, candidates, app2 = "<app>") {
168338
168351
  if (team2 && team2.trim() && team2.trim() !== want) throw new AdoptedTeamConflictError(app2, source2, team2.trim(), want);
168339
168352
  }
168340
168353
  }
168341
- var isSet, PAIRS, AdoptedTeamConflictError;
168354
+ var isSet, PAIRS, AdoptedConfigConflictError, AdoptedTeamConflictError;
168342
168355
  var init_adopted_identity = __esm({
168343
168356
  "../store-release/adopted-identity.ts"() {
168344
168357
  init_define_HHP_CATALOG();
@@ -168351,6 +168364,13 @@ var init_adopted_identity = __esm({
168351
168364
  ["ios", "appStoreId", "appStoreId"],
168352
168365
  ["android", "packageName", "androidApplicationId"]
168353
168366
  ];
168367
+ AdoptedConfigConflictError = class extends Error {
168368
+ code = "adopted_config_conflict";
168369
+ constructor(message5) {
168370
+ super(message5);
168371
+ this.name = "AdoptedConfigConflictError";
168372
+ }
168373
+ };
168354
168374
  AdoptedTeamConflictError = class extends Error {
168355
168375
  constructor(app2, source2, team2, adoptedTeam) {
168356
168376
  super(
@@ -194521,7 +194541,7 @@ var init_embedded_bundles = __esm({
194521
194541
  function resolveStoreBundleId(devBundleId, opts = {}) {
194522
194542
  if (opts.adopted) {
194523
194543
  if (opts.toBundleId && opts.toBundleId !== opts.adopted.iosBundleId) {
194524
- throw new Error(
194544
+ throw new AdoptedConfigConflictError(
194525
194545
  `store-spec: store.config.yaml ios.bundleId "${opts.toBundleId}" disagrees with config.ts store.adopt.iosBundleId "${opts.adopted.iosBundleId}" \u2014 make them equal (or drop ios.bundleId, which defaults from store.adopt)`
194526
194546
  );
194527
194547
  }
@@ -194649,6 +194669,7 @@ var init_store_spec = __esm({
194649
194669
  init_version();
194650
194670
  init_binary_core();
194651
194671
  init_embedded_bundles();
194672
+ init_adopted_identity();
194652
194673
  init_store_adopt2();
194653
194674
  init_embedded_bundles();
194654
194675
  HEADER2 = "# GENERATED by tools/store-release/store-spec.ts \u2014 do not edit by hand.\n# A store-distribution override of project.yml (prod bundle id, production APNs,\n# real associated-domains, code signing enabled). Regenerate, don't hand-tune.\n";
@@ -265106,13 +265127,23 @@ async function renderBuild(dir, app2, a3, opts) {
265106
265127
  };
265107
265128
  const keyBefore = keyNow();
265108
265129
  const kept = keyBefore && !opts.noCache ? readKeptBuild2(dir, keyBefore) : null;
265130
+ const trace = process.env.HIMI_RENDER_CACHE_TRACE === "1" ? (fields2) => process.stderr.write(`himi-render-cache ${JSON.stringify({ key: keyBefore, inputs, ...fields2 })}
265131
+ `) : null;
265109
265132
  if (kept && envUnchanged2(kept.build.env)) {
265110
265133
  try {
265111
265134
  const release4 = await loadReleaseFromDir(app2, kept.releaseDir);
265112
265135
  const renders = await a3.renderFromContent(dir, kept.releaseDir, { ...kept.build.ownBundles ? { tier5Dir: a3.bundleOutDir(dir) } : {}, render: opts.render, failedToBuild: failedScreenIds(kept.build.failedToBuild) });
265113
- if (renders) return { build: "reused", renders, kept: kept.build, release: release4 };
265114
- } catch {
265136
+ if (renders) {
265137
+ trace?.({ build: "reused" });
265138
+ return { build: "reused", renders, kept: kept.build, release: release4 };
265139
+ }
265140
+ trace?.({ declined: "the kept build no longer serves a screen it made" });
265141
+ } catch (e2) {
265142
+ trace?.({ declined: `reading the kept build failed: ${e2 instanceof Error ? e2.message : String(e2)}` });
265115
265143
  }
265144
+ } else if (trace) {
265145
+ const changed = kept ? Object.entries(kept.build.env ?? {}).filter(([name]) => !envUnchanged2({ [name]: kept.build.env[name] })).map(([name]) => name) : [];
265146
+ trace({ declined: opts.noCache ? "--no-cache" : !keyBefore ? "no key" : !kept ? "no build kept under this key" : `environment changed: ${changed.join(", ")}` });
265116
265147
  }
265117
265148
  const buildDir = newBuildDir2(dir);
265118
265149
  try {
@@ -265142,6 +265173,7 @@ async function renderBuild(dir, app2, a3, opts) {
265142
265173
  const key4 = bres.compileErrors.length === 0 ? keyNow() : null;
265143
265174
  if (key4 && key4 === keyBefore) keepBuild2(dir, key4, buildDir, build3);
265144
265175
  else dropBuildDir2(buildDir);
265176
+ trace?.({ build: "built", kept: Boolean(key4 && key4 === keyBefore), ...key4 === keyBefore ? {} : { keyAfter: key4, compileErrors: bres.compileErrors.length } });
265145
265177
  return { build: "built", renders: outcome.renders ?? [], kept: build3, release: release4 };
265146
265178
  } catch (e2) {
265147
265179
  dropBuildDir2(buildDir);
@@ -270841,6 +270873,41 @@ ${releaseId}`;
270841
270873
  }
270842
270874
  return m2;
270843
270875
  }
270876
+ const RECENT_LIVE_RELEASES = 5;
270877
+ const RECENT_LIVE_GRACE_MS = 24 * 60 * 60 * 1e3;
270878
+ const RECENT_LIVE_CACHE_CAP = 500;
270879
+ const recentLiveCache = /* @__PURE__ */ new Map();
270880
+ async function recentLiveAssets(app2, currentId) {
270881
+ const hit = recentLiveCache.get(app2);
270882
+ if (hit && hit.currentId === currentId && Date.now() - hit.at < manifestCacheTtlMs) return hit.bySha;
270883
+ const store = await getStore();
270884
+ const bySha = /* @__PURE__ */ new Map();
270885
+ if (!store.getWipRecord || !store.getManifestById) return bySha;
270886
+ let ids2;
270887
+ try {
270888
+ const promoted = normalizeWipRecord(await store.getWipRecord(app2)).promoted;
270889
+ const now = Date.now();
270890
+ ids2 = [];
270891
+ for (let i2 = promoted.length - 1; i2 >= 0 && ids2.length < RECENT_LIVE_RELEASES; i2--) {
270892
+ if (promoted[i2].id === currentId) continue;
270893
+ const replacedAt = i2 + 1 < promoted.length ? Date.parse(promoted[i2 + 1].at ?? "") : now;
270894
+ if (Number.isNaN(replacedAt) || now - replacedAt > RECENT_LIVE_GRACE_MS) break;
270895
+ ids2.push(promoted[i2].id);
270896
+ }
270897
+ const manifests = await Promise.all(ids2.map((id) => store.getManifestById(app2, id)));
270898
+ for (const m2 of manifests.reverse()) {
270899
+ for (const record6 of Object.values(m2?.assets ?? {})) bySha.set(record6.sha256, record6);
270900
+ }
270901
+ } catch {
270902
+ return bySha;
270903
+ }
270904
+ if (!recentLiveCache.has(app2) && recentLiveCache.size >= RECENT_LIVE_CACHE_CAP) {
270905
+ const oldest3 = recentLiveCache.keys().next().value;
270906
+ if (oldest3 !== void 0) recentLiveCache.delete(oldest3);
270907
+ }
270908
+ recentLiveCache.set(app2, { currentId, at: Date.now(), bySha });
270909
+ return bySha;
270910
+ }
270844
270911
  async function pinnedBody(app2, hash3, slot) {
270845
270912
  const store = await getStore();
270846
270913
  const doc = store.getDoc ? await store.getDoc(app2, hash3) : null;
@@ -271907,7 +271974,7 @@ ${releaseId}`;
271907
271974
  const sha7 = assetMatch[1];
271908
271975
  if (!isSafeSegment(sha7)) return json6(400, { error: "bad_asset" });
271909
271976
  const m2 = pin ? await pinnedManifest(app2, pin) : await manifest2(app2);
271910
- const record6 = Object.values(m2?.assets ?? {}).find((a3) => a3.sha256 === sha7);
271977
+ const record6 = Object.values(m2?.assets ?? {}).find((a3) => a3.sha256 === sha7) ?? (!pin && m2 ? (await recentLiveAssets(app2, m2.releaseId)).get(sha7) : void 0);
271911
271978
  if (!record6) return json6(404, { error: "asset_not_found", app: app2 });
271912
271979
  const etag = strongEtagForSha256(sha7);
271913
271980
  const media = record6.storage === "media";
@@ -272120,6 +272187,7 @@ var init_server3 = __esm({
272120
272187
  init_sha256();
272121
272188
  init_store();
272122
272189
  init_base64();
272190
+ init_wip_pointer();
272123
272191
  init_contract();
272124
272192
  init_preview_token();
272125
272193
  init_pinned_read();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/himalaya-cli",
3
- "version": "0.1910.0",
3
+ "version": "0.1911.0",
4
4
  "type": "module",
5
5
  "description": "himi — the Himalaya authoring CLI. Build a Tier-5 content package on your own machine, push it to the production serve as a draft, preview it on web + Himi Player, and read worker logs back — the remote dev loop. Wraps @himalaya/serve-cli for transport.",
6
6
  "keywords": [
@@ -82,5 +82,5 @@
82
82
  "artifactId": "himalaya-cli"
83
83
  }
84
84
  },
85
- "falconPackageHash": "c8e651a2989fdf01a0fdd4fc79d1a2a0e0918f4788fc8e14d1987b34"
85
+ "falconPackageHash": "6fd5f59feb7e8a086b67858bcf93c361ae78a1ad9bdc7cf3fdcd04f9"
86
86
  }