@wix/himalaya-cli 0.1413.0 → 0.1415.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/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk-auto/_shared/runtime.generated.d.ts +31 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-comments.mjs +8 -2
- package/dist/cli.mjs +2 -0
- package/guides/wix-api-usage.md +9 -0
- package/package.json +2 -2
|
@@ -3,6 +3,32 @@
|
|
|
3
3
|
export interface WixCallOptions {
|
|
4
4
|
site?: string;
|
|
5
5
|
}
|
|
6
|
+
/** The endpoint answered: `value` is what the call returns without `{ offline: "queue" }`. */
|
|
7
|
+
export interface WixSent<T> {
|
|
8
|
+
status: "sent";
|
|
9
|
+
value: T;
|
|
10
|
+
}
|
|
11
|
+
/** The write waits in the device's offline outbox (RFC 0072); `writeId` names it in
|
|
12
|
+
* `wixApi.offline` events. Show it as pending until `applied` or `rejected`. */
|
|
13
|
+
export interface WixQueued {
|
|
14
|
+
status: "queued";
|
|
15
|
+
writeId: string;
|
|
16
|
+
tag: string;
|
|
17
|
+
}
|
|
18
|
+
export type WixOfflineResult<T> = WixSent<T> | WixQueued;
|
|
19
|
+
/** Per-call options of a write the runtime may queue offline. `offline: "queue"` opts this ONE
|
|
20
|
+
* call into the outbox, and the answer becomes a `WixOfflineResult<T>`. It queues only if
|
|
21
|
+
* the app also declares a `queueOffline` cache rule for the endpoint (and, on web, the
|
|
22
|
+
* endpoint's dedupe allows it); otherwise it is sent live as usual, and refused offline
|
|
23
|
+
* (`err.code === "offline_write_blocked"`). */
|
|
24
|
+
export interface WixQueueCallOptions extends WixCallOptions {
|
|
25
|
+
offline?: "queue";
|
|
26
|
+
}
|
|
27
|
+
/** What a queueable write answers for options `O`: the envelope when `O` opts in, the plain
|
|
28
|
+
* response when it cannot, either when that is only known at runtime. */
|
|
29
|
+
export type WixQueueAnswer<O, T> = O extends {
|
|
30
|
+
offline: "queue";
|
|
31
|
+
} ? WixOfflineResult<T> : "offline" extends keyof O ? (O[keyof O & "offline"] extends undefined ? T : T | WixOfflineResult<T>) : T;
|
|
6
32
|
/** How a request reaches the wire: the request field behind each `{…}` in the path, in
|
|
7
33
|
* order, and whether the request travels in the query string (GET/DELETE) or the body. */
|
|
8
34
|
export interface WixRoute {
|
|
@@ -25,3 +51,8 @@ export interface WixRoute {
|
|
|
25
51
|
* Exported so the hand-written ./extensions sidecar can build the same URLs. */
|
|
26
52
|
export declare function wixQueryPath(path: string, req: unknown): string;
|
|
27
53
|
export declare function wixCall<T>(verb: string, template: string, req: unknown, opts?: WixCallOptions, route?: WixRoute): Promise<T>;
|
|
54
|
+
/** `wixCall` for a write on the runtime's offline allow-table (RFC 0072). With
|
|
55
|
+
* `opts.offline === "queue"` the opt-in rides as the bridge's 5th argument and the answer is
|
|
56
|
+
* the runtime's envelope; a runtime without offline writes (no `wixApi.offline`) sends the
|
|
57
|
+
* call live, reported as `sent`. Without it, exactly `wixCall`. */
|
|
58
|
+
export declare function wixQueueCall<T, O extends WixQueueCallOptions>(verb: string, template: string, req: unknown, opts?: O, route?: WixRoute): Promise<WixQueueAnswer<O, T>>;
|
|
@@ -466,6 +466,9 @@ function withoutFields(req, fields) {
|
|
|
466
466
|
return out;
|
|
467
467
|
}
|
|
468
468
|
function wixCall2(verb, template, req, opts, route = {}) {
|
|
469
|
+
return send(verb, template, req, opts, route, false);
|
|
470
|
+
}
|
|
471
|
+
function send(verb, template, req, opts, route, queue) {
|
|
469
472
|
const api = globalThis.himalaya?.wixApi;
|
|
470
473
|
if (!api) return Promise.reject(new Error("@himalaya/wix-*: host did not install the wixApi bridge"));
|
|
471
474
|
const fields = route.pathFields ?? [];
|
|
@@ -485,8 +488,11 @@ function wixCall2(verb, template, req, opts, route = {}) {
|
|
|
485
488
|
}
|
|
486
489
|
const site = opts?.site?.trim();
|
|
487
490
|
const headers = site ? { "wix-site-id": site } : void 0;
|
|
488
|
-
|
|
489
|
-
|
|
491
|
+
const target = route.query ? wixQueryPath2(path, withoutFields(req, fields)) : path;
|
|
492
|
+
const body = route.query ? void 0 : req;
|
|
493
|
+
if (!queue) return api.call(verb, target, body, headers);
|
|
494
|
+
if (!api.offline) return api.call(verb, target, body, headers).then((value) => ({ status: "sent", value }));
|
|
495
|
+
return api.call(verb, target, body, headers, { offline: "queue" });
|
|
490
496
|
}
|
|
491
497
|
|
|
492
498
|
// ../../stdlib/wix-sdk-auto/comments/categories.generated.ts
|
package/dist/cli.mjs
CHANGED
|
@@ -7659,6 +7659,7 @@ function buttonVariant(style) {
|
|
|
7659
7659
|
var SYSTEM_FONT_FAMILY, TONAL_ELEVATION_ALPHA, BUTTON_MIN_HIT_TARGET, nonNegative, nonEmpty, own, COLOR_TOKEN_PROPS, TYPOGRAPHY_TOKEN_PROPS, BUTTON_VARIANTS;
|
|
7660
7660
|
var init_tokens = __esm({
|
|
7661
7661
|
"../../core/ts/src/tokens.ts"() {
|
|
7662
|
+
"use strict";
|
|
7662
7663
|
SYSTEM_FONT_FAMILY = "$system";
|
|
7663
7664
|
TONAL_ELEVATION_ALPHA = [0, 0.05, 0.08, 0.11, 0.12, 0.14];
|
|
7664
7665
|
BUTTON_MIN_HIT_TARGET = 44;
|
|
@@ -7714,6 +7715,7 @@ function resolveTranslation(value, catalog3, sourceCatalog) {
|
|
|
7714
7715
|
var BINDING_SIGILS, BINDING_SIGIL_RE, TRANSLATION_PREFIX, TRANSLATION_KEY_RE;
|
|
7715
7716
|
var init_bindings = __esm({
|
|
7716
7717
|
"../../core/ts/src/bindings.ts"() {
|
|
7718
|
+
"use strict";
|
|
7717
7719
|
BINDING_SIGILS = ["service", "flag", "item", "t"];
|
|
7718
7720
|
BINDING_SIGIL_RE = new RegExp(
|
|
7719
7721
|
`^\\$(?:${BINDING_SIGILS.filter((s2) => s2 !== "t").join("|")})\\b|^\\$t:`
|
package/guides/wix-api-usage.md
CHANGED
|
@@ -255,6 +255,15 @@ when BOTH keys turn:
|
|
|
255
255
|
|
|
256
256
|
(`himalaya.wixApi.call(method, path, body, headers, { offline: "queue" })` is the raw form.)
|
|
257
257
|
|
|
258
|
+
A generated `@himalaya/wix-*` method takes the same option where the endpoint can queue:
|
|
259
|
+
`createRsvp(req, { offline: "queue" })` answers `WixOfflineResult<WixCreateRsvpResponse>`
|
|
260
|
+
(`sent` / `queued`, as above), and `createRsvp(req)` still answers the plain response. The
|
|
261
|
+
option (`WixQueueCallOptions`, alongside `site`) is typed only on a write whose verb and path
|
|
262
|
+
the platform lists as safe to resend, so a read or any other write rejects it at compile time.
|
|
263
|
+
Today that is `events-v2`'s `createRsvp`; the Wix Data save/insert and the cart add are
|
|
264
|
+
hand-written and take `offline.call` above. An RSVP has no server-side dedupe, so on web it
|
|
265
|
+
never queues: offline it is refused with `offline_write_blocked`.
|
|
266
|
+
|
|
258
267
|
What a worker gets back:
|
|
259
268
|
|
|
260
269
|
- `sent` — online and nothing of the same `tag` waiting: the endpoint's own answer.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/himalaya-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1415.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": "
|
|
74
|
+
"falconPackageHash": "1c990236c511b70b0b5fa3ae85a7c68fd66d800cf0480250dd0acbcb"
|
|
75
75
|
}
|