68930: add embed query param for followLinks in buildHref + tests

removed fdescribe
This commit is contained in:
Marie Verdonck
2020-02-20 18:23:08 +01:00
parent 01231ef105
commit 32d0c8118b
5 changed files with 149 additions and 27 deletions

View File

@@ -23,6 +23,11 @@ export class FollowLinkConfig<R extends HALResource> {
* use on the retrieved object.
*/
linksToFollow?: Array<FollowLinkConfig<any>>;
/**
* Forward to rest which links we're following, so these can already be embedded
*/
forwardToRest? = true;
}
/**
@@ -36,15 +41,19 @@ export class FollowLinkConfig<R extends HALResource> {
* in a certain way
* @param linksToFollow: a list of {@link FollowLinkConfig}s to
* use on the retrieved object.
* @param forwardToRest: boolean to check whether to forward info on followLinks to rest,
* so these can be embedded, default true
*/
export const followLink = <R extends HALResource>(
linkName: keyof R['_links'],
findListOptions?: FindListOptions,
forwardToRest = true,
...linksToFollow: Array<FollowLinkConfig<any>>
): FollowLinkConfig<R> => {
return {
name: linkName,
findListOptions,
forwardToRest,
linksToFollow
}
};