@wix/himalaya-cli 0.1672.0 → 0.1674.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 (44) hide show
  1. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/legacy-import/src/index.d.ts +16 -0
  2. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/legacy-import.d.ts +21 -3
  3. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/online-programs/src/index.d.ts +4 -0
  4. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/core.mjs +14 -2
  5. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/legacy-import.mjs +32 -1
  6. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-online-programs.mjs +25 -1
  7. package/dist/browser-plane/assets.json +5 -5
  8. package/dist/browser-plane/preview-deferred/{cf2ac6865a1e6be5cccec4f2538bf18bbbf121a5f5971ad46212bf3a848ec35c.bin → 0f5533bf4197dc43489701db18378cecdb02db230a0fc2603e764999544513da.bin} +1 -1
  9. package/dist/browser-plane/sw.js +6 -6
  10. package/dist/cli.mjs +366 -110
  11. package/dist/preview-assets.generated.bin +0 -0
  12. package/guides/himi-json-output.md +5 -0
  13. package/guides/releasing-with-himi-serve.md +10 -2
  14. package/guides/sdk-reference.json +17 -3
  15. package/guides/skill.md +1 -0
  16. package/guides/web-page-sdk-reference.md +1 -1
  17. package/package.json +2 -2
  18. package/templates/beauty-salon/l10n/en.json +1 -1
  19. package/templates/branded-lite/dev/index.ts +6607 -2231
  20. package/templates/branded-lite/l10n/en.json +25 -15
  21. package/templates/branded-lite/l10n/he.json +34 -34
  22. package/templates/branded-lite/tier5-src/_shared/himi-cms.ts +10 -3
  23. package/templates/branded-lite/tier5-src/_shared/program-standing.ts +6 -0
  24. package/templates/branded-lite/tier5-src/himi-branded-lite-cms/index.ts +7 -0
  25. package/templates/branded-lite/tier5-src/himi-branded-lite-cms-collection/index.ts +527 -138
  26. package/templates/branded-lite/tier5-src/himi-branded-lite-member-programs/index.ts +36 -7
  27. package/templates/branded-lite/tier5-src/himi-branded-lite-program/index.ts +30 -17
  28. package/templates/community-club/dev/index.ts +2459 -271
  29. package/templates/community-club/l10n/en.json +16 -11
  30. package/templates/community-club/l10n/he.json +38 -34
  31. package/templates/community-club/tier5-src/_shared/himi-cms.ts +10 -3
  32. package/templates/community-club/tier5-src/himi-branded-lite-cms/index.ts +7 -0
  33. package/templates/community-club/tier5-src/himi-branded-lite-cms-collection/index.ts +527 -138
  34. package/templates/events-meetups/l10n/en.json +1 -1
  35. package/templates/gym-fitness/l10n/en.json +1 -1
  36. package/templates/nonprofit-cause/l10n/en.json +1 -1
  37. package/templates/podcast-creator/l10n/en.json +1 -1
  38. package/templates/portfolio-creative/l10n/en.json +1 -1
  39. package/templates/restaurant/l10n/en.json +1 -1
  40. package/templates/retail-store/l10n/en.json +1 -1
  41. package/templates/yoga-studio/l10n/en.json +1 -1
  42. package/templates/yoga-studio/tier5-src/_shared/program-standing.ts +6 -0
  43. package/templates/yoga-studio/tier5-src/himi-branded-lite-member-programs/index.ts +36 -7
  44. package/templates/yoga-studio/tier5-src/himi-branded-lite-program/index.ts +30 -17
package/dist/cli.mjs CHANGED
@@ -650,12 +650,15 @@ __export(config_exports, {
650
650
  BUILTIN_TARGETS: () => BUILTIN_TARGETS,
651
651
  clearControlToken: () => clearControlToken,
652
652
  defaultTargetsPath: () => defaultTargetsPath,
653
+ loadPendingDeviceLogin: () => loadPendingDeviceLogin,
653
654
  loadSiteClient: () => loadSiteClient,
654
655
  loadTargetsFile: () => loadTargetsFile,
655
656
  resolveTarget: () => resolveTarget,
656
657
  resolveTargetName: () => resolveTargetName,
657
658
  saveControlToken: () => saveControlToken,
658
- saveSiteClient: () => saveSiteClient
659
+ savePendingDeviceLogin: () => savePendingDeviceLogin,
660
+ saveSiteClient: () => saveSiteClient,
661
+ swapPendingDeviceLogin: () => swapPendingDeviceLogin
659
662
  });
660
663
  import { homedir } from "node:os";
661
664
  import { join, dirname } from "node:path";
@@ -670,7 +673,8 @@ function loadTargetsFile(path2 = defaultTargetsPath()) {
670
673
  function saveControlToken(target, token, path2 = defaultTargetsPath()) {
671
674
  const file2 = loadTargetsFile(path2);
672
675
  file2.targets = file2.targets ?? {};
673
- file2.targets[target] = { ...file2.targets[target], controlToken: token };
676
+ const { pendingDeviceLogin: _superseded, ...rest } = file2.targets[target] ?? {};
677
+ file2.targets[target] = { ...rest, controlToken: token };
674
678
  writeTargetsFilePrivate(path2, file2);
675
679
  return path2;
676
680
  }
@@ -682,6 +686,35 @@ function saveSiteClient(target, msid, client4, path2 = defaultTargetsPath()) {
682
686
  writeTargetsFilePrivate(path2, file2);
683
687
  return path2;
684
688
  }
689
+ function savePendingDeviceLogin(target, pending2, path2 = defaultTargetsPath()) {
690
+ const file2 = loadTargetsFile(path2);
691
+ const t2 = file2.targets?.[target];
692
+ if (!pending2 && !t2?.pendingDeviceLogin) return path2;
693
+ file2.targets = file2.targets ?? {};
694
+ const next = { ...t2 };
695
+ if (pending2) next.pendingDeviceLogin = pending2;
696
+ else delete next.pendingDeviceLogin;
697
+ file2.targets[target] = next;
698
+ writeTargetsFilePrivate(path2, file2);
699
+ return path2;
700
+ }
701
+ function swapPendingDeviceLogin(target, deviceCode, next, path2 = defaultTargetsPath()) {
702
+ const file2 = loadTargetsFile(path2);
703
+ const t2 = file2.targets?.[target];
704
+ if (t2?.pendingDeviceLogin?.deviceCode !== deviceCode) return false;
705
+ const copy = { ...t2 };
706
+ if (next) copy.pendingDeviceLogin = next;
707
+ else delete copy.pendingDeviceLogin;
708
+ file2.targets[target] = copy;
709
+ writeTargetsFilePrivate(path2, file2);
710
+ return true;
711
+ }
712
+ function loadPendingDeviceLogin(target, path2 = defaultTargetsPath()) {
713
+ const p2 = loadTargetsFile(path2).targets?.[target]?.pendingDeviceLogin;
714
+ if (!p2 || typeof p2 !== "object") return void 0;
715
+ const ok5 = typeof p2.deviceCode === "string" && p2.deviceCode !== "" && typeof p2.ownerIssue === "string" && typeof p2.userCode === "string" && typeof p2.verificationUri === "string" && Number.isFinite(p2.interval) && Number.isFinite(p2.expiresAt) && Number.isFinite(p2.lastPollAt);
716
+ return ok5 ? p2 : void 0;
717
+ }
685
718
  function loadSiteClient(msid, target, path2 = defaultTargetsPath()) {
686
719
  const targets = loadTargetsFile(path2).targets ?? {};
687
720
  const key3 = msid.toLowerCase();
@@ -707,8 +740,10 @@ function writeTargetsFilePrivate(path2, file2) {
707
740
  }
708
741
  function clearControlToken(target, path2 = defaultTargetsPath()) {
709
742
  const file2 = loadTargetsFile(path2);
710
- if (file2.targets?.[target]?.controlToken) {
711
- delete file2.targets[target].controlToken;
743
+ const t2 = file2.targets?.[target];
744
+ if (t2?.controlToken || t2?.pendingDeviceLogin) {
745
+ delete t2.controlToken;
746
+ delete t2.pendingDeviceLogin;
712
747
  writeFileSync(path2, JSON.stringify(file2, null, 2) + "\n");
713
748
  }
714
749
  return path2;
@@ -152695,6 +152730,7 @@ var wix_owner_exports = {};
152695
152730
  __export(wix_owner_exports, {
152696
152731
  TOKEN_EXCHANGE_URL: () => TOKEN_EXCHANGE_URL,
152697
152732
  WIX_CLI_FIX: () => WIX_CLI_FIX,
152733
+ WIX_TOKEN_RE: () => WIX_TOKEN_RE,
152698
152734
  WIX_VIDEO_GATEWAY_URL: () => WIX_VIDEO_GATEWAY_URL,
152699
152735
  WixApiError: () => WixApiError,
152700
152736
  WixTokenError: () => WixTokenError,
@@ -152727,6 +152763,9 @@ function resolveSiteId(flag2) {
152727
152763
  }
152728
152764
  return id;
152729
152765
  }
152766
+ function redactWixCredentials(s2) {
152767
+ return s2.replace(WIX_CREDENTIAL_G, (m2) => `${/^(IDN2|IST|OauthNG\.JWS|SRV\.JWS)/.exec(m2)?.[1] ?? "token"}.<redacted>`);
152768
+ }
152730
152769
  async function siteToken(msid, spawnImpl = spawn3, fetchImpl = fetch) {
152731
152770
  if (!process.env.WIX_TEST_TOKEN?.trim()) {
152732
152771
  const key3 = siteApiKey();
@@ -152812,7 +152851,7 @@ function refreshableSiteToken(msid, token) {
152812
152851
  }
152813
152852
  function redactTokens(v2) {
152814
152853
  const s2 = typeof v2 === "string" ? v2 : JSON.stringify(v2 ?? null);
152815
- return s2.replace(/OauthNG\.JWS\.[A-Za-z0-9._-]+/g, "OauthNG.JWS.<redacted>").slice(0, 300);
152854
+ return redactWixCredentials(s2).slice(0, 300);
152816
152855
  }
152817
152856
  function exchangeRefusal(status, body, msid) {
152818
152857
  const b2 = body ?? {};
@@ -152901,7 +152940,7 @@ async function mintToken(args, label4, cacheKey, spawnImpl) {
152901
152940
  const timer = setTimeout(
152902
152941
  () => done(() => reject(new WixTokenError(
152903
152942
  "wix_cli_token_failed",
152904
- `\`${label4}\` printed no OauthNG token within ${TOKEN_MINT_TIMEOUT_MS}ms. Is the Wix CLI logged in (\`wix login\`)? ${redactForError(out2)}`,
152943
+ `\`${label4}\` printed no Wix token within ${TOKEN_MINT_TIMEOUT_MS}ms. Is the Wix CLI logged in (\`wix login\`)? ${redactForError(out2)}`,
152905
152944
  mintFailedFix(label4)
152906
152945
  ))),
152907
152946
  TOKEN_MINT_TIMEOUT_MS
@@ -152919,7 +152958,7 @@ async function mintToken(args, label4, cacheKey, spawnImpl) {
152919
152958
  child.on("error", (e2) => done(() => reject(spawnFailure(label4, e2))));
152920
152959
  child.on("exit", (code2) => done(() => reject(new WixTokenError(
152921
152960
  "wix_cli_token_failed",
152922
- `\`${label4}\` exited (code ${code2}) without printing an OauthNG token \u2014 is the Wix CLI logged in (\`wix login\`)? ${redactForError(out2)}`,
152961
+ `\`${label4}\` exited (code ${code2}) without printing a Wix token \u2014 is the Wix CLI logged in (\`wix login\`)? ${redactForError(out2)}`,
152923
152962
  mintFailedFix(label4)
152924
152963
  ))));
152925
152964
  });
@@ -152927,7 +152966,7 @@ async function mintToken(args, label4, cacheKey, spawnImpl) {
152927
152966
  return token;
152928
152967
  }
152929
152968
  function redactForError(buf) {
152930
- const cleaned = buf.replace(/OauthNG\.JWS\.[A-Za-z0-9._-]+/g, "OauthNG.JWS.<redacted>").replace(/\b[A-Za-z0-9_-]{40,}\b/g, "<redacted>");
152969
+ const cleaned = redactWixCredentials(buf).replace(/\b[A-Za-z0-9_-]{40,}\b/g, "<redacted>");
152931
152970
  const trimmed = cleaned.trim();
152932
152971
  return trimmed ? `Output (credentials redacted):
152933
152972
  ${trimmed.slice(0, 300)}` : "It printed nothing.";
@@ -153022,14 +153061,17 @@ async function mapLimit(items, limit, fn2) {
153022
153061
  }));
153023
153062
  return results;
153024
153063
  }
153025
- var API_BASE, WIX_VIDEO_GATEWAY_URL, tokenCache, TOKEN_RE, TOKEN_MINT_TIMEOUT_MS, TOKEN_EXCHANGE_URL, EXCHANGE_REFRESH_MARGIN_MS, EXCHANGE_DEFAULT_TTL_S, exchangeCache, recentExchanged, RECENT_EXCHANGED_PER_SITE, exchangeInFlight, SITE_TOKEN_EXCHANGE_FIX, ACCOUNT_TOKEN_KEY, WIX_CLI_FIX, WixTokenError, WixApiError, DEFAULT_TIMEOUT_MS;
153064
+ var API_BASE, WIX_VIDEO_GATEWAY_URL, tokenCache, WIX_CREDENTIAL, WIX_TOKEN_RE, TOKEN_RE, WIX_CREDENTIAL_G, TOKEN_MINT_TIMEOUT_MS, TOKEN_EXCHANGE_URL, EXCHANGE_REFRESH_MARGIN_MS, EXCHANGE_DEFAULT_TTL_S, exchangeCache, recentExchanged, RECENT_EXCHANGED_PER_SITE, exchangeInFlight, SITE_TOKEN_EXCHANGE_FIX, ACCOUNT_TOKEN_KEY, WIX_CLI_FIX, WixTokenError, WixApiError, DEFAULT_TIMEOUT_MS;
153026
153065
  var init_wix_owner = __esm({
153027
153066
  "src/wix-owner.ts"() {
153028
153067
  init_define_HHP_CATALOG();
153029
153068
  API_BASE = "https://www.wixapis.com";
153030
153069
  WIX_VIDEO_GATEWAY_URL = "https://manage.wix.com/_api/vod/public/graphql";
153031
153070
  tokenCache = /* @__PURE__ */ new Map();
153032
- TOKEN_RE = /OauthNG\.JWS\.[A-Za-z0-9._-]+/;
153071
+ WIX_CREDENTIAL = "(?:IDN2|IST|OauthNG\\.JWS|SRV\\.JWS)\\.[A-Za-z0-9_-]+(?:\\.[A-Za-z0-9_-]*)*";
153072
+ WIX_TOKEN_RE = new RegExp(WIX_CREDENTIAL);
153073
+ TOKEN_RE = WIX_TOKEN_RE;
153074
+ WIX_CREDENTIAL_G = new RegExp(WIX_CREDENTIAL, "g");
153033
153075
  TOKEN_MINT_TIMEOUT_MS = 3e4;
153034
153076
  TOKEN_EXCHANGE_URL = `${API_BASE}/oauth2/token`;
153035
153077
  EXCHANGE_REFRESH_MARGIN_MS = 6e4;
@@ -222930,50 +222972,50 @@ var init_preview_assets_generated = __esm({
222930
222972
  init_define_HHP_CATALOG();
222931
222973
  init_preview_assets_format();
222932
222974
  PREVIEW_ASSET_MANIFEST = [
222933
- { key: "assets/DashboardHost-DDz6f3jr.js", contentType: "application/javascript; charset=utf-8", offset: 8, length: 2984, sha256: "92e4c2c5643f3328cc5bcca0fe7c34407165aaabb03da833fa70b34f6260b259" },
222934
- { key: "assets/DevDrawer-DAnNrvEw.js", contentType: "application/javascript; charset=utf-8", offset: 2992, length: 16783, sha256: "ca7af545f6ea02aa6f5fe1b899ef14869f986a9cd9fd8edf4f135be1a138a5ff" },
222935
- { key: "assets/IdiomCompare-CAAg4GVY.js", contentType: "application/javascript; charset=utf-8", offset: 19775, length: 1926, sha256: "e07c76f50e7effab208c7fcbe2ea52d3bd09690f3bfe9b147dc7c6a386f8adfb" },
222936
- { key: "assets/LightboxViewer-ChAgn09C.js", contentType: "application/javascript; charset=utf-8", offset: 21701, length: 17379, sha256: "9a71c33960f1f70ac815ae036973cd29f54ed0ff9ae531390cf49cd438919dca" },
222937
- { key: "assets/OfflineReadingBar-BHKyn3fS.js", contentType: "application/javascript; charset=utf-8", offset: 39080, length: 1646, sha256: "4a0aefd8ead269c3298e61740ff6dace56fc13cffef1fec5f98ee588eeead296" },
222938
- { key: "assets/PhonePreviewControl--6eecl2m.js", contentType: "application/javascript; charset=utf-8", offset: 40726, length: 37851, sha256: "75ee5e75479639d3a699f0d7adc550c9ed8454a7263342f6cefe0f48359fefbd" },
222939
- { key: "assets/SchemeCompare-BfqXx-sZ.js", contentType: "application/javascript; charset=utf-8", offset: 78577, length: 1858, sha256: "ef033da3c8e879d3e84c7c710920eb8f1dbea6b07f9cbb295bfc89aae239bd65" },
222940
- { key: "assets/WixFrogTelemetrySink-9xk0fLVA.js", contentType: "application/javascript; charset=utf-8", offset: 80435, length: 3497, sha256: "a6958aa7f82c3ce12493581b715d3c89361d5ec881a6df93259f0c6b29935650" },
222975
+ { key: "assets/DashboardHost-Dkt8yykH.js", contentType: "application/javascript; charset=utf-8", offset: 8, length: 2984, sha256: "e826ef5f55e3e6fe6e8b31e1911c6996e1e620c2e0799c317a7f89e918787958" },
222976
+ { key: "assets/DevDrawer-Xew7BiFr.js", contentType: "application/javascript; charset=utf-8", offset: 2992, length: 16783, sha256: "692ccd0572a4862f04962ab4b446c4fa1985d8cfd4416cbdb6b0e077ea82f531" },
222977
+ { key: "assets/IdiomCompare-D3DTQsPc.js", contentType: "application/javascript; charset=utf-8", offset: 19775, length: 1926, sha256: "5dfd234097857e00b518490a26f22cd763db72cd70703680d0d6cfc8e9d79a99" },
222978
+ { key: "assets/LightboxViewer-CJBVb0qZ.js", contentType: "application/javascript; charset=utf-8", offset: 21701, length: 17379, sha256: "9a8dc89a99043771247f7d7ee2bbbf41a8df69c9f2c1408945a08e30944a1f3a" },
222979
+ { key: "assets/OfflineReadingBar-8oyoGONb.js", contentType: "application/javascript; charset=utf-8", offset: 39080, length: 1646, sha256: "5f84a3bd39044fed0e8e96d0de5cab85eed3512ef195951bc25f12ee524412bd" },
222980
+ { key: "assets/PhonePreviewControl-9KM0QxYm.js", contentType: "application/javascript; charset=utf-8", offset: 40726, length: 37851, sha256: "7d2f3b57ebec72ce4c925fcb3a68adec95c1af02c1e4b3cb4a8c2d8f1b25eb86" },
222981
+ { key: "assets/SchemeCompare-Dxkab461.js", contentType: "application/javascript; charset=utf-8", offset: 78577, length: 1858, sha256: "a23c74bd63cc0502387dfaa4ab611e54c997a55cd814a0901b367b74cda7de67" },
222982
+ { key: "assets/WixFrogTelemetrySink-DGrETY8d.js", contentType: "application/javascript; charset=utf-8", offset: 80435, length: 3497, sha256: "43409962b43b1aacb4ffb821e1f9f2775e901049b260e414e8c76ea7c8d7d024" },
222941
222983
  { key: "assets/calendar-ics-BvfIYWjG.js", contentType: "application/javascript; charset=utf-8", offset: 83932, length: 2192, sha256: "1636167041e9829ceccd3544297b86b8475c38bd2f759c4dbc17c813dc6e9254" },
222942
222984
  { key: "assets/catalog-CAoUWITw.js", contentType: "application/javascript; charset=utf-8", offset: 86124, length: 26046, sha256: "4c270ca3051f77d761aef1297125e02339d48493dd2b84a0cacf0faf41aa8cb3" },
222943
- { key: "assets/catalogFontFaces-B0R6HIow.js", contentType: "application/javascript; charset=utf-8", offset: 112170, length: 1111, sha256: "dff6e6ed0237ed2e4604e979ed1058d5683bf3b5ac89489e9cb30cf7e5e0bc78" },
222985
+ { key: "assets/catalogFontFaces-DarpOX-8.js", contentType: "application/javascript; charset=utf-8", offset: 112170, length: 1111, sha256: "e2dd72a0beb134687199d4b5728fdbb980a8af81071b31d3cee74c9a653d0603" },
222944
222986
  { key: "assets/contacts-vcard-BcohPQ0m.js", contentType: "application/javascript; charset=utf-8", offset: 113281, length: 2567, sha256: "c4ff75e96cd909bbb9182c5dc78794fcebc65139fbddef2537711d774fb33ad0" },
222945
- { key: "assets/files-transfer-CV9voERK.js", contentType: "application/javascript; charset=utf-8", offset: 115848, length: 6446, sha256: "78929714c922287b1c317482c623d2195500d2c5320b6e6f958754f4399e759d" },
222987
+ { key: "assets/files-transfer-DSAckwLq.js", contentType: "application/javascript; charset=utf-8", offset: 115848, length: 6446, sha256: "9934ee9b52dda45ddb2f182c76d3cdb75b10f1fff150d94556d12c21bbdfcc6f" },
222946
222988
  { key: "assets/frogActionMap-CTMe3Bz1.js", contentType: "application/javascript; charset=utf-8", offset: 122294, length: 1172, sha256: "9f1ce4c70a680dfb902949e1f482c7e47500b69c3350cd091b1b51d674032d53" },
222947
- { key: "assets/frogApiRules-Dkw51eux.js", contentType: "application/javascript; charset=utf-8", offset: 123466, length: 2207, sha256: "cee7129a49db038aeb53c17fc767d0dcc1fcafdf587c68c96c662d05f8d7f47d" },
222989
+ { key: "assets/frogApiRules-CG0L8zVF.js", contentType: "application/javascript; charset=utf-8", offset: 123466, length: 2207, sha256: "5138a3316bd0e68303f18a1cc080171359db321492fec3cf23919ac50ca4b26e" },
222948
222990
  { key: "assets/frogScreenMap-S_IRnz20.js", contentType: "application/javascript; charset=utf-8", offset: 125673, length: 1067, sha256: "22b2f71e1b06df8f1e79b890d47fe42e983d37865c2cc9be753e4121764c91e1" },
222949
222991
  { key: "assets/glassPreviewBrowser-DONaOehd.js", contentType: "application/javascript; charset=utf-8", offset: 126740, length: 6578, sha256: "4402c4cddd2a564e7466cdf1e12a0e0277c0400b288e1e5eda1d23e797599d31" },
222950
222992
  { key: "assets/image-preparation-Cj4gldm6.js", contentType: "application/javascript; charset=utf-8", offset: 133318, length: 2704, sha256: "32944ea587c2f3b84389b66b50a850437560238f1c8d33b6275973ee04eee865" },
222951
- { key: "assets/index-DZUhelsx.js", contentType: "application/javascript; charset=utf-8", offset: 136022, length: 1565244, sha256: "0d4eec4ac4f25fb0581d3cf5e8d255a829447f083f29e8152a1995e85df9bc9e" },
222952
- { key: "assets/jsx-runtime-CdvZGgm7.js", contentType: "application/javascript; charset=utf-8", offset: 1701266, length: 7751, sha256: "42a78b508d0f309f6a4a6efbb8669015211b3c26574c5b0929884c4d9d20b806" },
222953
- { key: "assets/pdf-DralfB9K.js", contentType: "application/javascript; charset=utf-8", offset: 1709017, length: 488215, sha256: "cf2ac6865a1e6be5cccec4f2538bf18bbbf121a5f5971ad46212bf3a848ec35c" },
222954
- { key: "assets/pdf.worker.min-BGnVRhRG.js", contentType: "application/javascript; charset=utf-8", offset: 2197232, length: 90, sha256: "521a0e528916d678d7588b2cddf3dadd3bb959a6d62426382f61c77a82017e35" },
222955
- { key: "assets/pdf.worker.min-BmVo14Nb.mjs", contentType: "application/javascript; charset=utf-8", offset: 2197322, length: 1317034, sha256: "a33cfe728c584fdba4fcc1fd54bcdc2f9f2f13889ddbb5b2bd1d0f8cbe49b84e" },
222956
- { key: "assets/pdfDocument-C16eHcfe.js", contentType: "application/javascript; charset=utf-8", offset: 3514356, length: 3470, sha256: "960cd697ed1610c82fbe3491a7791c13a65f451d7a1f31e9ea075bb182e23586" },
222957
- { key: "assets/pdfFetch-Cc8i1I1h.js", contentType: "application/javascript; charset=utf-8", offset: 3517826, length: 2266, sha256: "1d21ad008921942217c9eac0c35b1713773b9d89c71e3ab4412781f7bb88f463" },
222958
- { key: "assets/webviewBridgeHost-CJa2wzlM.js", contentType: "application/javascript; charset=utf-8", offset: 3520092, length: 9888, sha256: "fa9c023ed92286ba845dc67038e4a2341592c9e94655d7429fb8b64cc46eae7d" },
222959
- { key: "fonts/Roboto-LICENSE.txt", contentType: "application/octet-stream", offset: 3529980, length: 4610, sha256: "994062dd7af4186a739de55dd9e151c63b6301f8e2cbafc608d35c2e87da0cd2" },
222960
- { key: "fonts/Roboto-Variable.ttf", contentType: "font/ttf", offset: 3534590, length: 488584, sha256: "d7598e12c5dbef095ff8272cfc55da0250bd07fbdecbac8a530b9b277872a134" },
222961
- { key: "fonts/WixMadeforDisplay-Bold.ttf", contentType: "font/ttf", offset: 4023174, length: 90924, sha256: "ec4c7d63772d980d6e147b2df6215fd2737e4b04cebe0cf7e11dc695fb63cdcf" },
222962
- { key: "fonts/WixMadeforDisplay-ExtraBold.ttf", contentType: "font/ttf", offset: 4114098, length: 90984, sha256: "bf4c16a2774edd38a921edf3099469866cd74c094fd596f3fa4e81f54a04dfaa" },
222963
- { key: "fonts/WixMadeforDisplay-Medium.ttf", contentType: "font/ttf", offset: 4205082, length: 90980, sha256: "368faca44fb9f7207e4af784e94750b1ee59c1098b8689e0f4a918926f244fb5" },
222964
- { key: "fonts/WixMadeforDisplay-Regular.ttf", contentType: "font/ttf", offset: 4296062, length: 90872, sha256: "97ed8f1a6772abe26e3d8af5cecfc4b02faa94497d585b0398b5053b739a70c1" },
222965
- { key: "fonts/WixMadeforDisplay-SemiBold.ttf", contentType: "font/ttf", offset: 4386934, length: 90980, sha256: "642feab8a48ddf6c7a89d7c2a7c0edfa0e6e773f671287e460e222703563191e" },
222966
- { key: "fonts/WixMadeforText-Bold.ttf", contentType: "font/ttf", offset: 4477914, length: 108636, sha256: "37c179b4fefb63ea9637322b84583a2df53aa226c150294eea1675c14b1b8e29" },
222967
- { key: "fonts/WixMadeforText-ExtraBold.ttf", contentType: "font/ttf", offset: 4586550, length: 109084, sha256: "62e2fe4718129f36ecdb0ae4de385bd6b81ecc876146447167c6c140fad699a9" },
222968
- { key: "fonts/WixMadeforText-Medium.ttf", contentType: "font/ttf", offset: 4695634, length: 109048, sha256: "4ecf270136af928612c76fe4ebade91d8156975e5ea4c0cf9225501dd1788e02" },
222969
- { key: "fonts/WixMadeforText-Regular.ttf", contentType: "font/ttf", offset: 4804682, length: 107700, sha256: "dee56f09fd3efc127c1ea95557edc74110c1460a46287da36e0af25efd341ef5" },
222970
- { key: "fonts/WixMadeforText-SemiBold.ttf", contentType: "font/ttf", offset: 4912382, length: 88108, sha256: "dced97a77624bc5f8b1ae65850360908297f4588e09feb6f22792d29dc7e765b" },
222971
- { key: "himi-sw.js", contentType: "application/javascript; charset=utf-8", offset: 5000490, length: 6818, sha256: "835250c3d8004f27c2b67f9b471984351ba6df07b916d97e33b43c691200a18c" },
222972
- { key: "index.html", contentType: "text/html; charset=utf-8", offset: 5007308, length: 4924, sha256: "f177622464ce1d149de7d3c019d4f4e0f00e09ed97f462f099244fa70098f3cc" },
222973
- { key: "ios-glass-preview.css", contentType: "text/css; charset=utf-8", offset: 5012232, length: 11457, sha256: "6cb2b75264fa5fa2b4d28851878a5eab0712900e8b3a6c2370cc661d6d820805" },
222974
- { key: "kit-tab-bar.css", contentType: "text/css; charset=utf-8", offset: 5023689, length: 1171, sha256: "9e2c3a0faaf05d5471badf167a4d3bdf1c4e6dd65c432eea6d254158bfd99585" },
222975
- { key: "t5-frame.html", contentType: "text/html; charset=utf-8", offset: 5024860, length: 23047, sha256: "20d1459e3f896f344e478e613d0c979a0de02e81a929a45d3a0ef6a53af36441" },
222976
- { key: "t5-worker-frame.html", contentType: "text/html; charset=utf-8", offset: 5047907, length: 23064, sha256: "8655cfe9c74212ec5dafecb49d2fdeb48b19f1bd8a710091e3e55631f9b4ab06" }
222993
+ { key: "assets/index-DmB0MJKJ.js", contentType: "application/javascript; charset=utf-8", offset: 136022, length: 1565290, sha256: "a7553f2bd9aba01389289b01059bacd1daa8f8c3503f320ccf95a7ce4487ff1f" },
222994
+ { key: "assets/jsx-runtime-CdvZGgm7.js", contentType: "application/javascript; charset=utf-8", offset: 1701312, length: 7751, sha256: "42a78b508d0f309f6a4a6efbb8669015211b3c26574c5b0929884c4d9d20b806" },
222995
+ { key: "assets/pdf-11HKDITS.js", contentType: "application/javascript; charset=utf-8", offset: 1709063, length: 488215, sha256: "0f5533bf4197dc43489701db18378cecdb02db230a0fc2603e764999544513da" },
222996
+ { key: "assets/pdf.worker.min-BGnVRhRG.js", contentType: "application/javascript; charset=utf-8", offset: 2197278, length: 90, sha256: "521a0e528916d678d7588b2cddf3dadd3bb959a6d62426382f61c77a82017e35" },
222997
+ { key: "assets/pdf.worker.min-BmVo14Nb.mjs", contentType: "application/javascript; charset=utf-8", offset: 2197368, length: 1317034, sha256: "a33cfe728c584fdba4fcc1fd54bcdc2f9f2f13889ddbb5b2bd1d0f8cbe49b84e" },
222998
+ { key: "assets/pdfDocument-iMU9yIaT.js", contentType: "application/javascript; charset=utf-8", offset: 3514402, length: 3470, sha256: "3ff2e5acf741af0d65b9ea75b88477bd74cac31cfeb806c93a4991794afb08c8" },
222999
+ { key: "assets/pdfFetch-Cc8i1I1h.js", contentType: "application/javascript; charset=utf-8", offset: 3517872, length: 2266, sha256: "1d21ad008921942217c9eac0c35b1713773b9d89c71e3ab4412781f7bb88f463" },
223000
+ { key: "assets/webviewBridgeHost-vl_MZxfG.js", contentType: "application/javascript; charset=utf-8", offset: 3520138, length: 9888, sha256: "2b14eb62daabb9b8fc1b12010b5c7d182f997aebb04bae249c1276464a7fc15e" },
223001
+ { key: "fonts/Roboto-LICENSE.txt", contentType: "application/octet-stream", offset: 3530026, length: 4610, sha256: "994062dd7af4186a739de55dd9e151c63b6301f8e2cbafc608d35c2e87da0cd2" },
223002
+ { key: "fonts/Roboto-Variable.ttf", contentType: "font/ttf", offset: 3534636, length: 488584, sha256: "d7598e12c5dbef095ff8272cfc55da0250bd07fbdecbac8a530b9b277872a134" },
223003
+ { key: "fonts/WixMadeforDisplay-Bold.ttf", contentType: "font/ttf", offset: 4023220, length: 90924, sha256: "ec4c7d63772d980d6e147b2df6215fd2737e4b04cebe0cf7e11dc695fb63cdcf" },
223004
+ { key: "fonts/WixMadeforDisplay-ExtraBold.ttf", contentType: "font/ttf", offset: 4114144, length: 90984, sha256: "bf4c16a2774edd38a921edf3099469866cd74c094fd596f3fa4e81f54a04dfaa" },
223005
+ { key: "fonts/WixMadeforDisplay-Medium.ttf", contentType: "font/ttf", offset: 4205128, length: 90980, sha256: "368faca44fb9f7207e4af784e94750b1ee59c1098b8689e0f4a918926f244fb5" },
223006
+ { key: "fonts/WixMadeforDisplay-Regular.ttf", contentType: "font/ttf", offset: 4296108, length: 90872, sha256: "97ed8f1a6772abe26e3d8af5cecfc4b02faa94497d585b0398b5053b739a70c1" },
223007
+ { key: "fonts/WixMadeforDisplay-SemiBold.ttf", contentType: "font/ttf", offset: 4386980, length: 90980, sha256: "642feab8a48ddf6c7a89d7c2a7c0edfa0e6e773f671287e460e222703563191e" },
223008
+ { key: "fonts/WixMadeforText-Bold.ttf", contentType: "font/ttf", offset: 4477960, length: 108636, sha256: "37c179b4fefb63ea9637322b84583a2df53aa226c150294eea1675c14b1b8e29" },
223009
+ { key: "fonts/WixMadeforText-ExtraBold.ttf", contentType: "font/ttf", offset: 4586596, length: 109084, sha256: "62e2fe4718129f36ecdb0ae4de385bd6b81ecc876146447167c6c140fad699a9" },
223010
+ { key: "fonts/WixMadeforText-Medium.ttf", contentType: "font/ttf", offset: 4695680, length: 109048, sha256: "4ecf270136af928612c76fe4ebade91d8156975e5ea4c0cf9225501dd1788e02" },
223011
+ { key: "fonts/WixMadeforText-Regular.ttf", contentType: "font/ttf", offset: 4804728, length: 107700, sha256: "dee56f09fd3efc127c1ea95557edc74110c1460a46287da36e0af25efd341ef5" },
223012
+ { key: "fonts/WixMadeforText-SemiBold.ttf", contentType: "font/ttf", offset: 4912428, length: 88108, sha256: "dced97a77624bc5f8b1ae65850360908297f4588e09feb6f22792d29dc7e765b" },
223013
+ { key: "himi-sw.js", contentType: "application/javascript; charset=utf-8", offset: 5000536, length: 6818, sha256: "835250c3d8004f27c2b67f9b471984351ba6df07b916d97e33b43c691200a18c" },
223014
+ { key: "index.html", contentType: "text/html; charset=utf-8", offset: 5007354, length: 4924, sha256: "d4354e106e5e5e7184e55323a6fff572f68747b9b25048bfbe4a22bc7af35ac6" },
223015
+ { key: "ios-glass-preview.css", contentType: "text/css; charset=utf-8", offset: 5012278, length: 11457, sha256: "6cb2b75264fa5fa2b4d28851878a5eab0712900e8b3a6c2370cc661d6d820805" },
223016
+ { key: "kit-tab-bar.css", contentType: "text/css; charset=utf-8", offset: 5023735, length: 1171, sha256: "9e2c3a0faaf05d5471badf167a4d3bdf1c4e6dd65c432eea6d254158bfd99585" },
223017
+ { key: "t5-frame.html", contentType: "text/html; charset=utf-8", offset: 5024906, length: 23047, sha256: "20d1459e3f896f344e478e613d0c979a0de02e81a929a45d3a0ef6a53af36441" },
223018
+ { key: "t5-worker-frame.html", contentType: "text/html; charset=utf-8", offset: 5047953, length: 23064, sha256: "8655cfe9c74212ec5dafecb49d2fdeb48b19f1bd8a710091e3e55631f9b4ab06" }
222977
223019
  ];
222978
223020
  }
222979
223021
  });
@@ -247159,7 +247201,7 @@ async function accountToken2(spawnImpl = spawn7) {
247159
247201
  };
247160
247202
  const timer = setTimeout(
247161
247203
  () => done(() => reject(new Error(
247162
- `\`wix token\` printed no OauthNG token within ${TOKEN_MINT_TIMEOUT_MS2}ms. Is the Wix CLI logged in (\`wix login\`)? ${redactForError(out2)}`
247204
+ `\`wix token\` printed no Wix token within ${TOKEN_MINT_TIMEOUT_MS2}ms. Is the Wix CLI logged in (\`wix login\`)? ${redactForError(out2)}`
247163
247205
  ))),
247164
247206
  TOKEN_MINT_TIMEOUT_MS2
247165
247207
  );
@@ -247172,7 +247214,7 @@ async function accountToken2(spawnImpl = spawn7) {
247172
247214
  child.stderr?.on("data", scan);
247173
247215
  child.on("error", (e2) => done(() => reject(new Error(mintHelp2(e2.message)))));
247174
247216
  child.on("exit", (code2) => done(() => reject(new Error(
247175
- `\`wix token\` exited (code ${code2}) without printing an OauthNG token \u2014 is the Wix CLI logged in (\`wix login\`)? ${redactForError(out2)}`
247217
+ `\`wix token\` exited (code ${code2}) without printing a Wix token \u2014 is the Wix CLI logged in (\`wix login\`)? ${redactForError(out2)}`
247176
247218
  ))));
247177
247219
  });
247178
247220
  cached2 = token;
@@ -247234,7 +247276,7 @@ var init_wix_account2 = __esm({
247234
247276
  init_wix_owner();
247235
247277
  API_BASE2 = "https://www.wixapis.com";
247236
247278
  API_KEYS_URL = "https://manage.wix.com/account/api-keys";
247237
- TOKEN_RE2 = /OauthNG\.JWS\.[A-Za-z0-9._-]+/;
247279
+ TOKEN_RE2 = WIX_TOKEN_RE;
247238
247280
  TOKEN_MINT_TIMEOUT_MS2 = 3e4;
247239
247281
  DEFAULT_TIMEOUT_MS6 = Number(process.env.HIMI_WIX_TIMEOUT_MS) || 12e4;
247240
247282
  }
@@ -249628,7 +249670,8 @@ var BOOLEAN_FLAGS = /* @__PURE__ */ new Set([
249628
249670
  "input-evidence",
249629
249671
  "wix-token-stdin",
249630
249672
  "no-key",
249631
- "no-frame"
249673
+ "no-frame",
249674
+ "resume"
249632
249675
  ]);
249633
249676
  var SWITCH_FLAGS = new Set([...BOOLEAN_FLAGS].filter((name) => name !== "deep"));
249634
249677
  var SWITCH_CONSEQUENCE = {
@@ -249946,7 +249989,8 @@ var USAGE = `himi \u2014 the Himalaya authoring CLI (remote dev loop)
249946
249989
  NOT in git \u2014 prefer committing to assets/ instead)
249947
249990
  himi assets rm <name> [--live] drop an asset record; the next resolve falls back to the
249948
249991
  baked copy (bytes survive until a retention pass)
249949
- himi login [--browser|--device [--site <msid>] [--redirect-uri <uri>]|--wix [--wix-token-stdin]|--dpx] [--target <t>] [--no-open]
249992
+ himi login [--browser|--device [--site <msid>] [--redirect-uri <uri>] [--no-wait]|--wix [--wix-token-stdin]|--dpx] [--target <t>] [--no-open]
249993
+ himi login --device --resume [--timeout <s>] [--target <t>]
249950
249994
  get + store a scoped control token for push/promote
249951
249995
  --browser: sign in with your own Wix account in a browser
249952
249996
  on THIS machine (NO VPN, no BO) -> use with --target wix
@@ -249962,6 +250006,10 @@ var USAGE = `himi \u2014 the Himalaya authoring CLI (remote dev loop)
249962
250006
  --site <msid>: the owner also connects that site; you
249963
250007
  get its Headless client id (no Wix token), kept per
249964
250008
  site for \`himi site client list\`
250009
+ --no-wait: print the URL + code and exit at once;
250010
+ then \`himi login --device --resume\` polls for at
250011
+ most --timeout seconds (default 50): exit 0 signed
250012
+ in, exit 3 (device_pending) not approved yet
249965
250013
  --dpx: Wix employee path via an existing BO session
249966
250014
  (internal; --target bo)
249967
250015
  himi apps [list] | claim <slug> [--display-name <n>] [--account-id <id>] [--cookie <c>]
@@ -250606,7 +250654,7 @@ var COMMANDS = [
250606
250654
  { name: "data", summary: "read-only plan or explicitly provision/seed declared KV and Wix Data resources. Preview and production are separate scopes. KV administration uses the operator data plane from --data-url/HIMI_DATA_ADMIN_URL and HIMI_DATA_ADMIN_TOKEN; draft push never calls it.", required: "plan|create|seed [--site <msid>] [--environment preview|production] [--content <dir>] [--data-url <url>] [--dry-run] [--force]" },
250607
250655
  { name: "icons", summary: "list the valid Icon.name vocabulary (an unknown name renders a fallback glyph; validate warns on unknown names) (offline)", required: "[--json]" },
250608
250656
  { name: "icon", summary: "the app's LAUNCHER icon \u2014 the home-screen / store mark, which is BINARY-floor and never over-the-air (distinct from `himi icons`, the in-screen glyph vocabulary). `status`/`check` report what this app would actually ship and validate it against both stores: exact 1024x1024, no tRNS chunk, non-interlaced, and \u2014 when the optional image toolchain is installed \u2014 no transparent regions (Apple permits an alpha channel but not transparent pixels: ITMS-90717), no pre-masked corners, no letterboxed wordmark; they also print the store-policy checklist no checker can decide. `set <file.png>` installs supplied art, `from-site` installs the logo `himi site analyze` downloaded, `from-one-app` preserves the hash-verified collected app mark (requires the image toolchain), and `generate` makes a gradient tile + glyph \u2014 these commands trim, flatten onto the app's accent, write the 1024 opaque master plus the 512 Play listing icon (Play wants 32-bit WITH alpha, so it is a separate file), and DECLARE it in himalaya.content.json, without which the release bakes no icon at all", required: "[status|check] | set <file.png> | from-one-app [--evidence-dir <dir>] | from-site [--book <dir>] | generate [--glyph <g>] [--accent <hex>] | glyphs [--content <dir>] [--json]" },
250609
- { name: "login", summary: "obtain a scoped serve-control token from Wix identity and store it in ~/.himalaya/serve-targets.json (so push/promote need no hand-pasted token). Four modes: --browser (your own Wix account, no VPN/BO), --device (an agent holding NO credential, whose browser cannot reach the owner: prints a URL and a code, the owner approves from any browser signed in to Wix, and the poll stores the same token; with --site <msid> the owner also connects that site and the agent gets its Headless client id, no Wix token), --wix (HEADLESS \u2014 the owner's held Wix token piped with --wix-token-stdin or set as WIX_TOKEN, else WIX_API_KEY, else the machine's own Wix CLI credential; the mode a CI pod or agent container can satisfy \u2014 any valid Wix token is the owner), --dpx (Wix employee, reads ~/.dpx/session/token). RFC 0026 WS3.", required: "[--browser|--device [--site <msid>] [--redirect-uri <uri>]|--wix [--wix-token-stdin]|--dpx] [--target <t>] [--issue-url <url>]" },
250657
+ { name: "login", summary: "obtain a scoped serve-control token from Wix identity and store it in ~/.himalaya/serve-targets.json (so push/promote need no hand-pasted token). Four modes: --browser (your own Wix account, no VPN/BO), --device (an agent holding NO credential, whose browser cannot reach the owner: prints a URL and a code, the owner approves from any browser signed in to Wix, and the poll stores the same token; with --site <msid> the owner also connects that site and the agent gets its Headless client id, no Wix token; --no-wait prints the URL and code and exits at once, then `--device --resume [--timeout <s>]` polls for at most that many seconds (default 50) and exits 0 signed in or 3 with code device_pending, for a caller that cannot run one command for minutes or sees output only when a command exits), --wix (HEADLESS \u2014 the owner's held Wix token piped with --wix-token-stdin or set as WIX_TOKEN, else WIX_API_KEY, else the machine's own Wix CLI credential; the mode a CI pod or agent container can satisfy \u2014 any valid Wix token is the owner), --dpx (Wix employee, reads ~/.dpx/session/token). RFC 0026 WS3.", required: "[--browser|--device [--site <msid>] [--redirect-uri <uri>] [--no-wait]|--wix [--wix-token-stdin]|--dpx] [--target <t>] [--issue-url <url>] | --device --resume [--timeout <s>] [--target <t>]" },
250610
250658
  { name: "logout", summary: "remove the stored control token for a target", required: "[--target <t>]" },
250611
250659
  { name: "connector", summary: "personal access tokens for the hosted MCP connector (Wix Native App Builder), for an AI tool that cannot sign in with OAuth (e.g. Base44's builder): `token create` opens a Wix sign-in page and prints a long-lived token once, to paste into the tool as `Authorization: Bearer <token>`; `token list` / `token revoke <id>` manage them with the `himi login --browser` token. The token can only build and publish DRAFTS.", required: "token create [--name <n>] [--days <1-90>] [--no-open] | token list | token revoke <id> [--target <t>]" },
250612
250660
  { name: "notify", summary: "Hosted --all-members requires --yes for a live send; --dry-run checks ownership/readiness and counts approved recipients without sending. `setup` optionally configures Branded/Ping from local customer key files; `status --refresh` reads live backend readiness. Setup may be deferred while building. These use serve-control and require owner plus Wix account authentication. `send`, `tokens`, `doctor`: send a REAL push notification to registered devices (RFC 0036 WS5) \u2014 APNs .p8 over HTTP/2 for iOS, FCM v1 for Android. `send` targets one device (--token / --device <registry id>) or fans out to the whole app (--all), reporting a per-device result; a token the provider says is uninstalled (APNs 410 Unregistered / FCM UNREGISTERED) is auto-disabled, while a merely wrong one (BadDeviceToken \u2014 usually a sandbox/production mismatch) is recorded and left enabled. `tokens` lists the registry. `doctor` reports which credentials resolve and which sender each platform picks. Talks to the admin-server via --admin-url/HIMALAYA_ADMIN_URL, authenticated with --admin-session/HIMALAYA_ADMIN_SESSION. `send --provider ping` is the hosted alternative: the serve plane sends to one site member (--member-email) or all approved members (--all-members) through Ping as Himalaya, with owner login instead of provider keys, and reports acceptance, never delivery. NOT `himi push`, which publishes a release.", required: "setup|status [--content <dir>] [--target <t>] [--refresh] [--yes] [--no-push-setup] | send --provider ping [--content <dir>] [--app <a>] [--site <msid>] (--member-email <email> | --all-members (--dry-run | --yes)) --title <s> [--body <s>] --link <url> [--request-id <uuid>] [--dry-run] [--json] | send|tokens|doctor [--app <a>] [--token <t> | --device <id> | --all] [--title <s>] [--body <s>] [--link <url>] [--platform ios|android] [--badge <n>] [--channel <id>] [--silent] [--dry-run] [--json]" },
@@ -251534,6 +251582,10 @@ async function templateCommand(ctx) {
251534
251582
  } else if (Buffer.byteLength(JSON.stringify(plainSource), "utf8") <= MAX_PUBLISH_BODY_BYTES && publishReleaseWireBytes(payload, publishMeta) <= MAX_PUBLISH_BODY_BYTES) {
251535
251583
  sendPayload = payload;
251536
251584
  bodyGzipped = true;
251585
+ } else if (publishReleaseWireBytes(gzipped, publishMeta) <= MAX_PUBLISH_BODY_BYTES) {
251586
+ sendPayload = gzipped;
251587
+ templateBodyBytes = gzBytes;
251588
+ bodyGzipped = true;
251537
251589
  }
251538
251590
  }
251539
251591
  if (templateBodyBytes > MAX_PUBLISH_BODY_BYTES && !bodyGzipped) {
@@ -256642,7 +256694,8 @@ init_cli_shared();
256642
256694
  var LOGIN_HELP = `himi login \u2014 get a scoped serve-control token and store it in
256643
256695
  ~/.himalaya/serve-targets.json, so push / promote / preview need no pasted token.
256644
256696
 
256645
- himi login [--browser | --device [--site <msid>] [--redirect-uri <uri>] | --wix [--wix-token-stdin] | --dpx] [--target <t>] [--no-open]
256697
+ himi login [--browser | --device [--site <msid>] [--redirect-uri <uri>] [--no-wait] | --wix [--wix-token-stdin] | --dpx] [--target <t>] [--no-open]
256698
+ himi login --device --resume [--timeout <s>] [--target <t>]
256646
256699
 
256647
256700
  MODES \u2014 pick by who is at the keyboard
256648
256701
  --browser YOUR OWN Wix account, in a browser. No VPN, no BO. The DEFAULT when the target
@@ -256671,6 +256724,16 @@ MODES \u2014 pick by who is at the keyboard
256671
256724
  (a public value; no Wix token), kept per site for \`himi site client list\`
256672
256725
  and \`himi site analyze --client-id\`. --redirect-uri <uri> is the redirect
256673
256726
  that client must carry (default himalaya-demo-app://oauth/callback).
256727
+ --no-wait CAN'T RUN ONE COMMAND FOR 10 MINUTES, or only see its output when it
256728
+ exits? Start with --no-wait: it prints the URL, the code and the expiry (JSON:
256729
+ pending, verificationUri, verificationUriComplete, userCode, expiresAt, resume),
256730
+ keeps the pending login in serve-targets.json (owner-only) and exits 0 at once.
256731
+ Show the owner the link and the code, then run
256732
+ himi login --device --resume [--timeout <s>]
256733
+ until it exits 0. Each resume polls for at most --timeout SECONDS (default 50,
256734
+ max 600) and keeps the plane's slow-down between calls. Exit 3 with
256735
+ code "device_pending" means not approved yet: run it again. Exit 1 with
256736
+ device_code_expired / device_access_denied / device_not_started means start over.
256674
256737
  --dpx Wix EMPLOYEE. Reads the BO session at ~/.dpx/session/token (dpx 2.x:
256675
256738
  \`dpx auth login\` then \`dpx auth token > ~/.dpx/session/token\`). Internal
256676
256739
  targets only (--target bo); VPN-gated.
@@ -256702,6 +256765,8 @@ function credentialSwapNotice(prevToken, nextToken, target) {
256702
256765
  }
256703
256766
  var DEVICE_MAX_WAIT_MS = 10 * 60 * 1e3;
256704
256767
  var DEVICE_DEFAULT_INTERVAL_SEC = 5;
256768
+ var DEVICE_RESUME_DEFAULT_TIMEOUT_SEC = 50;
256769
+ var DEVICE_PENDING_EXIT = 3;
256705
256770
  function deviceSiteOutcome(ctx, target, site) {
256706
256771
  const out2 = { ...site };
256707
256772
  if (site.msid && site.clientId) {
@@ -256724,20 +256789,21 @@ function deviceSiteOutcome(ctx, target, site) {
256724
256789
  }
256725
256790
  return out2;
256726
256791
  }
256727
- async function deviceLogin(ctx, target, ownerIssue, prevControlToken, siteReq = {}) {
256728
- const { io: io2, print } = ctx;
256729
- const clock = ctx.deps.clock ?? { now: () => Date.now(), sleep: (ms2) => new Promise((r3) => setTimeout(r3, ms2)) };
256730
- const base = ownerIssue.replace(/\/$/, "");
256731
- const post = (path2, body) => fetch(`${base}${path2}`, {
256732
- method: "POST",
256733
- headers: { "content-type": "application/json", accept: "application/json" },
256734
- body: JSON.stringify(body),
256735
- redirect: "error",
256736
- signal: AbortSignal.timeout(3e4)
256737
- });
256792
+ var deviceClock = (ctx) => ctx.deps.clock ?? { now: () => Date.now(), sleep: (ms2) => new Promise((r3) => setTimeout(r3, ms2)) };
256793
+ var devicePoster = (base) => (path2, body, timeoutMs = 3e4) => fetch(`${base}${path2}`, {
256794
+ method: "POST",
256795
+ headers: { "content-type": "application/json", accept: "application/json" },
256796
+ body: JSON.stringify(body),
256797
+ redirect: "error",
256798
+ signal: AbortSignal.timeout(timeoutMs)
256799
+ });
256800
+ var deviceResumeCommand = (target) => `himi login --device --resume --target ${target}`;
256801
+ async function startDeviceGrant(ctx, target, base, siteReq) {
256802
+ const { io: io2 } = ctx;
256803
+ const clock = deviceClock(ctx);
256738
256804
  let start;
256739
256805
  try {
256740
- start = await post("/v1/owner/device/code", {
256806
+ start = await devicePoster(base)("/v1/owner/device/code", {
256741
256807
  ...siteReq.site ? { site: siteReq.site } : {},
256742
256808
  ...siteReq.redirectUri ? { redirect_uri: siteReq.redirectUri } : {}
256743
256809
  });
@@ -256757,12 +256823,74 @@ async function deviceLogin(ctx, target, ownerIssue, prevControlToken, siteReq =
256757
256823
  return 1;
256758
256824
  }
256759
256825
  const expiresMs = Math.max(0, Number(grant.expires_in) || 0) * 1e3;
256760
- const deadline = clock.now() + Math.min(expiresMs || DEVICE_MAX_WAIT_MS, DEVICE_MAX_WAIT_MS);
256761
- let interval = Math.max(1, Number(grant.interval) || DEVICE_DEFAULT_INTERVAL_SEC);
256762
- const link3 = grant.verification_uri_complete ?? grant.verification_uri;
256763
- io2.error("To sign in, the Wix account owner opens this link on any device where they are signed in to wix.com:");
256764
- io2.error(` ${link3}`);
256765
- io2.error(`and approves code ${grant.user_code} (or opens ${grant.verification_uri} and types it). Waiting up to ${Math.round((deadline - clock.now()) / 6e4)} minutes\u2026`);
256826
+ return {
256827
+ deviceCode: grant.device_code,
256828
+ userCode: grant.user_code,
256829
+ verificationUri: grant.verification_uri,
256830
+ ...grant.verification_uri_complete ? { verificationUriComplete: grant.verification_uri_complete } : {},
256831
+ expiresAt: clock.now() + Math.min(expiresMs || DEVICE_MAX_WAIT_MS, DEVICE_MAX_WAIT_MS),
256832
+ interval: Math.max(1, Number(grant.interval) || DEVICE_DEFAULT_INTERVAL_SEC)
256833
+ };
256834
+ }
256835
+ function classifyDevicePoll(resp, body, interval, target) {
256836
+ if (resp.ok && body.token) return { kind: "ok", token: body.token };
256837
+ if (body.error === "authorization_pending") return { kind: "pending" };
256838
+ if (resp.status === 429) {
256839
+ return { kind: "backoff", interval: Math.max(interval + 5, Number(body.retryAfterSec) || Number(resp.headers.get("retry-after")) || 0) };
256840
+ }
256841
+ if (body.error === "slow_down") return { kind: "backoff", interval: Math.max(interval + 5, Number(body.interval) || 0) };
256842
+ const code2 = body.error === "access_denied" ? "device_access_denied" : body.error === "expired_token" ? "device_code_expired" : "device_login_failed";
256843
+ return {
256844
+ kind: "fail",
256845
+ final: code2 !== "device_login_failed",
256846
+ envelope: {
256847
+ ok: false,
256848
+ code: code2,
256849
+ status: resp.status,
256850
+ error: body.error ?? "device login failed",
256851
+ ...body.error === "access_denied" ? { hint: "the owner denied this sign-in" } : body.error === "expired_token" ? { hint: "the code expired before it was approved \u2014 run `himi login --device` again" } : ownerPlaneHint(resp.status, body.error, target)
256852
+ }
256853
+ };
256854
+ }
256855
+ function storeDeviceToken(ctx, target, prevControlToken, token, body) {
256856
+ const storedAt = saveControlToken(target, token);
256857
+ let exp;
256858
+ try {
256859
+ exp = JSON.parse(Buffer.from(token.split(".")[0], "base64url").toString("utf8")).exp;
256860
+ } catch {
256861
+ }
256862
+ const swap = credentialSwapNotice(prevControlToken, token, target);
256863
+ const site = body.site && typeof body.site === "object" ? deviceSiteOutcome(ctx, target, body.site) : void 0;
256864
+ ctx.print({
256865
+ ok: true,
256866
+ via: "device",
256867
+ target,
256868
+ sub: body.sub,
256869
+ exp,
256870
+ scope: body.scope,
256871
+ storedAt,
256872
+ ...site ? { site } : {},
256873
+ ...swap ? { notice: swap } : {},
256874
+ ...Array.isArray(body.scope) && body.scope.length === 0 ? { hint: "you own no apps yet \u2014 claim one with `himi apps claim <slug>`" } : {}
256875
+ });
256876
+ return 0;
256877
+ }
256878
+ function showDeviceCode(ctx, grant, tail) {
256879
+ const link3 = grant.verificationUriComplete ?? grant.verificationUri;
256880
+ ctx.io.error("To sign in, the Wix account owner opens this link on any device where they are signed in to wix.com:");
256881
+ ctx.io.error(` ${link3}`);
256882
+ ctx.io.error(`and approves code ${grant.userCode} (or opens ${grant.verificationUri} and types it). ${tail}`);
256883
+ }
256884
+ async function deviceLogin(ctx, target, ownerIssue, prevControlToken, siteReq = {}) {
256885
+ const { io: io2 } = ctx;
256886
+ const clock = deviceClock(ctx);
256887
+ const base = ownerIssue.replace(/\/$/, "");
256888
+ const post = devicePoster(base);
256889
+ const grant = await startDeviceGrant(ctx, target, base, siteReq);
256890
+ if (typeof grant === "number") return grant;
256891
+ const deadline = grant.expiresAt;
256892
+ let interval = grant.interval;
256893
+ showDeviceCode(ctx, grant, `Waiting up to ${Math.round((deadline - clock.now()) / 6e4)} minutes\u2026`);
256766
256894
  for (; ; ) {
256767
256895
  if (clock.now() + interval * 1e3 > deadline) {
256768
256896
  io2.error(JSON.stringify({ ok: false, code: "device_timed_out", error: "timed out waiting for the owner to approve", hint: "run `himi login --device` again for a new code" }));
@@ -256771,53 +256899,151 @@ async function deviceLogin(ctx, target, ownerIssue, prevControlToken, siteReq =
256771
256899
  await clock.sleep(interval * 1e3);
256772
256900
  let resp;
256773
256901
  try {
256774
- resp = await post("/v1/owner/device/token", { device_code: grant.device_code });
256902
+ resp = await post("/v1/owner/device/token", { device_code: grant.deviceCode });
256775
256903
  } catch {
256776
256904
  continue;
256777
256905
  }
256778
256906
  const body = await resp.json().catch(() => ({}));
256779
- if (resp.ok && body.token) {
256780
- const storedAt = saveControlToken(target, body.token);
256781
- let exp;
256782
- try {
256783
- exp = JSON.parse(Buffer.from(body.token.split(".")[0], "base64url").toString("utf8")).exp;
256784
- } catch {
256785
- }
256786
- const swap = credentialSwapNotice(prevControlToken, body.token, target);
256787
- const site = body.site && typeof body.site === "object" ? deviceSiteOutcome(ctx, target, body.site) : void 0;
256788
- print({
256789
- ok: true,
256790
- via: "device",
256791
- target,
256792
- sub: body.sub,
256793
- exp,
256794
- scope: body.scope,
256795
- storedAt,
256796
- ...site ? { site } : {},
256797
- ...swap ? { notice: swap } : {},
256798
- ...Array.isArray(body.scope) && body.scope.length === 0 ? { hint: "you own no apps yet \u2014 claim one with `himi apps claim <slug>`" } : {}
256799
- });
256800
- return 0;
256801
- }
256802
- if (body.error === "authorization_pending") continue;
256803
- if (resp.status === 429) {
256804
- interval = Math.max(interval + 5, Number(body.retryAfterSec) || Number(resp.headers.get("retry-after")) || 0);
256805
- continue;
256806
- }
256807
- if (body.error === "slow_down") {
256808
- interval = Math.max(interval + 5, Number(body.interval) || 0);
256907
+ const step = classifyDevicePoll(resp, body, interval, target);
256908
+ if (step.kind === "ok") return storeDeviceToken(ctx, target, prevControlToken, step.token, body);
256909
+ if (step.kind === "pending") continue;
256910
+ if (step.kind === "backoff") {
256911
+ interval = step.interval;
256809
256912
  continue;
256810
256913
  }
256811
- const code2 = body.error === "access_denied" ? "device_access_denied" : body.error === "expired_token" ? "device_code_expired" : "device_login_failed";
256914
+ io2.error(JSON.stringify(step.envelope));
256915
+ return 1;
256916
+ }
256917
+ }
256918
+ async function deviceLoginStart(ctx, target, ownerIssue, siteReq) {
256919
+ const clock = deviceClock(ctx);
256920
+ const base = ownerIssue.replace(/\/$/, "");
256921
+ const grant = await startDeviceGrant(ctx, target, base, siteReq);
256922
+ if (typeof grant === "number") return grant;
256923
+ savePendingDeviceLogin(target, {
256924
+ deviceCode: grant.deviceCode,
256925
+ userCode: grant.userCode,
256926
+ verificationUri: grant.verificationUri,
256927
+ ...grant.verificationUriComplete ? { verificationUriComplete: grant.verificationUriComplete } : {},
256928
+ ownerIssue: base,
256929
+ interval: grant.interval,
256930
+ expiresAt: grant.expiresAt,
256931
+ lastPollAt: clock.now(),
256932
+ ...siteReq.site ? { site: siteReq.site } : {},
256933
+ ...siteReq.redirectUri ? { redirectUri: siteReq.redirectUri } : {}
256934
+ });
256935
+ const resume2 = deviceResumeCommand(target);
256936
+ const expiresAt = new Date(grant.expiresAt).toISOString();
256937
+ showDeviceCode(ctx, grant, `Then run \`${resume2}\` until it succeeds (the code expires at ${expiresAt}).`);
256938
+ ctx.print({
256939
+ ok: true,
256940
+ pending: true,
256941
+ via: "device",
256942
+ target,
256943
+ verificationUri: grant.verificationUri,
256944
+ ...grant.verificationUriComplete ? { verificationUriComplete: grant.verificationUriComplete } : {},
256945
+ userCode: grant.userCode,
256946
+ expiresAt,
256947
+ interval: grant.interval,
256948
+ resume: resume2
256949
+ });
256950
+ return 0;
256951
+ }
256952
+ async function deviceLoginResume(ctx, target, prevControlToken, timeoutSec) {
256953
+ const { io: io2 } = ctx;
256954
+ const clock = deviceClock(ctx);
256955
+ const p2 = loadPendingDeviceLogin(target);
256956
+ if (!p2) {
256812
256957
  io2.error(JSON.stringify({
256813
256958
  ok: false,
256814
- code: code2,
256815
- status: resp.status,
256816
- error: body.error ?? "device login failed",
256817
- ...body.error === "access_denied" ? { hint: "the owner denied this sign-in" } : body.error === "expired_token" ? { hint: "the code expired before it was approved \u2014 run `himi login --device` again" } : ownerPlaneHint(resp.status, body.error, target)
256959
+ code: "device_not_started",
256960
+ error: `no device login is pending for target "${target}"`,
256961
+ hint: `start one with \`himi login --device --no-wait --target ${target}\` (a login that succeeded, was denied or expired is no longer pending)`
256818
256962
  }));
256819
256963
  return 1;
256820
256964
  }
256965
+ const issuerRefusal = ownerIssuerRefusal(p2.ownerIssue);
256966
+ if (issuerRefusal) {
256967
+ io2.error(JSON.stringify(issuerRefusal));
256968
+ return 2;
256969
+ }
256970
+ const post = devicePoster(p2.ownerIssue);
256971
+ const resume2 = deviceResumeCommand(target);
256972
+ const deadline = clock.now() + timeoutSec * 1e3;
256973
+ let interval = p2.interval;
256974
+ let lastPollAt = p2.lastPollAt;
256975
+ const keep = () => swapPendingDeviceLogin(target, p2.deviceCode, { ...p2, interval, lastPollAt });
256976
+ const clear = () => swapPendingDeviceLogin(target, p2.deviceCode, void 0);
256977
+ const superseded = () => {
256978
+ io2.error(JSON.stringify({
256979
+ ok: false,
256980
+ code: "device_superseded",
256981
+ error: "this device login was replaced (a newer `--no-wait`, another login or a logout) before it finished; nothing was stored",
256982
+ hint: `run \`${resume2}\` for the current pending login, or \`himi login --device --no-wait\` for a new one`
256983
+ }));
256984
+ return 1;
256985
+ };
256986
+ const stillPending = (wait) => {
256987
+ keep();
256988
+ const expiresAt = new Date(p2.expiresAt).toISOString();
256989
+ io2.error(`Still waiting for the owner to approve code ${p2.userCode} at ${p2.verificationUriComplete ?? p2.verificationUri}. Run \`${resume2}\` again (the code expires at ${expiresAt}).`);
256990
+ ctx.print({
256991
+ ok: false,
256992
+ pending: true,
256993
+ code: "device_pending",
256994
+ via: "device",
256995
+ target,
256996
+ error: "the owner has not approved the sign-in yet",
256997
+ userCode: p2.userCode,
256998
+ verificationUri: p2.verificationUri,
256999
+ ...p2.verificationUriComplete ? { verificationUriComplete: p2.verificationUriComplete } : {},
257000
+ expiresAt,
257001
+ interval,
257002
+ retryAfterSec: Math.ceil(wait / 1e3),
257003
+ resume: resume2
257004
+ });
257005
+ return DEVICE_PENDING_EXIT;
257006
+ };
257007
+ for (; ; ) {
257008
+ const now = clock.now();
257009
+ const wait = Math.max(0, lastPollAt + interval * 1e3 - now);
257010
+ if (now + wait >= p2.expiresAt) {
257011
+ clear();
257012
+ io2.error(JSON.stringify({
257013
+ ok: false,
257014
+ code: "device_code_expired",
257015
+ error: "the device code expired before the owner approved it",
257016
+ hint: "run `himi login --device --no-wait` again for a new code"
257017
+ }));
257018
+ return 1;
257019
+ }
257020
+ if (now + wait >= deadline) return stillPending(wait);
257021
+ await clock.sleep(wait);
257022
+ const left = deadline - clock.now();
257023
+ if (left <= 0) return stillPending(0);
257024
+ lastPollAt = clock.now();
257025
+ let resp;
257026
+ try {
257027
+ resp = await post("/v1/owner/device/token", { device_code: p2.deviceCode }, Math.min(3e4, left));
257028
+ } catch {
257029
+ continue;
257030
+ }
257031
+ const body = await resp.json().catch(() => ({}));
257032
+ const step = classifyDevicePoll(resp, body, interval, target);
257033
+ if (step.kind === "ok") {
257034
+ if (!clear()) return superseded();
257035
+ return storeDeviceToken(ctx, target, prevControlToken, step.token, body);
257036
+ }
257037
+ if (step.kind === "pending") continue;
257038
+ if (step.kind === "backoff") {
257039
+ interval = step.interval;
257040
+ continue;
257041
+ }
257042
+ if (step.final) clear();
257043
+ else keep();
257044
+ io2.error(JSON.stringify(step.envelope));
257045
+ return 1;
257046
+ }
256821
257047
  }
256822
257048
  async function loginCommand(ctx) {
256823
257049
  const { io: io2, flags, print, targetName } = ctx;
@@ -256837,6 +257063,33 @@ async function loginCommand(ctx) {
256837
257063
  io2.error(JSON.stringify({ error: e2.message }));
256838
257064
  return 2;
256839
257065
  }
257066
+ const noWait = flags["no-wait"] === true;
257067
+ const resume2 = flags.resume === true;
257068
+ if ((noWait || resume2 || flags.timeout !== void 0) && !flags.device) {
257069
+ io2.error(JSON.stringify({ error: "--no-wait / --resume / --timeout belong to `himi login --device`" }));
257070
+ return 2;
257071
+ }
257072
+ if (noWait && resume2) {
257073
+ io2.error(JSON.stringify({ error: "--no-wait starts a device login and --resume finishes one: pass one of them" }));
257074
+ return 2;
257075
+ }
257076
+ if (flags.timeout !== void 0 && !resume2) {
257077
+ io2.error(JSON.stringify({ error: "--timeout bounds `himi login --device --resume` only; plain --device waits up to the code's lifetime" }));
257078
+ return 2;
257079
+ }
257080
+ if (resume2 && (flags.site !== void 0 || flags["redirect-uri"] !== void 0)) {
257081
+ io2.error(JSON.stringify({ error: "--site / --redirect-uri go on the start (`himi login --device --no-wait --site <msid>`); --resume polls the login that start began" }));
257082
+ return 2;
257083
+ }
257084
+ let resumeTimeoutSec = DEVICE_RESUME_DEFAULT_TIMEOUT_SEC;
257085
+ if (flags.timeout !== void 0) {
257086
+ const t2 = num3(flags.timeout);
257087
+ if (t2 === void 0 || !Number.isInteger(t2) || t2 < 1 || t2 > DEVICE_MAX_WAIT_MS / 1e3) {
257088
+ io2.error(JSON.stringify({ error: `--timeout is a whole number of SECONDS from 1 to ${DEVICE_MAX_WAIT_MS / 1e3}, got ${JSON.stringify(flags.timeout)}`, hint: `the default, ${DEVICE_RESUME_DEFAULT_TIMEOUT_SEC}, fits a 60-second command limit` }));
257089
+ return 2;
257090
+ }
257091
+ resumeTimeoutSec = t2;
257092
+ }
256840
257093
  const siteFlag = str3(flags.site);
256841
257094
  const redirectFlag = str3(flags["redirect-uri"]);
256842
257095
  if ((flags.site !== void 0 || flags["redirect-uri"] !== void 0) && !flags.device) {
@@ -256864,6 +257117,7 @@ async function loginCommand(ctx) {
256864
257117
  io2.error(JSON.stringify({ error: "--device is its own login mode: drop --wix / --browser / --dpx" }));
256865
257118
  return 2;
256866
257119
  }
257120
+ if (resume2) return deviceLoginResume(ctx, target, prevControlToken, resumeTimeoutSec);
256867
257121
  if (!ownerIssue) {
256868
257122
  io2.error(JSON.stringify({
256869
257123
  error: `no owner issuer for target "${target}"`,
@@ -256876,10 +257130,12 @@ async function loginCommand(ctx) {
256876
257130
  io2.error(JSON.stringify(issuerRefusal2));
256877
257131
  return 2;
256878
257132
  }
256879
- return deviceLogin(ctx, target, ownerIssue, prevControlToken, {
257133
+ const siteReq = {
256880
257134
  ...siteFlag ? { site: siteFlag.trim().toLowerCase() } : {},
256881
257135
  ...redirectFlag?.trim() ? { redirectUri: redirectFlag.trim() } : {}
256882
- });
257136
+ };
257137
+ if (noWait) return deviceLoginStart(ctx, target, ownerIssue, siteReq);
257138
+ return deviceLogin(ctx, target, ownerIssue, prevControlToken, siteReq);
256883
257139
  }
256884
257140
  if (flags.wix) {
256885
257141
  if (!ownerIssue) {