@wix/himalaya-cli 0.1535.0 → 0.1537.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 (30) hide show
  1. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/bookings-v2/src/extensions.d.ts +16 -0
  2. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/data-collections-v1/src/extensions.d.ts +4 -0
  3. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/wix-data/src/index.d.ts +497 -4
  4. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-bookings.mjs +5 -0
  5. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-data-collections.mjs +1 -5
  6. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-data.mjs +315 -7
  7. package/dist/cli.mjs +805 -533
  8. package/dist/preview-assets.generated.bin +0 -0
  9. package/fixtures/wix-canned.json +1 -0
  10. package/guides/cms-collections.md +31 -0
  11. package/guides/himi-json-output.md +9 -0
  12. package/guides/release-notes.md +12 -0
  13. package/guides/wix-api-usage.md +53 -6
  14. package/package.json +2 -2
  15. package/templates/beauty-salon/dev/index.ts +1109 -2310
  16. package/templates/beauty-salon/tier5-src/_shared/himi-bookings.ts +121 -1
  17. package/templates/beauty-salon/tier5-src/himi-booking-service/index.ts +9 -55
  18. package/templates/beauty-salon/tier5-src/himi-booking-services/index.ts +264 -18
  19. package/templates/branded-lite/dev/index.ts +1075 -2276
  20. package/templates/branded-lite/tier5-src/_shared/himi-bookings.ts +121 -1
  21. package/templates/branded-lite/tier5-src/himi-booking-service/index.ts +9 -55
  22. package/templates/branded-lite/tier5-src/himi-booking-services/index.ts +264 -18
  23. package/templates/gym-fitness/dev/index.ts +1075 -2276
  24. package/templates/gym-fitness/tier5-src/_shared/himi-bookings.ts +121 -1
  25. package/templates/gym-fitness/tier5-src/himi-booking-service/index.ts +9 -55
  26. package/templates/gym-fitness/tier5-src/himi-booking-services/index.ts +264 -18
  27. package/templates/yoga-studio/dev/index.ts +1137 -2338
  28. package/templates/yoga-studio/tier5-src/_shared/himi-bookings.ts +121 -1
  29. package/templates/yoga-studio/tier5-src/himi-booking-service/index.ts +9 -55
  30. package/templates/yoga-studio/tier5-src/himi-booking-services/index.ts +264 -18
Binary file
@@ -222,6 +222,7 @@
222
222
  "total": 2
223
223
  }
224
224
  },
225
+ "POST /bookings/v2/services/categories/query": { "categories": [] },
225
226
  "POST /bookings/v2/services/query": {
226
227
  "services": [
227
228
  {
@@ -266,6 +266,12 @@ operation alone:
266
266
  { readRole: "ANYONE", writeRole: "ADMIN", insertRole: "ANYONE" }
267
267
  ```
268
268
 
269
+ Wix stores the `ADMIN` role as `CMS_EDITOR`: reading a collection's permissions back (the
270
+ `/wix-data/v1/permissions` endpoint, `getPermissions`) shows `CMS_EDITOR`, and writing them with
271
+ `updatePermissions` accepts `CMS_EDITOR`, not `ADMIN`. Sending `ADMIN` there fails with a misleading
272
+ `dataPermissions is invalid: itemUpdate value is required`. Creating a collection, which is what
273
+ `himi cms create` does, still takes `ADMIN`.
274
+
269
275
  `ANYONE` is accepted on `insertRole`/`updateRole` and refused on `removeRole` and on the
270
276
  `writeRole` blanket. The asymmetry is the point: an unwanted row can be removed, a removed
271
277
  row cannot be brought back. Reach for this when the app writes as the identity it actually
@@ -386,6 +392,16 @@ seed` must not bury that under sample data again.
386
392
 
387
393
  `--only <id>` scopes to one collection; `--dry-run` reports without writing.
388
394
 
395
+ Rows go to the site in batches of 100, one request each, in the order they appear in the
396
+ seed array. Wix answers a batch with HTTP 200 whatever happened to the rows, so the report
397
+ is built from each row's own result: `inserted` counts only the rows Wix confirmed, and a
398
+ row it refused appears under `failed` with its position in the seed array, its error code
399
+ and its reason, and the run exits 1 with `code: "seed_rows_failed"`. A request that fails
400
+ outright is not retried — an insert has no idempotency key, so a retry could duplicate rows
401
+ that already landed. It stops that collection and exits 1 with what landed under `partial`;
402
+ rows marked `unconfirmed` may or may not exist, so run `himi cms query` before seeding
403
+ again.
404
+
389
405
  ### `himi cms seed --ai` — generate rows to review
390
406
 
391
407
  Writes a full row set with the correct JSON type per field into a sidecar
@@ -439,6 +455,21 @@ const rows = (res.dataItems ?? []).map((item) => ({
439
455
  Do not bind `_createdDate` directly to `Text`: an object crosses the worker
440
456
  boundary as structured data and otherwise paints as `[object Object]`.
441
457
 
458
+ `@himalaya/wix-data` covers more than a query: patch, save, count, bulk writes,
459
+ aggregation, distinct values, search and references (the full list is in
460
+ `himi docs wix-api-usage`). Three rules matter when your collection is one you
461
+ own:
462
+
463
+ - **Change fields with `patchDataItem`, not `updateDataItem`.** An update replaces the
464
+ whole item, so a call that sends two fields deletes the rest — including the field
465
+ you look the row up by.
466
+ - **Write a long list with a bulk call, and check the result.** One bulk call is one
467
+ write against the site's per-minute quota, but it answers `200` even when some
468
+ items failed; `bulkFailures(res)` lists them.
469
+ - **Do not write a multi-reference field through insert, save or update.** Wix
470
+ accepts the call and stores nothing. This is also why `himi cms` does not declare
471
+ reference fields yet.
472
+
442
473
  **Bake the collection ids in as a screen `input` and read them back**, so the worker holds
443
474
  no hardcoded ids and `config.ts` stays the single source of truth:
444
475
 
@@ -80,6 +80,15 @@ The `ux_evidence_*` codes map to the existing typed `uxEvidence.state`; a succes
80
80
  `recorded` state has no refusal code. Successful pushes and warnings do not gain
81
81
  failure codes. A forced push still follows the existing override rules.
82
82
 
83
+ ## `himi cms seed` codes
84
+
85
+ | Code | Meaning |
86
+ |---|---|
87
+ | `seed_rows_failed` | At least one seed row did not land. Wix answers a bulk insert with HTTP 200 whatever happened to the rows, so the report lists each failure under `failed`: `collection`, `rows` (zero-based positions in the seed array), `outcome` (`rejected`: Wix refused them; `unconfirmed`: they may or may not exist; `not-sent`: never attempted), Wix's `code` when it gave one, and a `reason`. `inserted` counts only confirmed rows. Exit 1. |
88
+ | `seed_request_failed` | A bulk-insert request failed outright (a refused request, a server error, a timeout or a dropped connection), so the run stopped. Printed on stderr with `ok: false` beside the legacy `error`, `app`, `site` and `hint` fields; `partial` carries the report so far, with the same `failed` list (that batch as `rejected` or `unconfirmed`, the collection's later rows as `not-sent`) and `code: "seed_request_failed"` too, even when an earlier batch had rows refused. Collections after the failing one were not attempted. Exit 1. |
89
+
90
+ This is not a whole-command migration: the command's other refusals still have no code.
91
+
83
92
  ## `himi store iap status` codes
84
93
 
85
94
  Status adds these stable codes to incomplete JSON results. Existing result fields and exit
@@ -14,6 +14,18 @@ areas, always in the same order, so you can skim for the one you care about.
14
14
 
15
15
  ---
16
16
 
17
+ ## 2026-11-02
18
+
19
+ ### Validate & test
20
+
21
+ - **`himi validate` now judges `textPrimary` on card surfaces.** Body text was judged only against
22
+ the page (`surfacePrimary`), so a navy page with white cards and white text validated clean while
23
+ every card title rendered white on white. `textPrimary` is now also judged against
24
+ `surfaceSecondary` and `surfaceElevated`: below 1.5:1 the text is invisible and validate fails
25
+ with an error (also for `textPrimary` on the page); below WCAG AA 4.5:1 it is a warning. The
26
+ finding says when the page and the card sit on opposite sides of mid-grey, so no single text
27
+ colour can serve both. (#4999)
28
+
17
29
  ## 2026-11-01
18
30
 
19
31
  ### Getting started & the CLI
@@ -197,8 +197,9 @@ surface. Lead with it: it builds the request, calls the bridge, and decodes the
197
197
  ```ts
198
198
  import { queryDataItems, insertDataItem, updateDataItem, removeDataItem } from "@himalaya/wix-data";
199
199
 
200
- // queryDataItems(collectionId, limit = 50, filter?, returnTotalCount = false, offset = 0, sort?)
200
+ // queryDataItems(collectionId, limit = 50, filter?, returnTotalCount = false, offset = 0, sort?, options?)
201
201
  // → { dataItems?, items?, pagingMetadata? }
202
+ // `options` (all optional): { consistentRead, cursorPaging, fields, includeReferences, language, includeDraftItems }
202
203
  const res = await queryDataItems("MyCollection", 50);
203
204
  const rows = (res.dataItems ?? res.items ?? []).map((it) => it.data); // parsed objects, not bytes
204
205
 
@@ -206,12 +207,58 @@ const rows = (res.dataItems ?? res.items ?? []).map((it) => it.data); // parse
206
207
  const newest = await queryDataItems("Jobs", 1, undefined, false, 0, [{ fieldName: "postedDate", order: "DESC" }]);
207
208
  ```
208
209
 
209
- The full items CRUD is typed: `insertDataItem(collectionId, data)` (POST `/wix-data/v2/items`),
210
- `updateDataItem(collectionId, id, data)` (PUT), and `removeDataItem(collectionId, id)` (DELETE). This is
211
- **Wix CMS / Data (data *items*)** — distinct from the Catalog **`data-collections-v1` schema** API
212
- (`@himalaya/wix-data-collections`), which describes a collection's *shape*, not its rows; don't conflate them.
210
+ The client covers the whole everyday items surface. This is **Wix CMS / Data (data *items*)** — distinct from the
211
+ Catalog **`data-collections-v1` schema** API (`@himalaya/wix-data-collections`), which describes a collection's
212
+ *shape*, not its rows; don't conflate them.
213
213
 
214
- Only reach for the raw transport for a `wix-data` endpoint the client doesn't cover yet:
214
+ | You want to… | Call | Mind |
215
+ |---|---|---|
216
+ | Read one row | `getDataItem(collectionId, id)` | not a page plus `.find()` |
217
+ | Create a row | `insertDataItem(collectionId, data, { id? })` | create-only: a repeated `id` is a 409, not an overwrite |
218
+ | Insert or replace by id | `saveDataItem(collectionId, data, { id? })` | safe to retry only with an explicit `id` (without one Wix mints a new id, so a retry adds a second row); replaces the whole item |
219
+ | Change some fields | `patchDataItem(collectionId, id, [setField("title", "New"), incrementField("views")])` | prefer this to `updateDataItem`; increments are atomic |
220
+ | Replace a whole item | `updateDataItem(collectionId, id, data)` | **deletes every field you leave out** |
221
+ | Delete a row | `removeDataItem(collectionId, id)` | irreversible |
222
+ | Count rows | `countDataItems(collectionId, filter?)` | one read, no rows transferred |
223
+ | Write many rows | `bulkInsertDataItems`, `bulkSaveDataItems`, `bulkUpdateDataItems`, `bulkPatchDataItems`, `bulkRemoveDataItems` | up to 1000 per call (100 for patch); one write against the site quota |
224
+ | Group, sum, average | `aggregateDataItemsPipeline(collectionId, { stages })` | not for Wix app collections |
225
+ | List the values in use | `queryDistinctValues(collectionId, fieldName, { filter? })` | for filter chips and pickers |
226
+ | Search text | `searchDataItems(collectionId, "terms", { fuzzy? })` | always eventually consistent; offset `paging` only (Wix refuses cursor paging on search); a collection whose search is not enabled answers `428 WDE0190` |
227
+ | Follow relations | `queryReferencedDataItems`, `isReferencedDataItem`; write with `insertDataItemReferences`, `removeDataItemReferences`, `replaceDataItemReferences` | read back with `includeReferences` |
228
+
229
+ These catch people out:
230
+
231
+ - **A bulk call answers `200` even when items failed.** Check `bulkFailures(res)` (or
232
+ `res.bulkActionMetadata.totalFailures`) and match each failure to your input with
233
+ `itemMetadata.originalIndex`. A failed entry looks like
234
+ `{ itemMetadata: { id, originalIndex: 1, success: false, error: { code: "WDE0074", description } } }`
235
+ (`WDE0074`: the id already exists; `WDE0073`: no such item to remove). A **permission** refusal
236
+ (`WDE0027`) comes back both ways: a bulk insert, update or patch the caller may not make still answers
237
+ `200` with every item failed, while a bulk remove the caller may not make is a `403` for the whole
238
+ request, like a single-item write. Handle both.
239
+ - **Cursor paging: pass the same arguments for every page.** The cursor carries the first page's query, and Wix
240
+ refuses most of it beside a cursor (`400 WDE0080`): the filter, sort and `returnTotalCount` of a query, the field name
241
+ of distinct values, the referring item of a referenced-items read, the stages of an aggregation. The client drops
242
+ those on a page that carries a cursor.
243
+ - **A read right after your own write can miss it.** Reads come from the nearest mirror; pass
244
+ `{ consistentRead: true }` in the query options when you need to see what you just wrote.
245
+ - **Multi-reference values are silently dropped** when written through insert, save, update or any bulk write — Wix
246
+ answers `200` and stores nothing. Write links with the reference calls (or `setField` with an array of ids), and read
247
+ back with `includeReferences` to confirm. A multi-reference field is absent from query results unless you name it
248
+ in `includeReferences`, which takes objects, `{ includeReferences: [{ field: "authors" }] }`; a plain string array
249
+ is a `400 Expected an object`.
250
+ - **Offline and caching treat some of these reads as writes.** On iOS, Android and the web host, the offline
251
+ guard counts a `POST` as a read only when its path ends in `query`, `count`, `list`, `search`, `get` or `read`. So
252
+ `aggregateDataItemsPipeline`, `queryDistinctValues`, `queryReferencedDataItems` and `isReferencedDataItem` are
253
+ refused offline like writes rather than answered from cache. And in an app whose cache policy tags
254
+ `/wix-data/v2/items`, any non-cacheable `POST` under that prefix, `countDataItems` and `searchDataItems` included,
255
+ purges that family's cached queries. Until those layers learn these endpoints, keep such reads off a hot path.
256
+ - **Dates in filters:** compare a system date such as `_createdDate` as `{ $date: "…" }`. Wix's reference says a plain
257
+ ISO string is accepted, but in testing against a live site a bare string on a system date field matched nothing and
258
+ still answered `200` with no rows, so wrap it.
259
+
260
+ Not wrapped: the draft/publish lifecycle, filter-driven async patch and remove, `truncate`, and the single-reference
261
+ calls (use the bulk reference calls with one entry). For those, use the raw transport:
215
262
 
216
263
  ```ts
217
264
  // un-codegen'd fallback ONLY — prefer the typed queryDataItems above:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/himalaya-cli",
3
- "version": "0.1535.0",
3
+ "version": "0.1537.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": "395faacedd989d9d5e0abe28f52bc208bcccc0f5f23ab9fd2aaa81b2"
74
+ "falconPackageHash": "d6ee8032d51eaeb8dc274ee3f30d37f7461aff9849c18acd863e9fd6"
75
75
  }