@wix/himalaya-cli 0.1370.0 → 0.1372.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.
|
@@ -141,4 +141,122 @@ export declare function wixClientIdOf(appConfigJson: string): {
|
|
|
141
141
|
} | {
|
|
142
142
|
error: "unsupported_auth" | "no_client_id";
|
|
143
143
|
};
|
|
144
|
+
/** The account-session cookies worth forwarding — `WixNativeAuthProvider.isForwardableWixSessionCookie`
|
|
145
|
+
* (iOS) by name, and the predicate RFC 0071 §3 measured: an instance minted with exactly these works
|
|
146
|
+
* as a plain `Authorization` header, and one minted with a session-BINDING cookie
|
|
147
|
+
* (`server-session-bind`, `bSession`, …) would not. The mint and every forwarded call use this one
|
|
148
|
+
* predicate, so the instance and the call always name the same principal. */
|
|
149
|
+
export declare function isForwardableWixSessionCookie(name: string): boolean;
|
|
150
|
+
/** [cookieHeader] narrowed to the forwardable account-session cookies, or "" when it carries no
|
|
151
|
+
* `wixSession2` (nothing to act as). */
|
|
152
|
+
export declare function forwardableWixSessionCookies(cookieHeader: string | null | undefined): string;
|
|
153
|
+
/** Where an account sign-in starts: Wix's own login (email, Google, Apple, 2FA), back to [postLogin]. */
|
|
154
|
+
export declare function wixAccountSignInUrl(postLogin: string): string;
|
|
155
|
+
/**
|
|
156
|
+
* EVERY endpoint the account session is forwarded to: host, method and exact path, taken from what
|
|
157
|
+
* apps/himi-spaces-lite/{my-sites,join,site-open}.ts call (their header comments cite the RN Spaces
|
|
158
|
+
* sources). An exact path, not a prefix: a prefix on apps.wix.com would hand the account's session to
|
|
159
|
+
* every service mounted under it. Anything else gets no cookie — it is served by the bridge's other
|
|
160
|
+
* rungs, which carry none. tests/webwix-account.test.ts holds this list against those files.
|
|
161
|
+
*/
|
|
162
|
+
export declare const ACCOUNT_FORWARD_ALLOWLIST: ReadonlyArray<{
|
|
163
|
+
host: string;
|
|
164
|
+
method: string;
|
|
165
|
+
path: string;
|
|
166
|
+
}>;
|
|
167
|
+
/** The parsed target when [method] [url] is on `ACCOUNT_FORWARD_ALLOWLIST`, else null. https on the
|
|
168
|
+
* default port, no userinfo — the same shape check as `isAllowedConsumerStreamTarget`. */
|
|
169
|
+
export declare function allowedAccountTarget(method: string, url: string): URL | null;
|
|
170
|
+
/** Whether a successful [method] [url] was a join (see `ACCOUNT_JOIN_PATHS`). */
|
|
171
|
+
export declare function isAccountJoinCall(method: string, url: string): boolean;
|
|
172
|
+
/**
|
|
173
|
+
* One allowlisted call as the account: the forwardable session cookies, the XSRF mirror and JSON
|
|
174
|
+
* accept (the recipe `wixOwnerSitesCall` documents), and — for a site-scoped call — the site's Member
|
|
175
|
+
* instance as a raw `Authorization` (RFC 0071 §3: never `Bearer`). Refuses anything off the
|
|
176
|
+
* allowlist, and never follows a redirect: a 3xx is this call's answer, not a hop that would carry
|
|
177
|
+
* the session somewhere else.
|
|
178
|
+
*/
|
|
179
|
+
export declare function wixAccountCall(method: string, url: string, body: string | undefined, sessionCookie: string, fetchImpl?: typeof fetch, forwardedHeaders?: Record<string, string>, memberInstance?: string): Promise<WixBridgeEnvelope>;
|
|
180
|
+
/** RFC 0071 §3 — the account is not a member of [metaSiteId]. Raised ONLY by the Member mint (403/404)
|
|
181
|
+
* or its validation, never by a call's own 403. The name is the contract: the bridge answers it as
|
|
182
|
+
* `{"error":"NotSiteMember"}`, which apps/himi-spaces-lite/site-open.ts `isNotSiteMember` reads. */
|
|
183
|
+
export declare class NotSiteMember extends Error {
|
|
184
|
+
readonly metaSiteId: string;
|
|
185
|
+
readonly reason: string;
|
|
186
|
+
readonly code = "NotSiteMember";
|
|
187
|
+
constructor(metaSiteId: string, reason: string);
|
|
188
|
+
}
|
|
189
|
+
/** The account session itself is gone: the Member mint — which authenticates by the session alone —
|
|
190
|
+
* answered 401. Not a membership verdict and not transient: the host must
|
|
191
|
+
* sign the account in again. */
|
|
192
|
+
export declare class AccountSessionExpired extends Error {
|
|
193
|
+
readonly metaSiteId: string;
|
|
194
|
+
readonly reason: string;
|
|
195
|
+
readonly code = "AccountSessionExpired";
|
|
196
|
+
constructor(metaSiteId: string, reason: string);
|
|
197
|
+
}
|
|
198
|
+
/** The Member instance could not be had for a TRANSIENT reason (network, 5xx, timeout). Not a
|
|
199
|
+
* membership verdict: a host retries it and never shows the join screen. */
|
|
200
|
+
export declare class SiteInstanceUnavailable extends Error {
|
|
201
|
+
readonly metaSiteId: string;
|
|
202
|
+
readonly reason: string;
|
|
203
|
+
readonly code = "SiteInstanceUnavailable";
|
|
204
|
+
constructor(metaSiteId: string, reason: string);
|
|
205
|
+
}
|
|
206
|
+
/** Why [instance] is not a Member instance of [metaSiteId], or null when it is — iOS
|
|
207
|
+
* `memberInstanceRejection`, word for word: the payload names the site, a non-empty `siteMemberId`
|
|
208
|
+
* equal to `uid`, and no `permissions` (a User instance carries `permissions: "OWNER"`). */
|
|
209
|
+
export declare function memberInstanceRejection(instance: string, metaSiteId: string): string | null;
|
|
210
|
+
/** When to stop using [instance]: 60 s before its payload's `expirationDate` (RFC 0071 §3), or
|
|
211
|
+
* [fallbackMs] after [now] when it carries none. */
|
|
212
|
+
export declare function memberInstanceRefreshAt(instance: string, now: number, fallbackMs?: number): number;
|
|
213
|
+
/** How long a refusal is remembered. Short on purpose: it only stops one screen's burst of calls from
|
|
214
|
+
* re-minting per call; a join clears it at once (`forgetRefusals`). */
|
|
215
|
+
export declare const MEMBER_NEGATIVE_TTL_MS = 10000;
|
|
216
|
+
/** A transient failure is remembered for less: it is the next retry's to try. */
|
|
217
|
+
export declare const MEMBER_TRANSIENT_TTL_MS = 3000;
|
|
218
|
+
/**
|
|
219
|
+
* RFC 0071 §3 — per-(site, account session) Member instances: single-flight (N racing calls cost one
|
|
220
|
+
* mint), a short negative cache, refreshed 60 s before the instance's own expiry. Keyed by a DIGEST
|
|
221
|
+
* of `wixSession2`, never the cookie itself. Same mint as owner preview's `OwnerInstanceCache`, with
|
|
222
|
+
* `signed_instance_type=Member`, and — unlike owner mode — no fallback: a failure fails the call.
|
|
223
|
+
*/
|
|
224
|
+
export declare class MemberInstanceCache {
|
|
225
|
+
private fetchImpl;
|
|
226
|
+
private mintTimeoutMs;
|
|
227
|
+
private cache;
|
|
228
|
+
private inflight;
|
|
229
|
+
private refusals;
|
|
230
|
+
/** Per session: bumped by `forgetSession` / `forgetRefusals`. A mint that started under an older
|
|
231
|
+
* generation still answers its own callers, but writes nothing back — otherwise a mint in flight
|
|
232
|
+
* across a sign-out re-caches the signed-out instance, and one in flight across a join re-caches
|
|
233
|
+
* the `NotSiteMember` the join just made stale. */
|
|
234
|
+
private generations;
|
|
235
|
+
constructor(fetchImpl?: typeof fetch, mintTimeoutMs?: number);
|
|
236
|
+
private session;
|
|
237
|
+
private key;
|
|
238
|
+
/** The site's Member instance for this session. Throws `NotSiteMember` or `SiteInstanceUnavailable`.
|
|
239
|
+
* `force`: Wix refused the instance this cache handed out (a 401) — mint a new one. */
|
|
240
|
+
instance(msid: string, sessionCookie: string, opts?: {
|
|
241
|
+
force?: boolean;
|
|
242
|
+
now?: number;
|
|
243
|
+
}): Promise<string>;
|
|
244
|
+
/** Drop everything held for this session — instances and refusals alike: its sign-out or expiry
|
|
245
|
+
* (RFC 0071 §6, sign-out purges every per-site instance). */
|
|
246
|
+
forgetSession(sessionCookie: string): void;
|
|
247
|
+
/** Drop every refusal held for this session — after a join, which makes them stale. */
|
|
248
|
+
forgetRefusals(sessionCookie: string): void;
|
|
249
|
+
private mint;
|
|
250
|
+
}
|
|
251
|
+
/** The bridge's answer for a Member-instance failure: `NotSiteMember` → 403, `AccountSessionExpired` →
|
|
252
|
+
* 401, anything else → 502, in the `{ error }` shape every bridge refusal has. The name in `error` is
|
|
253
|
+
* what a host branches on. */
|
|
254
|
+
export declare function memberInstanceRefusal(e: unknown): {
|
|
255
|
+
status: number;
|
|
256
|
+
body: {
|
|
257
|
+
error: string;
|
|
258
|
+
metaSiteId?: string;
|
|
259
|
+
reason?: string;
|
|
260
|
+
};
|
|
261
|
+
};
|
|
144
262
|
export {};
|