@wix/himalaya-cli 0.988.0 → 0.989.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
@@ -5330,6 +5330,7 @@ function resolveTranslation(value, catalog, sourceCatalog) {
5330
5330
  var BINDING_SIGILS, BINDING_SIGIL_RE, TRANSLATION_PREFIX, TRANSLATION_KEY_RE;
5331
5331
  var init_bindings = __esm({
5332
5332
  "../../core/ts/src/bindings.ts"() {
5333
+ "use strict";
5333
5334
  BINDING_SIGILS = ["service", "flag", "item", "t"];
5334
5335
  BINDING_SIGIL_RE = new RegExp(
5335
5336
  `^\\$(?:${BINDING_SIGILS.filter((s) => s !== "t").join("|")})\\b|^\\$t:`
@@ -15931,7 +15932,7 @@ function wixClientIdOf(appConfigJson) {
15931
15932
  if (typeof clientId !== "string" || !clientId) return { error: "no_client_id" };
15932
15933
  return { clientId };
15933
15934
  }
15934
- var WIX_API, ONE_APP_SESSION, OWNER_SCOPED_WIX_HOST, VisitorTokenCache, OwnerInstanceCache, OWNER_SITES_QUERY_PATH, OWNER_SITES_COUNT_PATH, OwnerSitesCache;
15935
+ var WIX_API, ONE_APP_SESSION, OWNER_SCOPED_WIX_HOST, VisitorTokenCache, OWNER_REFRESH_MARGIN_MS, OwnerInstanceCache, OWNER_SITES_QUERY_PATH, OWNER_SITES_COUNT_PATH, OwnerSitesCache;
15935
15936
  var init_wix_bridge = __esm({
15936
15937
  "../../core/serve-runtime/src/wix-bridge.ts"() {
15937
15938
  init_sha256();
@@ -15968,20 +15969,29 @@ var init_wix_bridge = __esm({
15968
15969
  this.cache.delete(clientId);
15969
15970
  }
15970
15971
  };
15972
+ OWNER_REFRESH_MARGIN_MS = 6e4;
15971
15973
  OwnerInstanceCache = class {
15972
15974
  constructor(fetchImpl = fetch, ttlMs = 5 * 6e4) {
15973
15975
  this.fetchImpl = fetchImpl;
15974
15976
  this.ttlMs = ttlMs;
15975
15977
  }
15976
15978
  cache = /* @__PURE__ */ new Map();
15979
+ /** Keyed on the SESSION (`wixSession2`), not the whole cookie header: manage.wix.com's jar churns
15980
+ * (analytics, experiments), and keying on all of it re-minted on nearly every call (#3044). A
15981
+ * header with no session cookie falls back to itself — callers refuse that case before here. */
15977
15982
  key(msid, cookieHeader) {
15983
+ const session = /(?:^|;\s*)wixSession2=([^;]*)/.exec(cookieHeader)?.[1] ?? cookieHeader;
15978
15984
  return sha256Hex2(`${msid}
15979
- ${cookieHeader}`);
15985
+ ${session}`);
15980
15986
  }
15981
15987
  async instance(msid, cookieHeader, now = Date.now()) {
15988
+ return (await this.entry(msid, cookieHeader, now)).instance;
15989
+ }
15990
+ /** The instance and the time this cache stops trusting it (#3044: the web host caches until then). */
15991
+ async entry(msid, cookieHeader, now = Date.now()) {
15982
15992
  const key2 = this.key(msid, cookieHeader);
15983
15993
  const hit = this.cache.get(key2);
15984
- if (hit && hit.expiresAt > now) return hit.instance;
15994
+ if (hit && hit.expiresAt - OWNER_REFRESH_MARGIN_MS > now) return { instance: hit.instance, expiresAt: hit.expiresAt };
15985
15995
  const res = await this.fetchImpl(`${ONE_APP_SESSION}/${msid}/signed-instance?signed_instance_type=User`, {
15986
15996
  method: "GET",
15987
15997
  headers: { Cookie: cookieHeader }
@@ -15994,8 +16004,9 @@ ${cookieHeader}`);
15994
16004
  }
15995
16005
  if (res.status < 200 || res.status >= 300 || !j.signedInstance)
15996
16006
  throw new Error(`owner mint failed (${res.status})`);
15997
- this.cache.set(key2, { instance: j.signedInstance, expiresAt: now + this.ttlMs });
15998
- return j.signedInstance;
16007
+ const entry = { instance: j.signedInstance, expiresAt: now + this.ttlMs };
16008
+ this.cache.set(key2, entry);
16009
+ return { ...entry };
15999
16010
  }
16000
16011
  /** Drop a cached instance (e.g. after a 401 from wixapis) so the next call re-mints. */
16001
16012
  invalidate(msid, cookieHeader) {
@@ -43028,6 +43039,22 @@ ${releaseId}`;
43028
43039
  }
43029
43040
  });
43030
43041
  }
43042
+ if (path === "/v1/owner/instance") {
43043
+ if (opts.webwixBridge === false) return json3(503, { error: "webwix_bridge_disabled" });
43044
+ if (!webwixOwnerRungOn()) return json3(503, { error: "webwix_owner_disabled" });
43045
+ const msid = url.searchParams.get("msid") ?? "";
43046
+ if (!isSafeMsid(msid)) return json3(400, { error: "webwix_owner_bad_msid" });
43047
+ const cookie = request.headers.get("cookie") ?? "";
43048
+ if (!/wixSession2=/.test(cookie)) return json3(401, { error: "webwix_owner_no_session" });
43049
+ try {
43050
+ const entry = await webwixOwnerInstances.entry(msid, cookie);
43051
+ return json3(200, { ...entry, expiresInMs: Math.max(0, entry.expiresAt - Date.now()) }, { "cache-control": "no-store" });
43052
+ } catch (e) {
43053
+ const msg = String(e?.message ?? e);
43054
+ if (/owner mint failed \(5\d\d\)/.test(msg) || !msg.includes("owner mint failed")) return json3(502, { error: "webwix_bridge_upstream_failed" });
43055
+ return json3(403, { error: "webwix_owner_mint_failed" });
43056
+ }
43057
+ }
43031
43058
  if (path === "/v1/owner/sites") {
43032
43059
  if (!webwixOwnerRungOn()) return json3(503, { error: "webwix_owner_disabled" });
43033
43060
  const cookie = request.headers.get("cookie") ?? "";
@@ -43792,19 +43819,19 @@ var init_preview_assets_generated = __esm({
43792
43819
  "../../packages/serve/src/preview-assets.generated.ts"() {
43793
43820
  init_preview_assets_format();
43794
43821
  PREVIEW_ASSET_MANIFEST = [
43795
- { key: "assets/index-BHbI7Cmq.js", contentType: "application/javascript; charset=utf-8", offset: 8, length: 994462, sha256: "f4589e2d3922fada826a38cbf29c40cfbd124903a29c07c32b93f7019e417e05" },
43796
- { key: "fonts/WixMadeforDisplay-Bold.ttf", contentType: "font/ttf", offset: 994470, length: 90924, sha256: "ec4c7d63772d980d6e147b2df6215fd2737e4b04cebe0cf7e11dc695fb63cdcf" },
43797
- { key: "fonts/WixMadeforDisplay-ExtraBold.ttf", contentType: "font/ttf", offset: 1085394, length: 90984, sha256: "bf4c16a2774edd38a921edf3099469866cd74c094fd596f3fa4e81f54a04dfaa" },
43798
- { key: "fonts/WixMadeforDisplay-Medium.ttf", contentType: "font/ttf", offset: 1176378, length: 90980, sha256: "368faca44fb9f7207e4af784e94750b1ee59c1098b8689e0f4a918926f244fb5" },
43799
- { key: "fonts/WixMadeforDisplay-Regular.ttf", contentType: "font/ttf", offset: 1267358, length: 90872, sha256: "97ed8f1a6772abe26e3d8af5cecfc4b02faa94497d585b0398b5053b739a70c1" },
43800
- { key: "fonts/WixMadeforDisplay-SemiBold.ttf", contentType: "font/ttf", offset: 1358230, length: 90980, sha256: "642feab8a48ddf6c7a89d7c2a7c0edfa0e6e773f671287e460e222703563191e" },
43801
- { key: "fonts/WixMadeforText-Bold.ttf", contentType: "font/ttf", offset: 1449210, length: 108636, sha256: "37c179b4fefb63ea9637322b84583a2df53aa226c150294eea1675c14b1b8e29" },
43802
- { key: "fonts/WixMadeforText-ExtraBold.ttf", contentType: "font/ttf", offset: 1557846, length: 109084, sha256: "62e2fe4718129f36ecdb0ae4de385bd6b81ecc876146447167c6c140fad699a9" },
43803
- { key: "fonts/WixMadeforText-Medium.ttf", contentType: "font/ttf", offset: 1666930, length: 109048, sha256: "4ecf270136af928612c76fe4ebade91d8156975e5ea4c0cf9225501dd1788e02" },
43804
- { key: "fonts/WixMadeforText-Regular.ttf", contentType: "font/ttf", offset: 1775978, length: 107700, sha256: "dee56f09fd3efc127c1ea95557edc74110c1460a46287da36e0af25efd341ef5" },
43805
- { key: "fonts/WixMadeforText-SemiBold.ttf", contentType: "font/ttf", offset: 1883678, length: 88108, sha256: "dced97a77624bc5f8b1ae65850360908297f4588e09feb6f22792d29dc7e765b" },
43806
- { key: "index.html", contentType: "text/html; charset=utf-8", offset: 1971786, length: 4448, sha256: "246aa990caa5f3d2b93be16c284909d3cd339608304a0378eb838ea6eb21d21c" },
43807
- { key: "t5-frame.html", contentType: "text/html; charset=utf-8", offset: 1976234, length: 13784, sha256: "cfb9465254fab84f0e084bb4542c282758ea29774b5f172840cc0b9e4194ef89" }
43822
+ { key: "assets/index-DKlP06hp.js", contentType: "application/javascript; charset=utf-8", offset: 8, length: 997374, sha256: "9dd7ca28e467c7715af80eb404682bcd75804fee6941c8ae30cacdb542385854" },
43823
+ { key: "fonts/WixMadeforDisplay-Bold.ttf", contentType: "font/ttf", offset: 997382, length: 90924, sha256: "ec4c7d63772d980d6e147b2df6215fd2737e4b04cebe0cf7e11dc695fb63cdcf" },
43824
+ { key: "fonts/WixMadeforDisplay-ExtraBold.ttf", contentType: "font/ttf", offset: 1088306, length: 90984, sha256: "bf4c16a2774edd38a921edf3099469866cd74c094fd596f3fa4e81f54a04dfaa" },
43825
+ { key: "fonts/WixMadeforDisplay-Medium.ttf", contentType: "font/ttf", offset: 1179290, length: 90980, sha256: "368faca44fb9f7207e4af784e94750b1ee59c1098b8689e0f4a918926f244fb5" },
43826
+ { key: "fonts/WixMadeforDisplay-Regular.ttf", contentType: "font/ttf", offset: 1270270, length: 90872, sha256: "97ed8f1a6772abe26e3d8af5cecfc4b02faa94497d585b0398b5053b739a70c1" },
43827
+ { key: "fonts/WixMadeforDisplay-SemiBold.ttf", contentType: "font/ttf", offset: 1361142, length: 90980, sha256: "642feab8a48ddf6c7a89d7c2a7c0edfa0e6e773f671287e460e222703563191e" },
43828
+ { key: "fonts/WixMadeforText-Bold.ttf", contentType: "font/ttf", offset: 1452122, length: 108636, sha256: "37c179b4fefb63ea9637322b84583a2df53aa226c150294eea1675c14b1b8e29" },
43829
+ { key: "fonts/WixMadeforText-ExtraBold.ttf", contentType: "font/ttf", offset: 1560758, length: 109084, sha256: "62e2fe4718129f36ecdb0ae4de385bd6b81ecc876146447167c6c140fad699a9" },
43830
+ { key: "fonts/WixMadeforText-Medium.ttf", contentType: "font/ttf", offset: 1669842, length: 109048, sha256: "4ecf270136af928612c76fe4ebade91d8156975e5ea4c0cf9225501dd1788e02" },
43831
+ { key: "fonts/WixMadeforText-Regular.ttf", contentType: "font/ttf", offset: 1778890, length: 107700, sha256: "dee56f09fd3efc127c1ea95557edc74110c1460a46287da36e0af25efd341ef5" },
43832
+ { key: "fonts/WixMadeforText-SemiBold.ttf", contentType: "font/ttf", offset: 1886590, length: 88108, sha256: "dced97a77624bc5f8b1ae65850360908297f4588e09feb6f22792d29dc7e765b" },
43833
+ { key: "index.html", contentType: "text/html; charset=utf-8", offset: 1974698, length: 4448, sha256: "a21d7d8d7acdce79ccd442b4137814a17739998360e5b11fc74958c55b77ce30" },
43834
+ { key: "t5-frame.html", contentType: "text/html; charset=utf-8", offset: 1979146, length: 13784, sha256: "cfb9465254fab84f0e084bb4542c282758ea29774b5f172840cc0b9e4194ef89" }
43808
43835
  ];
43809
43836
  }
43810
43837
  });
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/himalaya-cli",
3
- "version": "0.988.0",
3
+ "version": "0.989.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": [
@@ -65,5 +65,5 @@
65
65
  "artifactId": "himalaya-cli"
66
66
  }
67
67
  },
68
- "falconPackageHash": "c2103681d4e81b57ca6cb6c383be4713d6962b36a34881a75524df88"
68
+ "falconPackageHash": "67a573e97c057c3bf277ed30655a7855e28d5c899c59b41eac1f3c85"
69
69
  }