@wix/himalaya-cli 0.1250.0 → 0.1252.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/core/dev-server/src/wix-member-login.d.ts +6 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/state/src/index.d.ts +2 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/serve-runtime/src/wix-bridge.d.ts +144 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/serve-storage/src/sha256.d.ts +13 -0
- package/dist/cli.mjs +554 -284
- package/dist/preview-assets.generated.bin +0 -0
- package/guides/sdk-reference.json +1 -1
- package/package.json +2 -2
- package/templates/beauty-salon-owner/dev/index.ts +668 -87
- package/templates/beauty-salon-owner/tier5-src/_shared/aria-chat.ts +271 -45
- package/templates/beauty-salon-owner/tier5-src/_shared/aria-widget-model.ts +3 -0
- package/templates/beauty-salon-owner/tier5-src/_shared/aria-widget-view.ts +333 -18
- package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-aria/index.ts +7 -0
- package/templates/community-club-owner/dev/index.ts +668 -87
- package/templates/community-club-owner/tier5-src/_shared/aria-chat.ts +271 -45
- package/templates/community-club-owner/tier5-src/_shared/aria-widget-model.ts +3 -0
- package/templates/community-club-owner/tier5-src/_shared/aria-widget-view.ts +333 -18
- package/templates/community-club-owner/tier5-src/himi-owner-lite-aria/index.ts +7 -0
- package/templates/events-meetups-owner/dev/index.ts +668 -87
- package/templates/events-meetups-owner/tier5-src/_shared/aria-chat.ts +271 -45
- package/templates/events-meetups-owner/tier5-src/_shared/aria-widget-model.ts +3 -0
- package/templates/events-meetups-owner/tier5-src/_shared/aria-widget-view.ts +333 -18
- package/templates/events-meetups-owner/tier5-src/himi-owner-lite-aria/index.ts +7 -0
- package/templates/gym-fitness-owner/dev/index.ts +668 -87
- package/templates/gym-fitness-owner/tier5-src/_shared/aria-chat.ts +271 -45
- package/templates/gym-fitness-owner/tier5-src/_shared/aria-widget-model.ts +3 -0
- package/templates/gym-fitness-owner/tier5-src/_shared/aria-widget-view.ts +333 -18
- package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-aria/index.ts +7 -0
- package/templates/nonprofit-cause-owner/dev/index.ts +668 -87
- package/templates/nonprofit-cause-owner/tier5-src/_shared/aria-chat.ts +271 -45
- package/templates/nonprofit-cause-owner/tier5-src/_shared/aria-widget-model.ts +3 -0
- package/templates/nonprofit-cause-owner/tier5-src/_shared/aria-widget-view.ts +333 -18
- package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-aria/index.ts +7 -0
- package/templates/owner-lite/dev/index.ts +754 -173
- package/templates/owner-lite/tier5-src/_shared/aria-chat.ts +271 -45
- package/templates/owner-lite/tier5-src/_shared/aria-widget-model.ts +3 -0
- package/templates/owner-lite/tier5-src/_shared/aria-widget-view.ts +333 -18
- package/templates/owner-lite/tier5-src/himi-owner-lite-aria/index.ts +7 -0
- package/templates/podcast-creator-owner/dev/index.ts +668 -87
- package/templates/podcast-creator-owner/tier5-src/_shared/aria-chat.ts +271 -45
- package/templates/podcast-creator-owner/tier5-src/_shared/aria-widget-model.ts +3 -0
- package/templates/podcast-creator-owner/tier5-src/_shared/aria-widget-view.ts +333 -18
- package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-aria/index.ts +7 -0
- package/templates/portfolio-creative-owner/dev/index.ts +668 -87
- package/templates/portfolio-creative-owner/tier5-src/_shared/aria-chat.ts +271 -45
- package/templates/portfolio-creative-owner/tier5-src/_shared/aria-widget-model.ts +3 -0
- package/templates/portfolio-creative-owner/tier5-src/_shared/aria-widget-view.ts +333 -18
- package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-aria/index.ts +7 -0
- package/templates/restaurant-owner/dev/index.ts +668 -87
- package/templates/restaurant-owner/tier5-src/_shared/aria-chat.ts +271 -45
- package/templates/restaurant-owner/tier5-src/_shared/aria-widget-model.ts +3 -0
- package/templates/restaurant-owner/tier5-src/_shared/aria-widget-view.ts +333 -18
- package/templates/restaurant-owner/tier5-src/himi-owner-lite-aria/index.ts +7 -0
- package/templates/retail-store-owner/dev/index.ts +668 -87
- package/templates/retail-store-owner/tier5-src/_shared/aria-chat.ts +271 -45
- package/templates/retail-store-owner/tier5-src/_shared/aria-widget-model.ts +3 -0
- package/templates/retail-store-owner/tier5-src/_shared/aria-widget-view.ts +333 -18
- package/templates/retail-store-owner/tier5-src/himi-owner-lite-aria/index.ts +7 -0
- package/templates/yoga-studio-owner/dev/index.ts +668 -87
- package/templates/yoga-studio-owner/tier5-src/_shared/aria-chat.ts +271 -45
- package/templates/yoga-studio-owner/tier5-src/_shared/aria-widget-model.ts +3 -0
- package/templates/yoga-studio-owner/tier5-src/_shared/aria-widget-view.ts +333 -18
- package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-aria/index.ts +7 -0
|
@@ -15,6 +15,12 @@ export declare function webWixCall(method: string, path: string, body: string |
|
|
|
15
15
|
status: number;
|
|
16
16
|
body: string;
|
|
17
17
|
}>;
|
|
18
|
+
/** Open a Wix response without buffering it, for the authorized SSE bridge.
|
|
19
|
+
* Credentials stay server-side and the host lock is identical to webWixCall. */
|
|
20
|
+
export declare function webWixStream(method: string, path: string, body: string | undefined, token: string, cookie?: string, forwardedHeaders?: Record<string, string>, signal?: AbortSignal): Promise<Response>;
|
|
21
|
+
/** Keep the credential-bearing stream bridge on the same narrow endpoint policy as native
|
|
22
|
+
* Wix consumer auth. General member calls have broader Wix-host routing through webWixCall. */
|
|
23
|
+
export { isAllowedConsumerStreamTarget } from "../../serve-runtime/src/wix-bridge.js";
|
|
18
24
|
/** The signed-in member's Wix id, or null when the profile read fails (the identity route then
|
|
19
25
|
* falls back to the login email). The token belongs in `webWixCall`'s TOKEN slot: the identity
|
|
20
26
|
* route used to pass it third, where it became the GET's ignored body, so the read went out as
|
package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/state/src/index.d.ts
CHANGED
|
@@ -38,6 +38,8 @@ export interface StreamDirective {
|
|
|
38
38
|
url: string;
|
|
39
39
|
headers?: Record<string, string>;
|
|
40
40
|
body?: unknown;
|
|
41
|
+
/** Apply the host's Wix authorization to this request before opening the stream. */
|
|
42
|
+
authorize?: boolean;
|
|
41
43
|
};
|
|
42
44
|
/** Reducer action name dispatched once per parsed `data:` event. */
|
|
43
45
|
onEvent: string;
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/** The narrow Wix consumer endpoints allowed to receive credentials for SSE. */
|
|
2
|
+
export declare function isAllowedConsumerStreamTarget(raw: string): boolean;
|
|
3
|
+
/** Classify an absolute-URL rejection: an off-gateway Wix account host is a
|
|
4
|
+
* native-only endpoint (`owner-only`), anything else is an open-proxy attempt. */
|
|
5
|
+
export declare function absoluteUrlRejection(path: string): "owner-only" | "open-proxy";
|
|
6
|
+
/** The bridge envelope the web host's `wixCallOverBridge` expects on a 2xx. */
|
|
7
|
+
export interface WixBridgeEnvelope {
|
|
8
|
+
status: number;
|
|
9
|
+
body: string;
|
|
10
|
+
}
|
|
11
|
+
/** One anonymous visitor token for `clientId`. #3123 Stage B: the proxy no longer serves visitor
|
|
12
|
+
* calls (each browser mints its own, core/web-host/src/wix/directWixCall.ts), so nothing caches
|
|
13
|
+
* one per pod any more — the one server-side use left is the member-login redirect, which needs a
|
|
14
|
+
* visitor token to build Wix's hosted-login URL once per login. */
|
|
15
|
+
export declare function mintAnonymousVisitor(clientId: string, fetchImpl?: typeof fetch): Promise<string>;
|
|
16
|
+
/**
|
|
17
|
+
* Proxy one REST call to wixapis.com with the given token. `path` must be
|
|
18
|
+
* origin-relative — an absolute URL is the caller trying to use the bridge as an
|
|
19
|
+
* open proxy, which the read-only origin must never be (throws).
|
|
20
|
+
*/
|
|
21
|
+
export declare function wixVisitorCall(method: string, path: string, body: string | undefined, token: string, fetchImpl?: typeof fetch, forwardedHeaders?: Record<string, string>): Promise<WixBridgeEnvelope>;
|
|
22
|
+
/**
|
|
23
|
+
* The caller-supplied headers a proxied call may carry to Wix (#3190): the Wix ASPECT headers
|
|
24
|
+
* (locale, currency, consistency, BI, brand, consent, revisions) and the per-call site selector
|
|
25
|
+
* `wix-site-id` — native sends it on every call and the dev-server's per-business net-mock rules key
|
|
26
|
+
* on it. (`ChatToken` is the one destination-bound exception: see `normalizeWixForwardedHeaders`.)
|
|
27
|
+
* An ALLOWLIST, lower-case: anything else is dropped — above all a second credential or an
|
|
28
|
+
* identity header (`x-wix-authorization`, `x-wix-clientid`, `x-xsrf-token`, `wix-account-id`,
|
|
29
|
+
* signed instances), which would otherwise ride along with the rung's own `Authorization` and leave
|
|
30
|
+
* which identity the call runs as to the gateway. Also hop-by-hop and framing headers.
|
|
31
|
+
*
|
|
32
|
+
* The aspect headers are exactly the ones the web host's browser-direct transports forward
|
|
33
|
+
* (`DIRECT_FORWARDABLE_HEADERS`, core/web-host/src/wix/directWixCall.ts — the gateway's CORS answer
|
|
34
|
+
* minus credentials); `BRIDGE_ONLY_FORWARDABLE_HEADERS` is the one addition, and
|
|
35
|
+
* core/web-host/tests/direct-wix-call.test.ts holds the lists together, so a call cannot behave
|
|
36
|
+
* differently depending on which path served it.
|
|
37
|
+
*/
|
|
38
|
+
export declare const WIX_FORWARDABLE_HEADERS: ReadonlySet<string>;
|
|
39
|
+
/** What the bridge forwards beyond the browser-direct transports' aspect headers: the site selector
|
|
40
|
+
* (direct owner calls pick their instance by it instead). */
|
|
41
|
+
export declare const BRIDGE_ONLY_FORWARDABLE_HEADERS: ReadonlySet<string>;
|
|
42
|
+
/** The headers of an untrusted web bridge envelope that may reach Wix (`WIX_FORWARDABLE_HEADERS`, plus
|
|
43
|
+
* `ChatToken` when `path` is chat-web itself), in the caller's spelling. The bridge always owns
|
|
44
|
+
* Authorization, cookies, Host and content framing. */
|
|
45
|
+
export declare function normalizeWixForwardedHeaders(input: unknown, path?: string): Record<string, string>;
|
|
46
|
+
/** Guard the msid before it is interpolated into the mint URL (uuid-ish only). */
|
|
47
|
+
export declare function isSafeMsid(msid: string): boolean;
|
|
48
|
+
/** A `renew` never re-mints an instance younger than this, whichever mint made it (another tab's
|
|
49
|
+
* renewal, a first ask, the envelope's own 401 retry). An instance that new is the fresh one: a 401
|
|
50
|
+
* on it is Wix's answer about the endpoint, not a stale credential, and re-minting would only buy
|
|
51
|
+
* the same answer. It also means the route can't be driven to mint on every request. Once an entry
|
|
52
|
+
* is dropped (`invalidate`, a failed mint) there is nothing to hand back, and a renewal mints once,
|
|
53
|
+
* like any ask.
|
|
54
|
+
* No longer than the web host's `OWNER_RENEW_COOLDOWN_MS` (core/web-host/src/wix/directWixCall.ts,
|
|
55
|
+
* #3140): the host never sends `renew=1` sooner than that after its own re-mint, so each renewal it
|
|
56
|
+
* makes is honoured. A longer window here would hand it back the instance Wix just refused.
|
|
57
|
+
* core/serve/tests/owner-instance.test.ts pins the two together. */
|
|
58
|
+
export declare const OWNER_RENEW_MIN_AGE_MS = 5000;
|
|
59
|
+
type OwnerInstanceEntry = {
|
|
60
|
+
instance: string;
|
|
61
|
+
expiresAt: number;
|
|
62
|
+
};
|
|
63
|
+
export declare class OwnerInstanceCache {
|
|
64
|
+
private fetchImpl;
|
|
65
|
+
/** Signed instances are long-lived, but the SESSION behind them may not be —
|
|
66
|
+
* keep the window short so a logout is honored quickly. */
|
|
67
|
+
private ttlMs;
|
|
68
|
+
private mintTimeoutMs;
|
|
69
|
+
/** A monotonic clock for how long a mint TOOK (injectable for tests). */
|
|
70
|
+
private elapsedClock;
|
|
71
|
+
private cache;
|
|
72
|
+
/** The one mint on its way per (business, session). Every caller, plain or renewing, joins it:
|
|
73
|
+
* it started after whatever is cached was minted, so it is the fresh instance. */
|
|
74
|
+
private inflight;
|
|
75
|
+
constructor(fetchImpl?: typeof fetch,
|
|
76
|
+
/** Signed instances are long-lived, but the SESSION behind them may not be —
|
|
77
|
+
* keep the window short so a logout is honored quickly. */
|
|
78
|
+
ttlMs?: number, mintTimeoutMs?: number,
|
|
79
|
+
/** A monotonic clock for how long a mint TOOK (injectable for tests). */
|
|
80
|
+
elapsedClock?: () => number);
|
|
81
|
+
/** Keyed on the SESSION (`wixSession2`), not the whole cookie header: manage.wix.com's jar churns
|
|
82
|
+
* (analytics, experiments), and keying on all of it re-minted on nearly every call (#3044). A
|
|
83
|
+
* header with no session cookie falls back to itself — callers refuse that case before here. */
|
|
84
|
+
private key;
|
|
85
|
+
instance(msid: string, cookieHeader: string, now?: number): Promise<string>;
|
|
86
|
+
/** The instance and the time this cache stops trusting it (#3044: the web host caches until then).
|
|
87
|
+
* `renew`: Wix refused the instance this cache handed out (the route's `renew=1`, #3140) — mint a
|
|
88
|
+
* new one, unless the cached one is younger than OWNER_RENEW_MIN_AGE_MS or a mint is already on
|
|
89
|
+
* its way, in which case that IS the new one. */
|
|
90
|
+
entry(msid: string, cookieHeader: string, now?: number, opts?: {
|
|
91
|
+
renew?: boolean;
|
|
92
|
+
}): Promise<OwnerInstanceEntry>;
|
|
93
|
+
private mint;
|
|
94
|
+
/** Drop a cached instance so the next call re-mints. The envelope owner branch's own 401 retry;
|
|
95
|
+
* the route's `renew=1` goes through `entry(…, { renew: true })` instead. */
|
|
96
|
+
invalidate(msid: string, cookieHeader: string): void;
|
|
97
|
+
}
|
|
98
|
+
export declare const OWNER_SITES_QUERY_PATH = "/site-list/v2/sites/query";
|
|
99
|
+
export declare const OWNER_SITES_COUNT_PATH = "/site-list/v2/sites/count";
|
|
100
|
+
/** True for the ONLY two paths the account-level owner-sites rung may reach. */
|
|
101
|
+
export declare function isOwnerSitesPath(path: string): boolean;
|
|
102
|
+
/**
|
|
103
|
+
* POST one site-list call to wixapis.com, authorized by the FORWARDED caller
|
|
104
|
+
* cookies (never an Authorization header, never stored). Host-locked AND
|
|
105
|
+
* path-locked: anything but the two owner-sites paths throws.
|
|
106
|
+
*/
|
|
107
|
+
export declare function wixOwnerSitesCall(path: string, cookieHeader: string, body: string | undefined, fetchImpl?: typeof fetch): Promise<WixBridgeEnvelope>;
|
|
108
|
+
/** One trimmed row of `GET /v1/owner/sites` — `id` IS the site's metaSiteId. */
|
|
109
|
+
export interface OwnerSiteRow {
|
|
110
|
+
id: string;
|
|
111
|
+
displayName: string;
|
|
112
|
+
namespace?: string;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* RFC 0050 extension — the trimmed "my sites" listing per session, cached
|
|
116
|
+
* briefly. The cache key is a DIGEST of the cookie header (never the cookies
|
|
117
|
+
* themselves — same posture as OwnerInstanceCache); the limit rides the digest
|
|
118
|
+
* so differently-sized listings don't cross-serve. TTL mirrors OwnerInstanceCache
|
|
119
|
+
* (and wix-cache-policy's ttl:300 for this API): sites are stable, but the
|
|
120
|
+
* SESSION behind the listing may not be — keep the window short so a logout
|
|
121
|
+
* stops listing quickly.
|
|
122
|
+
*/
|
|
123
|
+
export declare class OwnerSitesCache {
|
|
124
|
+
private fetchImpl;
|
|
125
|
+
private ttlMs;
|
|
126
|
+
private cache;
|
|
127
|
+
constructor(fetchImpl?: typeof fetch, ttlMs?: number);
|
|
128
|
+
private key;
|
|
129
|
+
sites(cookieHeader: string, limit: number, now?: number): Promise<OwnerSiteRow[]>;
|
|
130
|
+
/** Drop a cached listing (e.g. after an upstream 401) so the next call re-fetches. */
|
|
131
|
+
invalidate(cookieHeader: string, limit: number): void;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Resolve the Wix OAuth clientId for a published app-config, or a typed refusal.
|
|
135
|
+
* Only `wix-*` auth providers carry a REAL Wix clientId — a generic-oauth app's
|
|
136
|
+
* clientId is some other issuer's, and minting against it would just burn a
|
|
137
|
+
* round-trip to wixapis for a guaranteed failure.
|
|
138
|
+
*/
|
|
139
|
+
export declare function wixClientIdOf(appConfigJson: string): {
|
|
140
|
+
clientId: string;
|
|
141
|
+
} | {
|
|
142
|
+
error: "unsupported_auth" | "no_client_id";
|
|
143
|
+
};
|
|
144
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** SHA-256 of `input`, as 32 bytes. Identical to `createHash("sha256").update(input).digest()`. */
|
|
2
|
+
export declare function sha256(input: string | Uint8Array): Uint8Array;
|
|
3
|
+
/** Lowercase hex of `sha256(input)` — what `createHash("sha256").digest("hex")` produces. */
|
|
4
|
+
export declare function sha256Hex(input: string | Uint8Array): string;
|
|
5
|
+
/**
|
|
6
|
+
* The same hex digest as `sha256Hex`, via the platform's native implementation.
|
|
7
|
+
*
|
|
8
|
+
* Identical output — `sha256-parity.test.ts` proves the two agree with each other and with node —
|
|
9
|
+
* but ~40x faster, because it is not JavaScript. Use it wherever the caller is already async AND
|
|
10
|
+
* the input can be large: a package archive, an asset. It is not a drop-in for the sync one, which
|
|
11
|
+
* is what lets `strongEtag` stay a plain function.
|
|
12
|
+
*/
|
|
13
|
+
export declare function sha256HexAsync(input: string | Uint8Array): Promise<string>;
|