@wix/himalaya-cli 0.976.0 → 0.978.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.
@@ -1,4 +1,5 @@
1
1
  import type { DesignTokens } from "./tokens.js";
2
+ import type { PushRoute, PushPayloadAdapter } from "./push-routes.js";
2
3
  import type { NavigationConfig, SplashConfig } from "./schema.js";
3
4
  import { type LocaleConfig } from "./locale.js";
4
5
  import { type DistributionConfig } from "./distribution.js";
@@ -6,6 +7,7 @@ import type { CmsConfig } from "./cms.js";
6
7
  import { type DataResourcesConfig } from "@wix/himalaya/data-resources";
7
8
  import type { FunctionDefinition, FunctionScheduleRecord } from "@himalaya/functions";
8
9
  export type { CmsConfig, CmsCollectionSpec, CmsFieldSpec, WixFieldType } from "./cms.js";
10
+ export type { PushRoute, PushPayloadAdapter };
9
11
  export type { DataResourcesConfig, KvSpec, ResourceEnvironment, ResourceScope } from "@wix/himalaya/data-resources";
10
12
  export { WIX_FIELD_TYPES } from "./cms.js";
11
13
  /** Wix site/environment binding used by the server-function surface. */
@@ -445,6 +447,16 @@ export interface PushConfig {
445
447
  richTemplates?: RichTemplate[];
446
448
  /** Prompt for the OS notification permission on first launch. */
447
449
  requestPermissionOnLaunch?: boolean;
450
+ /** Notification route table. Derive these from the app's own contract rather than
451
+ * hand-listing them, so a route can never target a screen the provisioned app
452
+ * does not have. Honoured by iOS + Android; the web host has no push transport. */
453
+ routes?: PushRoute[];
454
+ payloadAdapter?: PushPayloadAdapter;
455
+ /** A `tier5.<service>.<action>` dispatched on EVERY notification — receipt or tap
456
+ * — so a worker can keep a badge count or refresh a feed without navigating. It
457
+ * receives `templateId`, `topic`, `metaSiteId`, `notificationId`, `link`,
458
+ * `resolvedLink` and `tapped` (all as strings, the dispatch bridge's contract). */
459
+ observerAction?: string;
448
460
  }
449
461
  export type IapProductType = "subscription" | "nonConsumable" | "consumable";
450
462
  export interface IapProduct {
@@ -0,0 +1,74 @@
1
+ /**
2
+ * How a payload link is stripped down to the residual path+query `routes` match
3
+ * against. An UNKNOWN value passes the link through unchanged rather than failing, so
4
+ * an older binary served a newer adapter degrades instead of dropping every
5
+ * notification (invariants 6/8).
6
+ */
7
+ export type PushPayloadAdapter = "" | "wix-ping";
8
+ /**
9
+ * One notification-routing rule. Mirrors `PushRoute` in core.proto / Schema.swift /
10
+ * Schema.kt, and is re-exported from `define-app` as part of the authoring surface —
11
+ * defined HERE, once, next to the matcher that consumes it.
12
+ *
13
+ * Routes translate a FOREIGN link space (the Wix mobile links Ping delivers) into this
14
+ * app's own, in front of the existing resolver — never beside it. No match leaves the
15
+ * link untouched, which is why an app declaring no routes behaves exactly as it did
16
+ * before they existed.
17
+ */
18
+ export interface PushRoute {
19
+ /** WIX-link-space pattern over the residual path+query, in the same grammar as
20
+ * `deepLinkPatterns`: `"orders/?orderId=:orderId"`. */
21
+ match: string;
22
+ /** The himi link to resolve instead, with `{name}` placeholders filled from the
23
+ * captured params: `"<scheme>://screen/himi_order?id={orderId}"`. May instead name
24
+ * a `tier5.*` action, which dispatches to a worker rather than navigating. */
25
+ link: string;
26
+ /** Optional EXTRA conditions on the Ping payload. Omitted ⇒ unconstrained, so one
27
+ * link space can fan out by template or topic. */
28
+ templateId?: string;
29
+ topic?: string;
30
+ }
31
+ /** The payload facts a route may additionally condition on. */
32
+ export interface PushPayloadContext {
33
+ templateId?: string;
34
+ topic?: string;
35
+ }
36
+ /** What an adapter made of a payload link. */
37
+ export interface AdaptedLink {
38
+ /** Residual path+query the routes match against, with no leading slash. */
39
+ residual: string;
40
+ /** The site the payload named, when it named one. */
41
+ metaSiteId?: string;
42
+ /** False when the adapter did not recognize the link and passed it through. */
43
+ adapted: boolean;
44
+ }
45
+ /**
46
+ * Strip a payload link down to the residual path+query a route matches against.
47
+ *
48
+ * `adapter` is `""` (pass through) or `"wix-ping"`. An UNKNOWN adapter passes the
49
+ * link through unchanged rather than failing, so an older binary served a config
50
+ * naming an adapter it has never heard of degrades to today's behavior instead of
51
+ * dropping every notification (invariants 6/8).
52
+ */
53
+ export declare function adaptPayloadLink(link: string, adapter?: string): AdaptedLink;
54
+ /**
55
+ * The himi link the first matching route produces, or null when nothing matches.
56
+ *
57
+ * Null means "resolve the input unchanged" to the caller — never "give up" — which
58
+ * is what keeps an app that declares no routes behaving exactly as it did before.
59
+ * Rules are tried in declaration order, so a more specific rule goes first.
60
+ */
61
+ export declare function matchPushRoute(residual: string, routes: readonly PushRoute[] | undefined, payload?: PushPayloadContext): string | null;
62
+ /**
63
+ * Adapt + match in one step: the himi link to resolve instead of `link`, the params
64
+ * the route captured, and the site the payload named. `link` is null when no route
65
+ * matched.
66
+ */
67
+ export declare function resolvePushRoute(link: string, config: {
68
+ routes?: readonly PushRoute[];
69
+ payloadAdapter?: string;
70
+ } | undefined, payload?: PushPayloadContext): {
71
+ link: string | null;
72
+ params: Record<string, string>;
73
+ metaSiteId?: string;
74
+ };
package/dist/cli.mjs CHANGED
@@ -5290,7 +5290,6 @@ function resolveTranslation(value, catalog, sourceCatalog) {
5290
5290
  var BINDING_SIGILS, BINDING_SIGIL_RE, TRANSLATION_PREFIX, TRANSLATION_KEY_RE;
5291
5291
  var init_bindings = __esm({
5292
5292
  "../../core/ts/src/bindings.ts"() {
5293
- "use strict";
5294
5293
  BINDING_SIGILS = ["service", "flag", "item", "t"];
5295
5294
  BINDING_SIGIL_RE = new RegExp(
5296
5295
  `^\\$(?:${BINDING_SIGILS.filter((s) => s !== "t").join("|")})\\b|^\\$t:`
@@ -18715,6 +18714,7 @@ function shouldRevealError(args) {
18715
18714
  var EMAIL_RE, URL_HOST_RE, INTEGER_RE, NUMBER_RE;
18716
18715
  var init_validation = __esm({
18717
18716
  "../../core/ts/src/validation.ts"() {
18717
+ "use strict";
18718
18718
  EMAIL_RE = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*\.[A-Za-z]{2,}$/;
18719
18719
  URL_HOST_RE = /^[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*(:[0-9]+)?$/;
18720
18720
  INTEGER_RE = /^[+-]?[0-9]+$/;
@@ -22139,6 +22139,7 @@ function validateWorkerSubtree(raw, slotId, policy, actionCatalog) {
22139
22139
  var WORKER_SUBTREE_CEILINGS, ID_PART, ACTION_ID;
22140
22140
  var init_worker_subtree = __esm({
22141
22141
  "../../core/ts/src/worker-subtree.ts"() {
22142
+ "use strict";
22142
22143
  init_worker_subtree_safe_types_generated();
22143
22144
  WORKER_SUBTREE_CEILINGS = Object.freeze({
22144
22145
  maxEncodedBytes: 65536,
@@ -37479,6 +37480,7 @@ async function navIssues(dir, strict) {
37479
37480
  }
37480
37481
  }
37481
37482
  const nav = cfg.navigation;
37483
+ pushRouteIssues(cfg.push, nav, warn);
37482
37484
  if (nav === void 0 || nav === null) return issues;
37483
37485
  if (!isPlainObject(nav)) {
37484
37486
  error("nav-not-an-object", `navigation must be an object (got ${Array.isArray(nav) ? "array" : typeof nav}).`);
@@ -37546,6 +37548,31 @@ async function navIssues(dir, strict) {
37546
37548
  }
37547
37549
  return issues;
37548
37550
  }
37551
+ function pushRouteIssues(push, nav, warn) {
37552
+ if (!isPlainObject(push) || push.payloadAdapter !== "wix-ping") return;
37553
+ const routes = Array.isArray(push.routes) ? push.routes.filter(isPlainObject) : [];
37554
+ if (routes.length === 0) {
37555
+ warn(
37556
+ "push-routes-missing",
37557
+ `push.payloadAdapter is "wix-ping" but push.routes is empty \u2014 Wix business-event links cannot map to app screens. Direct Himi screen links still work. Declare a route per business-event link the site sends, e.g. { match: "my-account/:site/stores/orders/:orderId", link: "<scheme>://screen/<order screen>?id={orderId}" }.`
37558
+ );
37559
+ return;
37560
+ }
37561
+ const linkables = isPlainObject(nav) ? nav.linkableScreens : void 0;
37562
+ if (!Array.isArray(linkables)) return;
37563
+ const declared = new Set(
37564
+ linkables.filter(isPlainObject).map((s) => String(s.screenId ?? ""))
37565
+ );
37566
+ for (const route of routes) {
37567
+ const screenId = /:\/\/screen\/([^?]+)/.exec(String(route.link ?? ""))?.[1];
37568
+ if (screenId && !declared.has(screenId)) {
37569
+ warn(
37570
+ "push-route-unknown-screen",
37571
+ `push.routes: "${String(route.match)}" opens "${screenId}", which navigation.linkableScreens does not declare \u2014 the device cannot resolve it, so the notification opens nothing.`
37572
+ );
37573
+ }
37574
+ }
37575
+ }
37549
37576
  var NAVIGATION_KEYS, NAV_KINDS, ITEMS_BLOCKS, SERVED_ONLY_NAV_KEYS, MISPLACED_TOP_LEVEL_KEYS, isPlainObject, itemCount;
37550
37577
  var init_nav_lint = __esm({
37551
37578
  "src/nav-lint.ts"() {
@@ -43592,19 +43619,19 @@ var init_preview_assets_generated = __esm({
43592
43619
  "../../packages/serve/src/preview-assets.generated.ts"() {
43593
43620
  init_preview_assets_format();
43594
43621
  PREVIEW_ASSET_MANIFEST = [
43595
- { key: "assets/index-cNYP8bZY.js", contentType: "application/javascript; charset=utf-8", offset: 8, length: 986950, sha256: "590a8f1725d59e3d3c05d00508498e60b69174f474ba8ff1d3df4baea4c10e72" },
43596
- { key: "fonts/WixMadeforDisplay-Bold.ttf", contentType: "font/ttf", offset: 986958, length: 90924, sha256: "ec4c7d63772d980d6e147b2df6215fd2737e4b04cebe0cf7e11dc695fb63cdcf" },
43597
- { key: "fonts/WixMadeforDisplay-ExtraBold.ttf", contentType: "font/ttf", offset: 1077882, length: 90984, sha256: "bf4c16a2774edd38a921edf3099469866cd74c094fd596f3fa4e81f54a04dfaa" },
43598
- { key: "fonts/WixMadeforDisplay-Medium.ttf", contentType: "font/ttf", offset: 1168866, length: 90980, sha256: "368faca44fb9f7207e4af784e94750b1ee59c1098b8689e0f4a918926f244fb5" },
43599
- { key: "fonts/WixMadeforDisplay-Regular.ttf", contentType: "font/ttf", offset: 1259846, length: 90872, sha256: "97ed8f1a6772abe26e3d8af5cecfc4b02faa94497d585b0398b5053b739a70c1" },
43600
- { key: "fonts/WixMadeforDisplay-SemiBold.ttf", contentType: "font/ttf", offset: 1350718, length: 90980, sha256: "642feab8a48ddf6c7a89d7c2a7c0edfa0e6e773f671287e460e222703563191e" },
43601
- { key: "fonts/WixMadeforText-Bold.ttf", contentType: "font/ttf", offset: 1441698, length: 108636, sha256: "37c179b4fefb63ea9637322b84583a2df53aa226c150294eea1675c14b1b8e29" },
43602
- { key: "fonts/WixMadeforText-ExtraBold.ttf", contentType: "font/ttf", offset: 1550334, length: 109084, sha256: "62e2fe4718129f36ecdb0ae4de385bd6b81ecc876146447167c6c140fad699a9" },
43603
- { key: "fonts/WixMadeforText-Medium.ttf", contentType: "font/ttf", offset: 1659418, length: 109048, sha256: "4ecf270136af928612c76fe4ebade91d8156975e5ea4c0cf9225501dd1788e02" },
43604
- { key: "fonts/WixMadeforText-Regular.ttf", contentType: "font/ttf", offset: 1768466, length: 107700, sha256: "dee56f09fd3efc127c1ea95557edc74110c1460a46287da36e0af25efd341ef5" },
43605
- { key: "fonts/WixMadeforText-SemiBold.ttf", contentType: "font/ttf", offset: 1876166, length: 88108, sha256: "dced97a77624bc5f8b1ae65850360908297f4588e09feb6f22792d29dc7e765b" },
43606
- { key: "index.html", contentType: "text/html; charset=utf-8", offset: 1964274, length: 4448, sha256: "130ee208bf11075676b686b88ea3fa9e1eccff5d7047915d09594b8247f240eb" },
43607
- { key: "t5-frame.html", contentType: "text/html; charset=utf-8", offset: 1968722, length: 13784, sha256: "cfb9465254fab84f0e084bb4542c282758ea29774b5f172840cc0b9e4194ef89" }
43622
+ { key: "assets/index-QajXLF48.js", contentType: "application/javascript; charset=utf-8", offset: 8, length: 987074, sha256: "46a30017dbf3793f00e3ad24c865ca7708174a0c676a87257fb37f3f6a4179fa" },
43623
+ { key: "fonts/WixMadeforDisplay-Bold.ttf", contentType: "font/ttf", offset: 987082, length: 90924, sha256: "ec4c7d63772d980d6e147b2df6215fd2737e4b04cebe0cf7e11dc695fb63cdcf" },
43624
+ { key: "fonts/WixMadeforDisplay-ExtraBold.ttf", contentType: "font/ttf", offset: 1078006, length: 90984, sha256: "bf4c16a2774edd38a921edf3099469866cd74c094fd596f3fa4e81f54a04dfaa" },
43625
+ { key: "fonts/WixMadeforDisplay-Medium.ttf", contentType: "font/ttf", offset: 1168990, length: 90980, sha256: "368faca44fb9f7207e4af784e94750b1ee59c1098b8689e0f4a918926f244fb5" },
43626
+ { key: "fonts/WixMadeforDisplay-Regular.ttf", contentType: "font/ttf", offset: 1259970, length: 90872, sha256: "97ed8f1a6772abe26e3d8af5cecfc4b02faa94497d585b0398b5053b739a70c1" },
43627
+ { key: "fonts/WixMadeforDisplay-SemiBold.ttf", contentType: "font/ttf", offset: 1350842, length: 90980, sha256: "642feab8a48ddf6c7a89d7c2a7c0edfa0e6e773f671287e460e222703563191e" },
43628
+ { key: "fonts/WixMadeforText-Bold.ttf", contentType: "font/ttf", offset: 1441822, length: 108636, sha256: "37c179b4fefb63ea9637322b84583a2df53aa226c150294eea1675c14b1b8e29" },
43629
+ { key: "fonts/WixMadeforText-ExtraBold.ttf", contentType: "font/ttf", offset: 1550458, length: 109084, sha256: "62e2fe4718129f36ecdb0ae4de385bd6b81ecc876146447167c6c140fad699a9" },
43630
+ { key: "fonts/WixMadeforText-Medium.ttf", contentType: "font/ttf", offset: 1659542, length: 109048, sha256: "4ecf270136af928612c76fe4ebade91d8156975e5ea4c0cf9225501dd1788e02" },
43631
+ { key: "fonts/WixMadeforText-Regular.ttf", contentType: "font/ttf", offset: 1768590, length: 107700, sha256: "dee56f09fd3efc127c1ea95557edc74110c1460a46287da36e0af25efd341ef5" },
43632
+ { key: "fonts/WixMadeforText-SemiBold.ttf", contentType: "font/ttf", offset: 1876290, length: 88108, sha256: "dced97a77624bc5f8b1ae65850360908297f4588e09feb6f22792d29dc7e765b" },
43633
+ { key: "index.html", contentType: "text/html; charset=utf-8", offset: 1964398, length: 4448, sha256: "e2f66c98bc1767a88a1d28cf5af1078a100e4505d14370f06066534651ea5912" },
43634
+ { key: "t5-frame.html", contentType: "text/html; charset=utf-8", offset: 1968846, length: 13784, sha256: "cfb9465254fab84f0e084bb4542c282758ea29774b5f172840cc0b9e4194ef89" }
43608
43635
  ];
43609
43636
  }
43610
43637
  });
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/himalaya-cli",
3
- "version": "0.976.0",
3
+ "version": "0.978.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": [
@@ -64,5 +64,5 @@
64
64
  "artifactId": "himalaya-cli"
65
65
  }
66
66
  },
67
- "falconPackageHash": "97cd179b2e2933b970764b974d240af745f9cd70a3feaa016e12fadf"
67
+ "falconPackageHash": "88b2cfb0f2d75cce7fa6a3681bfbfd1b227e95d24d266ba8ca8e722a"
68
68
  }