@wix/himalaya-cli 0.1772.0 → 0.1773.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.
@@ -7,6 +7,8 @@ export interface OneAppPage {
7
7
  plainText: string;
8
8
  empty: boolean;
9
9
  normalizedWebsiteLinks: number;
10
+ /** What the document holds that the page leaves out, e.g. "video (2)": plugins the app cannot render yet. Empty when nothing is left out. */
11
+ gaps: string[];
10
12
  }
11
13
  export type OneAppPageContentError = Error & {
12
14
  code: "invalid" | "unsupported";
@@ -15,7 +17,8 @@ export type OneAppPageContentError = Error & {
15
17
  export declare function oneAppPageContentErrorCode(error: unknown): "invalid" | "unsupported" | undefined;
16
18
  /** Validate a UUID source page selector before constructing a Pages read. */
17
19
  export declare const isOneAppPageId: (value: unknown) => value is string;
18
- /** Decode the exact Pages response; malformed, mismatched and unsupported documents throw.
20
+ /** Decode the exact Pages response; malformed, mismatched and unsupported documents throw. A legacy draft plugin the
21
+ * app cannot render does not: the page keeps the rest and lists the plugin in `gaps`.
19
22
  * A real empty document succeeds with empty=true. Renderer media sizing and link sanitization
20
23
  * use the existing bounded RichContent encoder on every format. */
21
24
  export declare function decodeOneAppPage(response: unknown, expectedPageId: string): OneAppPage;
@@ -1599,7 +1599,20 @@ function normalizeWebsiteLinks(nodes) {
1599
1599
  }
1600
1600
  return changed;
1601
1601
  }
1602
- function draftDocument(value) {
1602
+ function draftImageSrc(data) {
1603
+ const src = data.src ?? data.url;
1604
+ if (typeof src === "string") return src ? { url: src } : void 0;
1605
+ const media = object(src);
1606
+ if (typeof media.url === "string" && media.url) return { url: media.url };
1607
+ const id2 = media.id ?? media.file_name;
1608
+ return typeof id2 === "string" && id2 ? { id: id2 } : void 0;
1609
+ }
1610
+ var DRAFT_PLUGIN_LABELS = {
1611
+ "wix-draft-plugin-video": "video",
1612
+ "wix-draft-plugin-file-upload": "file download",
1613
+ "wix-draft-plugin-gallery": "gallery"
1614
+ };
1615
+ function draftDocument(value, skipped) {
1603
1616
  const draft = object(value);
1604
1617
  if (!Array.isArray(draft.blocks) || draft.blocks.length > 5e3) return invalid();
1605
1618
  if (draft.entityMap !== void 0 && (!draft.entityMap || typeof draft.entityMap !== "object" || Array.isArray(draft.entityMap))) return invalid();
@@ -1621,10 +1634,22 @@ function draftDocument(value) {
1621
1634
  if (ranges.length !== 1) return unsupported();
1622
1635
  const entity = object(entities[String(object(ranges[0]).key)]);
1623
1636
  const data = object(entity.data);
1624
- if (entity.type !== "IMAGE" && entity.type !== "wix-draft-plugin-image") return unsupported();
1625
- const url = data.src ?? data.url;
1626
- if (typeof url !== "string" || !url) return invalid();
1627
- nodes.push({ type: "IMAGE", imageData: { image: { src: { url }, ...typeof data.width === "number" ? { width: data.width } : {}, ...typeof data.height === "number" ? { height: data.height } : {} }, ...typeof data.alt === "string" ? { altText: data.alt } : {} } });
1637
+ if (entity.type !== "IMAGE" && entity.type !== "wix-draft-plugin-image") {
1638
+ const label = DRAFT_PLUGIN_LABELS[String(entity.type)] ?? `plugin ${String(entity.type)}`;
1639
+ skipped.set(label, (skipped.get(label) ?? 0) + 1);
1640
+ continue;
1641
+ }
1642
+ const src = draftImageSrc(data);
1643
+ if (!src) return invalid();
1644
+ const size = (key) => [data[key], object(data.src)[key]].find((v) => typeof v === "number");
1645
+ const [width, height] = [size("width"), size("height")];
1646
+ const alt = data.alt ?? object(data.metadata).alt;
1647
+ const link = object(object(data.config).link).url;
1648
+ nodes.push({ type: "IMAGE", imageData: {
1649
+ image: { src, ...width !== void 0 ? { width } : {}, ...height !== void 0 ? { height } : {} },
1650
+ ...typeof alt === "string" ? { altText: alt } : {},
1651
+ ...typeof link === "string" && link ? { link: { url: link } } : {}
1652
+ } });
1628
1653
  continue;
1629
1654
  }
1630
1655
  const cuts = [.../* @__PURE__ */ new Set([0, text2.length, ...spans.flatMap((s2) => [Number(s2.offset), Number(s2.offset) + Number(s2.length)])])].sort((a, b) => a - b);
@@ -1651,6 +1676,8 @@ function draftDocument(value) {
1651
1676
  const list = last?.type === type ? last : { type, nodes: [] };
1652
1677
  if (last !== list) nodes.push(list);
1653
1678
  list.nodes?.push({ type: "LIST_ITEM", nodes: [paragraph] });
1679
+ } else if (block2.type === "blockquote") {
1680
+ nodes.push({ type: "BLOCKQUOTE", nodes: [paragraph] });
1654
1681
  } else if (/^header-(one|two|three|four|five|six)$/.test(String(block2.type))) {
1655
1682
  nodes.push({ type: "HEADING", headingData: { level: ["one", "two", "three", "four", "five", "six"].indexOf(String(block2.type).slice(7)) + 1 }, nodes: runs });
1656
1683
  } else if (block2.type === "unstyled" || block2.type === "paragraph" || block2.type === void 0) nodes.push(paragraph);
@@ -1664,6 +1691,7 @@ function decodeOneAppPage(response, expectedPageId) {
1664
1691
  const raw = body.content;
1665
1692
  if (richContentOverLimits(raw, null)) return invalid();
1666
1693
  let document;
1694
+ const skipped = /* @__PURE__ */ new Map();
1667
1695
  const contentType = body.contentType;
1668
1696
  if (contentType === "PLAIN_TEXT") document = plainTextToRicos(raw);
1669
1697
  else if (contentType === "RICH_CONTENT" || contentType === "DRAFTJS") {
@@ -1674,7 +1702,7 @@ function decodeOneAppPage(response, expectedPageId) {
1674
1702
  return invalid();
1675
1703
  }
1676
1704
  if (richContentOverLimits(raw, parsed)) return invalid();
1677
- if (contentType === "DRAFTJS") document = draftDocument(parsed);
1705
+ if (contentType === "DRAFTJS") document = draftDocument(parsed, skipped);
1678
1706
  else {
1679
1707
  if (!Array.isArray(object(parsed).nodes)) return invalid();
1680
1708
  document = parsed;
@@ -1685,6 +1713,8 @@ function decodeOneAppPage(response, expectedPageId) {
1685
1713
  return typeof n.type === "string" && n.type.length > 0 && (n.type !== "TEXT" || typeof object(n.textData).text === "string") && (n.nodes === void 0 || Array.isArray(n.nodes) && validNodes(n.nodes));
1686
1714
  });
1687
1715
  if (!validNodes(document.nodes)) return invalid();
1716
+ const authored = document.nodes.some((n) => n.type !== "PARAGRAPH" || (n.nodes ?? []).some((c) => c.type !== "TEXT" || !!c.textData?.text?.trim()));
1717
+ if (skipped.size && !authored) return unsupported();
1688
1718
  const normalizedWebsiteLinks = normalizeWebsiteLinks(document.nodes);
1689
1719
  let encoded;
1690
1720
  try {
@@ -1694,9 +1724,17 @@ function decodeOneAppPage(response, expectedPageId) {
1694
1724
  }
1695
1725
  if (encoded.rejected) return invalid();
1696
1726
  const plainText = ricosToPlainText(document);
1697
- const authored = document.nodes.some((n) => n.type !== "PARAGRAPH" || (n.nodes ?? []).some((c) => c.type !== "TEXT" || !!c.textData?.text?.trim()));
1698
1727
  if (!encoded.json && authored) return unsupported();
1699
- return { pageId: expectedPageId, title: typeof content.title === "string" ? content.title : "", contentType, documentJson: encoded.json, plainText, empty: !authored, normalizedWebsiteLinks };
1728
+ return {
1729
+ pageId: expectedPageId,
1730
+ title: typeof content.title === "string" ? content.title : "",
1731
+ contentType,
1732
+ documentJson: encoded.json,
1733
+ plainText,
1734
+ empty: !authored,
1735
+ normalizedWebsiteLinks,
1736
+ gaps: [...skipped].map(([label, count]) => `${label} (${count})`)
1737
+ };
1700
1738
  }
1701
1739
  function oneAppPageSection(page2, options) {
1702
1740
  if (!options.id) throw new Error("oneAppPageSection requires a stable placement id");
package/dist/cli.mjs CHANGED
@@ -41920,7 +41920,6 @@ function shouldRevealError(args) {
41920
41920
  var EMAIL_RE, URL_HOST_RE, INTEGER_RE, NUMBER_RE, AUTHORED_PATTERN_LIMIT, authoredPatterns;
41921
41921
  var init_validation = __esm({
41922
41922
  "../../core/ts/src/validation.ts"() {
41923
- "use strict";
41924
41923
  init_define_HHP_CATALOG();
41925
41924
  EMAIL_RE = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*\.[A-Za-z]{2,}$/;
41926
41925
  URL_HOST_RE = /^[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*(:[0-9]+)?$/;
@@ -185017,6 +185016,14 @@ var init_js_yaml = __esm({
185017
185016
  }
185018
185017
  });
185019
185018
 
185019
+ // ../mobile-dist/dist-contract-merge.ts
185020
+ var init_dist_contract_merge = __esm({
185021
+ "../mobile-dist/dist-contract-merge.ts"() {
185022
+ init_define_HHP_CATALOG();
185023
+ init_binding_spellings();
185024
+ }
185025
+ });
185026
+
185020
185027
  // ../auth-bake/release-auth.ts
185021
185028
  function effectiveAuthProvider(appConfig, capabilities) {
185022
185029
  const provider = appConfig.authConfig?.providerId;
@@ -185027,6 +185034,7 @@ var SHELL_PROVIDER;
185027
185034
  var init_release_auth = __esm({
185028
185035
  "../auth-bake/release-auth.ts"() {
185029
185036
  init_define_HHP_CATALOG();
185037
+ init_dist_contract_merge();
185030
185038
  SHELL_PROVIDER = "the shell's provider";
185031
185039
  }
185032
185040
  });
@@ -268517,7 +268525,15 @@ function normalizeWebsiteLinks(nodes2) {
268517
268525
  }
268518
268526
  return changed;
268519
268527
  }
268520
- function draftDocument(value2) {
268528
+ function draftImageSrc(data) {
268529
+ const src = data.src ?? data.url;
268530
+ if (typeof src === "string") return src ? { url: src } : void 0;
268531
+ const media = object13(src);
268532
+ if (typeof media.url === "string" && media.url) return { url: media.url };
268533
+ const id = media.id ?? media.file_name;
268534
+ return typeof id === "string" && id ? { id } : void 0;
268535
+ }
268536
+ function draftDocument(value2, skipped) {
268521
268537
  const draft = object13(value2);
268522
268538
  if (!Array.isArray(draft.blocks) || draft.blocks.length > 5e3) return invalid3();
268523
268539
  if (draft.entityMap !== void 0 && (!draft.entityMap || typeof draft.entityMap !== "object" || Array.isArray(draft.entityMap))) return invalid3();
@@ -268539,10 +268555,22 @@ function draftDocument(value2) {
268539
268555
  if (ranges.length !== 1) return unsupported();
268540
268556
  const entity = object13(entities[String(object13(ranges[0]).key)]);
268541
268557
  const data = object13(entity.data);
268542
- if (entity.type !== "IMAGE" && entity.type !== "wix-draft-plugin-image") return unsupported();
268543
- const url = data.src ?? data.url;
268544
- if (typeof url !== "string" || !url) return invalid3();
268545
- nodes2.push({ type: "IMAGE", imageData: { image: { src: { url }, ...typeof data.width === "number" ? { width: data.width } : {}, ...typeof data.height === "number" ? { height: data.height } : {} }, ...typeof data.alt === "string" ? { altText: data.alt } : {} } });
268558
+ if (entity.type !== "IMAGE" && entity.type !== "wix-draft-plugin-image") {
268559
+ const label4 = DRAFT_PLUGIN_LABELS[String(entity.type)] ?? `plugin ${String(entity.type)}`;
268560
+ skipped.set(label4, (skipped.get(label4) ?? 0) + 1);
268561
+ continue;
268562
+ }
268563
+ const src = draftImageSrc(data);
268564
+ if (!src) return invalid3();
268565
+ const size = (key4) => [data[key4], object13(data.src)[key4]].find((v2) => typeof v2 === "number");
268566
+ const [width, height] = [size("width"), size("height")];
268567
+ const alt = data.alt ?? object13(data.metadata).alt;
268568
+ const link4 = object13(object13(data.config).link).url;
268569
+ nodes2.push({ type: "IMAGE", imageData: {
268570
+ image: { src, ...width !== void 0 ? { width } : {}, ...height !== void 0 ? { height } : {} },
268571
+ ...typeof alt === "string" ? { altText: alt } : {},
268572
+ ...typeof link4 === "string" && link4 ? { link: { url: link4 } } : {}
268573
+ } });
268546
268574
  continue;
268547
268575
  }
268548
268576
  const cuts = [.../* @__PURE__ */ new Set([0, text32.length, ...spans.flatMap((s5) => [Number(s5.offset), Number(s5.offset) + Number(s5.length)])])].sort((a3, b3) => a3 - b3);
@@ -268569,6 +268597,8 @@ function draftDocument(value2) {
268569
268597
  const list5 = last?.type === type2 ? last : { type: type2, nodes: [] };
268570
268598
  if (last !== list5) nodes2.push(list5);
268571
268599
  list5.nodes?.push({ type: "LIST_ITEM", nodes: [paragraph] });
268600
+ } else if (block.type === "blockquote") {
268601
+ nodes2.push({ type: "BLOCKQUOTE", nodes: [paragraph] });
268572
268602
  } else if (/^header-(one|two|three|four|five|six)$/.test(String(block.type))) {
268573
268603
  nodes2.push({ type: "HEADING", headingData: { level: ["one", "two", "three", "four", "five", "six"].indexOf(String(block.type).slice(7)) + 1 }, nodes: runs });
268574
268604
  } else if (block.type === "unstyled" || block.type === "paragraph" || block.type === void 0) nodes2.push(paragraph);
@@ -268582,6 +268612,7 @@ function decodeOneAppPage(response, expectedPageId) {
268582
268612
  const raw = body.content;
268583
268613
  if (richContentOverLimits(raw, null)) return invalid3();
268584
268614
  let document2;
268615
+ const skipped = /* @__PURE__ */ new Map();
268585
268616
  const contentType = body.contentType;
268586
268617
  if (contentType === "PLAIN_TEXT") document2 = plainTextToRicos(raw);
268587
268618
  else if (contentType === "RICH_CONTENT" || contentType === "DRAFTJS") {
@@ -268592,7 +268623,7 @@ function decodeOneAppPage(response, expectedPageId) {
268592
268623
  return invalid3();
268593
268624
  }
268594
268625
  if (richContentOverLimits(raw, parsed)) return invalid3();
268595
- if (contentType === "DRAFTJS") document2 = draftDocument(parsed);
268626
+ if (contentType === "DRAFTJS") document2 = draftDocument(parsed, skipped);
268596
268627
  else {
268597
268628
  if (!Array.isArray(object13(parsed).nodes)) return invalid3();
268598
268629
  document2 = parsed;
@@ -268603,6 +268634,8 @@ function decodeOneAppPage(response, expectedPageId) {
268603
268634
  return typeof n2.type === "string" && n2.type.length > 0 && (n2.type !== "TEXT" || typeof object13(n2.textData).text === "string") && (n2.nodes === void 0 || Array.isArray(n2.nodes) && validNodes(n2.nodes));
268604
268635
  });
268605
268636
  if (!validNodes(document2.nodes)) return invalid3();
268637
+ const authored2 = document2.nodes.some((n2) => n2.type !== "PARAGRAPH" || (n2.nodes ?? []).some((c2) => c2.type !== "TEXT" || !!c2.textData?.text?.trim()));
268638
+ if (skipped.size && !authored2) return unsupported();
268606
268639
  const normalizedWebsiteLinks = normalizeWebsiteLinks(document2.nodes);
268607
268640
  let encoded3;
268608
268641
  try {
@@ -268612,9 +268645,17 @@ function decodeOneAppPage(response, expectedPageId) {
268612
268645
  }
268613
268646
  if (encoded3.rejected) return invalid3();
268614
268647
  const plainText3 = ricosToPlainText(document2);
268615
- const authored2 = document2.nodes.some((n2) => n2.type !== "PARAGRAPH" || (n2.nodes ?? []).some((c2) => c2.type !== "TEXT" || !!c2.textData?.text?.trim()));
268616
268648
  if (!encoded3.json && authored2) return unsupported();
268617
- return { pageId: expectedPageId, title: typeof content.title === "string" ? content.title : "", contentType, documentJson: encoded3.json, plainText: plainText3, empty: !authored2, normalizedWebsiteLinks };
268649
+ return {
268650
+ pageId: expectedPageId,
268651
+ title: typeof content.title === "string" ? content.title : "",
268652
+ contentType,
268653
+ documentJson: encoded3.json,
268654
+ plainText: plainText3,
268655
+ empty: !authored2,
268656
+ normalizedWebsiteLinks,
268657
+ gaps: [...skipped].map(([label4, count3]) => `${label4} (${count3})`)
268658
+ };
268618
268659
  }
268619
268660
  function oneAppPageSection(page, options2) {
268620
268661
  if (!options2.id) throw new Error("oneAppPageSection requires a stable placement id");
@@ -268626,7 +268667,7 @@ function oneAppPageSection(page, options2) {
268626
268667
  documentJson: page.documentJson
268627
268668
  } } };
268628
268669
  }
268629
- var failure2, object13, invalid3, unsupported, isOneAppPageId;
268670
+ var failure2, object13, invalid3, unsupported, isOneAppPageId, DRAFT_PLUGIN_LABELS;
268630
268671
  var init_one_app_page = __esm({
268631
268672
  "../../stdlib/flows/screens/src/one-app-page.ts"() {
268632
268673
  init_define_HHP_CATALOG();
@@ -268638,6 +268679,11 @@ var init_one_app_page = __esm({
268638
268679
  invalid3 = () => failure2("invalid", "The referenced page returned malformed content.");
268639
268680
  unsupported = () => failure2("unsupported", "The referenced page uses an unsupported content format.");
268640
268681
  isOneAppPageId = (value2) => typeof value2 === "string" && /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(value2);
268682
+ DRAFT_PLUGIN_LABELS = {
268683
+ "wix-draft-plugin-video": "video",
268684
+ "wix-draft-plugin-file-upload": "file download",
268685
+ "wix-draft-plugin-gallery": "gallery"
268686
+ };
268641
268687
  }
268642
268688
  });
268643
268689
 
@@ -268692,7 +268738,10 @@ async function collectOneAppPages(raw, source2, read2) {
268692
268738
  }
268693
268739
  const captured = documents.get(pageId2);
268694
268740
  placement.state = captured.state;
268695
- if (captured.page) placement.component = oneAppPageSection(captured.page, { id: `one_app_page_${hash2(placement.sourcePointer).slice(0, 16)}` });
268741
+ if (captured.page) {
268742
+ placement.component = oneAppPageSection(captured.page, { id: `one_app_page_${hash2(placement.sourcePointer).slice(0, 16)}` });
268743
+ if (captured.page.gaps.length) placement.gaps = captured.page.gaps;
268744
+ }
268696
268745
  }
268697
268746
  return { version: 1, source: source2, placements, documents: [...documents.values()] };
268698
268747
  }
@@ -270751,7 +270800,11 @@ var init_generate2 = __esm({
270751
270800
  },
270752
270801
  pages_section: (id, _s2, _st, index, ctx, elementId) => {
270753
270802
  const placement = ctx.placements.get(`${ctx.page.layoutItemId}:${elementId}:${index}`);
270754
- if (placement?.state === "ready" && placement.component) return vstack(`${id}.box`, [placement.component], 0, inset(8, 8));
270803
+ if (placement?.state === "ready" && placement.component) {
270804
+ const left = arr(placement.gaps).map(str16).filter(Boolean);
270805
+ if (left.length) ctx.gap(elementId, "pages_section", `the Pages document has content the section cannot show (${left.join(", ")}); its text and images are shown without it`);
270806
+ return vstack(`${id}.box`, [placement.component], 0, inset(8, 8));
270807
+ }
270755
270808
  return ctx.unsupported(elementId, "pages_section", placement ? `its Pages document is not ready in pages-content.json (state "${str16(placement.state)}")` : "its Pages document is not in pages-content.json: re-run `himi one-app migrate` to collect it");
270756
270809
  },
270757
270810
  // The site's services as rows that open the service, with a See All button to the services screen. The source section has no settings
@@ -896,8 +896,10 @@ or malformed selectors/content), `unsupported`, `forbidden`, `unauthorized`,
896
896
  `not_found` and `unavailable` remain distinct gaps. A failed document has no
897
897
  emitted component. Preserve the gap and resolve it before claiming its coverage;
898
898
  never substitute an empty paragraph, demo copy or owner read. Supported DraftJS
899
- text, styled links, flat lists, headings and images are converted; nested lists
900
- and unknown plugins remain explicit `unsupported` gaps.
899
+ text, styled links, flat lists, headings, quotes and images (including the image plugin's media object) are
900
+ converted. A plugin the app cannot render (file, video, gallery, unknown) is left out: the placement stays `ready`,
901
+ lists it in `gaps` (for example `video (2)`), and `generate` reports it as a `pages_section` gap. A document holding
902
+ only such plugins, and nested lists, remain explicit `unsupported` gaps.
901
903
 
902
904
  This reconstruction captures editorial presentation only. Changing catalogs,
903
905
  transactions and member records remain live. It uses the existing cross-platform
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/himalaya-cli",
3
- "version": "0.1772.0",
3
+ "version": "0.1773.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": "34c24f13e5a84869f63b5d5116175c72f45d5abaef41ffcd30c0e1ef"
85
+ "falconPackageHash": "867ce5320d279afbf966bd34b84f4f4fd7eb94a71bf3acf71d8720fe"
86
86
  }