in src/dataServices/dynamoDbHelper.ts [20:51]
private async getMostRecentResources(
resourceType: string,
id: string,
maxNumberOfVersionsToGet: number,
projectionExpression?: string,
tenantId?: string,
): Promise<ItemList> {
const params = DynamoDbParamBuilder.buildGetResourcesQueryParam(
id,
resourceType,
maxNumberOfVersionsToGet,
projectionExpression,
tenantId,
);
let result: any = {};
try {
result = await this.dynamoDb.query(params).promise();
} catch (e) {
if ((e as any).code === 'ConditionalCheckFailedException') {
throw new ResourceNotFoundError(resourceType, id);
}
throw e;
}
const items = result.Items
? result.Items.map((ddbJsonItem: any) => DynamoDBConverter.unmarshall(ddbJsonItem))
: [];
if (items.length === 0) {
throw new ResourceNotFoundError(resourceType, id);
}
return items;
}