@unified-product-graph/core 0.12.7 → 0.12.8

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.cjs CHANGED
@@ -38,7 +38,10 @@ __export(index_exports, {
38
38
  MARKET_COMPETITIVE_PLAYBOOK: () => MARKET_COMPETITIVE_PLAYBOOK,
39
39
  OPERATIONS_QUALITY_PLAYBOOK: () => OPERATIONS_QUALITY_PLAYBOOK,
40
40
  PRODUCT_DELIVERY_PLAYBOOK: () => PRODUCT_DELIVERY_PLAYBOOK,
41
+ PROPERTY_MODIFIERS: () => PROPERTY_MODIFIERS,
42
+ PROPERTY_MODIFIER_SEMANTICS: () => PROPERTY_MODIFIER_SEMANTICS,
41
43
  PROPERTY_SCALE_MAP: () => PROPERTY_SCALE_MAP,
44
+ RECORD_ENTITY_TYPES: () => RECORD_ENTITY_TYPES,
42
45
  REFLECT_MODES: () => REFLECT_MODES,
43
46
  REGISTRY_PRODUCT_ID: () => REGISTRY_PRODUCT_ID,
44
47
  STRATEGY_OUTCOMES_PLAYBOOK: () => STRATEGY_OUTCOMES_PLAYBOOK,
@@ -140,6 +143,7 @@ __export(index_exports, {
140
143
  getDomainIdForType: () => getDomainIdForType,
141
144
  getDomainsInRing: () => getDomainsInRing,
142
145
  getEdgePropertySchema: () => getEdgePropertySchema,
146
+ getEntityModifierSummary: () => getEntityModifierSummary,
143
147
  getEnumScale: () => getEnumScale,
144
148
  getEnumValueMeta: () => getEnumValueMeta,
145
149
  getGuideForDomain: () => getGuideForDomain,
@@ -155,6 +159,7 @@ __export(index_exports, {
155
159
  getPropertiesForScale: () => getPropertiesForScale,
156
160
  getPropertyDefaultScale: () => getPropertyDefaultScale,
157
161
  getPropertyMigrations: () => getPropertyMigrations,
162
+ getPropertyModifier: () => getPropertyModifier,
158
163
  getPropertySchema: () => getPropertySchema,
159
164
  getRegion: () => getRegion,
160
165
  getRegionForEntityType: () => getRegionForEntityType,
@@ -171,6 +176,7 @@ __export(index_exports, {
171
176
  getValidChildren: () => getValidChildren,
172
177
  getVisibleTypes: () => getVisibleTypes,
173
178
  hasStatusMigration: () => hasStatusMigration,
179
+ isAggregateShapedProperty: () => isAggregateShapedProperty,
174
180
  isCanonical: () => isCanonical,
175
181
  isCanonicalProductStage: () => isCanonicalProductStage,
176
182
  isContainmentFreeType: () => isContainmentFreeType,
@@ -183,9 +189,12 @@ __export(index_exports, {
183
189
  isLifecyclePlannedType: () => isLifecyclePlannedType,
184
190
  isPolymorphicEdge: () => isPolymorphicEdge,
185
191
  isPortfolio: () => isPortfolio,
192
+ isRecordEntity: () => isRecordEntity,
186
193
  isRegisteredPolymorphicEdge: () => isRegisteredPolymorphicEdge,
194
+ isRuntimeStateShapedProperty: () => isRuntimeStateShapedProperty,
187
195
  isSubSequenceStep: () => isSubSequenceStep,
188
196
  isUPGDocument: () => isUPGDocument,
197
+ listPropertiesByModifier: () => listPropertiesByModifier,
189
198
  listStatusMigrations: () => listStatusMigrations,
190
199
  listTreePatternSummaries: () => listTreePatternSummaries,
191
200
  migrateEdge: () => migrateEdge,
@@ -19423,6 +19432,62 @@ function isUPGDocument(doc) {
19423
19432
  return validateUPGDocument(doc).valid;
19424
19433
  }
19425
19434
 
19435
+ // src/properties/property-modifiers.ts
19436
+ var PROPERTY_MODIFIERS = ["derived", "snapshot", "volatile"];
19437
+ var PROPERTY_MODIFIER_SEMANTICS = {
19438
+ derived: "Computed from edges/children at read-time; never hand-authored. A stored value that contradicts the graph is a smell.",
19439
+ snapshot: "A stale-stamped cache of a live reading; SHOULD pair with a `*_as_of` timestamp. Definition entities carry live state only as a snapshot.",
19440
+ volatile: "An environment-specific pointer (URL / path / id) that may rot or be stripped on export; not portable modeling knowledge."
19441
+ };
19442
+ function listPropertiesByModifier(modifier) {
19443
+ const out = [];
19444
+ for (const [type, props] of Object.entries(UPG_PROPERTY_SCHEMA)) {
19445
+ for (const [property, def] of Object.entries(props)) {
19446
+ const m = def?.modifier;
19447
+ if (!m) continue;
19448
+ if (modifier && m !== modifier) continue;
19449
+ out.push({ type, property, modifier: m });
19450
+ }
19451
+ }
19452
+ return out;
19453
+ }
19454
+ function getPropertyModifier(entityType, property) {
19455
+ return UPG_PROPERTY_SCHEMA[entityType]?.[property]?.modifier;
19456
+ }
19457
+ function getEntityModifierSummary(entityType) {
19458
+ const props = UPG_PROPERTY_SCHEMA[entityType];
19459
+ if (!props) return void 0;
19460
+ const summary = { derived: [], snapshot: [], volatile: [] };
19461
+ let any = false;
19462
+ for (const [property, def] of Object.entries(props)) {
19463
+ const m = def?.modifier;
19464
+ if (!m) continue;
19465
+ summary[m].push(property);
19466
+ any = true;
19467
+ }
19468
+ return any ? summary : void 0;
19469
+ }
19470
+ var RECORD_ENTITY_TYPES = /* @__PURE__ */ new Set([
19471
+ "ai_cost_tracker",
19472
+ "eval_run",
19473
+ "test_result",
19474
+ "agent_session",
19475
+ "cohort",
19476
+ "ai_trace",
19477
+ "workflow_run"
19478
+ ]);
19479
+ function isRecordEntity(entityType) {
19480
+ return RECORD_ENTITY_TYPES.has(entityType);
19481
+ }
19482
+ function isAggregateShapedProperty(name, def) {
19483
+ if (def?.type !== "number") return false;
19484
+ return name.endsWith("_count") || name === "headcount";
19485
+ }
19486
+ function isRuntimeStateShapedProperty(name, def) {
19487
+ if (def?.type !== "number") return false;
19488
+ return /_rate$/.test(name) || /_pct$/.test(name) || /^current_/.test(name) || /_remaining$/.test(name) || /_p\d+_/.test(name) || /^monthly_/.test(name) || /_per_/.test(name);
19489
+ }
19490
+
19426
19491
  // src/properties/edge-property-validation.ts
19427
19492
  function validateEdgeProperties(edgeType, properties) {
19428
19493
  const schema = getEdgePropertySchema(edgeType);
@@ -29465,7 +29530,7 @@ function isCanonical(text) {
29465
29530
  }
29466
29531
 
29467
29532
  // src/index.ts
29468
- var UPG_VERSION = "0.12.7";
29533
+ var UPG_VERSION = "0.12.8";
29469
29534
  var UPG_FORMAT_VERSION = "0.4.0";
29470
29535
  var MARKDOWN_FORMAT_VERSION = "0.1";
29471
29536
  var UPG_TYPES = getTypes();
@@ -29548,7 +29613,10 @@ var UPG_META_COUNT = UPG_ENTITY_META.length;
29548
29613
  MARKET_COMPETITIVE_PLAYBOOK,
29549
29614
  OPERATIONS_QUALITY_PLAYBOOK,
29550
29615
  PRODUCT_DELIVERY_PLAYBOOK,
29616
+ PROPERTY_MODIFIERS,
29617
+ PROPERTY_MODIFIER_SEMANTICS,
29551
29618
  PROPERTY_SCALE_MAP,
29619
+ RECORD_ENTITY_TYPES,
29552
29620
  REFLECT_MODES,
29553
29621
  REGISTRY_PRODUCT_ID,
29554
29622
  STRATEGY_OUTCOMES_PLAYBOOK,
@@ -29650,6 +29718,7 @@ var UPG_META_COUNT = UPG_ENTITY_META.length;
29650
29718
  getDomainIdForType,
29651
29719
  getDomainsInRing,
29652
29720
  getEdgePropertySchema,
29721
+ getEntityModifierSummary,
29653
29722
  getEnumScale,
29654
29723
  getEnumValueMeta,
29655
29724
  getGuideForDomain,
@@ -29665,6 +29734,7 @@ var UPG_META_COUNT = UPG_ENTITY_META.length;
29665
29734
  getPropertiesForScale,
29666
29735
  getPropertyDefaultScale,
29667
29736
  getPropertyMigrations,
29737
+ getPropertyModifier,
29668
29738
  getPropertySchema,
29669
29739
  getRegion,
29670
29740
  getRegionForEntityType,
@@ -29681,6 +29751,7 @@ var UPG_META_COUNT = UPG_ENTITY_META.length;
29681
29751
  getValidChildren,
29682
29752
  getVisibleTypes,
29683
29753
  hasStatusMigration,
29754
+ isAggregateShapedProperty,
29684
29755
  isCanonical,
29685
29756
  isCanonicalProductStage,
29686
29757
  isContainmentFreeType,
@@ -29693,9 +29764,12 @@ var UPG_META_COUNT = UPG_ENTITY_META.length;
29693
29764
  isLifecyclePlannedType,
29694
29765
  isPolymorphicEdge,
29695
29766
  isPortfolio,
29767
+ isRecordEntity,
29696
29768
  isRegisteredPolymorphicEdge,
29769
+ isRuntimeStateShapedProperty,
29697
29770
  isSubSequenceStep,
29698
29771
  isUPGDocument,
29772
+ listPropertiesByModifier,
29699
29773
  listStatusMigrations,
29700
29774
  listTreePatternSummaries,
29701
29775
  migrateEdge,