in src/router/bundle/bundleGenerator.ts [15:51]
static generateBundle(
baseUrl: string,
queryParams: any,
searchResult: SearchResult,
bundleType: 'searchset' | 'history',
resourceType?: string,
id?: string,
) {
const currentDateTime = new Date();
const bundle = {
resourceType: 'Bundle',
id: uuidv4(),
meta: {
lastUpdated: currentDateTime.toISOString(),
},
type: bundleType,
total: searchResult.numberOfResults, // Total number of search results, not total of results on page
link: [this.createLinkWithQuery('self', baseUrl, bundleType === 'history', resourceType, id, queryParams)],
entry: searchResult.entries,
};
if (searchResult.previousResultUrl) {
bundle.link.push(this.createLink('previous', searchResult.previousResultUrl));
}
if (searchResult.nextResultUrl) {
bundle.link.push(this.createLink('next', searchResult.nextResultUrl));
}
if (searchResult.firstResultUrl) {
bundle.link.push(this.createLink('first', searchResult.firstResultUrl));
}
if (searchResult.lastResultUrl) {
bundle.link.push(this.createLink('last', searchResult.lastResultUrl));
}
return bundle;
}