put back the actual implementation, to not break old clients

Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2022-02-16 15:51:51 +01:00
parent deaf6065db
commit a31cdf9c85
2 changed files with 55 additions and 0 deletions
+10
View File
@@ -91,6 +91,11 @@ export class CatalogClient implements CatalogApi {
compoundName: EntityName,
options?: CatalogRequestOptions,
): Promise<Entity | undefined>;
// @deprecated (undocumented)
getLocationByEntity(
entity: Entity,
options?: CatalogRequestOptions,
): Promise<Location_2 | undefined>;
getLocationById(
id: string,
options?: CatalogRequestOptions,
@@ -99,6 +104,11 @@ export class CatalogClient implements CatalogApi {
locationRef: string,
options?: CatalogRequestOptions,
): Promise<Location_2 | undefined>;
// @deprecated (undocumented)
getOriginLocationByEntity(
entity: Entity,
options?: CatalogRequestOptions,
): Promise<Location_2 | undefined>;
refreshEntity(
entityRef: string,
options?: CatalogRequestOptions,
@@ -15,6 +15,8 @@
*/
import {
ANNOTATION_LOCATION,
ANNOTATION_ORIGIN_LOCATION,
Entity,
EntityName,
parseEntityRef,
@@ -243,6 +245,49 @@ export class CatalogClient implements CatalogApi {
};
}
/**
* @deprecated please use getLocationByRef instead
*/
async getOriginLocationByEntity(
entity: Entity,
options?: CatalogRequestOptions,
): Promise<Location | undefined> {
const locationCompound =
entity.metadata.annotations?.[ANNOTATION_ORIGIN_LOCATION];
if (!locationCompound) {
return undefined;
}
const all: { data: Location }[] = await this.requestRequired(
'GET',
'/locations',
options,
);
return all
.map(r => r.data)
.find(l => locationCompound === stringifyLocationRef(l));
}
/**
* @deprecated please use getLocationByRef instead
*/
async getLocationByEntity(
entity: Entity,
options?: CatalogRequestOptions,
): Promise<Location | undefined> {
const locationCompound = entity.metadata.annotations?.[ANNOTATION_LOCATION];
if (!locationCompound) {
return undefined;
}
const all: { data: Location }[] = await this.requestRequired(
'GET',
'/locations',
options,
);
return all
.map(r => r.data)
.find(l => locationCompound === stringifyLocationRef(l));
}
/**
* {@inheritdoc CatalogApi.getLocationByRef}
*/