@wix/himalaya-cli 0.1117.0 → 0.1118.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.
@@ -173,6 +173,8 @@ export interface DerivedAppMeta {
173
173
  screenIds: string[];
174
174
  templatedPatterns: string[];
175
175
  urlScheme: string;
176
+ /** Forwarded from AppConfig.cache: the app's declared Wix read cache rules (#3450 follow-up). */
177
+ cache?: import("@wix/himalaya/core").AppCacheConfig;
176
178
  /** Forwarded from AppConfig.push for the OTA app-config channel. */
177
179
  push?: import("@wix/himalaya/core").PushConfig;
178
180
  /** Forwarded from AppConfig.control for the OTA app-config channel. */
@@ -0,0 +1,2 @@
1
+ import type { WixCacheRule } from "./wix-cache-policy.js";
2
+ export declare const PLATFORM_DEFAULT_WIX_CACHE_RULES: readonly WixCacheRule[];
@@ -1,3 +1,4 @@
1
+ import type { AppCacheConfig } from "@wix/himalaya/core";
1
2
  export interface WixCacheRule {
2
3
  method: string | null;
3
4
  pathPrefix: string;
@@ -11,4 +12,23 @@ export interface WixCachePolicy {
11
12
  defaultCacheable: boolean;
12
13
  }
13
14
  export declare function clampRule(rule: WixCacheRule, denyPrefixes: string[], maxTTL: number): WixCacheRule;
14
- export declare function resolveWixCachePolicy(appName: string): WixCachePolicy;
15
+ /** What an app declares in `defineApp({ cache })`. */
16
+ export type DeclaredWixCache = AppCacheConfig;
17
+ /**
18
+ * The EFFECTIVE Wix read cache policy an app is served (web, iOS and Android all read it).
19
+ *
20
+ * Rules, in precedence order — every client keeps the FIRST longest-prefix match:
21
+ * 1. the app's own `defineApp({ cache })` rules (from its config.ts);
22
+ * 2. the legacy per-app table above (apps not yet moved to config.ts);
23
+ * 3. the platform defaults (#3450 follow-up), generated from the Wix SDK catalog: public
24
+ * catalog/content reads, stale-while-revalidate, plus write families that purge them.
25
+ * Before them every app without a table entry was served `{ rules: [] }` and so cached
26
+ * NO Wix read on any platform. An app opts out with `cache: { platformDefaults: false }`.
27
+ * An app (or legacy) rule SHADOWS every default underneath its prefix — clients pick the
28
+ * longest prefix first, so an app's broad `/stores/` opt-out would otherwise lose to a longer
29
+ * default like `/stores/v3/products/query`.
30
+ * 4. the platform deny + personal-data prefixes as explicit non-cacheable rules — so an app's
31
+ * `defaultCacheable: true` can never make a PII path cacheable by matching nothing.
32
+ * Everything is clamped under the platform envelope (PII denies, TTL ceiling).
33
+ */
34
+ export declare function resolveWixCachePolicy(appName: string, declared?: DeclaredWixCache): WixCachePolicy;
@@ -410,7 +410,9 @@ export interface AppConfig {
410
410
  * App-declared Wix REST cache rules. The app controls per-endpoint opt-out
411
411
  * (`cacheable: false`) and TTL; the server renders the EFFECTIVE policy by
412
412
  * clamping these under the platform envelope (PII denies, TTL ceiling) and
413
- * delivers it OTA via /v1/app-config. Omit to cache nothing (deny-by-default).
413
+ * delivers it OTA via /v1/app-config. Omit to get only the platform defaults — public
414
+ * catalog/content reads generated from the Wix SDK catalog (see
415
+ * core/dev-server/src/wix-cache-defaults.generated.ts); `platformDefaults: false` opts out.
414
416
  */
415
417
  cache?: AppCacheConfig;
416
418
  /**
@@ -634,7 +636,12 @@ export interface AppCacheRule {
634
636
  export interface AppCacheConfig {
635
637
  /** Behavior for a request no rule matches. Defaults to false (deny). */
636
638
  defaultCacheable?: boolean;
637
- rules: AppCacheRule[];
639
+ /** Omit for none — e.g. `cache: { platformDefaults: false }` to opt out of the defaults alone. */
640
+ rules?: AppCacheRule[];
641
+ /** Also apply the platform default read rules (public catalog/content). Defaults to true. The
642
+ * app's own rules take precedence, and each one shadows every default under its prefix — so a
643
+ * broad `{ pathPrefix: "/stores/", cacheable: false }` opts the whole store out. */
644
+ platformDefaults?: boolean;
638
645
  }
639
646
  /** A single interface orientation. Platform-neutral names; the native-config
640
647
  * generator maps them to `UIInterfaceOrientation*` (iOS) and the runtime maps
@@ -7595,7 +7595,7 @@ function validateConfigShape(config) {
7595
7595
  validateIcon(config.icon, config.designTokens?.colors, config.designTokensPath);
7596
7596
  }
7597
7597
  if (config.cache) {
7598
- for (const r of config.cache.rules) {
7598
+ for (const r of config.cache.rules ?? []) {
7599
7599
  if (!r.pathPrefix || !r.pathPrefix.startsWith("/")) {
7600
7600
  throw new Error(`defineApp: cache rule pathPrefix must start with "/". Got "${r.pathPrefix}".`);
7601
7601
  }
@@ -9068,6 +9068,7 @@ function deriveAppMeta(name, m, platforms = {}) {
9068
9068
  drawer: config.navigation?.drawer,
9069
9069
  navKind: config.navigation?.navKind,
9070
9070
  orientation: config.navigation?.orientation,
9071
+ cache: config.cache,
9071
9072
  sidebar: config.navigation?.sidebar,
9072
9073
  navLogicBundle: config.navigation?.navLogicBundle,
9073
9074
  appIconBadgeSources: config.navigation?.appIconBadgeSources,