@wix/himalaya-cli 0.1365.0 → 0.1367.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
@@ -1827,7 +1827,7 @@ var init_scaffold = __esm({
1827
1827
  MODULE_SOURCE_FILE = /\.(?:[cm]?[jt]sx?)$/i;
1828
1828
  TEMPLATES_DIR = resolve2(dirname2(fileURLToPath(import.meta.url)), "../templates");
1829
1829
  SHOWCASE_TEMPLATES_DIR = resolve2(dirname2(fileURLToPath(import.meta.url)), "../showcase-apps");
1830
- SHOWCASE_TEMPLATE_NAMES = ["video-courses", "base44-starter", "base44-booking"];
1830
+ SHOWCASE_TEMPLATE_NAMES = ["video-courses", "base44-starter", "base44-booking", "base44-inspections"];
1831
1831
  BASE44_APP_ID_PLACEHOLDER = "ReplaceWithYourBase44AppId";
1832
1832
  BASE44_APP_ID_RE = /^[A-Za-z0-9]{8,64}$/;
1833
1833
  TEMPLATE_META_FILE = "himalaya.template.json";
@@ -136209,7 +136209,7 @@ import { dirname as dirname31, join as join47, resolve as resolve39 } from "node
136209
136209
  import { fileURLToPath as fileURLToPath23 } from "node:url";
136210
136210
  import { createRequire as createRequire2 } from "node:module";
136211
136211
  import { execFileSync as execFileSync4 } from "node:child_process";
136212
- import { gzipSync } from "node:zlib";
136212
+ import { gzipSync as gzipSync2 } from "node:zlib";
136213
136213
  function bakeNeedsLiveOrigin(collect2, templatedRoutes = []) {
136214
136214
  if (collect2?.render !== void 0) return true;
136215
136215
  return templatedRoutes.some((t2) => typeof t2.seedIds === "function");
@@ -136835,7 +136835,7 @@ async function buildFromLoaded(preloaded, dest, opts = {}) {
136835
136835
  await store.putBundle(app, hash2, bytes2);
136836
136836
  const integrity2 = sri2(bytes2);
136837
136837
  bundles[name] = { sha256: hash2, sri: integrity2, bytes: bytes2.length };
136838
- tierBundles.set(name, { name, integrity: integrity2, gzippedKilobytes: gzipSync(bytes2).length / 1024 });
136838
+ tierBundles.set(name, { name, integrity: integrity2, gzippedKilobytes: gzipSync2(bytes2).length / 1024 });
136839
136839
  addrCache.set(name, hash2);
136840
136840
  return hash2;
136841
136841
  };
@@ -174147,6 +174147,7 @@ import { join as join84, resolve as resolve61, relative as relative15, basename
174147
174147
  import { fileURLToPath as fileURLToPath29 } from "node:url";
174148
174148
 
174149
174149
  // ../serve-cli/src/client.ts
174150
+ import { gzipSync } from "node:zlib";
174150
174151
  var MAX_PUBLISH_BODY_BYTES = 8 * 1024 * 1024;
174151
174152
  function publishReleaseBody(payload, meta, draft = false) {
174152
174153
  return { ...payload, ...meta ?? {}, ...draft ? { draft: true } : {} };
@@ -174154,6 +174155,17 @@ function publishReleaseBody(payload, meta, draft = false) {
174154
174155
  function publishReleaseBodyBytes(payload, meta, draft = false) {
174155
174156
  return Buffer.byteLength(JSON.stringify(publishReleaseBody(payload, meta, draft)), "utf8");
174156
174157
  }
174158
+ function publishReleaseWireBytes(payload, meta, draft = false) {
174159
+ return encodePublishBody(publishReleaseBody(payload, meta, draft)).bytes.byteLength;
174160
+ }
174161
+ var MAX_DECODED_PUBLISH_BODY_BYTES = 32 * 1024 * 1024;
174162
+ function encodePublishBody(body) {
174163
+ const plain2 = Buffer.from(JSON.stringify(body), "utf8");
174164
+ if (plain2.byteLength <= MAX_PUBLISH_BODY_BYTES || plain2.byteLength > MAX_DECODED_PUBLISH_BODY_BYTES) {
174165
+ return { bytes: plain2, gzip: false };
174166
+ }
174167
+ return { bytes: gzipSync(plain2), gzip: true };
174168
+ }
174157
174169
  var CREDENTIAL_HEADERS = /* @__PURE__ */ new Set([
174158
174170
  "x-control-token",
174159
174171
  "x-telemetry-token",
@@ -174176,13 +174188,13 @@ var ServeCliClient = class {
174176
174188
  if (!/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$/.test(this.target.previewRoute)) throw new Error("invalid_dist_preview_route");
174177
174189
  headers2["x-wix-route-serve"] = this.target.previewRoute;
174178
174190
  }
174179
- if (opts.body !== void 0) headers2["content-type"] = "application/json";
174191
+ if (opts.body !== void 0 || opts.rawBody !== void 0) headers2["content-type"] = "application/json";
174180
174192
  const carriesCredential = Object.keys(headers2).some((h3) => CREDENTIAL_HEADERS.has(h3.toLowerCase()));
174181
174193
  const res = await this.fetchImpl(this.baseFor(plane) + path2, {
174182
174194
  method,
174183
174195
  headers: headers2,
174184
174196
  ...carriesCredential ? { redirect: "error" } : {},
174185
- body: opts.body !== void 0 ? JSON.stringify(opts.body) : void 0
174197
+ body: opts.rawBody !== void 0 ? new Uint8Array(opts.rawBody) : opts.body !== void 0 ? JSON.stringify(opts.body) : void 0
174186
174198
  });
174187
174199
  const text9 = await res.text();
174188
174200
  let json6 = null;
@@ -174424,8 +174436,15 @@ var ServeCliClient = class {
174424
174436
  }
174425
174437
  /** Publish a built release into the store (POST /v1/admin/release), with optional label/notes/gitSha.
174426
174438
  * `draft: true` stores it fully servable (pinned reads) WITHOUT moving the live release. */
174427
- publishRelease(payload, meta, draft = false) {
174428
- return this.request("control", "POST", "/v1/admin/release", { body: publishReleaseBody(payload, meta, draft), headers: this.ctrlHeaders() });
174439
+ async publishRelease(payload, meta, draft = false) {
174440
+ const { bytes: bytes2, gzip } = encodePublishBody(publishReleaseBody(payload, meta, draft));
174441
+ const headers2 = { ...this.ctrlHeaders(), ...gzip ? { "content-encoding": "gzip" } : {} };
174442
+ const res = await this.request("control", "POST", "/v1/admin/release", { rawBody: bytes2, headers: headers2 });
174443
+ if (gzip && res.status === 400 && res.json?.error === "bad_json") {
174444
+ const json6 = { code: "compressed_publish_unsupported", error: "compressed_publish_unsupported", hint: "this body is over the plain publish cap, and the plane did not accept it compressed: either the plane predates gzip publish bodies (it needs a serve deploy), or this is a self-serve credential, which keeps the plain 8 MB cap" };
174445
+ return { ...res, json: json6, text: JSON.stringify(json6) };
174446
+ }
174447
+ return res;
174429
174448
  }
174430
174449
  /** The app's own source archive for one release (GET /v1/owner/source) — what `himi pull`
174431
174450
  * restores from.
@@ -179718,19 +179737,23 @@ ${doNow.map((l2) => ` ${l2}`).join("\n")}`);
179718
179737
  let sendPayload = payload;
179719
179738
  let templateBodyBytes = publishReleaseBodyBytes(payload, publishMeta);
179720
179739
  let sourceGzChars;
179740
+ let bodyGzipped = false;
179721
179741
  if (templateBodyBytes > MAX_PUBLISH_BODY_BYTES) {
179722
- const { gzipSync: gzipSync2 } = await import("node:zlib");
179742
+ const { gzipSync: gzipSync3 } = await import("node:zlib");
179723
179743
  const { source: plainSource, ...rest } = payload;
179724
- const sourceGz = gzipSync2(Buffer.from(JSON.stringify(plainSource), "utf8"), { level: 9 }).toString("base64");
179744
+ const sourceGz = gzipSync3(Buffer.from(JSON.stringify(plainSource), "utf8"), { level: 9 }).toString("base64");
179725
179745
  sourceGzChars = sourceGz.length;
179726
179746
  const gzipped = { ...rest, sourceGz };
179727
179747
  const gzBytes = publishReleaseBodyBytes(gzipped, publishMeta);
179728
179748
  if (gzBytes <= MAX_PUBLISH_BODY_BYTES) {
179729
179749
  sendPayload = gzipped;
179730
179750
  templateBodyBytes = gzBytes;
179751
+ } else if (Buffer.byteLength(JSON.stringify(plainSource), "utf8") <= MAX_PUBLISH_BODY_BYTES && publishReleaseWireBytes(payload, publishMeta) <= MAX_PUBLISH_BODY_BYTES) {
179752
+ sendPayload = payload;
179753
+ bodyGzipped = true;
179731
179754
  }
179732
179755
  }
179733
- if (templateBodyBytes > MAX_PUBLISH_BODY_BYTES) {
179756
+ if (templateBodyBytes > MAX_PUBLISH_BODY_BYTES && !bodyGzipped) {
179734
179757
  io2.error(JSON.stringify({
179735
179758
  ok: false,
179736
179759
  template: name,
@@ -179798,7 +179821,8 @@ ${doNow.map((l2) => ` ${l2}`).join("\n")}`);
179798
179821
  }
179799
179822
  if (!r2.ok) {
179800
179823
  const hint = releaseIdExistsHint(r2.status, r2.json);
179801
- print({ ok: false, status: r2.status, body: r2.json ?? r2.text, ...hint ? { hint } : {} });
179824
+ const code = r2.json?.code === "compressed_publish_unsupported" ? "compressed_publish_unsupported" : void 0;
179825
+ print({ ok: false, ...code ? { code } : {}, status: r2.status, body: r2.json ?? r2.text, ...hint ? { hint } : {} });
179802
179826
  return 1;
179803
179827
  }
179804
179828
  if (sendPayload.sourceGz && r2.json?.template !== true) {
@@ -106,6 +106,15 @@ failure codes. A forced push still follows the existing override rules.
106
106
  | `config_not_applied` | `--content` was given, but the binding is not in its `config.ts` (no config file, a dynamic or symlinked config, an edit `himi validate` rolled back, or no validator); the `config` report or `note` says what to add by hand. |
107
107
  | `connect_failed` | An otherwise unclassified error stopped connect (for example an unreadable manifest, or a failed `--out` write). The original message is preserved. |
108
108
 
109
+ ## `himi template publish` codes
110
+
111
+ `template publish` is still mostly legacy. It carries one code so far, on the path that sends the
112
+ whole body gzip-encoded because it is over the plain 8 MB cap:
113
+
114
+ | Code | Meaning |
115
+ |---|---|
116
+ | `compressed_publish_unsupported` | The publish body went out gzipped and the publishing service did not accept it compressed, so it read the bytes as malformed JSON. Either the service does not accept compressed bodies yet, or the credential is a self-serve one, which keeps the 8 MB uncompressed limit. Nothing was written. |
117
+
109
118
  ## `himi site member-app` codes
110
119
 
111
120
  `himi site member-app set|clear|show <site>` prints one envelope. A refusal from the publishing service
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/himalaya-cli",
3
- "version": "0.1365.0",
3
+ "version": "0.1367.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": [
@@ -71,5 +71,5 @@
71
71
  "artifactId": "himalaya-cli"
72
72
  }
73
73
  },
74
- "falconPackageHash": "ba734484945c55507351443800ba12569f99c00d2324c1d84e355d00"
74
+ "falconPackageHash": "f0bd979c3332da32c4c59ee213e5f02fad1f6edd492c8ab44ee4947b"
75
75
  }