mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-15 14:03:06 +00:00
68930: rename forwardToRest typo fix
This commit is contained in:
@@ -177,14 +177,14 @@ describe('DataService', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not include linksToFollow with shootEmbed = false', () => {
|
it('should not include linksToFollow with shouldEmbed = false', () => {
|
||||||
const mockFollowLinkConfig: FollowLinkConfig<Item> = Object.assign(new FollowLinkConfig(), {
|
const mockFollowLinkConfig: FollowLinkConfig<Item> = Object.assign(new FollowLinkConfig(), {
|
||||||
name: 'bundles' as any,
|
name: 'bundles' as any,
|
||||||
shootEmbed: false,
|
shouldEmbed: false,
|
||||||
});
|
});
|
||||||
const mockFollowLinkConfig2: FollowLinkConfig<Item> = Object.assign(new FollowLinkConfig(), {
|
const mockFollowLinkConfig2: FollowLinkConfig<Item> = Object.assign(new FollowLinkConfig(), {
|
||||||
name: 'owningCollection' as any,
|
name: 'owningCollection' as any,
|
||||||
shootEmbed: false,
|
shouldEmbed: false,
|
||||||
});
|
});
|
||||||
const mockFollowLinkConfig3: FollowLinkConfig<Item> = Object.assign(new FollowLinkConfig(), {
|
const mockFollowLinkConfig3: FollowLinkConfig<Item> = Object.assign(new FollowLinkConfig(), {
|
||||||
name: 'templateItemOf' as any,
|
name: 'templateItemOf' as any,
|
||||||
@@ -249,14 +249,14 @@ describe('DataService', () => {
|
|||||||
expect(result).toEqual(expected);
|
expect(result).toEqual(expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not include linksToFollow with shootEmbed = false', () => {
|
it('should not include linksToFollow with shouldEmbed = false', () => {
|
||||||
const mockFollowLinkConfig: FollowLinkConfig<Item> = Object.assign(new FollowLinkConfig(), {
|
const mockFollowLinkConfig: FollowLinkConfig<Item> = Object.assign(new FollowLinkConfig(), {
|
||||||
name: 'bundles' as any,
|
name: 'bundles' as any,
|
||||||
shootEmbed: false,
|
shouldEmbed: false,
|
||||||
});
|
});
|
||||||
const mockFollowLinkConfig2: FollowLinkConfig<Item> = Object.assign(new FollowLinkConfig(), {
|
const mockFollowLinkConfig2: FollowLinkConfig<Item> = Object.assign(new FollowLinkConfig(), {
|
||||||
name: 'owningCollection' as any,
|
name: 'owningCollection' as any,
|
||||||
shootEmbed: false,
|
shouldEmbed: false,
|
||||||
});
|
});
|
||||||
const mockFollowLinkConfig3: FollowLinkConfig<Item> = Object.assign(new FollowLinkConfig(), {
|
const mockFollowLinkConfig3: FollowLinkConfig<Item> = Object.assign(new FollowLinkConfig(), {
|
||||||
name: 'templateItemOf' as any,
|
name: 'templateItemOf' as any,
|
||||||
|
@@ -155,13 +155,13 @@ export abstract class DataService<T extends CacheableObject> {
|
|||||||
/**
|
/**
|
||||||
* Adds the embed options to the link for the request
|
* Adds the embed options to the link for the request
|
||||||
* @param args params for the query string
|
* @param args params for the query string
|
||||||
* @param linksToFollow links we want to embed in query string if shootEmbed is true
|
* @param linksToFollow links we want to embed in query string if shouldEmbed is true
|
||||||
*/
|
*/
|
||||||
protected addEmbedParams(args: any, ...linksToFollow: Array<FollowLinkConfig<T>>) {
|
protected addEmbedParams(args: any, ...linksToFollow: Array<FollowLinkConfig<T>>) {
|
||||||
if (linksToFollow !== undefined) {
|
if (linksToFollow !== undefined) {
|
||||||
[...linksToFollow].forEach((linkToFollow: FollowLinkConfig<T>) => {
|
[...linksToFollow].forEach((linkToFollow: FollowLinkConfig<T>) => {
|
||||||
console.log('linksToFollow', linksToFollow)
|
console.log('linksToFollow', linksToFollow)
|
||||||
if (linkToFollow.shootEmbed) {
|
if (linkToFollow.shouldEmbed) {
|
||||||
const embedString = 'embed=' + String(linkToFollow.name);
|
const embedString = 'embed=' + String(linkToFollow.name);
|
||||||
const embedWithNestedString = this.addNestedEmbeds(embedString, ...linkToFollow.linksToFollow);
|
const embedWithNestedString = this.addNestedEmbeds(embedString, ...linkToFollow.linksToFollow);
|
||||||
args = [...args, embedWithNestedString];
|
args = [...args, embedWithNestedString];
|
||||||
@@ -174,14 +174,14 @@ export abstract class DataService<T extends CacheableObject> {
|
|||||||
/**
|
/**
|
||||||
* Add the nested followLinks to the embed param, recursively, separated by a /
|
* Add the nested followLinks to the embed param, recursively, separated by a /
|
||||||
* @param embedString embedString so far (recursive)
|
* @param embedString embedString so far (recursive)
|
||||||
* @param linksToFollow links we want to embed in query string if shootEmbed is true
|
* @param linksToFollow links we want to embed in query string if shouldEmbed is true
|
||||||
*/
|
*/
|
||||||
protected addNestedEmbeds(embedString: string, ...linksToFollow: Array<FollowLinkConfig<T>>): string {
|
protected addNestedEmbeds(embedString: string, ...linksToFollow: Array<FollowLinkConfig<T>>): string {
|
||||||
let nestEmbed = embedString;
|
let nestEmbed = embedString;
|
||||||
if (linksToFollow !== undefined) {
|
if (linksToFollow !== undefined) {
|
||||||
console.log('linksToFollow addNestedEmbed', linksToFollow);
|
console.log('linksToFollow addNestedEmbed', linksToFollow);
|
||||||
[...linksToFollow].forEach((linkToFollow: FollowLinkConfig<T>) => {
|
[...linksToFollow].forEach((linkToFollow: FollowLinkConfig<T>) => {
|
||||||
if (linkToFollow.shootEmbed) {
|
if (linkToFollow.shouldEmbed) {
|
||||||
nestEmbed = nestEmbed + '/' + String(linkToFollow.name);
|
nestEmbed = nestEmbed + '/' + String(linkToFollow.name);
|
||||||
if (linkToFollow.linksToFollow !== undefined) {
|
if (linkToFollow.linksToFollow !== undefined) {
|
||||||
nestEmbed = this.addNestedEmbeds(nestEmbed, ...linkToFollow.linksToFollow);
|
nestEmbed = this.addNestedEmbeds(nestEmbed, ...linkToFollow.linksToFollow);
|
||||||
|
@@ -27,7 +27,7 @@ export class FollowLinkConfig<R extends HALResource> {
|
|||||||
/**
|
/**
|
||||||
* Forward to rest which links we're following, so these can already be embedded
|
* Forward to rest which links we're following, so these can already be embedded
|
||||||
*/
|
*/
|
||||||
shootEmbed? = true;
|
shouldEmbed? = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -41,19 +41,19 @@ export class FollowLinkConfig<R extends HALResource> {
|
|||||||
* in a certain way
|
* in a certain way
|
||||||
* @param linksToFollow: a list of {@link FollowLinkConfig}s to
|
* @param linksToFollow: a list of {@link FollowLinkConfig}s to
|
||||||
* use on the retrieved object.
|
* use on the retrieved object.
|
||||||
* @param shootEmbed: boolean to check whether to forward info on followLinks to rest,
|
* @param shouldEmbed: boolean to check whether to forward info on followLinks to rest,
|
||||||
* so these can be embedded, default true
|
* so these can be embedded, default true
|
||||||
*/
|
*/
|
||||||
export const followLink = <R extends HALResource>(
|
export const followLink = <R extends HALResource>(
|
||||||
linkName: keyof R['_links'],
|
linkName: keyof R['_links'],
|
||||||
findListOptions?: FindListOptions,
|
findListOptions?: FindListOptions,
|
||||||
shootEmbed = true,
|
shouldEmbed = true,
|
||||||
...linksToFollow: Array<FollowLinkConfig<any>>
|
...linksToFollow: Array<FollowLinkConfig<any>>
|
||||||
): FollowLinkConfig<R> => {
|
): FollowLinkConfig<R> => {
|
||||||
return {
|
return {
|
||||||
name: linkName,
|
name: linkName,
|
||||||
findListOptions,
|
findListOptions,
|
||||||
shootEmbed: shootEmbed,
|
shouldEmbed: shouldEmbed,
|
||||||
linksToFollow
|
linksToFollow
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user