@myvitalrx/metadata-runtime 1.2.0 → 1.3.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 +18 -1
- package/dist/index.js +135 -20
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1352,6 +1352,11 @@ type MetadataRelationListResult = {
|
|
|
1352
1352
|
supported: boolean;
|
|
1353
1353
|
relations: MetadataRelationRow[];
|
|
1354
1354
|
};
|
|
1355
|
+
/** One source value and its related targets from {@link MetadataProvider.getRelatedValueGroups}. */
|
|
1356
|
+
type MetadataRelatedGroup = {
|
|
1357
|
+
sourceValueCode: string;
|
|
1358
|
+
values: MetadataValue[];
|
|
1359
|
+
};
|
|
1355
1360
|
/**
|
|
1356
1361
|
* Compact lookup item returned by {@link MetadataProvider.getValue} /
|
|
1357
1362
|
* {@link MetadataProvider.batchGet}. Includes the published projection
|
|
@@ -1393,6 +1398,13 @@ interface MetadataProvider {
|
|
|
1393
1398
|
getValue(typeCode: string, valueCode: string, options?: MetadataResolveOptions): Promise<MetadataValue | null>;
|
|
1394
1399
|
batchGet(references: string[], options?: MetadataResolveOptions): Promise<MetadataBatchResult>;
|
|
1395
1400
|
getRelatedValues(sourceTypeCode: string, sourceValueCode: string, targetTypeCode: string, options?: MetadataResolveOptions): Promise<MetadataValue[]>;
|
|
1401
|
+
/**
|
|
1402
|
+
* Related values for many sources of one type.
|
|
1403
|
+
* Extension: one localhost call per chunk against `relationship-index.json`.
|
|
1404
|
+
* S3: the index already in {@link MetadataCache}. Does not change {@link getRelatedValues}.
|
|
1405
|
+
* Empty `sourceValueCodes` returns `[]`. Order follows `sourceValueCodes`.
|
|
1406
|
+
*/
|
|
1407
|
+
getRelatedValueGroups(sourceTypeCode: string, sourceValueCodes: readonly string[], targetTypeCode: string, options?: MetadataResolveOptions): Promise<MetadataRelatedGroup[]>;
|
|
1396
1408
|
getStatus(): Promise<MetadataProviderStatus>;
|
|
1397
1409
|
isAvailable(): Promise<boolean>;
|
|
1398
1410
|
/**
|
|
@@ -1608,6 +1620,7 @@ declare class RuntimeMetadataService implements ReadModelProvider<ProjectionEntr
|
|
|
1608
1620
|
getValue(typeCode: string, valueCode: string, options?: MetadataResolveOptions): Promise<MetadataValue | null>;
|
|
1609
1621
|
batchGet(references: string[], options?: MetadataResolveOptions): Promise<MetadataBatchResult>;
|
|
1610
1622
|
getRelatedValues(sourceTypeCode: string, sourceValueCode: string, targetTypeCode: string, options?: MetadataResolveOptions): Promise<MetadataValue[]>;
|
|
1623
|
+
getRelatedValueGroups(sourceTypeCode: string, sourceValueCodes: readonly string[], targetTypeCode: string, options?: MetadataResolveOptions): Promise<MetadataRelatedGroup[]>;
|
|
1611
1624
|
listRelations(query: MetadataRelationQuery): Promise<MetadataRelationListResult>;
|
|
1612
1625
|
listTypeValues(typeCode: string, options?: MetadataResolveOptions): Promise<ListedMetadataType | null>;
|
|
1613
1626
|
getActiveProviderKind(): MetadataProviderKind;
|
|
@@ -1750,6 +1763,7 @@ declare class ExtensionMetadataProvider implements MetadataProvider {
|
|
|
1750
1763
|
listTypeValues(typeCode: string, options?: MetadataResolveOptions): Promise<ListedMetadataType | null>;
|
|
1751
1764
|
listRelations(query: MetadataRelationQuery): Promise<MetadataRelationListResult>;
|
|
1752
1765
|
getRelatedValues(sourceTypeCode: string, sourceValueCode: string, targetTypeCode: string, options?: MetadataResolveOptions): Promise<MetadataValue[]>;
|
|
1766
|
+
getRelatedValueGroups(sourceTypeCode: string, sourceValueCodes: readonly string[], targetTypeCode: string, options?: MetadataResolveOptions): Promise<MetadataRelatedGroup[]>;
|
|
1753
1767
|
getLocalizationValue(keyOrTypeCode: string, valueCodeOrLocale?: string, maybeLocale?: string): Promise<string | undefined>;
|
|
1754
1768
|
getLocalizationMap(locale: string): Promise<Record<string, string> | undefined>;
|
|
1755
1769
|
requestRefresh(releaseId?: string): Promise<boolean>;
|
|
@@ -1782,6 +1796,7 @@ declare class S3MetadataProvider implements MetadataProvider {
|
|
|
1782
1796
|
batchGet(references: string[], options?: MetadataResolveOptions): Promise<MetadataBatchResult>;
|
|
1783
1797
|
listRelations(query: MetadataRelationQuery): Promise<MetadataRelationListResult>;
|
|
1784
1798
|
getRelatedValues(sourceTypeCode: string, sourceValueCode: string, targetTypeCode: string, options?: MetadataResolveOptions): Promise<MetadataValue[]>;
|
|
1799
|
+
getRelatedValueGroups(sourceTypeCode: string, sourceValueCodes: readonly string[], targetTypeCode: string, options?: MetadataResolveOptions): Promise<MetadataRelatedGroup[]>;
|
|
1785
1800
|
listTypeValues(typeCode: string, options?: MetadataResolveOptions): Promise<ListedMetadataType | null>;
|
|
1786
1801
|
}
|
|
1787
1802
|
declare function relatedValueCodes(index: RelationshipIndex | undefined, sourceTypeCode: string, sourceValueCode: string, targetTypeCode: string): string[];
|
|
@@ -1824,6 +1839,8 @@ declare class InMemoryMetadataProvider implements MetadataProvider {
|
|
|
1824
1839
|
batchGet(references: string[], options?: MetadataResolveOptions): Promise<MetadataBatchResult>;
|
|
1825
1840
|
listRelations(query: MetadataRelationQuery): Promise<MetadataRelationListResult>;
|
|
1826
1841
|
getRelatedValues(sourceTypeCode: string, sourceValueCode: string, targetTypeCode: string, options?: MetadataResolveOptions): Promise<MetadataValue[]>;
|
|
1842
|
+
getRelatedValueGroups(sourceTypeCode: string, sourceValueCodes: readonly string[], targetTypeCode: string, options?: MetadataResolveOptions): Promise<MetadataRelatedGroup[]>;
|
|
1843
|
+
private relatedValuesFor;
|
|
1827
1844
|
listTypeValues(typeCode: string, options?: MetadataResolveOptions): Promise<ListedMetadataType | null>;
|
|
1828
1845
|
}
|
|
1829
1846
|
|
|
@@ -1887,4 +1904,4 @@ declare class ProviderFailoverCoordinator {
|
|
|
1887
1904
|
}
|
|
1888
1905
|
declare function isExtensionServing(status: MetadataProviderStatus): boolean;
|
|
1889
1906
|
|
|
1890
|
-
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_PROJECTIONS_BUCKET_ENV, METADATA_PROVIDER_KIND, type ManifestCompareResult, type ManifestLookupIndexEntry, type ManifestMetadataTypeEntry, ManifestValidationError, type MetadataBatchResult, MetadataCache, type MetadataCacheSnapshot, type MetadataCacheWriteGuard, MetadataDownloader, type MetadataDownloaderOptions, type MetadataHealthReport, MetadataHealthService, type MetadataHealthServiceOptions, MetadataLoader, type MetadataLoaderOptions, MetadataLookupError, MetadataNotReadyError, MetadataProjectionUnavailableError, type MetadataProvider, type MetadataProviderKind, type MetadataProviderStatus, type MetadataReference, MetadataRefreshService, type MetadataRefreshServiceOptions, type MetadataRelationListResult, type MetadataRelationQuery, type MetadataRelationRow, 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, canonicalMetadataProjectionsBucketName, collectResponseReferences, collectResponseTypeCodes, createCodeFieldExclusionSet, createRuntimeMetadataFromEnv, defaultExtensionBaseUrl, ensureRuntimeMetadataLoaded, formatMetadataReference, getCandidateTypeCodesForKey, getRuntimeMetadataHealth, getRuntimeMetadataService, hasPotentialMetadata, isCompactMetadataReference, isExtensionEnabled, isExtensionServing, isMetadataProjectionConfigured, isMetadataProjectionsBucketConfigured, isMetadataReference, isMetadataValueObject, isMetadataValueObjectArray, isWorkflowStepRecord, isWorkflowStepRuleField, localizedLabelFromEntry, manifestLocalizationSchema, metadataGroupFromManifest, metadataValueToReference, normalizeRuntimeMetadataTypeCode, onMetadataProjectionCompleted, parseMetadataReference, projectionEntryToMetadataValue, projectionManifestSchema, readMetadataProjectionsBucket, readModelGroupsFromManifest, relatedValueCodes, resetRuntimeMetadataBootstrapState, resolveMetadataProjectionsBucket, resolveRuntimeMetadataConfig, runtimeMetadataConfigSchema, selectMetadataProvider, tryGetRuntimeMetadataService, tryParseMetadataReference, typeCodeFromCodeFieldName };
|
|
1907
|
+
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_PROJECTIONS_BUCKET_ENV, METADATA_PROVIDER_KIND, type ManifestCompareResult, type ManifestLookupIndexEntry, type ManifestMetadataTypeEntry, ManifestValidationError, type MetadataBatchResult, MetadataCache, type MetadataCacheSnapshot, type MetadataCacheWriteGuard, MetadataDownloader, type MetadataDownloaderOptions, type MetadataHealthReport, MetadataHealthService, type MetadataHealthServiceOptions, MetadataLoader, type MetadataLoaderOptions, MetadataLookupError, MetadataNotReadyError, MetadataProjectionUnavailableError, type MetadataProvider, type MetadataProviderKind, type MetadataProviderStatus, type MetadataReference, MetadataRefreshService, type MetadataRefreshServiceOptions, type MetadataRelatedGroup, type MetadataRelationListResult, type MetadataRelationQuery, type MetadataRelationRow, 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, canonicalMetadataProjectionsBucketName, collectResponseReferences, collectResponseTypeCodes, createCodeFieldExclusionSet, createRuntimeMetadataFromEnv, defaultExtensionBaseUrl, ensureRuntimeMetadataLoaded, formatMetadataReference, getCandidateTypeCodesForKey, getRuntimeMetadataHealth, getRuntimeMetadataService, hasPotentialMetadata, isCompactMetadataReference, isExtensionEnabled, isExtensionServing, isMetadataProjectionConfigured, isMetadataProjectionsBucketConfigured, isMetadataReference, isMetadataValueObject, isMetadataValueObjectArray, isWorkflowStepRecord, isWorkflowStepRuleField, localizedLabelFromEntry, manifestLocalizationSchema, metadataGroupFromManifest, metadataValueToReference, normalizeRuntimeMetadataTypeCode, onMetadataProjectionCompleted, parseMetadataReference, projectionEntryToMetadataValue, projectionManifestSchema, readMetadataProjectionsBucket, readModelGroupsFromManifest, relatedValueCodes, resetRuntimeMetadataBootstrapState, resolveMetadataProjectionsBucket, resolveRuntimeMetadataConfig, runtimeMetadataConfigSchema, selectMetadataProvider, tryGetRuntimeMetadataService, tryParseMetadataReference, typeCodeFromCodeFieldName };
|
package/dist/index.js
CHANGED
|
@@ -3460,6 +3460,7 @@ function metadataValueToReference(value) {
|
|
|
3460
3460
|
// ../../libs/runtime-metadata/src/lib/provider/ExtensionMetadataProvider.ts
|
|
3461
3461
|
var DEFAULT_READY_TIMEOUT_MS = 5e3;
|
|
3462
3462
|
var DEFAULT_REQUEST_TIMEOUT_MS = 2e3;
|
|
3463
|
+
var RELATED_BATCH_LIMIT = 200;
|
|
3463
3464
|
var ExtensionMetadataProvider = class {
|
|
3464
3465
|
baseUrl;
|
|
3465
3466
|
readyTimeoutMs;
|
|
@@ -3691,6 +3692,38 @@ var ExtensionMetadataProvider = class {
|
|
|
3691
3692
|
throw err;
|
|
3692
3693
|
}
|
|
3693
3694
|
}
|
|
3695
|
+
async getRelatedValueGroups(sourceTypeCode, sourceValueCodes, targetTypeCode, options) {
|
|
3696
|
+
if (sourceValueCodes.length === 0) {
|
|
3697
|
+
return [];
|
|
3698
|
+
}
|
|
3699
|
+
const groups = [];
|
|
3700
|
+
try {
|
|
3701
|
+
for (let offset = 0; offset < sourceValueCodes.length; offset += RELATED_BATCH_LIMIT) {
|
|
3702
|
+
const sourceValues = sourceValueCodes.slice(offset, offset + RELATED_BATCH_LIMIT);
|
|
3703
|
+
const body = await this.requestJson("POST", "/v1/related/batch", {
|
|
3704
|
+
sourceType: sourceTypeCode,
|
|
3705
|
+
sourceValues,
|
|
3706
|
+
targetType: targetTypeCode,
|
|
3707
|
+
...options?.locale ? { locale: options.locale } : {}
|
|
3708
|
+
});
|
|
3709
|
+
for (const group of body.groups ?? []) {
|
|
3710
|
+
groups.push({
|
|
3711
|
+
sourceValueCode: group.sourceValueCode ?? "",
|
|
3712
|
+
values: (group.items ?? []).map((item) => this.toMetadataValue(item, options?.locale)).filter((item) => item != null)
|
|
3713
|
+
});
|
|
3714
|
+
}
|
|
3715
|
+
}
|
|
3716
|
+
return groups;
|
|
3717
|
+
} catch (err) {
|
|
3718
|
+
if (isNotFound(err)) {
|
|
3719
|
+
throw new MetadataProjectionUnavailableError(
|
|
3720
|
+
"Extension related batch route is unavailable",
|
|
3721
|
+
{ retryable: true, metadata: { path: "/v1/related/batch" } }
|
|
3722
|
+
);
|
|
3723
|
+
}
|
|
3724
|
+
throw err;
|
|
3725
|
+
}
|
|
3726
|
+
}
|
|
3694
3727
|
async getLocalizationValue(keyOrTypeCode, valueCodeOrLocale, maybeLocale) {
|
|
3695
3728
|
let key;
|
|
3696
3729
|
let locale;
|
|
@@ -4194,38 +4227,63 @@ var S3MetadataProvider = class {
|
|
|
4194
4227
|
};
|
|
4195
4228
|
}
|
|
4196
4229
|
async getRelatedValues(sourceTypeCode, sourceValueCode, targetTypeCode, options) {
|
|
4197
|
-
await this.
|
|
4198
|
-
const index = this.cache.getRelationshipIndex();
|
|
4199
|
-
const codes = relatedValueCodes(
|
|
4200
|
-
index,
|
|
4230
|
+
const groups = await this.getRelatedValueGroups(
|
|
4201
4231
|
sourceTypeCode,
|
|
4202
|
-
sourceValueCode,
|
|
4203
|
-
targetTypeCode
|
|
4232
|
+
[sourceValueCode],
|
|
4233
|
+
targetTypeCode,
|
|
4234
|
+
options
|
|
4204
4235
|
);
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4236
|
+
const values = groups[0]?.values ?? [];
|
|
4237
|
+
this.logger.info({
|
|
4238
|
+
event: "runtimeMetadata.related.lookup",
|
|
4239
|
+
sourceTypeCode,
|
|
4240
|
+
sourceValueCode,
|
|
4241
|
+
targetTypeCode,
|
|
4242
|
+
count: values.length
|
|
4243
|
+
});
|
|
4244
|
+
return values;
|
|
4245
|
+
}
|
|
4246
|
+
async getRelatedValueGroups(sourceTypeCode, sourceValueCodes, targetTypeCode, options) {
|
|
4247
|
+
if (sourceValueCodes.length === 0) {
|
|
4248
|
+
return [];
|
|
4249
|
+
}
|
|
4250
|
+
await this.ensureTypesLoaded([sourceTypeCode, targetTypeCode]);
|
|
4251
|
+
const index = this.cache.getRelationshipIndex();
|
|
4252
|
+
const groups = [];
|
|
4253
|
+
for (const sourceValueCode of sourceValueCodes) {
|
|
4254
|
+
const codes = relatedValueCodes(
|
|
4255
|
+
index,
|
|
4208
4256
|
sourceTypeCode,
|
|
4209
4257
|
sourceValueCode,
|
|
4210
4258
|
targetTypeCode
|
|
4211
4259
|
);
|
|
4212
|
-
codes.
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
|
|
4260
|
+
if (codes.length === 0) {
|
|
4261
|
+
codes.push(
|
|
4262
|
+
...relatedValueCodesFromEntry(
|
|
4263
|
+
this.resolver,
|
|
4264
|
+
sourceTypeCode,
|
|
4265
|
+
sourceValueCode,
|
|
4266
|
+
targetTypeCode
|
|
4267
|
+
)
|
|
4268
|
+
);
|
|
4269
|
+
}
|
|
4270
|
+
const values = [];
|
|
4271
|
+
for (const valueCode of codes) {
|
|
4272
|
+
const value = await this.getValue(targetTypeCode, valueCode, options);
|
|
4273
|
+
if (value) {
|
|
4274
|
+
values.push(value);
|
|
4275
|
+
}
|
|
4219
4276
|
}
|
|
4277
|
+
groups.push({ sourceValueCode, values });
|
|
4220
4278
|
}
|
|
4221
4279
|
this.logger.info({
|
|
4222
|
-
event: "runtimeMetadata.related.
|
|
4280
|
+
event: "runtimeMetadata.related.batch",
|
|
4223
4281
|
sourceTypeCode,
|
|
4224
|
-
sourceValueCode,
|
|
4225
4282
|
targetTypeCode,
|
|
4226
|
-
|
|
4283
|
+
sources: sourceValueCodes.length,
|
|
4284
|
+
count: groups.reduce((sum, group) => sum + group.values.length, 0)
|
|
4227
4285
|
});
|
|
4228
|
-
return
|
|
4286
|
+
return groups;
|
|
4229
4287
|
}
|
|
4230
4288
|
async listTypeValues(typeCode, options) {
|
|
4231
4289
|
await this.ensureTypesLoaded([typeCode]);
|
|
@@ -4886,6 +4944,36 @@ var RuntimeMetadataService = class {
|
|
|
4886
4944
|
throw err;
|
|
4887
4945
|
}
|
|
4888
4946
|
}
|
|
4947
|
+
async getRelatedValueGroups(sourceTypeCode, sourceValueCodes, targetTypeCode, options) {
|
|
4948
|
+
try {
|
|
4949
|
+
const provider = await this.activeProvider();
|
|
4950
|
+
const guard = this.currentWriteGuard();
|
|
4951
|
+
const groups = await provider.getRelatedValueGroups(
|
|
4952
|
+
sourceTypeCode,
|
|
4953
|
+
sourceValueCodes,
|
|
4954
|
+
targetTypeCode,
|
|
4955
|
+
options
|
|
4956
|
+
);
|
|
4957
|
+
this.hydrateProviderValues(
|
|
4958
|
+
groups.flatMap((group) => group.values),
|
|
4959
|
+
guard
|
|
4960
|
+
);
|
|
4961
|
+
return groups;
|
|
4962
|
+
} catch (err) {
|
|
4963
|
+
if (await this.tryActivateFallbackFromError(err, "extension-related")) {
|
|
4964
|
+
const fallback = this.metadataProviderFallback;
|
|
4965
|
+
if (fallback) {
|
|
4966
|
+
return fallback.getRelatedValueGroups(
|
|
4967
|
+
sourceTypeCode,
|
|
4968
|
+
sourceValueCodes,
|
|
4969
|
+
targetTypeCode,
|
|
4970
|
+
options
|
|
4971
|
+
);
|
|
4972
|
+
}
|
|
4973
|
+
}
|
|
4974
|
+
throw err;
|
|
4975
|
+
}
|
|
4976
|
+
}
|
|
4889
4977
|
async listRelations(query) {
|
|
4890
4978
|
try {
|
|
4891
4979
|
const provider = await this.activeProvider();
|
|
@@ -5357,6 +5445,33 @@ var InMemoryMetadataProvider = class {
|
|
|
5357
5445
|
{ retryable: true }
|
|
5358
5446
|
);
|
|
5359
5447
|
}
|
|
5448
|
+
return this.relatedValuesFor(sourceTypeCode, sourceValueCode, targetTypeCode, options);
|
|
5449
|
+
}
|
|
5450
|
+
async getRelatedValueGroups(sourceTypeCode, sourceValueCodes, targetTypeCode, options) {
|
|
5451
|
+
if (this.unavailable) {
|
|
5452
|
+
throw new MetadataProjectionUnavailableError(
|
|
5453
|
+
"In-memory metadata provider is unavailable",
|
|
5454
|
+
{ retryable: true }
|
|
5455
|
+
);
|
|
5456
|
+
}
|
|
5457
|
+
if (sourceValueCodes.length === 0) {
|
|
5458
|
+
return [];
|
|
5459
|
+
}
|
|
5460
|
+
const groups = [];
|
|
5461
|
+
for (const sourceValueCode of sourceValueCodes) {
|
|
5462
|
+
groups.push({
|
|
5463
|
+
sourceValueCode,
|
|
5464
|
+
values: await this.relatedValuesFor(
|
|
5465
|
+
sourceTypeCode,
|
|
5466
|
+
sourceValueCode,
|
|
5467
|
+
targetTypeCode,
|
|
5468
|
+
options
|
|
5469
|
+
)
|
|
5470
|
+
});
|
|
5471
|
+
}
|
|
5472
|
+
return groups;
|
|
5473
|
+
}
|
|
5474
|
+
async relatedValuesFor(sourceTypeCode, sourceValueCode, targetTypeCode, options) {
|
|
5360
5475
|
const sourceKey = formatMetadataReference(sourceTypeCode, sourceValueCode);
|
|
5361
5476
|
const targets = this.related.get(sourceKey)?.get(targetTypeCode) ?? [];
|
|
5362
5477
|
const values = [];
|