@wix/himalaya-cli 0.1406.0 → 0.1407.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.
Binary file
@@ -5234,6 +5234,12 @@
5234
5234
  "kind": "const",
5235
5235
  "jsdoc": "/** Capability version, for bundles that gate on min binary version. */",
5236
5236
  "decl": "export const version = 2;"
5237
+ },
5238
+ {
5239
+ "name": "\"./offline.js\"",
5240
+ "kind": "reexport",
5241
+ "jsdoc": "",
5242
+ "decl": "export {\n offline, isOfflineWriteBlocked, isOfflineWriteOutcomeUnknown,\n type Sent, type Queued, type OfflineResult, type OfflineEvent, type OfflineEventType, type PendingWrite, type RejectedWrite,\n} from \"./offline.js\";"
5237
5243
  }
5238
5244
  ]
5239
5245
  },
@@ -222,6 +222,55 @@ hosts will require. (Contrast: the cross-cutting facade `@himalaya/wix-platform`
222
222
  provisioned — decide per call whether to surface, fall back, or render an empty state (don't crash the worker).
223
223
  Produce complete results synchronously in the action (the ambient tick is unreliable — see the Tier-5 notes).
224
224
 
225
+ ## Offline writes — `{ offline: "queue" }`
226
+
227
+ A write a member makes offline can wait in an on-device outbox and go out on reconnect, but only
228
+ when BOTH keys turn:
229
+
230
+ 1. **The app's cache rule opts the endpoint in**, naming it exactly, with a `method` and a `tag`:
231
+
232
+ ```ts
233
+ cache: { rules: [
234
+ { method: "POST", pathPrefix: "/form-submission-service/v4/submissions", cacheable: false, ttl: 0,
235
+ tag: "forms", queueOffline: true },
236
+ ] }
237
+ ```
238
+
239
+ The platform queues it only if the endpoint is one it lists as safe to resend (each verified
240
+ live for how a repeated request is deduplicated), and never for payments, checkout, orders,
241
+ auth, gift cards, loyalty or bookings. It decides the dedupe mechanism and a max age (7 days,
242
+ 24 hours for personal data). App validation reports a rule that asks but cannot queue, and why.
243
+
244
+ 2. **The call site asks**, so a worker that never heard of this keeps today's behaviour:
245
+
246
+ ```ts
247
+ import { offline, isOfflineWriteOutcomeUnknown } from "@himalaya/wix-platform";
248
+
249
+ const r = await offline.call("POST", "/form-submission-service/v4/submissions", body);
250
+ if (r.status === "queued") markPending(r.writeId); // show the row as "Pending"
251
+ else render(r.value); // r.status === "sent"
252
+ offline.on("applied", (e) => clearPending(e.writeId));
253
+ offline.on("rejected", (e) => showFailed(e.writeId, e.code));
254
+ ```
255
+
256
+ (`himalaya.wixApi.call(method, path, body, headers, { offline: "queue" })` is the raw form.)
257
+
258
+ What a worker gets back:
259
+
260
+ - `sent` — online and nothing of the same `tag` waiting: the endpoint's own answer.
261
+ - `queued` — offline, or behind an earlier write of the same `tag`, or the live attempt failed in a
262
+ way the outbox will retry. Never resubmit it: that would be a real duplicate.
263
+ - a thrown response error — a definite rejection (a 4xx), exactly as without the option.
264
+ - `err.code === "offline_write_outcome_unknown"` — an endpoint with no server-side dedupe whose
265
+ attempt may or may not have landed. Say "we couldn't confirm this went through".
266
+ - `err.code === "offline_write_blocked"` — offline and the write may not queue (`err.reason`:
267
+ `not_queueable`, `no_outbox` for a visitor or a host with no member, `queue_full`).
268
+
269
+ Only a signed-in member has an outbox; it is dropped on sign-out, account switch and
270
+ `AppContext.forget`. `offline.pending()` lists what waits (no bodies), `offline.rejected()` what was
271
+ refused (with its body until the write's max age), `offline.dismiss(writeId)` clears one. The shell
272
+ banner shows "Offline · Pending sync (n)" and "Syncing (n)…" for the app on screen.
273
+
225
274
  ## Visitor vs owner scope — a data-surface cheat-sheet
226
275
 
227
276
  The currency trap below is just the sharpest edge of one rule: a **visitor / consumer** session reads site
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/himalaya-cli",
3
- "version": "0.1406.0",
3
+ "version": "0.1407.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": "964966afc4bcb743188c9fdf21d84de92fb1d9a392e0a48b0644a39a"
74
+ "falconPackageHash": "b802acb38e0b8d9b19d1d1d61a60d51aff08fee456a640e590e83157"
75
75
  }