@wix/himalaya-cli 0.1472.0 → 0.1473.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.
@@ -2,7 +2,7 @@ import type { IncomingMessage, ServerResponse } from "node:http";
2
2
  import type { DerivedAppMeta } from "./app-module.js";
3
3
  import { type WixCachePolicy } from "./wix-cache-policy.js";
4
4
  import type { NetMocksFile, WixMockRule } from "./wix-gateway.js";
5
- import { gateScreenIdProblem } from "../../ts/src/auth-gate-screen.js";
5
+ import { gateScreenIdProblem, liftAuthBlock } from "../../ts/src/auth-gate-screen.js";
6
6
  import { type UnmappedPushDestination } from "../../ts/src/wix-push-links.js";
7
7
  import type { PushConfig, FlagConfig, AppControl, TabBarConfig, DrawerConfig, SidebarConfig, SplashConfig, LocaleConfig, NavKind, OrientationConfig, StreamPolicy } from "@wix/himalaya/core";
8
8
  export type { PushConfig, FlagConfig, AppControl, TabBarConfig, DrawerConfig, SidebarConfig, SplashConfig, LocaleConfig, NavKind, OrientationConfig, StreamPolicy };
@@ -202,14 +202,11 @@ export { gateScreenIdProblem };
202
202
  /** Derive the OTA authConfig block from a defineApp auth block
203
203
  * ({ providerId, config }). `required` is read from `config.required === true`
204
204
  * and lifted to the top level, as is `config.gateScreenId` (#4651); secret-ish
205
- * keys are scrubbed. When the app's screens are given, a `gateScreenId` naming none
206
- * of them is DROPPED (the shell falls back to the stock login) and warned about —
207
- * never thrown: this runs on every app-config serve and hot reload, and
208
- * `himalaya-dev app validate` is where a bad id fails ([gateScreenIdProblem]). */
209
- export declare function deriveAuthConfig(auth: {
210
- providerId: string;
211
- config: Record<string, unknown>;
212
- } | undefined, screenIds?: readonly string[]): AuthConfigBlock | undefined;
205
+ * keys are scrubbed — the same `liftAuthBlock` the auth bake runs (#4818). When
206
+ * the app's screens are given, a `gateScreenId` naming none of them is DROPPED
207
+ * (the shell falls back to the stock login) and warned about — never thrown: this
208
+ * runs on every app-config serve and hot reload, and `himalaya-dev app validate` is where a bad id fails ([gateScreenIdProblem]). */
209
+ export declare function deriveAuthConfig(auth: Parameters<typeof liftAuthBlock>[0], screenIds?: readonly string[]): AuthConfigBlock | undefined;
213
210
  /** Derive a baseline NavigationConfig from the loaded app's derived meta. */
214
211
  /** What `deriveNavigationConfig` needs to finish an app-level nav bundle ref.
215
212
  *
@@ -8,3 +8,32 @@ export declare function gateScreenIdProblem(auth: {
8
8
  providerId: string;
9
9
  config: Record<string, unknown>;
10
10
  } | undefined, screenIds: readonly string[]): string | null;
11
+ /** Keys never lifted into a client auth block — the baked auth.json or the OTA authConfig (defense in
12
+ * depth: public OAuth client ids are safe; anything secret-shaped is not). */
13
+ export declare const AUTH_SECRET_KEY_RE: RegExp;
14
+ /** The client auth block: what auth.json bakes and what the OTA `authConfig` serves. */
15
+ export interface LiftedAuthBlock {
16
+ providerId: string;
17
+ required: boolean;
18
+ /** #4651 — the app's own auth gate screen; absent ⇒ the stock login. */
19
+ gateScreenId?: string;
20
+ config: Record<string, unknown>;
21
+ }
22
+ /** #4818 — the one lift from an auth block to the client shape, shared by the auth bake and the OTA
23
+ * authConfig so the two cannot drift. Accepts the defineApp shape (`config.required`,
24
+ * `config.gateScreenId`) AND an already-lifted block (top-level `required` / `gateScreenId`, as an
25
+ * existing auth.json or a seed's `authConfig` carries them): re-lifting a lifted block is the
26
+ * identity, so a re-bake never fails open. `required` is true when either place says so; a
27
+ * `config.gateScreenId` wins over a top-level one. Secret-ish config keys are scrubbed. Returns null
28
+ * when there is no usable providerId. */
29
+ export declare function liftAuthBlock(auth: {
30
+ providerId?: unknown;
31
+ required?: unknown;
32
+ gateScreenId?: unknown;
33
+ config?: Record<string, unknown>;
34
+ } | undefined | null): LiftedAuthBlock | null;
35
+ /** The raw gate id of either auth shape (`config.gateScreenId` first), unvalidated — for the checks. */
36
+ export declare function liftedGateScreenId(auth: {
37
+ gateScreenId?: unknown;
38
+ config?: Record<string, unknown>;
39
+ }): unknown;
package/dist/cli.mjs CHANGED
@@ -10034,7 +10034,6 @@ function webViewOriginAllowed(url, origins) {
10034
10034
  }
10035
10035
  var init_webview_origin = __esm({
10036
10036
  "../../core/ts/src/webview-origin.ts"() {
10037
- "use strict";
10038
10037
  }
10039
10038
  });
10040
10039
 
@@ -31153,8 +31152,29 @@ function gateScreenIdProblem(auth, screenIds) {
31153
31152
  if (screenIds.includes(gateId)) return null;
31154
31153
  return `defineApp: auth.config.gateScreenId is "${gateId}", which is not one of the app's exact screens \u2014 a required-auth launch would have no login to show (a release serves exact screens, so a templated route 404s). Name an exact screen, or drop gateScreenId to use the stock login.`;
31155
31154
  }
31155
+ function liftAuthBlock(auth) {
31156
+ if (!auth || typeof auth.providerId !== "string" || auth.providerId.length === 0) return null;
31157
+ const config = {};
31158
+ for (const [key3, value] of Object.entries(auth.config ?? {})) {
31159
+ if (key3 === "required" || key3 === "gateScreenId") continue;
31160
+ if (AUTH_SECRET_KEY_RE.test(key3)) continue;
31161
+ config[key3] = value;
31162
+ }
31163
+ const gateScreenId = liftedGateScreenId(auth);
31164
+ return {
31165
+ providerId: auth.providerId,
31166
+ required: auth.config?.required === true || auth.required === true,
31167
+ ...typeof gateScreenId === "string" && gateScreenId.length > 0 ? { gateScreenId } : {},
31168
+ config
31169
+ };
31170
+ }
31171
+ function liftedGateScreenId(auth) {
31172
+ return auth.config?.gateScreenId ?? auth.gateScreenId;
31173
+ }
31174
+ var AUTH_SECRET_KEY_RE;
31156
31175
  var init_auth_gate_screen = __esm({
31157
31176
  "../../core/ts/src/auth-gate-screen.ts"() {
31177
+ AUTH_SECRET_KEY_RE = /secret|private/i;
31158
31178
  }
31159
31179
  });
31160
31180
 
@@ -31350,22 +31370,15 @@ function deriveTelemetryConfig(app) {
31350
31370
  return cfg;
31351
31371
  }
31352
31372
  function deriveAuthConfig(auth, screenIds) {
31353
- if (!auth?.providerId) return void 0;
31354
- const config = {};
31355
- for (const [key3, value] of Object.entries(auth.config ?? {})) {
31356
- if (key3 === "required" || key3 === "gateScreenId") continue;
31357
- if (AUTH_SECRET_KEY_RE.test(key3)) continue;
31358
- config[key3] = value;
31373
+ const lifted = liftAuthBlock(auth);
31374
+ if (!lifted) return void 0;
31375
+ const gateScreenId = liftedGateScreenId(auth);
31376
+ const problem = gateScreenId !== void 0 && screenIds ? gateScreenIdProblem({ providerId: lifted.providerId, config: { gateScreenId } }, screenIds) : null;
31377
+ if (problem) {
31378
+ console.warn(`[app-config] ${problem} \u2014 serving the stock login instead.`);
31379
+ delete lifted.gateScreenId;
31359
31380
  }
31360
- const gateScreenId = auth.config?.gateScreenId;
31361
- const problem = typeof gateScreenId === "string" && screenIds ? gateScreenIdProblem(auth, screenIds) : null;
31362
- if (problem) console.warn(`[app-config] ${problem} \u2014 serving the stock login instead.`);
31363
- return {
31364
- providerId: auth.providerId,
31365
- required: auth.config?.required === true,
31366
- ...typeof gateScreenId === "string" && gateScreenId.length > 0 && !problem ? { gateScreenId } : {},
31367
- config
31368
- };
31381
+ return lifted;
31369
31382
  }
31370
31383
  function expandNavBundle(ref, ctx) {
31371
31384
  const url = ref.url ?? "";
@@ -31559,7 +31572,7 @@ function handleAppConfigRequest(req, res, meta, override, bundleCtx, devNetMocks
31559
31572
  });
31560
31573
  res.end(body);
31561
31574
  }
31562
- var SHARED_WIX_SENTRY_DSN, AUTH_SECRET_KEY_RE, NAV_OVERRIDES;
31575
+ var SHARED_WIX_SENTRY_DSN, NAV_OVERRIDES;
31563
31576
  var init_app_config = __esm({
31564
31577
  "../../core/dev-server/src/app-config.ts"() {
31565
31578
  init_wix_cache_policy();
@@ -31568,7 +31581,6 @@ var init_app_config = __esm({
31568
31581
  init_preview_surfaces();
31569
31582
  init_wix_push_links();
31570
31583
  SHARED_WIX_SENTRY_DSN = "https://5dfa4f23057c43149b6219c07d177472@sentry.io/84240";
31571
- AUTH_SECRET_KEY_RE = /secret|private/i;
31572
31584
  NAV_OVERRIDES = {
31573
31585
  reference: {
31574
31586
  deepLinkPatterns: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/himalaya-cli",
3
- "version": "0.1472.0",
3
+ "version": "0.1473.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": "ee8b0fb2a0d0d40cae5b63254991c3606bf70ea053c38b3b602e5890"
74
+ "falconPackageHash": "f58b0d57918c163a9918dbe6f1170839ea6c6d6cf0d2b9c38b7a7004"
75
75
  }