@wix/himalaya-cli 0.877.0 → 0.878.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.
@@ -37,7 +37,18 @@ export interface WixGetPostRequest {
37
37
  * filter-by-id — a graceful degrade to the LIST projection (no body) that keeps
38
38
  * blog detail + saved screens rendering instead of erroring out. `queryPosts`'s
39
39
  * request type has no `fieldsets` field, so that fallback path cannot carry the
40
- * body. */
40
+ * body.
41
+ *
42
+ * When that fallback ALSO finds nothing (#2658) — a deleted post, or one this
43
+ * visitor may not see — we reject rather than resolve. `WixGetPostResponse.post`
44
+ * is non-optional, so returning `{ post: resp.posts?.[0] }` would hand callers an
45
+ * `undefined` the type promises is present, and the `post.title` access that type
46
+ * licenses throws a `TypeError` deep inside the caller — the exact hard error
47
+ * this fallback exists to prevent, and harder to diagnose than a clean rejection.
48
+ * Every call site rides its own rejection path (cached-post state, draft-only
49
+ * `catch`, or an `allSettled` filter), so rejecting is what routes them into the
50
+ * graceful degrade they already implement. The originating failure travels as
51
+ * `cause`, so the 404-vs-network distinction is not lost. */
41
52
  export declare function getPost(postId: string, req?: WixGetPostRequest): Promise<WixGetPostResponse>;
42
53
  export interface WixBlogCategory {
43
54
  id: string;
@@ -12,9 +12,13 @@ function getPost(postId, req = {}) {
12
12
  return wixCall(
13
13
  "GET",
14
14
  `/blog/v3/posts/${encodeURIComponent(postId)}` + query
15
- ).catch(async () => {
15
+ ).catch(async (cause) => {
16
16
  const resp = await queryPosts({ query: { filter: { id: postId } } });
17
- return { post: resp.posts?.[0] };
17
+ const post = resp.posts?.[0];
18
+ if (!post) {
19
+ throw new Error(`Blog post not found: ${postId}`, { cause });
20
+ }
21
+ return { post };
18
22
  });
19
23
  }
20
24
  function queryCategories(req = {}) {
package/dist/cli.mjs CHANGED
@@ -5241,6 +5241,7 @@ function resolveTranslation(value, catalog, sourceCatalog) {
5241
5241
  var BINDING_SIGILS, BINDING_SIGIL_RE, TRANSLATION_PREFIX, TRANSLATION_KEY_RE;
5242
5242
  var init_bindings = __esm({
5243
5243
  "../../core/ts/src/bindings.ts"() {
5244
+ "use strict";
5244
5245
  BINDING_SIGILS = ["service", "flag", "item", "t"];
5245
5246
  BINDING_SIGIL_RE = new RegExp(
5246
5247
  `^\\$(?:${BINDING_SIGILS.filter((s) => s !== "t").join("|")})\\b|^\\$t:`
@@ -6590,7 +6590,7 @@
6590
6590
  {
6591
6591
  "name": "getPost",
6592
6592
  "kind": "function",
6593
- "jsdoc": "/** Fetch a single PUBLISHED post by id — GET /blog/v3/posts/{id}. The list\n * (queryPosts) returns published posts, so the detail reads them here (draft\n * ids are a different space — getDraftPost is for the edit/create flow).\n *\n * Body fieldsets (#826): Blog v3 `GET /posts/{id}` returns 200 but only the\n * LIST projection (title / excerpt / meta) unless the caller asks for the body —\n * the bare GET has NO `richContent` / `contentText`. So we request\n * RICH_CONTENT + CONTENT_TEXT by default and the article body loads on the happy\n * path; callers can override via `req.fieldsets`. (Supersedes the old #507 note:\n * the 502 this GET once returned for anonymous visitors is gone — it 200s now —\n * but a body-less 200 was never the \"body preserved whenever the backend is\n * healthy\" the earlier comment claimed; the body was simply never requested.)\n *\n * On any rejection (network / backend error) we still fall back to a queryPosts\n * filter-by-id — a graceful degrade to the LIST projection (no body) that keeps\n * blog detail + saved screens rendering instead of erroring out. `queryPosts`'s\n * request type has no `fieldsets` field, so that fallback path cannot carry the\n * body. */",
6593
+ "jsdoc": "/** Fetch a single PUBLISHED post by id — GET /blog/v3/posts/{id}. The list\n * (queryPosts) returns published posts, so the detail reads them here (draft\n * ids are a different space — getDraftPost is for the edit/create flow).\n *\n * Body fieldsets (#826): Blog v3 `GET /posts/{id}` returns 200 but only the\n * LIST projection (title / excerpt / meta) unless the caller asks for the body —\n * the bare GET has NO `richContent` / `contentText`. So we request\n * RICH_CONTENT + CONTENT_TEXT by default and the article body loads on the happy\n * path; callers can override via `req.fieldsets`. (Supersedes the old #507 note:\n * the 502 this GET once returned for anonymous visitors is gone — it 200s now —\n * but a body-less 200 was never the \"body preserved whenever the backend is\n * healthy\" the earlier comment claimed; the body was simply never requested.)\n *\n * On any rejection (network / backend error) we still fall back to a queryPosts\n * filter-by-id — a graceful degrade to the LIST projection (no body) that keeps\n * blog detail + saved screens rendering instead of erroring out. `queryPosts`'s\n * request type has no `fieldsets` field, so that fallback path cannot carry the\n * body.\n *\n * When that fallback ALSO finds nothing (#2658) — a deleted post, or one this\n * visitor may not see — we reject rather than resolve. `WixGetPostResponse.post`\n * is non-optional, so returning `{ post: resp.posts?.[0] }` would hand callers an\n * `undefined` the type promises is present, and the `post.title` access that type\n * licenses throws a `TypeError` deep inside the caller — the exact hard error\n * this fallback exists to prevent, and harder to diagnose than a clean rejection.\n * Every call site rides its own rejection path (cached-post state, draft-only\n * `catch`, or an `allSettled` filter), so rejecting is what routes them into the\n * graceful degrade they already implement. The originating failure travels as\n * `cause`, so the 404-vs-network distinction is not lost. */",
6594
6594
  "decl": "export function getPost(\n postId: string,\n req: WixGetPostRequest = {},\n): Promise<WixGetPostResponse>;",
6595
6595
  "http": "GET /blog/v3/posts/{…}"
6596
6596
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/himalaya-cli",
3
- "version": "0.877.0",
3
+ "version": "0.878.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": [
@@ -63,5 +63,5 @@
63
63
  "artifactId": "himalaya-cli"
64
64
  }
65
65
  },
66
- "falconPackageHash": "165e76dc8fe6c80270e34398c2070b203234e75c6e6b748b88abb286"
66
+ "falconPackageHash": "f191342a43dc741dcb30330836f5daafa7f1b917e8a252461dfc1cf2"
67
67
  }