@wix/himalaya-cli 0.1081.0 → 0.1082.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 (2) hide show
  1. package/dist/cli.mjs +19 -7
  2. package/package.json +2 -2
package/dist/cli.mjs CHANGED
@@ -6737,7 +6737,6 @@ function walk(node, registry, path2, out2) {
6737
6737
  var SYSTEM_FONT_FAMILY, TONAL_ELEVATION_ALPHA;
6738
6738
  var init_tokens = __esm({
6739
6739
  "../../core/ts/src/tokens.ts"() {
6740
- "use strict";
6741
6740
  SYSTEM_FONT_FAMILY = "$system";
6742
6741
  TONAL_ELEVATION_ALPHA = [0, 0.05, 0.08, 0.11, 0.12, 0.14];
6743
6742
  }
@@ -6764,7 +6763,6 @@ function resolveTranslation(value, catalog, sourceCatalog) {
6764
6763
  var BINDING_SIGILS, BINDING_SIGIL_RE, TRANSLATION_PREFIX, TRANSLATION_KEY_RE;
6765
6764
  var init_bindings = __esm({
6766
6765
  "../../core/ts/src/bindings.ts"() {
6767
- "use strict";
6768
6766
  BINDING_SIGILS = ["service", "flag", "item", "t"];
6769
6767
  BINDING_SIGIL_RE = new RegExp(
6770
6768
  `^\\$(?:${BINDING_SIGILS.filter((s) => s !== "t").join("|")})\\b|^\\$t:`
@@ -50205,7 +50203,12 @@ async function signature(body, secret) {
50205
50203
  function isClaims(value) {
50206
50204
  if (!value || typeof value !== "object") return false;
50207
50205
  const c = value;
50208
- return c.v === PREVIEW_TOKEN_VERSION && typeof c.sub === "string" && !!c.sub && typeof c.app === "string" && !!c.app && typeof c.releaseId === "string" && !!c.releaseId && (c.screenId === void 0 || typeof c.screenId === "string") && typeof c.source === "string" && typeof c.iat === "number" && Number.isInteger(c.iat) && typeof c.exp === "number" && Number.isInteger(c.exp);
50206
+ return c.v === PREVIEW_TOKEN_VERSION && typeof c.sub === "string" && !!c.sub && typeof c.app === "string" && !!c.app && typeof c.releaseId === "string" && !!c.releaseId && (c.screenId === void 0 || typeof c.screenId === "string") && typeof c.source === "string" && typeof c.iat === "number" && Number.isInteger(c.iat) && typeof c.exp === "number" && Number.isInteger(c.exp) && // A follow token carries BOTH claims or neither. Half of one is malformed — never a plain
50207
+ // preview token, which is what dropping the unrecognised half would turn it into.
50208
+ (c.grant === void 0 && c.gen === void 0 || isFollowClaimPair(c.grant, c.gen));
50209
+ }
50210
+ function isFollowClaimPair(grant, gen) {
50211
+ return typeof grant === "string" && FOLLOW_GRANT_ID_RE.test(grant) && typeof gen === "number" && Number.isInteger(gen) && gen >= 1;
50209
50212
  }
50210
50213
  async function verifyPreviewToken(input) {
50211
50214
  const [body, sig, extra] = input.token.split(".");
@@ -50225,7 +50228,7 @@ async function verifyPreviewToken(input) {
50225
50228
  }
50226
50229
  return { ok: true, claims };
50227
50230
  }
50228
- var SUBTLE_ALGO, PREVIEW_TOKEN_VERSION, DEFAULT_PREVIEW_TOKEN_TTL_SECONDS, WEB_PREVIEW_TOKEN_TTL_SECONDS;
50231
+ var SUBTLE_ALGO, PREVIEW_TOKEN_VERSION, DEFAULT_PREVIEW_TOKEN_TTL_SECONDS, WEB_PREVIEW_TOKEN_TTL_SECONDS, FOLLOW_GRANT_ID_RE;
50229
50232
  var init_preview_token = __esm({
50230
50233
  "../../core/serve-runtime/src/preview-token.ts"() {
50231
50234
  init_site_lease();
@@ -50234,6 +50237,7 @@ var init_preview_token = __esm({
50234
50237
  PREVIEW_TOKEN_VERSION = 1;
50235
50238
  DEFAULT_PREVIEW_TOKEN_TTL_SECONDS = 5 * 60;
50236
50239
  WEB_PREVIEW_TOKEN_TTL_SECONDS = 45 * 60;
50240
+ FOLLOW_GRANT_ID_RE = /^[A-Za-z0-9_-]{22}$/;
50237
50241
  }
50238
50242
  });
50239
50243
 
@@ -53664,14 +53668,21 @@ var init_assets = __esm({
53664
53668
 
53665
53669
  // ../../core/serve-runtime/src/pinned-read.ts
53666
53670
  async function checkPinnedRead(input) {
53667
- const { secret, token, app, releaseId, screenId, authorizePreview } = input;
53671
+ const { secret, token, app, releaseId, screenId, authorizePreview, authorizeFollow } = input;
53668
53672
  if (!secret) return authorizePreview ? { status: 503, body: { error: "preview_token_unavailable" } } : null;
53669
53673
  if (!token) return await input.isPublic() ? null : { status: 401, body: { error: "preview_token_required", app, releaseId } };
53670
- const verified = await verifyPreviewToken({ token, secret, app, releaseId, screenId });
53674
+ const verified = await verifyPreviewToken({ token, secret, app, releaseId, screenId, nowSeconds: input.nowSeconds });
53671
53675
  if (verified.ok) {
53672
53676
  if (authorizePreview ? !await authorizePreview(verified.claims) : !!verified.claims.siteLease) {
53673
53677
  return { status: 403, body: { error: "site_preview_forbidden" } };
53674
53678
  }
53679
+ if (verified.claims.grant !== void 0) {
53680
+ if (!authorizeFollow) return { status: 503, body: { error: "follow_token_unverifiable", app, releaseId } };
53681
+ const decision = await authorizeFollow(verified.claims);
53682
+ if (!decision.ok) {
53683
+ return { status: decision.status, body: { error: decision.error, ...decision.reason ? { reason: decision.reason } : {}, app, releaseId } };
53684
+ }
53685
+ }
53675
53686
  return null;
53676
53687
  }
53677
53688
  return {
@@ -54056,7 +54067,8 @@ ${releaseId}`;
54056
54067
  releaseId,
54057
54068
  screenId,
54058
54069
  isPublic: async () => (await manifest(app))?.releaseId === releaseId || await isRingRelease(app, releaseId),
54059
- authorizePreview: opts.authorizePreview
54070
+ authorizePreview: opts.authorizePreview,
54071
+ authorizeFollow: opts.authorizeFollow
54060
54072
  });
54061
54073
  return denied && json4(denied.status, denied.body);
54062
54074
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/himalaya-cli",
3
- "version": "0.1081.0",
3
+ "version": "0.1082.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": [
@@ -67,5 +67,5 @@
67
67
  "artifactId": "himalaya-cli"
68
68
  }
69
69
  },
70
- "falconPackageHash": "fabad058e08298bebcb3bacb89f82255ed6b92c6ee395d7b444c7fd3"
70
+ "falconPackageHash": "2de158374281e46bbd2976601d42e40436b4f87a2f4836dcab980ceb"
71
71
  }