@unified-product-graph/core 0.11.3 → 0.11.5

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/index.d.cts CHANGED
@@ -18972,7 +18972,9 @@ declare const ENTITY_EMOJI: Record<string, string>;
18972
18972
  /**
18973
18973
  * UPG canonical tree patterns: the named, server-owned shapes the `get_tree`
18974
18974
  * tool assembles (OST, OKR, user, product, validation, strategy, feature areas,
18975
- * delivery, architecture, journey, design system) — one per tree-shaped region.
18975
+ * delivery, architecture, journey, design system, commercial) — one per
18976
+ * tree-shaped region (or, for `architecture`/`commercial`, the tree-shaped
18977
+ * containment subset of a DAG/multi-hub region).
18976
18978
  *
18977
18979
  * A tree pattern is anchor + a TYPE-DRIVEN child map, NOT a list of edge names.
18978
18980
  * `get_tree` roots at `anchor_type` (falling back through `fallback_anchors` when
@@ -19007,6 +19009,25 @@ interface UPGTreeChild {
19007
19009
  * when present and are silent when absent.
19008
19010
  */
19009
19011
  required?: boolean;
19012
+ /**
19013
+ * The node property `get_tree` sorts this slot's children by (ascending,
19014
+ * nodes lacking it last). Ordering is a property of the DATA, not the viewer,
19015
+ * so the server returns children pre-sorted rather than leaving every client
19016
+ * to re-sort (UPG-663 sequence scalars: `phase_order`, `step_order`,
19017
+ * `action_order`, `state_order`). Omitted -> children keep declared slot order.
19018
+ */
19019
+ order_by?: string;
19020
+ /**
19021
+ * Spine resolution for a DAG. When this slot reaches the SAME node redundantly
19022
+ * with a path through a sibling type (e.g. `user_journey -> journey_step`
19023
+ * directly AND `user_journey -> journey_phase -> journey_step`), name that
19024
+ * sibling type here. A child also reachable as a grandchild through a
19025
+ * `prefer_via`-typed child renders under that spine, NOT here -- collapsing the
19026
+ * redundant path so the node is neither silently dropped (G5) nor
19027
+ * double-counted (J1). A child not on the spine still renders here, so the
19028
+ * direct path remains the fallback when the grouping layer is absent.
19029
+ */
19030
+ prefer_via?: string;
19010
19031
  }
19011
19032
  /** How a pattern decides what counts as a structural gap. */
19012
19033
  type UPGTreeGapPolicy = 'required-children-only' | 'all-optional';
@@ -19076,6 +19097,10 @@ interface UPGTreePatternEdge {
19076
19097
  /** The edge's classification (hierarchy, semantic, cross-domain, ...), or null. */
19077
19098
  kind: string | null;
19078
19099
  required: boolean;
19100
+ /** Node scalar this slot's children are sorted by, when declared (J2). */
19101
+ order_by?: string;
19102
+ /** Sibling type whose path is the canonical spine for this child (J1), when declared. */
19103
+ prefer_via?: string;
19079
19104
  }
19080
19105
  /** A pattern with its child map resolved to concrete edges (for introspection). */
19081
19106
  interface UPGTreePatternDetail extends UPGTreePattern {
@@ -21560,7 +21585,7 @@ declare function isCanonical(text: string): boolean;
21560
21585
  * it stamps the `upg_version` field of every `.upg` file written by the SDK.
21561
21586
  * The `check:version-lockstep` gate enforces this at release time.
21562
21587
  */
21563
- declare const UPG_VERSION: "0.11.3";
21588
+ declare const UPG_VERSION: "0.11.5";
21564
21589
  /**
21565
21590
  * The `.upg` JSON document format version. Written to the `upg_version` field.
21566
21591
  * Evolves independently from `UPG_VERSION` (the catalogue version).
package/dist/index.d.ts CHANGED
@@ -18972,7 +18972,9 @@ declare const ENTITY_EMOJI: Record<string, string>;
18972
18972
  /**
18973
18973
  * UPG canonical tree patterns: the named, server-owned shapes the `get_tree`
18974
18974
  * tool assembles (OST, OKR, user, product, validation, strategy, feature areas,
18975
- * delivery, architecture, journey, design system) — one per tree-shaped region.
18975
+ * delivery, architecture, journey, design system, commercial) — one per
18976
+ * tree-shaped region (or, for `architecture`/`commercial`, the tree-shaped
18977
+ * containment subset of a DAG/multi-hub region).
18976
18978
  *
18977
18979
  * A tree pattern is anchor + a TYPE-DRIVEN child map, NOT a list of edge names.
18978
18980
  * `get_tree` roots at `anchor_type` (falling back through `fallback_anchors` when
@@ -19007,6 +19009,25 @@ interface UPGTreeChild {
19007
19009
  * when present and are silent when absent.
19008
19010
  */
19009
19011
  required?: boolean;
19012
+ /**
19013
+ * The node property `get_tree` sorts this slot's children by (ascending,
19014
+ * nodes lacking it last). Ordering is a property of the DATA, not the viewer,
19015
+ * so the server returns children pre-sorted rather than leaving every client
19016
+ * to re-sort (UPG-663 sequence scalars: `phase_order`, `step_order`,
19017
+ * `action_order`, `state_order`). Omitted -> children keep declared slot order.
19018
+ */
19019
+ order_by?: string;
19020
+ /**
19021
+ * Spine resolution for a DAG. When this slot reaches the SAME node redundantly
19022
+ * with a path through a sibling type (e.g. `user_journey -> journey_step`
19023
+ * directly AND `user_journey -> journey_phase -> journey_step`), name that
19024
+ * sibling type here. A child also reachable as a grandchild through a
19025
+ * `prefer_via`-typed child renders under that spine, NOT here -- collapsing the
19026
+ * redundant path so the node is neither silently dropped (G5) nor
19027
+ * double-counted (J1). A child not on the spine still renders here, so the
19028
+ * direct path remains the fallback when the grouping layer is absent.
19029
+ */
19030
+ prefer_via?: string;
19010
19031
  }
19011
19032
  /** How a pattern decides what counts as a structural gap. */
19012
19033
  type UPGTreeGapPolicy = 'required-children-only' | 'all-optional';
@@ -19076,6 +19097,10 @@ interface UPGTreePatternEdge {
19076
19097
  /** The edge's classification (hierarchy, semantic, cross-domain, ...), or null. */
19077
19098
  kind: string | null;
19078
19099
  required: boolean;
19100
+ /** Node scalar this slot's children are sorted by, when declared (J2). */
19101
+ order_by?: string;
19102
+ /** Sibling type whose path is the canonical spine for this child (J1), when declared. */
19103
+ prefer_via?: string;
19079
19104
  }
19080
19105
  /** A pattern with its child map resolved to concrete edges (for introspection). */
19081
19106
  interface UPGTreePatternDetail extends UPGTreePattern {
@@ -21560,7 +21585,7 @@ declare function isCanonical(text: string): boolean;
21560
21585
  * it stamps the `upg_version` field of every `.upg` file written by the SDK.
21561
21586
  * The `check:version-lockstep` gate enforces this at release time.
21562
21587
  */
21563
- declare const UPG_VERSION: "0.11.3";
21588
+ declare const UPG_VERSION: "0.11.5";
21564
21589
  /**
21565
21590
  * The `.upg` JSON document format version. Written to the `upg_version` field.
21566
21591
  * Evolves independently from `UPG_VERSION` (the catalogue version).
package/dist/index.js CHANGED
@@ -19940,8 +19940,8 @@ function buildTypeAliases() {
19940
19940
  var UPG_TYPE_ALIASES = buildTypeAliases();
19941
19941
 
19942
19942
  // src/presentation/tree-patterns.ts
19943
- var req = (type) => ({ type, required: true });
19944
- var opt = (type) => ({ type });
19943
+ var req = (type, order_by) => order_by ? { type, required: true, order_by } : { type, required: true };
19944
+ var opt = (type, order_by) => order_by ? { type, order_by } : { type };
19945
19945
  var UPG_TREE_PATTERNS = [
19946
19946
  {
19947
19947
  id: "ost",
@@ -20127,11 +20127,18 @@ var UPG_TREE_PATTERNS = [
20127
20127
  anchor_type: "user_journey",
20128
20128
  fallback_anchors: ["user_flow"],
20129
20129
  child_map: {
20130
- user_journey: [opt("journey_phase"), opt("journey_step")],
20131
- journey_phase: [opt("journey_step")],
20132
- journey_step: [opt("journey_action"), opt("screen")],
20130
+ // The phase is the grouping layer: a step reachable through a phase
20131
+ // renders under the phase, not twice (J1). `prefer_via` collapses the
20132
+ // redundant direct path; a step in NO phase still renders here. Children
20133
+ // are returned in `*_order` sequence (J2), not storage order.
20134
+ user_journey: [
20135
+ opt("journey_phase", "phase_order"),
20136
+ { type: "journey_step", prefer_via: "journey_phase", order_by: "step_order" }
20137
+ ],
20138
+ journey_phase: [opt("journey_step", "step_order")],
20139
+ journey_step: [opt("journey_action", "action_order"), opt("screen")],
20133
20140
  user_flow: [opt("screen")],
20134
- screen: [opt("screen_state")]
20141
+ screen: [opt("screen_state", "state_order")]
20135
20142
  },
20136
20143
  natural_depth: 3
20137
20144
  },
@@ -20148,6 +20155,43 @@ var UPG_TREE_PATTERNS = [
20148
20155
  design_component: [opt("design_component"), opt("design_token")]
20149
20156
  },
20150
20157
  natural_depth: 3
20158
+ },
20159
+ {
20160
+ id: "commercial",
20161
+ label: "Commercial / money model",
20162
+ description: "The business-model spine: how the product captures value. The business model branches into its revenue streams, cost structure, and unit economics; a stream into its pricing tiers, the metrics that measure it, and the pricing strategy that prices it; and metrics decompose into their components (the MRR waterfall, NRR composition). A pricing tier reached from both its stream and its pricing strategy renders once, then as a shared reference.",
20163
+ // The sustaining money-model captures value as a containment hierarchy, so it
20164
+ // earns a tree even though business_gtm_growth is a multi-hub region: a pattern
20165
+ // is a curated spanning tree over a SUBSET of a region (cf. `architecture` over
20166
+ // the engineering_platform DAG). The GTM/value flow (positioning -> messaging
20167
+ // -> funnel) is deliberately NOT here — a tree would misrepresent it; it wants
20168
+ // sibling flow instruments. Company-grain financial metrics (CAC, LTV, runway)
20169
+ // hang off the product, not a single stream/cost, so they live in the okr/
20170
+ // strategy views, not this money-structure spine.
20171
+ region: "business_gtm_growth",
20172
+ gap_policy: "all-optional",
20173
+ anchor_type: "business_model",
20174
+ // Fallback is the product alone, and product is deliberately NOT a child_map
20175
+ // parent: were business_model listed under product, the product would be a
20176
+ // superset of the money spine and the most-nodes anchor rule would root there
20177
+ // (the same trap delivery hit with product -> roadmap). With product childless,
20178
+ // business_model always out-nodes it and wins; a graph with no business_model
20179
+ // falls back to a bare product root, reported anchor_resolved_from: business_model.
20180
+ fallback_anchors: ["product"],
20181
+ child_map: {
20182
+ business_model: [opt("revenue_stream"), opt("cost_structure"), opt("unit_economics")],
20183
+ revenue_stream: [opt("pricing_tier"), opt("metric"), opt("pricing_strategy")],
20184
+ cost_structure: [opt("metric")],
20185
+ pricing_strategy: [opt("pricing_tier")],
20186
+ // Self-nesting: a metric decomposes into its component metrics (Net New MRR ->
20187
+ // New/Expansion/Contraction/Churned). The assembler's `seen` set terminates
20188
+ // the recursion for free (a metric met again becomes a shared reference).
20189
+ metric: [opt("metric")]
20190
+ },
20191
+ // Default to 3 tiers (business_model -> stream/cost -> tier/metric) for a
20192
+ // readable money-model overview; `depth` extends into the metric -> metric
20193
+ // decomposition waterfall.
20194
+ natural_depth: 3
20151
20195
  }
20152
20196
  ];
20153
20197
  var UPG_TREE_PATTERNS_BY_ID = Object.fromEntries(
@@ -20169,7 +20213,10 @@ function resolveTreePatternEdges(pattern) {
20169
20213
  for (const [parent, children] of Object.entries(pattern.child_map)) {
20170
20214
  for (const c of children) {
20171
20215
  const e = resolvePatternEdge(parent, c.type);
20172
- out.push({ parent, child: c.type, via: e?.via ?? null, kind: e?.kind ?? null, required: !!c.required });
20216
+ const row = { parent, child: c.type, via: e?.via ?? null, kind: e?.kind ?? null, required: !!c.required };
20217
+ if (c.order_by) row.order_by = c.order_by;
20218
+ if (c.prefer_via) row.prefer_via = c.prefer_via;
20219
+ out.push(row);
20173
20220
  }
20174
20221
  }
20175
20222
  return out;
@@ -28556,7 +28603,7 @@ function isCanonical(text) {
28556
28603
  }
28557
28604
 
28558
28605
  // src/index.ts
28559
- var UPG_VERSION = "0.11.3";
28606
+ var UPG_VERSION = "0.11.5";
28560
28607
  var UPG_FORMAT_VERSION = "0.4.0";
28561
28608
  var MARKDOWN_FORMAT_VERSION = "0.1";
28562
28609
  var UPG_TYPES = getTypes();