@myvitalrx/metadata-runtime 1.14.0 → 1.16.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/README.md CHANGED
@@ -817,8 +817,22 @@ const validIn = await metadata.getRelationships({
817
817
  releaseId: session.releaseId,
818
818
  readPolicy: session.readPolicy,
819
819
  });
820
+
821
+ const catalogueRelations = await metadata.queryRelationships([
822
+ {
823
+ sourceTypeCode: 'Module',
824
+ sourceValueCode: 'RPM_VITALS',
825
+ targetTypeCode: 'Feature',
826
+ relationType: 'PARENT_CHILD',
827
+ direction: 'OUTGOING',
828
+ releaseId: session.releaseId,
829
+ readPolicy: session.readPolicy,
830
+ },
831
+ ]);
820
832
  ```
821
833
 
834
+ `queryRelationships` returns one result per query, in request order. The extension client sends at most 100 queries per request. One query uses `POST /v1/metadata/relationships/query`. Several queries use `POST /v1/metadata/relationships/batch`. Concurrent `getRelationships` calls started in the same turn are grouped the same way. Relationship lookups do not call `GET /v1/status` first. `getRelationships` and `getRelatedValues` keep their current signatures. `getRelatedValueGroups` is the batch form of `getRelatedValues`.
835
+
822
836
  Pass the same `releaseId` on every call in one catalogue build. If a refresh activates another release, the call fails with `MetadataReleaseMismatchError` instead of mixing releases. Start a new session and rebuild the catalogue.
823
837
 
824
838
  `REQUIRE_FRESH` accepts only a projection whose status is ready. `STALE` and `DEGRADED` fail with `MetadataFreshnessError`. The default remains `ALLOW_STALE`, including for these new methods. A strict read does not fall through to S3 when the extension cannot prove freshness.
@@ -831,6 +845,9 @@ Extension routes, also additive:
831
845
  GET /v1/metadata/types/{typeCode}/values
832
846
  POST /v1/metadata/types/values
833
847
  POST /v1/metadata/relationships/query
848
+ POST /v1/metadata/relationships/batch
834
849
  ```
835
850
 
836
- `GET /v1/metadata/{typeCode}` and `GET /v1/relations` are unchanged. On a cold extension the new relationship route loads `typed-relations.json` into a side cache so the older route keeps its previous bootstrap response.
851
+ The batch route accepts `{ releaseId, readPolicy, queries }` and returns `{ releaseId, results }` in the same order. More than 100 queries, or a body over 256 KB, is rejected. A query the index cannot answer sets `errorCode` and `message` on that result. Freshness and an unavailable snapshot fail the whole request. An extension that does not implement the batch route responds with `Unknown extension route`. The SDK does not repeat those queries one by one.
852
+
853
+ `GET /v1/metadata/{typeCode}` and `GET /v1/relations` are unchanged. Cold start loads `relationship-index.json` and `typed-relations.json` into one snapshot. Relationship lookups read that snapshot.
package/dist/index.d.ts CHANGED
@@ -1691,6 +1691,11 @@ interface MetadataRelationshipResult {
1691
1691
  supported: boolean;
1692
1692
  relationships: MetadataRelationship[];
1693
1693
  }
1694
+ /**
1695
+ * Maximum relationship queries in one extension HTTP request.
1696
+ * Keep aligned with the extension `RELATIONSHIP_QUERY_BATCH_LIMIT`.
1697
+ */
1698
+ declare const RELATIONSHIP_QUERY_BATCH_LIMIT = 100;
1694
1699
  interface MetadataReadSession {
1695
1700
  releaseId: string;
1696
1701
  readPolicy: MetadataReadPolicy;
@@ -1702,6 +1707,12 @@ interface MetadataReadSession {
1702
1707
  interface MetadataDiscoveryProvider {
1703
1708
  listValuesByType(typeCode: string, options?: MetadataListOptions): Promise<MetadataListResult>;
1704
1709
  getRelationships(query: MetadataRelationshipQuery): Promise<MetadataRelationshipResult>;
1710
+ /**
1711
+ * Resolve many relationship queries against one release.
1712
+ * Optional so existing providers stay valid. Callers fall back to
1713
+ * {@link getRelationships} when it is absent or the extension route is unsupported.
1714
+ */
1715
+ queryRelationships?(queries: readonly MetadataRelationshipQuery[]): Promise<MetadataRelationshipResult[]>;
1705
1716
  listValuesByTypes(typeCodes: readonly string[], options?: MetadataBatchListOptions): Promise<MetadataBatchListResult>;
1706
1717
  }
1707
1718
  declare function supportsMetadataDiscovery(provider: object): provider is MetadataDiscoveryProvider;
@@ -1908,6 +1919,12 @@ declare class RuntimeMetadataService implements ReadModelProvider<ProjectionEntr
1908
1919
  listValuesByType(typeCode: string, options?: MetadataListOptions): Promise<MetadataListResult>;
1909
1920
  listValuesByTypes(typeCodes: readonly string[], options?: MetadataBatchListOptions): Promise<MetadataBatchListResult>;
1910
1921
  getRelationships(query: MetadataRelationshipQuery): Promise<MetadataRelationshipResult>;
1922
+ /**
1923
+ * Resolve many relationship queries with a bounded number of extension requests.
1924
+ * Providers without a batch method, and extensions that do not implement the
1925
+ * batch route, keep the existing per-query behavior.
1926
+ */
1927
+ queryRelationships(queries: readonly MetadataRelationshipQuery[]): Promise<MetadataRelationshipResult[]>;
1911
1928
  getActiveProviderKind(): MetadataProviderKind;
1912
1929
  getProviderTransportState(): string;
1913
1930
  getExtensionHealthCheckCount(): number;
@@ -2039,6 +2056,12 @@ declare class ExtensionMetadataProvider implements MetadataProvider, MetadataDis
2039
2056
  private readonly requestTimeoutMs;
2040
2057
  private readonly logger;
2041
2058
  private lifecycleSupport?;
2059
+ /** Last release observed in READY state. Not a time-based cache. */
2060
+ private verifiedFreshReleaseId;
2061
+ private readinessCheckCount;
2062
+ private relationshipRequestCount;
2063
+ private pendingRelationships;
2064
+ private relationshipFlushScheduled;
2042
2065
  private readonly fetchImpl;
2043
2066
  constructor(options: ExtensionMetadataProviderOptions);
2044
2067
  isAvailable(): Promise<boolean>;
@@ -2054,6 +2077,15 @@ declare class ExtensionMetadataProvider implements MetadataProvider, MetadataDis
2054
2077
  listValuesByType(typeCode: string, options?: MetadataListOptions): Promise<MetadataListResult>;
2055
2078
  listValuesByTypes(typeCodes: readonly string[], options?: MetadataBatchListOptions): Promise<MetadataBatchListResult>;
2056
2079
  getRelationships(query: MetadataRelationshipQuery): Promise<MetadataRelationshipResult>;
2080
+ /**
2081
+ * One or more extension requests, chunked at {@link RELATIONSHIP_QUERY_BATCH_LIMIT}.
2082
+ * A single query uses the single-query route. Several queries use the batch route.
2083
+ */
2084
+ queryRelationships(queries: readonly MetadataRelationshipQuery[]): Promise<MetadataRelationshipResult[]>;
2085
+ getPerformanceCounters(): {
2086
+ readinessCheckCount: number;
2087
+ relationshipRequestCount: number;
2088
+ };
2057
2089
  listRelations(query: MetadataRelationQuery): Promise<MetadataRelationListResult>;
2058
2090
  getRelatedValues(sourceTypeCode: string, sourceValueCode: string, targetTypeCode: string, options?: MetadataResolveOptions): Promise<MetadataValue[]>;
2059
2091
  getRelatedValueGroups(sourceTypeCode: string, sourceValueCodes: readonly string[], targetTypeCode: string, options?: MetadataResolveOptions): Promise<MetadataRelatedGroup[]>;
@@ -2064,6 +2096,14 @@ declare class ExtensionMetadataProvider implements MetadataProvider, MetadataDis
2064
2096
  private assertQueryLifecycle;
2065
2097
  private toMetadataValue;
2066
2098
  private assertDiscoveryPolicy;
2099
+ private scheduleRelationshipFlush;
2100
+ private flushRelationships;
2101
+ private flushRelationshipGroup;
2102
+ private executeRelationshipGroup;
2103
+ private fetchRelationships;
2104
+ private settleSingleRelationship;
2105
+ private postSingleRelationship;
2106
+ private postRelationshipBatch;
2067
2107
  private requestJson;
2068
2108
  }
2069
2109
  declare function defaultExtensionBaseUrl(port?: number): string;
@@ -2239,4 +2279,4 @@ declare class ProviderFailoverCoordinator {
2239
2279
  }
2240
2280
  declare function isExtensionServing(status: MetadataProviderStatus): boolean;
2241
2281
 
2242
- export { CACHE_STATUS, type CacheStatus, type CandidateDiagnostic, type CollectMetadataDiagnostics, type CollectResponseMetadataOptions, type CreateRuntimeMetadataFromEnvOptions, DEFAULT_EXCLUDED_CODE_FIELDS, DEFAULT_PROVIDER_RECOVERY_COOLDOWN_MS, ExtensionMetadataProvider, type ExtensionMetadataProviderOptions, type ExtensionMetadataTypeInfo, InMemoryMetadataProvider, type InMemoryMetadataProviderOptions, type InMemoryMetadataRecord, InvalidMetadataReferenceError, type ListedMetadataType, type LoadedProjectionBundle, METADATA_ATTRIBUTE_FILTER_KEY, METADATA_PROJECTIONS_BUCKET_ENV, METADATA_PROVIDER_KIND, METADATA_READ_POLICY, METADATA_RELATION_DIRECTION, type ManifestCompareResult, type ManifestLookupIndexEntry, type ManifestMetadataTypeEntry, ManifestValidationError, type MetadataAttributeFilterKey, type MetadataBatchListOptions, type MetadataBatchListResult, type MetadataBatchResult, type MetadataBatchTypeList, MetadataCache, type MetadataCacheSnapshot, type MetadataCacheWriteGuard, MetadataDiscoveryError, type MetadataDiscoveryProvider, MetadataDownloader, type MetadataDownloaderOptions, MetadataExtensionContractError, MetadataFreshnessError, type MetadataHealthReport, MetadataHealthService, type MetadataHealthServiceOptions, type MetadataListOptions, type MetadataListResult, MetadataLoader, type MetadataLoaderOptions, MetadataLookupError, MetadataNotReadyError, MetadataProjectionUnavailableError, type MetadataProvider, type MetadataProviderKind, type MetadataProviderStatus, type MetadataReadPolicy, type MetadataReadSession, type MetadataReference, MetadataRefreshService, type MetadataRefreshServiceOptions, type MetadataRelatedGroup, type MetadataRelationDirection, type MetadataRelationListResult, type MetadataRelationQuery, type MetadataRelationRow, type MetadataRelationship, type MetadataRelationshipQuery, type MetadataRelationshipResult, MetadataReleaseMismatchError, type MetadataResolveOptions, MetadataResolver, type MetadataResolverOptions, type MetadataTypeCatalogInfo, type MetadataValue, NON_METADATA_KEYS, PROVIDER_TRANSPORT_STATE, ProjectionDownloadError, type ProjectionEntry, type ProjectionVersionEntry, ProviderFailoverCoordinator, type ProviderFailoverCoordinatorOptions, type ProviderTransportState, REFRESH_STATUS, RUNTIME_METADATA_EVENTS, RUNTIME_METADATA_INTEGRATION_TARGETS, RUNTIME_METADATA_TYPE_CODE_ALIASES, type ReadModelArtifact, type ReadModelBundle, type ReadModelCache, type ReadModelCacheLoader, type ReadModelDownloader, type ReadModelGroupDescriptor, type ReadModelGroupId, type ReadModelManifestGroupView, type ReadModelManifestGroups, type ReadModelProvider, type ReadModelRefreshCoordinator, type ReadModelResolver, type RefreshStatus, type ResolvableMetadataType, type ResolvedProjectionEntry, type RuntimeMetadataConfig, type RuntimeMetadataConfigInput, RuntimeMetadataError, RuntimeMetadataService, type RuntimeMetadataServiceOptions, S3MetadataProvider, type S3MetadataProviderClient, type S3MetadataProviderOptions, type SelectMetadataProviderInput, type SelectedMetadataProvider, UnknownMetadataTypeError, WORKFLOW_STEP_RULE_KEYS, assertMetadataReadPolicy, assertReleasePin, canonicalMetadataProjectionsBucketName, collectResponseReferences, collectResponseTypeCodes, createCodeFieldExclusionSet, createRuntimeMetadataFromEnv, defaultExtensionBaseUrl, ensureRuntimeMetadataLoaded, formatMetadataReference, getCandidateTypeCodesForKey, getRuntimeMetadataHealth, getRuntimeMetadataService, hasPotentialMetadata, isCompactMetadataReference, isExtensionEnabled, isExtensionServing, isFreshProjectionState, isMetadataProjectionConfigured, isMetadataProjectionsBucketConfigured, isMetadataReference, isMetadataValueObject, isMetadataValueObjectArray, isWorkflowStepRecord, isWorkflowStepRuleField, localizedLabelFromEntry, manifestLocalizationSchema, metadataGroupFromManifest, metadataValueToReference, normalizeRuntimeMetadataTypeCode, onMetadataProjectionCompleted, parseMetadataReference, projectionEntryToMetadataValue, projectionManifestSchema, readMetadataProjectionsBucket, readModelGroupsFromManifest, relatedValueCodes, resetRuntimeMetadataBootstrapState, resolveMetadataProjectionsBucket, resolveRuntimeMetadataConfig, runtimeMetadataConfigSchema, selectMetadataProvider, supportsMetadataDiscovery, throwPublishedListFailure, tryGetRuntimeMetadataService, tryParseMetadataReference, typeCodeFromCodeFieldName };
2282
+ export { CACHE_STATUS, type CacheStatus, type CandidateDiagnostic, type CollectMetadataDiagnostics, type CollectResponseMetadataOptions, type CreateRuntimeMetadataFromEnvOptions, DEFAULT_EXCLUDED_CODE_FIELDS, DEFAULT_PROVIDER_RECOVERY_COOLDOWN_MS, ExtensionMetadataProvider, type ExtensionMetadataProviderOptions, type ExtensionMetadataTypeInfo, InMemoryMetadataProvider, type InMemoryMetadataProviderOptions, type InMemoryMetadataRecord, InvalidMetadataReferenceError, type ListedMetadataType, type LoadedProjectionBundle, METADATA_ATTRIBUTE_FILTER_KEY, METADATA_PROJECTIONS_BUCKET_ENV, METADATA_PROVIDER_KIND, METADATA_READ_POLICY, METADATA_RELATION_DIRECTION, type ManifestCompareResult, type ManifestLookupIndexEntry, type ManifestMetadataTypeEntry, ManifestValidationError, type MetadataAttributeFilterKey, type MetadataBatchListOptions, type MetadataBatchListResult, type MetadataBatchResult, type MetadataBatchTypeList, MetadataCache, type MetadataCacheSnapshot, type MetadataCacheWriteGuard, MetadataDiscoveryError, type MetadataDiscoveryProvider, MetadataDownloader, type MetadataDownloaderOptions, MetadataExtensionContractError, MetadataFreshnessError, type MetadataHealthReport, MetadataHealthService, type MetadataHealthServiceOptions, type MetadataListOptions, type MetadataListResult, MetadataLoader, type MetadataLoaderOptions, MetadataLookupError, MetadataNotReadyError, MetadataProjectionUnavailableError, type MetadataProvider, type MetadataProviderKind, type MetadataProviderStatus, type MetadataReadPolicy, type MetadataReadSession, type MetadataReference, MetadataRefreshService, type MetadataRefreshServiceOptions, type MetadataRelatedGroup, type MetadataRelationDirection, type MetadataRelationListResult, type MetadataRelationQuery, type MetadataRelationRow, type MetadataRelationship, type MetadataRelationshipQuery, type MetadataRelationshipResult, MetadataReleaseMismatchError, type MetadataResolveOptions, MetadataResolver, type MetadataResolverOptions, type MetadataTypeCatalogInfo, type MetadataValue, NON_METADATA_KEYS, PROVIDER_TRANSPORT_STATE, ProjectionDownloadError, type ProjectionEntry, type ProjectionVersionEntry, ProviderFailoverCoordinator, type ProviderFailoverCoordinatorOptions, type ProviderTransportState, REFRESH_STATUS, RELATIONSHIP_QUERY_BATCH_LIMIT, RUNTIME_METADATA_EVENTS, RUNTIME_METADATA_INTEGRATION_TARGETS, RUNTIME_METADATA_TYPE_CODE_ALIASES, type ReadModelArtifact, type ReadModelBundle, type ReadModelCache, type ReadModelCacheLoader, type ReadModelDownloader, type ReadModelGroupDescriptor, type ReadModelGroupId, type ReadModelManifestGroupView, type ReadModelManifestGroups, type ReadModelProvider, type ReadModelRefreshCoordinator, type ReadModelResolver, type RefreshStatus, type ResolvableMetadataType, type ResolvedProjectionEntry, type RuntimeMetadataConfig, type RuntimeMetadataConfigInput, RuntimeMetadataError, RuntimeMetadataService, type RuntimeMetadataServiceOptions, S3MetadataProvider, type S3MetadataProviderClient, type S3MetadataProviderOptions, type SelectMetadataProviderInput, type SelectedMetadataProvider, UnknownMetadataTypeError, WORKFLOW_STEP_RULE_KEYS, assertMetadataReadPolicy, assertReleasePin, canonicalMetadataProjectionsBucketName, collectResponseReferences, collectResponseTypeCodes, createCodeFieldExclusionSet, createRuntimeMetadataFromEnv, defaultExtensionBaseUrl, ensureRuntimeMetadataLoaded, formatMetadataReference, getCandidateTypeCodesForKey, getRuntimeMetadataHealth, getRuntimeMetadataService, hasPotentialMetadata, isCompactMetadataReference, isExtensionEnabled, isExtensionServing, isFreshProjectionState, isMetadataProjectionConfigured, isMetadataProjectionsBucketConfigured, isMetadataReference, isMetadataValueObject, isMetadataValueObjectArray, isWorkflowStepRecord, isWorkflowStepRuleField, localizedLabelFromEntry, manifestLocalizationSchema, metadataGroupFromManifest, metadataValueToReference, normalizeRuntimeMetadataTypeCode, onMetadataProjectionCompleted, parseMetadataReference, projectionEntryToMetadataValue, projectionManifestSchema, readMetadataProjectionsBucket, readModelGroupsFromManifest, relatedValueCodes, resetRuntimeMetadataBootstrapState, resolveMetadataProjectionsBucket, resolveRuntimeMetadataConfig, runtimeMetadataConfigSchema, selectMetadataProvider, supportsMetadataDiscovery, throwPublishedListFailure, tryGetRuntimeMetadataService, tryParseMetadataReference, typeCodeFromCodeFieldName };