@wix/himalaya-cli 0.942.0 → 0.944.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.
@@ -533,6 +533,12 @@ export type TextProps = TextContent & {
533
533
  * the current left-to-right behavior. Both renderers honor it (parity). */
534
534
  textDirection?: "auto" | "ltr" | "rtl";
535
535
  decoration?: "underline" | "strikethrough";
536
+ /** EXTRA SPACE BETWEEN LINES, in points/px — added ON TOP of the line height the `style`
537
+ * token already sets. It is NOT a multiple: `lineSpacing: 6` means six points of extra
538
+ * leading, not six times the font size, and every renderer agrees on that. To
539
+ * change the line height as a ratio of the font size, set the typography token's `line`
540
+ * instead; that is where a body style's 1.4/1.7 lives. Absent/0 = the token's own line
541
+ * height, which is the right answer for almost every screen. */
536
542
  lineSpacing?: number;
537
543
  /** Per-item gate (usually an `$item.` field pre-substituted per row): when it
538
544
  * resolves empty, the text collapses to zero size instead of taking layout. */
@@ -185,7 +185,17 @@ export interface WixUpdateBookingResponse {
185
185
  export interface WixRescheduleBookingResponse {
186
186
  booking: WixBooking;
187
187
  }
188
+ /**
189
+ * @scope owner — requires an owner / business identity — a visitor session gets 403.
190
+ *
191
+ * POST /bookings/v2/bookings/query
192
+ */
188
193
  export declare function queryBookings(req?: WixQueryBookingsRequest, opts?: WixCallOptions): Promise<WixQueryBookingsResponse>;
194
+ /**
195
+ * @scope owner — requires an owner / business identity — a visitor session gets 403.
196
+ *
197
+ * GET /bookings/v1/bookings
198
+ */
189
199
  export declare function listBookings(req?: WixListBookingsRequest, opts?: WixCallOptions): Promise<WixListBookingsResponse>;
190
200
  export declare function getBooking(bookingId: string, opts?: WixCallOptions): Promise<WixGetBookingResponse>;
191
201
  export declare function createBooking(req?: WixCreateBookingRequest, opts?: WixCallOptions): Promise<WixCreateBookingResponse>;
@@ -50,9 +50,56 @@ export interface WixUpdateDataItemRequest {
50
50
  };
51
51
  }
52
52
  /** Query items in a collection — POST /wix-data/v2/items/query.
53
- * Pass `returnTotalCount: true` to ask Wix to fill `pagingMetadata.total`
54
- * (offset paging only; omitted by default because counting is extra work). */
55
- export declare function queryDataItems(dataCollectionId: string, limit?: number, filter?: Record<string, unknown>, returnTotalCount?: boolean): Promise<WixQueryDataItemsResponse>;
53
+ *
54
+ * `filter` is the Wix Data v2 filter object, which the type cannot express (it is
55
+ * `Record<string, unknown>` by construction). A field name maps to a value for
56
+ * equality, or to an operator object:
57
+ *
58
+ * ```ts
59
+ * await queryDataItems("Listings", 20, { city: "Tel Aviv" });
60
+ * await queryDataItems("Listings", 20, { price: { $lte: 2_500_000 } });
61
+ * await queryDataItems("Listings", 20, { _id: { $in: [a, b] } });
62
+ * ```
63
+ *
64
+ * `offset` pages: ask for `limit` rows starting at `offset`. Pair it with
65
+ * `returnTotalCount: true`, which fills `pagingMetadata.total` so a caller knows
66
+ * when to stop — it is omitted by default because counting is extra work, and it
67
+ * reports total for OFFSET paging only, which is the mode this function uses.
68
+ *
69
+ * ```ts
70
+ * const first = await queryDataItems("Listings", 50, undefined, true);
71
+ * const total = first.pagingMetadata?.total ?? 0;
72
+ * const rest = await queryDataItems("Listings", 50, undefined, false, 50);
73
+ * ```
74
+ *
75
+ * To read ONE row, use `getDataItem` rather than a page plus a client-side
76
+ * `.find()` — that pattern breaks silently once the collection outgrows `limit`. */
77
+ export declare function queryDataItems(dataCollectionId: string, limit?: number, filter?: Record<string, unknown>, returnTotalCount?: boolean, offset?: number): Promise<WixQueryDataItemsResponse>;
78
+ /** Read ONE item by id — GET /wix-data/v2/items/{dataItemId}?dataCollectionId=…
79
+ *
80
+ * Reach for this on a detail screen. Before it existed the only read this package
81
+ * offered was `queryDataItems`, so a detail worker had to fetch a bounded page and
82
+ * find its row client-side:
83
+ *
84
+ * ```ts
85
+ * const res = await queryDataItems("Listings", 50); // ← DON'T
86
+ * const row = (res.dataItems ?? []).find((it) => it.id === id);
87
+ * ```
88
+ *
89
+ * That is correct against a handful of seeded rows and silently wrong once the
90
+ * collection outgrows `limit`. Ask for the row instead:
91
+ *
92
+ * ```ts
93
+ * const { dataItem } = await getDataItem("Listings", id); // ← DO
94
+ * ```
95
+ *
96
+ * The collection id rides the query string rather than a body, because the Wix
97
+ * gateway drops a GET body — and the string is built with `encodeURIComponent`
98
+ * rather than `URLSearchParams`, which the bare Tier-5 worker runtimes (JSCore /
99
+ * Hermes / QuickJS-ng) do not provide. */
100
+ export declare function getDataItem(dataCollectionId: string, dataItemId: string): Promise<{
101
+ dataItem?: WixDataItem;
102
+ }>;
56
103
  /** Insert an item — POST /wix-data/v2/items. */
57
104
  export declare function insertDataItem(dataCollectionId: string, data: Record<string, unknown>): Promise<{
58
105
  dataItem?: WixDataItem;
@@ -7,15 +7,28 @@ function wixCall(method, path, body) {
7
7
  }
8
8
  return globalThis.himalaya.wixApi.call(method, path, body);
9
9
  }
10
- function queryDataItems(dataCollectionId, limit = 50, filter, returnTotalCount = false) {
10
+ function queryDataItems(dataCollectionId, limit = 50, filter, returnTotalCount = false, offset = 0) {
11
11
  if (!dataCollectionId) throw new Error("queryDataItems: dataCollectionId is required");
12
12
  const body = {
13
13
  dataCollectionId,
14
- query: { paging: { limit }, ...filter ? { filter } : {} },
14
+ query: {
15
+ // `offset` is omitted when 0 so a caller that does not page sends the byte-identical
16
+ // body it sent before this parameter existed.
17
+ paging: { limit, ...offset ? { offset } : {} },
18
+ ...filter ? { filter } : {}
19
+ },
15
20
  ...returnTotalCount ? { returnTotalCount: true } : {}
16
21
  };
17
22
  return wixCall("POST", "/wix-data/v2/items/query", body);
18
23
  }
24
+ function getDataItem(dataCollectionId, dataItemId) {
25
+ if (!dataCollectionId) throw new Error("getDataItem: dataCollectionId is required");
26
+ if (!dataItemId) throw new Error("getDataItem: dataItemId is required");
27
+ return wixCall(
28
+ "GET",
29
+ `/wix-data/v2/items/${encodeURIComponent(dataItemId)}?dataCollectionId=${encodeURIComponent(dataCollectionId)}`
30
+ );
31
+ }
19
32
  function insertDataItem(dataCollectionId, data) {
20
33
  if (!dataCollectionId) throw new Error("insertDataItem: dataCollectionId is required");
21
34
  return wixCall("POST", "/wix-data/v2/items", {
@@ -36,6 +49,7 @@ function removeDataItem(dataCollectionId, id) {
36
49
  return wixCall("DELETE", `/wix-data/v2/items/${encodeURIComponent(id)}?${q}`);
37
50
  }
38
51
  export {
52
+ getDataItem,
39
53
  insertDataItem,
40
54
  queryDataItems,
41
55
  removeDataItem,
package/dist/cli.mjs CHANGED
@@ -1378,7 +1378,12 @@ function readTemplateFiles(srcRoot) {
1378
1378
  function scaffoldFromTemplate(name, dir, template) {
1379
1379
  const srcRoot = templateSourceDir(template);
1380
1380
  if (!existsSync2(join3(srcRoot, "himalaya.content.json"))) {
1381
- throw new Error(`unknown template "${template}" (available: ${availableTemplates().join(", ") || "none bundled"})`);
1381
+ throw new Error(
1382
+ `unknown template "${template}" \u2014 not bundled with this CLI.
1383
+ bundled: ${availableTemplates().join(", ") || "none"}
1384
+ The published catalog is larger: \`himi template list --remote\` lists it, and
1385
+ \`himi init <app> --template ${template} --remote\` fetches one from there.`
1386
+ );
1382
1387
  }
1383
1388
  return finishScaffold(materializeSource(readTemplateFiles(srcRoot), name, dir), template);
1384
1389
  }
@@ -25590,7 +25595,7 @@ var init_renderNode = __esm({
25590
25595
  const content = countContent != null ? countContent : icuPattern != null ? /* @__PURE__ */ jsx6(InterpolatedTextView, { pattern: icuPattern, params: props.template?.params ?? {}, ctx }) : mdSource != null ? /* @__PURE__ */ jsx6("span", { dangerouslySetInnerHTML: mdInline(mdSource) }) : txt(props.text, ctx);
25591
25596
  const tAlign = props.textAlign === "center" ? "center" : props.textAlign === "trailing" ? "right" : props.textAlign === "justify" ? "justify" : props.textAlign === "leading" ? "left" : void 0;
25592
25597
  const tDecor = props.decoration === "strikethrough" ? "line-through" : props.decoration === "underline" ? "underline" : void 0;
25593
- const ln = typeof props.lineSpacing === "number" && f.line ? f.line + props.lineSpacing : f.line;
25598
+ const ln = typeof props.lineSpacing === "number" ? `${(f.line ?? 1.4) * f.size + props.lineSpacing}px` : f.line;
25594
25599
  return /* @__PURE__ */ jsx6("div", { ...countAttrs, style: { fontFamily: fontStack(f.family), fontSize: f.size, fontWeight: f.weight, lineHeight: ln, letterSpacing: f.letterSpacing, color: C(resolveScalarStatic(props.color, ctx) ?? "textPrimary", "#13171e"), whiteSpace: "pre-wrap", overflowWrap: "anywhere", wordBreak: "break-word", minWidth: 0, ...tAlign ? { textAlign: tAlign } : {}, ...tDecor ? { textDecoration: tDecor } : {}, ...props.maxLines ? { display: "-webkit-box", WebkitLineClamp: props.maxLines, WebkitBoxOrient: "vertical", overflow: "hidden" } : {}, ...wrap }, children: content == null || content === "" ? collapse ? null : "\xA0" : content });
25595
25600
  });
25596
25601
  ImageNode = withExtras("ImageNode", ({ props, ctx, wrap }) => {
@@ -43278,19 +43283,19 @@ var init_preview_assets_generated = __esm({
43278
43283
  "../../packages/serve/src/preview-assets.generated.ts"() {
43279
43284
  init_preview_assets_format();
43280
43285
  PREVIEW_ASSET_MANIFEST = [
43281
- { key: "assets/index-D1ZgNUMR.js", contentType: "application/javascript; charset=utf-8", offset: 8, length: 983079, sha256: "2ccd3ce0303a1f4ade606b38e144243d87217dc439e4738417556224e314b8a5" },
43282
- { key: "fonts/WixMadeforDisplay-Bold.ttf", contentType: "font/ttf", offset: 983087, length: 90924, sha256: "ec4c7d63772d980d6e147b2df6215fd2737e4b04cebe0cf7e11dc695fb63cdcf" },
43283
- { key: "fonts/WixMadeforDisplay-ExtraBold.ttf", contentType: "font/ttf", offset: 1074011, length: 90984, sha256: "bf4c16a2774edd38a921edf3099469866cd74c094fd596f3fa4e81f54a04dfaa" },
43284
- { key: "fonts/WixMadeforDisplay-Medium.ttf", contentType: "font/ttf", offset: 1164995, length: 90980, sha256: "368faca44fb9f7207e4af784e94750b1ee59c1098b8689e0f4a918926f244fb5" },
43285
- { key: "fonts/WixMadeforDisplay-Regular.ttf", contentType: "font/ttf", offset: 1255975, length: 90872, sha256: "97ed8f1a6772abe26e3d8af5cecfc4b02faa94497d585b0398b5053b739a70c1" },
43286
- { key: "fonts/WixMadeforDisplay-SemiBold.ttf", contentType: "font/ttf", offset: 1346847, length: 90980, sha256: "642feab8a48ddf6c7a89d7c2a7c0edfa0e6e773f671287e460e222703563191e" },
43287
- { key: "fonts/WixMadeforText-Bold.ttf", contentType: "font/ttf", offset: 1437827, length: 108636, sha256: "37c179b4fefb63ea9637322b84583a2df53aa226c150294eea1675c14b1b8e29" },
43288
- { key: "fonts/WixMadeforText-ExtraBold.ttf", contentType: "font/ttf", offset: 1546463, length: 109084, sha256: "62e2fe4718129f36ecdb0ae4de385bd6b81ecc876146447167c6c140fad699a9" },
43289
- { key: "fonts/WixMadeforText-Medium.ttf", contentType: "font/ttf", offset: 1655547, length: 109048, sha256: "4ecf270136af928612c76fe4ebade91d8156975e5ea4c0cf9225501dd1788e02" },
43290
- { key: "fonts/WixMadeforText-Regular.ttf", contentType: "font/ttf", offset: 1764595, length: 107700, sha256: "dee56f09fd3efc127c1ea95557edc74110c1460a46287da36e0af25efd341ef5" },
43291
- { key: "fonts/WixMadeforText-SemiBold.ttf", contentType: "font/ttf", offset: 1872295, length: 88108, sha256: "dced97a77624bc5f8b1ae65850360908297f4588e09feb6f22792d29dc7e765b" },
43292
- { key: "index.html", contentType: "text/html; charset=utf-8", offset: 1960403, length: 4448, sha256: "8f2222f638f46d9c9a5e57fc9cc5a30a76cee7f91923120aac299292c0f1f604" },
43293
- { key: "t5-frame.html", contentType: "text/html; charset=utf-8", offset: 1964851, length: 13784, sha256: "cfb9465254fab84f0e084bb4542c282758ea29774b5f172840cc0b9e4194ef89" }
43286
+ { key: "assets/index-C40lmxo4.js", contentType: "application/javascript; charset=utf-8", offset: 8, length: 983092, sha256: "919193db2182eb6a481f3729dda29af2441d6c46027c7fab508c2abb78f8fc0f" },
43287
+ { key: "fonts/WixMadeforDisplay-Bold.ttf", contentType: "font/ttf", offset: 983100, length: 90924, sha256: "ec4c7d63772d980d6e147b2df6215fd2737e4b04cebe0cf7e11dc695fb63cdcf" },
43288
+ { key: "fonts/WixMadeforDisplay-ExtraBold.ttf", contentType: "font/ttf", offset: 1074024, length: 90984, sha256: "bf4c16a2774edd38a921edf3099469866cd74c094fd596f3fa4e81f54a04dfaa" },
43289
+ { key: "fonts/WixMadeforDisplay-Medium.ttf", contentType: "font/ttf", offset: 1165008, length: 90980, sha256: "368faca44fb9f7207e4af784e94750b1ee59c1098b8689e0f4a918926f244fb5" },
43290
+ { key: "fonts/WixMadeforDisplay-Regular.ttf", contentType: "font/ttf", offset: 1255988, length: 90872, sha256: "97ed8f1a6772abe26e3d8af5cecfc4b02faa94497d585b0398b5053b739a70c1" },
43291
+ { key: "fonts/WixMadeforDisplay-SemiBold.ttf", contentType: "font/ttf", offset: 1346860, length: 90980, sha256: "642feab8a48ddf6c7a89d7c2a7c0edfa0e6e773f671287e460e222703563191e" },
43292
+ { key: "fonts/WixMadeforText-Bold.ttf", contentType: "font/ttf", offset: 1437840, length: 108636, sha256: "37c179b4fefb63ea9637322b84583a2df53aa226c150294eea1675c14b1b8e29" },
43293
+ { key: "fonts/WixMadeforText-ExtraBold.ttf", contentType: "font/ttf", offset: 1546476, length: 109084, sha256: "62e2fe4718129f36ecdb0ae4de385bd6b81ecc876146447167c6c140fad699a9" },
43294
+ { key: "fonts/WixMadeforText-Medium.ttf", contentType: "font/ttf", offset: 1655560, length: 109048, sha256: "4ecf270136af928612c76fe4ebade91d8156975e5ea4c0cf9225501dd1788e02" },
43295
+ { key: "fonts/WixMadeforText-Regular.ttf", contentType: "font/ttf", offset: 1764608, length: 107700, sha256: "dee56f09fd3efc127c1ea95557edc74110c1460a46287da36e0af25efd341ef5" },
43296
+ { key: "fonts/WixMadeforText-SemiBold.ttf", contentType: "font/ttf", offset: 1872308, length: 88108, sha256: "dced97a77624bc5f8b1ae65850360908297f4588e09feb6f22792d29dc7e765b" },
43297
+ { key: "index.html", contentType: "text/html; charset=utf-8", offset: 1960416, length: 4448, sha256: "4cff52eaf77b0c3c09effb2dd0447d78d2b03ecaa68893281b1637510b93d8ad" },
43298
+ { key: "t5-frame.html", contentType: "text/html; charset=utf-8", offset: 1964864, length: 13784, sha256: "cfb9465254fab84f0e084bb4542c282758ea29774b5f172840cc0b9e4194ef89" }
43294
43299
  ];
43295
43300
  }
43296
43301
  });
Binary file