@myvitalrx/metadata-runtime 1.11.0 → 1.12.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.
package/dist/index.d.ts CHANGED
@@ -309,6 +309,15 @@ interface ProjectionManifest {
309
309
  * Generated automatically from domain projection records at publish time.
310
310
  */
311
311
  lookupIndex: Record<string, ManifestLookupIndexEntry>;
312
+ /**
313
+ * Present when this release retains latest INACTIVE values and relationships.
314
+ * Older releases omit it. Explicit INACTIVE or ALL value queries must not
315
+ * treat that omission as an empty inactive catalogue.
316
+ */
317
+ lifecycle?: {
318
+ values: 'activeAndInactive';
319
+ relations: 'activeAndInactive';
320
+ };
312
321
  /**
313
322
  * Optional localization projection artifacts published in this release.
314
323
  */
@@ -492,6 +501,40 @@ declare class StructuredLogger {
492
501
  verbose(entry: LogEntry): void;
493
502
  }
494
503
 
504
+ /**
505
+ * Governed metadata lifecycle.
506
+ *
507
+ * Registry and relation rows use `ACTIVE` / `INACTIVE`.
508
+ * Projection value entries use camelCase `active` / `inactive`.
509
+ * Comparisons accept both casings. `DELETED` is never a lifecycle query hit.
510
+ */
511
+ declare const METADATA_STATUS: {
512
+ readonly ACTIVE: "ACTIVE";
513
+ readonly INACTIVE: "INACTIVE";
514
+ };
515
+ type MetadataStatus = (typeof METADATA_STATUS)[keyof typeof METADATA_STATUS];
516
+ declare const METADATA_STATUS_FILTER: {
517
+ readonly ACTIVE: "ACTIVE";
518
+ readonly INACTIVE: "INACTIVE";
519
+ readonly ALL: "ALL";
520
+ };
521
+ type MetadataStatusFilter = (typeof METADATA_STATUS_FILTER)[keyof typeof METADATA_STATUS_FILTER];
522
+
523
+ /**
524
+ * In-memory buckets for one typed catalog.
525
+ * Built once per loaded release. Lookups read one endpoint bucket.
526
+ */
527
+ type TypedRelationStatusBuckets = ReadonlyMap<MetadataStatus, ReadonlyMap<string, readonly TypedProjectionRelation[]>>;
528
+ type TypedRelationIndex = {
529
+ /** False when any row is missing a required field. Queries must not succeed. */
530
+ complete: boolean;
531
+ outgoing: ReadonlyMap<string, readonly TypedProjectionRelation[]>;
532
+ incoming: ReadonlyMap<string, readonly TypedProjectionRelation[]>;
533
+ /** Endpoint buckets split by relationship status. Default queries read ACTIVE only. */
534
+ outgoingByStatus: TypedRelationStatusBuckets;
535
+ incomingByStatus: TypedRelationStatusBuckets;
536
+ };
537
+
495
538
  declare const PUBLISHED_VALUE_SORT: {
496
539
  readonly SORT_ORDER: "sortOrder";
497
540
  readonly VALUE_CODE: "valueCode";
@@ -566,6 +609,8 @@ type MetadataCacheSnapshot = {
566
609
  * Undefined when the release does not publish the catalog.
567
610
  */
568
611
  readonly typedRelations?: readonly TypedProjectionRelation[];
612
+ /** Built once when `typedRelations` is installed. */
613
+ readonly typedRelationIndex?: TypedRelationIndex;
569
614
  readonly manifest: ProjectionManifest;
570
615
  readonly localization?: ReadonlyMap<string, ReadonlyMap<string, string>>;
571
616
  };
@@ -1192,6 +1237,7 @@ declare class MetadataCache implements ReadModelCache<MetadataCacheSnapshot, Pro
1192
1237
  getRelationshipIndex(): RelationshipIndex | undefined;
1193
1238
  /** Undefined when the active release has no typed relation catalog. */
1194
1239
  getTypedRelations(): readonly TypedProjectionRelation[] | undefined;
1240
+ getTypedRelationIndex(): TypedRelationIndex | undefined;
1195
1241
  getLocalization(locale: string): ReadonlyMap<string, string> | undefined;
1196
1242
  getLocalizationMap(locale: string): ReadonlyMap<string, string> | undefined;
1197
1243
  getLocalizationValue(key: string, locale?: string): string | undefined;
@@ -1387,14 +1433,22 @@ type MetadataResolveOptions = {
1387
1433
  /**
1388
1434
  * Include latest INACTIVE values from `inactiveRecords`.
1389
1435
  * Default lookups stay active-record only.
1436
+ * Prefer `status` for new callers. `includeInactive: true` remains ALL.
1390
1437
  */
1391
1438
  includeInactive?: boolean;
1439
+ /**
1440
+ * Lifecycle filter. Omitted and `ACTIVE` return active records.
1441
+ * `INACTIVE` and `ALL` fail when the release has no lifecycle coverage.
1442
+ */
1443
+ status?: MetadataStatusFilter;
1392
1444
  };
1393
1445
  type MetadataRelationQuery = {
1394
1446
  fromType: string;
1395
1447
  fromValue: string;
1396
1448
  relationType?: string;
1397
1449
  toType?: string;
1450
+ /** Omitted is ACTIVE. */
1451
+ status?: MetadataStatusFilter;
1398
1452
  };
1399
1453
  type MetadataRelationRow = TypedProjectionRelation;
1400
1454
  type MetadataRelationListResult = {
@@ -1432,6 +1486,14 @@ type MetadataProviderStatus = {
1432
1486
  metadataTypes?: readonly string[];
1433
1487
  /** Present when the extension recorded a load or refresh failure. */
1434
1488
  lastError?: string | null;
1489
+ /**
1490
+ * Whether the loaded release can answer explicit INACTIVE and ALL queries.
1491
+ * Absent on extension builds that predate lifecycle coverage.
1492
+ */
1493
+ lifecycle?: {
1494
+ values: boolean;
1495
+ relations: boolean;
1496
+ };
1435
1497
  };
1436
1498
  type MetadataBatchResult = {
1437
1499
  releaseId: string | null;
@@ -1563,6 +1625,11 @@ interface MetadataRelationshipQuery {
1563
1625
  targetTypeCode?: string;
1564
1626
  relationType?: string;
1565
1627
  direction?: MetadataRelationDirection;
1628
+ /**
1629
+ * Omitted is ACTIVE. `INACTIVE` and `ALL` are not answered from
1630
+ * `relationship-index.json`.
1631
+ */
1632
+ status?: MetadataStatusFilter;
1566
1633
  releaseId?: string;
1567
1634
  readPolicy?: MetadataReadPolicy;
1568
1635
  }
@@ -1927,6 +1994,7 @@ declare class ExtensionMetadataProvider implements MetadataProvider, MetadataDis
1927
1994
  private readonly readyTimeoutMs;
1928
1995
  private readonly requestTimeoutMs;
1929
1996
  private readonly logger;
1997
+ private lifecycleSupport?;
1930
1998
  private readonly fetchImpl;
1931
1999
  constructor(options: ExtensionMetadataProviderOptions);
1932
2000
  isAvailable(): Promise<boolean>;
@@ -1948,6 +2016,7 @@ declare class ExtensionMetadataProvider implements MetadataProvider, MetadataDis
1948
2016
  getLocalizationValue(keyOrTypeCode: string, valueCodeOrLocale?: string, maybeLocale?: string): Promise<string | undefined>;
1949
2017
  getLocalizationMap(locale: string): Promise<Record<string, string> | undefined>;
1950
2018
  requestRefresh(releaseId?: string): Promise<boolean>;
2019
+ private assertQueryLifecycle;
1951
2020
  private toMetadataValue;
1952
2021
  private assertDiscoveryPolicy;
1953
2022
  private requestJson;
@@ -1986,6 +2055,9 @@ declare class S3MetadataProvider implements MetadataProvider, MetadataDiscoveryP
1986
2055
  private prepareDiscoveryRead;
1987
2056
  private listLoadedType;
1988
2057
  private isKnownType;
2058
+ private valueFilter;
2059
+ private relatedGroupsForStatus;
2060
+ private relatedGroupsFromAdjacency;
1989
2061
  }
1990
2062
  declare function relatedValueCodes(index: RelationshipIndex | undefined, sourceTypeCode: string, sourceValueCode: string, targetTypeCode: string): string[];
1991
2063
  /** S3 client is owned by RuntimeMetadataService; listed for documentation. */
@@ -2008,6 +2080,11 @@ type InMemoryMetadataProviderOptions = {
2008
2080
  * Types present on `records` are known without being listed here.
2009
2081
  */
2010
2082
  knownTypeCodes?: readonly string[];
2083
+ /**
2084
+ * When false, explicit INACTIVE and ALL queries fail.
2085
+ * Default true so in-memory catalogues can answer lifecycle filters.
2086
+ */
2087
+ lifecycleSupported?: boolean;
2011
2088
  };
2012
2089
  /**
2013
2090
  * Test / local provider. Never talks to S3 or the extension.
@@ -2019,7 +2096,11 @@ declare class InMemoryMetadataProvider implements MetadataProvider, MetadataDisc
2019
2096
  private readonly byKey;
2020
2097
  private readonly related;
2021
2098
  private readonly relations;
2099
+ private readonly typedRelationIndex;
2022
2100
  private readonly knownTypeCodes;
2101
+ private readonly lifecycleSupported;
2102
+ private readonly activeByType;
2103
+ private readonly inactiveByType;
2023
2104
  constructor(options?: InMemoryMetadataProviderOptions);
2024
2105
  isAvailable(): Promise<boolean>;
2025
2106
  setUnavailable(unavailable: boolean): void;
@@ -2041,6 +2122,9 @@ declare class InMemoryMetadataProvider implements MetadataProvider, MetadataDisc
2041
2122
  getRelationships(query: MetadataRelationshipQuery): Promise<MetadataRelationshipResult>;
2042
2123
  private listOneType;
2043
2124
  private hasType;
2125
+ private indexRecords;
2126
+ private readFilter;
2127
+ private recordsForFilter;
2044
2128
  private assertReadable;
2045
2129
  }
2046
2130