@myvitalrx/metadata-runtime 1.11.0 → 1.13.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 +88 -2
- package/dist/index.js +942 -135
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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
|
}
|
|
@@ -1889,7 +1956,9 @@ declare function onMetadataProjectionCompleted(releaseId?: string): Promise<bool
|
|
|
1889
1956
|
* 1. Add `@api-hub/runtime-metadata` (+ `@api-hub/runtime-response-projector` if enriching HTTP)
|
|
1890
1957
|
* 2. Copy IAM pattern against `{stage}-mvx-metadata-projections-bucket`
|
|
1891
1958
|
* (or ImportValue `{stage}-metadata-projection-runtime-ProjectionsBucketName`)
|
|
1892
|
-
* 3. Set `METADATA_PROJECTIONS_BUCKET`
|
|
1959
|
+
* 3. Set `METADATA_PROJECTIONS_BUCKET`, `METADATA_EXTENSION_ENABLED`, and
|
|
1960
|
+
* `PROJECTION_ENVIRONMENT`. Host, port, prefix, S3 fallback, recovery,
|
|
1961
|
+
* startup, invoke refresh, and check interval have SDK and extension defaults.
|
|
1893
1962
|
* 4. Prefer platform default response projector (demand-driven); do not register
|
|
1894
1963
|
* metadata warm-up as `beforeHandler`
|
|
1895
1964
|
* 5. Do not add an EventBridge consumer merely to notify every warm Lambda.
|
|
@@ -1927,6 +1996,7 @@ declare class ExtensionMetadataProvider implements MetadataProvider, MetadataDis
|
|
|
1927
1996
|
private readonly readyTimeoutMs;
|
|
1928
1997
|
private readonly requestTimeoutMs;
|
|
1929
1998
|
private readonly logger;
|
|
1999
|
+
private lifecycleSupport?;
|
|
1930
2000
|
private readonly fetchImpl;
|
|
1931
2001
|
constructor(options: ExtensionMetadataProviderOptions);
|
|
1932
2002
|
isAvailable(): Promise<boolean>;
|
|
@@ -1948,6 +2018,7 @@ declare class ExtensionMetadataProvider implements MetadataProvider, MetadataDis
|
|
|
1948
2018
|
getLocalizationValue(keyOrTypeCode: string, valueCodeOrLocale?: string, maybeLocale?: string): Promise<string | undefined>;
|
|
1949
2019
|
getLocalizationMap(locale: string): Promise<Record<string, string> | undefined>;
|
|
1950
2020
|
requestRefresh(releaseId?: string): Promise<boolean>;
|
|
2021
|
+
private assertQueryLifecycle;
|
|
1951
2022
|
private toMetadataValue;
|
|
1952
2023
|
private assertDiscoveryPolicy;
|
|
1953
2024
|
private requestJson;
|
|
@@ -1986,6 +2057,9 @@ declare class S3MetadataProvider implements MetadataProvider, MetadataDiscoveryP
|
|
|
1986
2057
|
private prepareDiscoveryRead;
|
|
1987
2058
|
private listLoadedType;
|
|
1988
2059
|
private isKnownType;
|
|
2060
|
+
private valueFilter;
|
|
2061
|
+
private relatedGroupsForStatus;
|
|
2062
|
+
private relatedGroupsFromAdjacency;
|
|
1989
2063
|
}
|
|
1990
2064
|
declare function relatedValueCodes(index: RelationshipIndex | undefined, sourceTypeCode: string, sourceValueCode: string, targetTypeCode: string): string[];
|
|
1991
2065
|
/** S3 client is owned by RuntimeMetadataService; listed for documentation. */
|
|
@@ -2008,6 +2082,11 @@ type InMemoryMetadataProviderOptions = {
|
|
|
2008
2082
|
* Types present on `records` are known without being listed here.
|
|
2009
2083
|
*/
|
|
2010
2084
|
knownTypeCodes?: readonly string[];
|
|
2085
|
+
/**
|
|
2086
|
+
* When false, explicit INACTIVE and ALL queries fail.
|
|
2087
|
+
* Default true so in-memory catalogues can answer lifecycle filters.
|
|
2088
|
+
*/
|
|
2089
|
+
lifecycleSupported?: boolean;
|
|
2011
2090
|
};
|
|
2012
2091
|
/**
|
|
2013
2092
|
* Test / local provider. Never talks to S3 or the extension.
|
|
@@ -2019,7 +2098,11 @@ declare class InMemoryMetadataProvider implements MetadataProvider, MetadataDisc
|
|
|
2019
2098
|
private readonly byKey;
|
|
2020
2099
|
private readonly related;
|
|
2021
2100
|
private readonly relations;
|
|
2101
|
+
private readonly typedRelationIndex;
|
|
2022
2102
|
private readonly knownTypeCodes;
|
|
2103
|
+
private readonly lifecycleSupported;
|
|
2104
|
+
private readonly activeByType;
|
|
2105
|
+
private readonly inactiveByType;
|
|
2023
2106
|
constructor(options?: InMemoryMetadataProviderOptions);
|
|
2024
2107
|
isAvailable(): Promise<boolean>;
|
|
2025
2108
|
setUnavailable(unavailable: boolean): void;
|
|
@@ -2041,6 +2124,9 @@ declare class InMemoryMetadataProvider implements MetadataProvider, MetadataDisc
|
|
|
2041
2124
|
getRelationships(query: MetadataRelationshipQuery): Promise<MetadataRelationshipResult>;
|
|
2042
2125
|
private listOneType;
|
|
2043
2126
|
private hasType;
|
|
2127
|
+
private indexRecords;
|
|
2128
|
+
private readFilter;
|
|
2129
|
+
private recordsForFilter;
|
|
2044
2130
|
private assertReadable;
|
|
2045
2131
|
}
|
|
2046
2132
|
|
|
@@ -2049,7 +2135,7 @@ declare const PROVIDER_TRANSPORT_STATE: {
|
|
|
2049
2135
|
readonly EXTENSION_UNAVAILABLE: "EXTENSION_UNAVAILABLE";
|
|
2050
2136
|
};
|
|
2051
2137
|
type ProviderTransportState = (typeof PROVIDER_TRANSPORT_STATE)[keyof typeof PROVIDER_TRANSPORT_STATE];
|
|
2052
|
-
declare const DEFAULT_PROVIDER_RECOVERY_COOLDOWN_MS
|
|
2138
|
+
declare const DEFAULT_PROVIDER_RECOVERY_COOLDOWN_MS: 2000;
|
|
2053
2139
|
type ProviderFailoverCoordinatorOptions = {
|
|
2054
2140
|
extension: MetadataProvider;
|
|
2055
2141
|
fallback?: MetadataProvider;
|