@beinformed/ui 1.62.4 → 1.62.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/esm/models/content/ContentTOCModel.d.ts +5 -0
- package/esm/models/content/ContentTOCModel.js +15 -0
- package/esm/models/content/ContentTOCModel.js.flow +15 -0
- package/esm/models/content/ContentTOCModel.js.map +1 -1
- package/esm/models/content/__tests__/Formalsource.spec.js.flow +8 -0
- package/lib/models/content/ContentTOCModel.d.ts +5 -0
- package/lib/models/content/ContentTOCModel.js +15 -0
- package/lib/models/content/ContentTOCModel.js.map +1 -1
- package/package.json +1 -1
- package/src/models/content/ContentTOCModel.js +15 -0
- package/src/models/content/__tests__/Formalsource.spec.js +8 -0
- package/src/models/content/__tests__/formalsource-toc.json +3 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [1.62.5](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.62.4...v1.62.5) (2025-06-06)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **content-toc:** add related concepts href ([090b237](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/090b237591dd7f8499aa1624f4e7b24cec0e9c98))
|
|
11
|
+
|
|
5
12
|
## [1.62.4](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.62.3...v1.62.4) (2025-06-05)
|
|
6
13
|
|
|
7
14
|
|
|
@@ -17,6 +17,10 @@ export default class ContentTOCModel extends ResourceModel {
|
|
|
17
17
|
/**
|
|
18
18
|
*/
|
|
19
19
|
get abbreviation(): string | null;
|
|
20
|
+
/**
|
|
21
|
+
* Get related concepts link
|
|
22
|
+
*/
|
|
23
|
+
get relatedConceptsHref(): Href | null;
|
|
20
24
|
/**
|
|
21
25
|
*/
|
|
22
26
|
get selfContentLink(): ContentLinkModel;
|
|
@@ -47,5 +51,6 @@ import ResourceModel from "../base/ResourceModel";
|
|
|
47
51
|
import ContentTypeModel from "./ContentTypeModel";
|
|
48
52
|
import FilterCollection from "../filters/FilterCollection";
|
|
49
53
|
import { ModularUIModel } from "../types";
|
|
54
|
+
import Href from "../href/Href";
|
|
50
55
|
import ContentLinkModel from "./ContentLinkModel";
|
|
51
56
|
import SectionModel from "./SectionModel";
|
|
@@ -101,6 +101,21 @@ export default class ContentTOCModel extends ResourceModel {
|
|
|
101
101
|
return href;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
+
/**
|
|
105
|
+
* Get related concepts link
|
|
106
|
+
*/
|
|
107
|
+
get relatedConceptsHref() {
|
|
108
|
+
const relatedConceptsLink = this.links.getLinkByKey("relatedConcepts");
|
|
109
|
+
if (relatedConceptsLink) {
|
|
110
|
+
const {
|
|
111
|
+
href
|
|
112
|
+
} = relatedConceptsLink;
|
|
113
|
+
href.addParameter("entryDate", this.entryDate);
|
|
114
|
+
return href;
|
|
115
|
+
}
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
|
|
104
119
|
/**
|
|
105
120
|
*/
|
|
106
121
|
get selfContentLink() {
|
|
@@ -117,6 +117,21 @@ export default class ContentTOCModel extends ResourceModel {
|
|
|
117
117
|
return href;
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
+
/**
|
|
121
|
+
* Get related concepts link
|
|
122
|
+
*/
|
|
123
|
+
get relatedConceptsHref(): Href | null {
|
|
124
|
+
const relatedConceptsLink = this.links.getLinkByKey("relatedConcepts");
|
|
125
|
+
|
|
126
|
+
if (relatedConceptsLink) {
|
|
127
|
+
const { href } = relatedConceptsLink;
|
|
128
|
+
href.addParameter("entryDate", this.entryDate);
|
|
129
|
+
return href;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
return null;
|
|
133
|
+
}
|
|
134
|
+
|
|
120
135
|
/**
|
|
121
136
|
*/
|
|
122
137
|
get selfContentLink(): ContentLinkModel {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentTOCModel.js","names":["has","ResourceModel","FilterCollection","ContentLinkModel","ContentTypeModel","Href","SectionModel","TIMEVERSION_FILTER_NAME","getItems","items","entryDate","modelOptions","_mapInstanceProperty","call","item","link","section","_id","sections","ContentTOCModel","constructor","arguments","_defineProperty","type","modelName","isApplicableModel","data","contributions","resourcetype","getInitialChildModelLinks","contentTypeLink","links","getLinkByKey","setChildModels","models","contentType","_findInstanceProperty","model","label","getData","abbreviation","selfhref","href","selflink","filterCollection","forEach","filter","params","param","value","setParameter","name","removeParameter","selfContentLink","_context","categories","_context2","category","_contentType","_filterCollection","_context3","_filterInstanceProperty","_context4","key","_Object$keys","timeversionFilter","getFilterByAttributeKey","attribute","isCompleteSource","completeFilter"],"sources":["../../../src/models/content/ContentTOCModel.js"],"sourcesContent":["// @flow\nimport { has } from \"../../utils/helpers/objects\";\n\nimport ResourceModel from \"../base/ResourceModel\";\nimport FilterCollection from \"../filters/FilterCollection\";\nimport ContentLinkModel from \"./ContentLinkModel\";\nimport ContentTypeModel from \"./ContentTypeModel\";\nimport Href from \"../href/Href\";\n\nimport SectionModel from \"./SectionModel\";\n\nimport { TIMEVERSION_FILTER_NAME } from \"../../constants/Constants\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type { ModelOptions, ModularUIModel } from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\n\n/**\n * Get content items recursively\n */\nconst getItems = (\n items: Array<Object>,\n entryDate: ISO_DATE | null,\n modelOptions?: ModelOptions,\n): Array<ContentLinkModel> =>\n items.map((item) => {\n const link = new ContentLinkModel(\n {\n ...item,\n section: item._id,\n },\n entryDate,\n modelOptions,\n );\n\n if (item.items) {\n link.items = getItems(item.items, entryDate, modelOptions);\n }\n if (item.sections) {\n link.items = getItems(item.sections, entryDate, modelOptions);\n }\n\n return link;\n });\n\n/**\n * Content detail model\n */\nexport default class ContentTOCModel extends ResourceModel {\n _contentType: ContentTypeModel | null = null;\n _filterCollection: FilterCollection;\n\n /**\n */\n get type(): string {\n return \"ContentTOC\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"ContentTOCModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return data.contributions?.resourcetype === \"ContentTOC\";\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const contentTypeLink = this.links.getLinkByKey(\"contenttype\");\n\n if (contentTypeLink) {\n return [contentTypeLink];\n }\n\n return [];\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n this.contentType = models.find((model) => model.type === \"ContentType\");\n }\n\n /**\n * Get content label\n */\n get label(): string {\n return this.getData(\"label\", \"\");\n }\n\n /**\n */\n get abbreviation(): string | null {\n return this.getData(\"abbreviation\");\n }\n\n /**\n * Getting the self link of this list\n */\n get selfhref(): Href {\n const href = new Href(this.selflink.href);\n\n this.filterCollection.forEach((filter) => {\n filter.params.forEach((param) => {\n if (param.value) {\n href.setParameter(param.name, param.value);\n } else {\n href.removeParameter(param.name);\n }\n });\n });\n\n return href;\n }\n\n /**\n */\n get selfContentLink(): ContentLinkModel {\n return new ContentLinkModel(this.data, this.entryDate, this.modelOptions);\n }\n\n /**\n * Get sub items of toc\n */\n get items(): Array<ContentLinkModel> {\n if (this.data.items) {\n return getItems(this.data.items, this.entryDate, this.modelOptions);\n }\n\n if (this.data.sections) {\n return getItems(this.data.sections, this.entryDate, this.modelOptions);\n }\n\n return [];\n }\n\n /**\n */\n get sections(): Array<SectionModel> {\n if (this.data.sections) {\n return this.data.sections.map(\n (section) =>\n new SectionModel(section, this.entryDate, this.modelOptions),\n );\n }\n return [];\n }\n\n /**\n * get categories of content\n */\n get categories(): Array<ContentLinkModel> {\n if (this.data.categories) {\n return this.data.categories.map(\n (category) => new ContentLinkModel(category, null, this.modelOptions),\n );\n }\n\n return [];\n }\n\n /**\n * Retrieve content type model\n */\n get contentType(): ContentTypeModel | null {\n return this._contentType;\n }\n\n /**\n */\n set contentType(contentType: ?ModularUIModel) {\n this._contentType =\n contentType instanceof ContentTypeModel ? contentType : null;\n }\n\n /**\n * Retrieve available filters on concept toc\n */\n get filterCollection(): FilterCollection {\n if (!this._filterCollection) {\n this._filterCollection = new FilterCollection(\n this.data.filter,\n {\n filter: this.contributions.filter.filter((filter) => {\n const [key] = Object.keys(filter);\n return has(this.data?.filter, key);\n }),\n },\n this.modelOptions,\n );\n }\n\n return this._filterCollection;\n }\n\n /**\n * Retrieve modelcatalog.js of content toc\n */\n get entryDate(): ISO_DATE | null {\n const timeversionFilter = this.filterCollection.getFilterByAttributeKey(\n TIMEVERSION_FILTER_NAME,\n );\n\n return timeversionFilter?.attribute?.value ?? null;\n }\n\n /**\n */\n get isCompleteSource(): boolean {\n const completeFilter =\n this.filterCollection.getFilterByAttributeKey(\"complete\");\n return completeFilter?.attribute?.value === \"true\";\n }\n}\n"],"mappings":";;;;;AACA,SAASA,GAAG,QAAQ,6BAA6B;AAEjD,OAAOC,aAAa,MAAM,uBAAuB;AACjD,OAAOC,gBAAgB,MAAM,6BAA6B;AAC1D,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,OAAOC,IAAI,MAAM,cAAc;AAE/B,OAAOC,YAAY,MAAM,gBAAgB;AAEzC,SAASC,uBAAuB,QAAQ,2BAA2B;AAKnE;AACA;AACA;AACA,MAAMC,QAAQ,GAAGA,CACfC,KAAoB,EACpBC,SAA0B,EAC1BC,YAA2B,KAE3BC,oBAAA,CAAAH,KAAK,EAAAI,IAAA,CAALJ,KAAK,EAAMK,IAAI,IAAK;EAClB,MAAMC,IAAI,GAAG,IAAIZ,gBAAgB,CAC/B;IACE,GAAGW,IAAI;IACPE,OAAO,EAAEF,IAAI,CAACG;EAChB,CAAC,EACDP,SAAS,EACTC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,CAACC,GAAG,CAAC,GAAGC,YAAA,CAAYlB,MAAM,CAAC;UACjC,OAAO9C,GAAG,EAAA8D,SAAA,GAAC,IAAI,CAACpC,IAAI,qBAAAmC,uBAAA,CAAAC,SAAA,GAAUC,GAAG,CAAC;QACpC,CAAC;MACH,CAAC,EACD,IAAI,CAACpD,YACP,CAAC;IACH;IAEA,OAAO,IAAI,CAACgD,iBAAiB;EAC/B;;EAEA;AACF;AACA;EACE,IAAIjD,SAASA,CAAA,EAAoB;IAC/B,MAAMuD,iBAAiB,GAAG,IAAI,CAACrB,gBAAgB,CAACsB,uBAAuB,CACrE3D,uBACF,CAAC;IAED,OAAO0D,iBAAiB,EAAEE,SAAS,EAAElB,KAAK,IAAI,IAAI;EACpD;;EAEA;AACF;EACE,IAAImB,gBAAgBA,CAAA,EAAY;IAC9B,MAAMC,cAAc,GAClB,IAAI,CAACzB,gBAAgB,CAACsB,uBAAuB,CAAC,UAAU,CAAC;IAC3D,OAAOG,cAAc,EAAEF,SAAS,EAAElB,KAAK,KAAK,MAAM;EACpD;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"ContentTOCModel.js","names":["has","ResourceModel","FilterCollection","ContentLinkModel","ContentTypeModel","Href","SectionModel","TIMEVERSION_FILTER_NAME","getItems","items","entryDate","modelOptions","_mapInstanceProperty","call","item","link","section","_id","sections","ContentTOCModel","constructor","arguments","_defineProperty","type","modelName","isApplicableModel","data","contributions","resourcetype","getInitialChildModelLinks","contentTypeLink","links","getLinkByKey","setChildModels","models","contentType","_findInstanceProperty","model","label","getData","abbreviation","selfhref","href","selflink","filterCollection","forEach","filter","params","param","value","setParameter","name","removeParameter","relatedConceptsHref","relatedConceptsLink","addParameter","selfContentLink","_context","categories","_context2","category","_contentType","_filterCollection","_context3","_filterInstanceProperty","_context4","key","_Object$keys","timeversionFilter","getFilterByAttributeKey","attribute","isCompleteSource","completeFilter"],"sources":["../../../src/models/content/ContentTOCModel.js"],"sourcesContent":["// @flow\nimport { has } from \"../../utils/helpers/objects\";\n\nimport ResourceModel from \"../base/ResourceModel\";\nimport FilterCollection from \"../filters/FilterCollection\";\nimport ContentLinkModel from \"./ContentLinkModel\";\nimport ContentTypeModel from \"./ContentTypeModel\";\nimport Href from \"../href/Href\";\n\nimport SectionModel from \"./SectionModel\";\n\nimport { TIMEVERSION_FILTER_NAME } from \"../../constants/Constants\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type { ModelOptions, ModularUIModel } from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\n\n/**\n * Get content items recursively\n */\nconst getItems = (\n items: Array<Object>,\n entryDate: ISO_DATE | null,\n modelOptions?: ModelOptions,\n): Array<ContentLinkModel> =>\n items.map((item) => {\n const link = new ContentLinkModel(\n {\n ...item,\n section: item._id,\n },\n entryDate,\n modelOptions,\n );\n\n if (item.items) {\n link.items = getItems(item.items, entryDate, modelOptions);\n }\n if (item.sections) {\n link.items = getItems(item.sections, entryDate, modelOptions);\n }\n\n return link;\n });\n\n/**\n * Content detail model\n */\nexport default class ContentTOCModel extends ResourceModel {\n _contentType: ContentTypeModel | null = null;\n _filterCollection: FilterCollection;\n\n /**\n */\n get type(): string {\n return \"ContentTOC\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"ContentTOCModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return data.contributions?.resourcetype === \"ContentTOC\";\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const contentTypeLink = this.links.getLinkByKey(\"contenttype\");\n\n if (contentTypeLink) {\n return [contentTypeLink];\n }\n\n return [];\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n this.contentType = models.find((model) => model.type === \"ContentType\");\n }\n\n /**\n * Get content label\n */\n get label(): string {\n return this.getData(\"label\", \"\");\n }\n\n /**\n */\n get abbreviation(): string | null {\n return this.getData(\"abbreviation\");\n }\n\n /**\n * Getting the self link of this list\n */\n get selfhref(): Href {\n const href = new Href(this.selflink.href);\n\n this.filterCollection.forEach((filter) => {\n filter.params.forEach((param) => {\n if (param.value) {\n href.setParameter(param.name, param.value);\n } else {\n href.removeParameter(param.name);\n }\n });\n });\n\n return href;\n }\n\n /**\n * Get related concepts link\n */\n get relatedConceptsHref(): Href | null {\n const relatedConceptsLink = this.links.getLinkByKey(\"relatedConcepts\");\n\n if (relatedConceptsLink) {\n const { href } = relatedConceptsLink;\n href.addParameter(\"entryDate\", this.entryDate);\n return href;\n }\n\n return null;\n }\n\n /**\n */\n get selfContentLink(): ContentLinkModel {\n return new ContentLinkModel(this.data, this.entryDate, this.modelOptions);\n }\n\n /**\n * Get sub items of toc\n */\n get items(): Array<ContentLinkModel> {\n if (this.data.items) {\n return getItems(this.data.items, this.entryDate, this.modelOptions);\n }\n\n if (this.data.sections) {\n return getItems(this.data.sections, this.entryDate, this.modelOptions);\n }\n\n return [];\n }\n\n /**\n */\n get sections(): Array<SectionModel> {\n if (this.data.sections) {\n return this.data.sections.map(\n (section) =>\n new SectionModel(section, this.entryDate, this.modelOptions),\n );\n }\n return [];\n }\n\n /**\n * get categories of content\n */\n get categories(): Array<ContentLinkModel> {\n if (this.data.categories) {\n return this.data.categories.map(\n (category) => new ContentLinkModel(category, null, this.modelOptions),\n );\n }\n\n return [];\n }\n\n /**\n * Retrieve content type model\n */\n get contentType(): ContentTypeModel | null {\n return this._contentType;\n }\n\n /**\n */\n set contentType(contentType: ?ModularUIModel) {\n this._contentType =\n contentType instanceof ContentTypeModel ? contentType : null;\n }\n\n /**\n * Retrieve available filters on concept toc\n */\n get filterCollection(): FilterCollection {\n if (!this._filterCollection) {\n this._filterCollection = new FilterCollection(\n this.data.filter,\n {\n filter: this.contributions.filter.filter((filter) => {\n const [key] = Object.keys(filter);\n return has(this.data?.filter, key);\n }),\n },\n this.modelOptions,\n );\n }\n\n return this._filterCollection;\n }\n\n /**\n * Retrieve modelcatalog.js of content toc\n */\n get entryDate(): ISO_DATE | null {\n const timeversionFilter = this.filterCollection.getFilterByAttributeKey(\n TIMEVERSION_FILTER_NAME,\n );\n\n return timeversionFilter?.attribute?.value ?? null;\n }\n\n /**\n */\n get isCompleteSource(): boolean {\n const completeFilter =\n this.filterCollection.getFilterByAttributeKey(\"complete\");\n return completeFilter?.attribute?.value === \"true\";\n }\n}\n"],"mappings":";;;;;AACA,SAASA,GAAG,QAAQ,6BAA6B;AAEjD,OAAOC,aAAa,MAAM,uBAAuB;AACjD,OAAOC,gBAAgB,MAAM,6BAA6B;AAC1D,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,OAAOC,IAAI,MAAM,cAAc;AAE/B,OAAOC,YAAY,MAAM,gBAAgB;AAEzC,SAASC,uBAAuB,QAAQ,2BAA2B;AAKnE;AACA;AACA;AACA,MAAMC,QAAQ,GAAGA,CACfC,KAAoB,EACpBC,SAA0B,EAC1BC,YAA2B,KAE3BC,oBAAA,CAAAH,KAAK,EAAAI,IAAA,CAALJ,KAAK,EAAMK,IAAI,IAAK;EAClB,MAAMC,IAAI,GAAG,IAAIZ,gBAAgB,CAC/B;IACE,GAAGW,IAAI;IACPE,OAAO,EAAEF,IAAI,CAACG;EAChB,CAAC,EACDP,SAAS,EACTC,YACF,CAAC;EAED,IAAIG,IAAI,CAACL,KAAK,EAAE;IACdM,IAAI,CAACN,KAAK,GAAGD,QAAQ,CAACM,IAAI,CAACL,KAAK,EAAEC,SAAS,EAAEC,YAAY,CAAC;EAC5D;EACA,IAAIG,IAAI,CAACI,QAAQ,EAAE;IACjBH,IAAI,CAACN,KAAK,GAAGD,QAAQ,CAACM,IAAI,CAACI,QAAQ,EAAER,SAAS,EAAEC,YAAY,CAAC;EAC/D;EAEA,OAAOI,IAAI;AACb,CAAC,CAAC;;AAEJ;AACA;AACA;AACA,eAAe,MAAMI,eAAe,SAASlB,aAAa,CAAC;EAAAmB,YAAA;IAAA,SAAAC,SAAA;IAAAC,eAAA,uBACjB,IAAI;IAAAA,eAAA;EAAA;EA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AA,GAAUC,GAAG,CAAC;QACpC,CAAC;MACH,CAAC,EACD,IAAI,CAACvD,YACP,CAAC;IACH;IAEA,OAAO,IAAI,CAACmD,iBAAiB;EAC/B;;EAEA;AACF;AACA;EACE,IAAIpD,SAASA,CAAA,EAAoB;IAC/B,MAAM0D,iBAAiB,GAAG,IAAI,CAACxB,gBAAgB,CAACyB,uBAAuB,CACrE9D,uBACF,CAAC;IAED,OAAO6D,iBAAiB,EAAEE,SAAS,EAAErB,KAAK,IAAI,IAAI;EACpD;;EAEA;AACF;EACE,IAAIsB,gBAAgBA,CAAA,EAAY;IAC9B,MAAMC,cAAc,GAClB,IAAI,CAAC5B,gBAAgB,CAACyB,uBAAuB,CAAC,UAAU,CAAC;IAC3D,OAAOG,cAAc,EAAEF,SAAS,EAAErB,KAAK,KAAK,MAAM;EACpD;AACF","ignoreList":[]}
|
|
@@ -27,6 +27,10 @@ describe("formalsource", () => {
|
|
|
27
27
|
"Grant Funding Agreement - Terms and Conditions",
|
|
28
28
|
);
|
|
29
29
|
|
|
30
|
+
expect(tocModel.relatedConceptsHref.toString()).toBe(
|
|
31
|
+
"/content/bundle-com.beinformed.source.GrantFundingAgreementTermsandConditions/Grant%20Funding%20Agreement.formalsource/relatedConcepts?entryDate=2025-05-28",
|
|
32
|
+
);
|
|
33
|
+
|
|
30
34
|
expect(tocModel.items).toHaveLength(6);
|
|
31
35
|
expect(tocModel.items[0].items).toBeUndefined();
|
|
32
36
|
expect(tocModel.items[1].items).toHaveLength(2);
|
|
@@ -64,6 +68,10 @@ describe("formalsource", () => {
|
|
|
64
68
|
expect(completeModel.abbreviation).toBe("GFA-TC-01");
|
|
65
69
|
expect(completeModel.isCompleteSource).toBe(true);
|
|
66
70
|
|
|
71
|
+
expect(completeModel.relatedConceptsHref.toString()).toBe(
|
|
72
|
+
"/content/bundle-com.beinformed.source.GrantFundingAgreementTermsandConditions/Grant%20Funding%20Agreement.formalsource/relatedConcepts?entryDate=2025-05-28",
|
|
73
|
+
);
|
|
74
|
+
|
|
67
75
|
const firstSection = completeModel.sections[0];
|
|
68
76
|
expect(firstSection.selfhref.toString()).toBe(
|
|
69
77
|
"/content/bundle-com.beinformed.source.GrantFundingAgreementTermsandConditions/Grant%20Funding%20Agreement.formalsource/Chapter1",
|
|
@@ -17,6 +17,10 @@ export default class ContentTOCModel extends ResourceModel {
|
|
|
17
17
|
/**
|
|
18
18
|
*/
|
|
19
19
|
get abbreviation(): string | null;
|
|
20
|
+
/**
|
|
21
|
+
* Get related concepts link
|
|
22
|
+
*/
|
|
23
|
+
get relatedConceptsHref(): Href | null;
|
|
20
24
|
/**
|
|
21
25
|
*/
|
|
22
26
|
get selfContentLink(): ContentLinkModel;
|
|
@@ -47,5 +51,6 @@ import ResourceModel from "../base/ResourceModel";
|
|
|
47
51
|
import ContentTypeModel from "./ContentTypeModel";
|
|
48
52
|
import FilterCollection from "../filters/FilterCollection";
|
|
49
53
|
import { ModularUIModel } from "../types";
|
|
54
|
+
import Href from "../href/Href";
|
|
50
55
|
import ContentLinkModel from "./ContentLinkModel";
|
|
51
56
|
import SectionModel from "./SectionModel";
|
|
@@ -108,6 +108,21 @@ class ContentTOCModel extends _ResourceModel.default {
|
|
|
108
108
|
return href;
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
+
/**
|
|
112
|
+
* Get related concepts link
|
|
113
|
+
*/
|
|
114
|
+
get relatedConceptsHref() {
|
|
115
|
+
const relatedConceptsLink = this.links.getLinkByKey("relatedConcepts");
|
|
116
|
+
if (relatedConceptsLink) {
|
|
117
|
+
const {
|
|
118
|
+
href
|
|
119
|
+
} = relatedConceptsLink;
|
|
120
|
+
href.addParameter("entryDate", this.entryDate);
|
|
121
|
+
return href;
|
|
122
|
+
}
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
|
|
111
126
|
/**
|
|
112
127
|
*/
|
|
113
128
|
get selfContentLink() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentTOCModel.js","names":["_objects","require","_ResourceModel","_interopRequireDefault","_FilterCollection","_ContentLinkModel","_ContentTypeModel","_Href","_SectionModel","_Constants","getItems","items","entryDate","modelOptions","_map","default","call","item","link","ContentLinkModel","section","_id","sections","ContentTOCModel","ResourceModel","constructor","arguments","_defineProperty2","type","modelName","isApplicableModel","data","contributions","resourcetype","getInitialChildModelLinks","contentTypeLink","links","getLinkByKey","setChildModels","models","contentType","_find","model","label","getData","abbreviation","selfhref","href","Href","selflink","filterCollection","forEach","filter","params","param","value","setParameter","name","removeParameter","selfContentLink","_context","SectionModel","categories","_context2","category","_contentType","ContentTypeModel","_filterCollection","_context3","FilterCollection","_filter","_context4","key","_keys","has","timeversionFilter","getFilterByAttributeKey","TIMEVERSION_FILTER_NAME","attribute","isCompleteSource","completeFilter","exports"],"sources":["../../../src/models/content/ContentTOCModel.js"],"sourcesContent":["// @flow\nimport { has } from \"../../utils/helpers/objects\";\n\nimport ResourceModel from \"../base/ResourceModel\";\nimport FilterCollection from \"../filters/FilterCollection\";\nimport ContentLinkModel from \"./ContentLinkModel\";\nimport ContentTypeModel from \"./ContentTypeModel\";\nimport Href from \"../href/Href\";\n\nimport SectionModel from \"./SectionModel\";\n\nimport { TIMEVERSION_FILTER_NAME } from \"../../constants/Constants\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type { ModelOptions, ModularUIModel } from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\n\n/**\n * Get content items recursively\n */\nconst getItems = (\n items: Array<Object>,\n entryDate: ISO_DATE | null,\n modelOptions?: ModelOptions,\n): Array<ContentLinkModel> =>\n items.map((item) => {\n const link = new ContentLinkModel(\n {\n ...item,\n section: item._id,\n },\n entryDate,\n modelOptions,\n );\n\n if (item.items) {\n link.items = getItems(item.items, entryDate, modelOptions);\n }\n if (item.sections) {\n link.items = getItems(item.sections, entryDate, modelOptions);\n }\n\n return link;\n });\n\n/**\n * Content detail model\n */\nexport default class ContentTOCModel extends ResourceModel {\n _contentType: ContentTypeModel | null = null;\n _filterCollection: FilterCollection;\n\n /**\n */\n get type(): string {\n return \"ContentTOC\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"ContentTOCModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return data.contributions?.resourcetype === \"ContentTOC\";\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const contentTypeLink = this.links.getLinkByKey(\"contenttype\");\n\n if (contentTypeLink) {\n return [contentTypeLink];\n }\n\n return [];\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n this.contentType = models.find((model) => model.type === \"ContentType\");\n }\n\n /**\n * Get content label\n */\n get label(): string {\n return this.getData(\"label\", \"\");\n }\n\n /**\n */\n get abbreviation(): string | null {\n return this.getData(\"abbreviation\");\n }\n\n /**\n * Getting the self link of this list\n */\n get selfhref(): Href {\n const href = new Href(this.selflink.href);\n\n this.filterCollection.forEach((filter) => {\n filter.params.forEach((param) => {\n if (param.value) {\n href.setParameter(param.name, param.value);\n } else {\n href.removeParameter(param.name);\n }\n });\n });\n\n return href;\n }\n\n /**\n */\n get selfContentLink(): ContentLinkModel {\n return new ContentLinkModel(this.data, this.entryDate, this.modelOptions);\n }\n\n /**\n * Get sub items of toc\n */\n get items(): Array<ContentLinkModel> {\n if (this.data.items) {\n return getItems(this.data.items, this.entryDate, this.modelOptions);\n }\n\n if (this.data.sections) {\n return getItems(this.data.sections, this.entryDate, this.modelOptions);\n }\n\n return [];\n }\n\n /**\n */\n get sections(): Array<SectionModel> {\n if (this.data.sections) {\n return this.data.sections.map(\n (section) =>\n new SectionModel(section, this.entryDate, this.modelOptions),\n );\n }\n return [];\n }\n\n /**\n * get categories of content\n */\n get categories(): Array<ContentLinkModel> {\n if (this.data.categories) {\n return this.data.categories.map(\n (category) => new ContentLinkModel(category, null, this.modelOptions),\n );\n }\n\n return [];\n }\n\n /**\n * Retrieve content type model\n */\n get contentType(): ContentTypeModel | null {\n return this._contentType;\n }\n\n /**\n */\n set contentType(contentType: ?ModularUIModel) {\n this._contentType =\n contentType instanceof ContentTypeModel ? contentType : null;\n }\n\n /**\n * Retrieve available filters on concept toc\n */\n get filterCollection(): FilterCollection {\n if (!this._filterCollection) {\n this._filterCollection = new FilterCollection(\n this.data.filter,\n {\n filter: this.contributions.filter.filter((filter) => {\n const [key] = Object.keys(filter);\n return has(this.data?.filter, key);\n }),\n },\n this.modelOptions,\n );\n }\n\n return this._filterCollection;\n }\n\n /**\n * Retrieve modelcatalog.js of content toc\n */\n get entryDate(): ISO_DATE | null {\n const timeversionFilter = this.filterCollection.getFilterByAttributeKey(\n TIMEVERSION_FILTER_NAME,\n );\n\n return timeversionFilter?.attribute?.value ?? null;\n }\n\n /**\n */\n get isCompleteSource(): boolean {\n const completeFilter =\n this.filterCollection.getFilterByAttributeKey(\"complete\");\n return completeFilter?.attribute?.value === \"true\";\n }\n}\n"],"mappings":";;;;;;;;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AAEA,IAAAC,cAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,iBAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,iBAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,iBAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,KAAA,GAAAJ,sBAAA,CAAAF,OAAA;AAEA,IAAAO,aAAA,GAAAL,sBAAA,CAAAF,OAAA;AAEA,IAAAQ,UAAA,GAAAR,OAAA;AAKA;AACA;AACA;AACA,MAAMS,QAAQ,GAAGA,CACfC,KAAoB,EACpBC,SAA0B,EAC1BC,YAA2B,KAE3B,IAAAC,IAAA,CAAAC,OAAA,EAAAJ,KAAK,EAAAK,IAAA,CAALL,KAAK,EAAMM,IAAI,IAAK;EAClB,MAAMC,IAAI,GAAG,IAAIC,yBAAgB,CAC/B;IACE,GAAGF,IAAI;IACPG,OAAO,EAAEH,IAAI,CAACI;EAChB,CAAC,EACDT,SAAS,EACTC,YACF,CAAC;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A,OAAAE,OAAA,CAAAvD,OAAA,MAAI,CAACiB,aAAa,GAAAhB,IAAA,CAAAoD,SAAA,EAAgBhB,MAAM,IAAK;UAAA,IAAAmB,SAAA;UACnD,MAAM,CAACC,GAAG,CAAC,GAAG,IAAAC,KAAA,CAAA1D,OAAA,EAAYqC,MAAM,CAAC;UACjC,OAAO,IAAAsB,YAAG,GAAAH,SAAA,GAAC,IAAI,CAACxC,IAAI,yBAAAuC,OAAA,CAAAvD,OAAA,EAAAwD,SAAA,GAAUC,GAAG,CAAC;QACpC,CAAC;MACH,CAAC,EACD,IAAI,CAAC3D,YACP,CAAC;IACH;IAEA,OAAO,IAAI,CAACsD,iBAAiB;EAC/B;;EAEA;AACF;AACA;EACE,IAAIvD,SAASA,CAAA,EAAoB;IAC/B,MAAM+D,iBAAiB,GAAG,IAAI,CAACzB,gBAAgB,CAAC0B,uBAAuB,CACrEC,kCACF,CAAC;IAED,OAAOF,iBAAiB,EAAEG,SAAS,EAAEvB,KAAK,IAAI,IAAI;EACpD;;EAEA;AACF;EACE,IAAIwB,gBAAgBA,CAAA,EAAY;IAC9B,MAAMC,cAAc,GAClB,IAAI,CAAC9B,gBAAgB,CAAC0B,uBAAuB,CAAC,UAAU,CAAC;IAC3D,OAAOI,cAAc,EAAEF,SAAS,EAAEvB,KAAK,KAAK,MAAM;EACpD;AACF;AAAC0B,OAAA,CAAAlE,OAAA,GAAAQ,eAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"ContentTOCModel.js","names":["_objects","require","_ResourceModel","_interopRequireDefault","_FilterCollection","_ContentLinkModel","_ContentTypeModel","_Href","_SectionModel","_Constants","getItems","items","entryDate","modelOptions","_map","default","call","item","link","ContentLinkModel","section","_id","sections","ContentTOCModel","ResourceModel","constructor","arguments","_defineProperty2","type","modelName","isApplicableModel","data","contributions","resourcetype","getInitialChildModelLinks","contentTypeLink","links","getLinkByKey","setChildModels","models","contentType","_find","model","label","getData","abbreviation","selfhref","href","Href","selflink","filterCollection","forEach","filter","params","param","value","setParameter","name","removeParameter","relatedConceptsHref","relatedConceptsLink","addParameter","selfContentLink","_context","SectionModel","categories","_context2","category","_contentType","ContentTypeModel","_filterCollection","_context3","FilterCollection","_filter","_context4","key","_keys","has","timeversionFilter","getFilterByAttributeKey","TIMEVERSION_FILTER_NAME","attribute","isCompleteSource","completeFilter","exports"],"sources":["../../../src/models/content/ContentTOCModel.js"],"sourcesContent":["// @flow\nimport { has } from \"../../utils/helpers/objects\";\n\nimport ResourceModel from \"../base/ResourceModel\";\nimport FilterCollection from \"../filters/FilterCollection\";\nimport ContentLinkModel from \"./ContentLinkModel\";\nimport ContentTypeModel from \"./ContentTypeModel\";\nimport Href from \"../href/Href\";\n\nimport SectionModel from \"./SectionModel\";\n\nimport { TIMEVERSION_FILTER_NAME } from \"../../constants/Constants\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type { ModelOptions, ModularUIModel } from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\n\n/**\n * Get content items recursively\n */\nconst getItems = (\n items: Array<Object>,\n entryDate: ISO_DATE | null,\n modelOptions?: ModelOptions,\n): Array<ContentLinkModel> =>\n items.map((item) => {\n const link = new ContentLinkModel(\n {\n ...item,\n section: item._id,\n },\n entryDate,\n modelOptions,\n );\n\n if (item.items) {\n link.items = getItems(item.items, entryDate, modelOptions);\n }\n if (item.sections) {\n link.items = getItems(item.sections, entryDate, modelOptions);\n }\n\n return link;\n });\n\n/**\n * Content detail model\n */\nexport default class ContentTOCModel extends ResourceModel {\n _contentType: ContentTypeModel | null = null;\n _filterCollection: FilterCollection;\n\n /**\n */\n get type(): string {\n return \"ContentTOC\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"ContentTOCModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return data.contributions?.resourcetype === \"ContentTOC\";\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const contentTypeLink = this.links.getLinkByKey(\"contenttype\");\n\n if (contentTypeLink) {\n return [contentTypeLink];\n }\n\n return [];\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n this.contentType = models.find((model) => model.type === \"ContentType\");\n }\n\n /**\n * Get content label\n */\n get label(): string {\n return this.getData(\"label\", \"\");\n }\n\n /**\n */\n get abbreviation(): string | null {\n return this.getData(\"abbreviation\");\n }\n\n /**\n * Getting the self link of this list\n */\n get selfhref(): Href {\n const href = new Href(this.selflink.href);\n\n this.filterCollection.forEach((filter) => {\n filter.params.forEach((param) => {\n if (param.value) {\n href.setParameter(param.name, param.value);\n } else {\n href.removeParameter(param.name);\n }\n });\n });\n\n return href;\n }\n\n /**\n * Get related concepts link\n */\n get relatedConceptsHref(): Href | null {\n const relatedConceptsLink = this.links.getLinkByKey(\"relatedConcepts\");\n\n if (relatedConceptsLink) {\n const { href } = relatedConceptsLink;\n href.addParameter(\"entryDate\", this.entryDate);\n return href;\n }\n\n return null;\n }\n\n /**\n */\n get selfContentLink(): ContentLinkModel {\n return new ContentLinkModel(this.data, this.entryDate, this.modelOptions);\n }\n\n /**\n * Get sub items of toc\n */\n get items(): Array<ContentLinkModel> {\n if (this.data.items) {\n return getItems(this.data.items, this.entryDate, this.modelOptions);\n }\n\n if (this.data.sections) {\n return getItems(this.data.sections, this.entryDate, this.modelOptions);\n }\n\n return [];\n }\n\n /**\n */\n get sections(): Array<SectionModel> {\n if (this.data.sections) {\n return this.data.sections.map(\n (section) =>\n new SectionModel(section, this.entryDate, this.modelOptions),\n );\n }\n return [];\n }\n\n /**\n * get categories of content\n */\n get categories(): Array<ContentLinkModel> {\n if (this.data.categories) {\n return this.data.categories.map(\n (category) => new ContentLinkModel(category, null, this.modelOptions),\n );\n }\n\n return [];\n }\n\n /**\n * Retrieve content type model\n */\n get contentType(): ContentTypeModel | null {\n return this._contentType;\n }\n\n /**\n */\n set contentType(contentType: ?ModularUIModel) {\n this._contentType =\n contentType instanceof ContentTypeModel ? contentType : null;\n }\n\n /**\n * Retrieve available filters on concept toc\n */\n get filterCollection(): FilterCollection {\n if (!this._filterCollection) {\n this._filterCollection = new FilterCollection(\n this.data.filter,\n {\n filter: this.contributions.filter.filter((filter) => {\n const [key] = Object.keys(filter);\n return has(this.data?.filter, key);\n }),\n },\n this.modelOptions,\n );\n }\n\n return this._filterCollection;\n }\n\n /**\n * Retrieve modelcatalog.js of content toc\n */\n get entryDate(): ISO_DATE | null {\n const timeversionFilter = this.filterCollection.getFilterByAttributeKey(\n TIMEVERSION_FILTER_NAME,\n );\n\n return timeversionFilter?.attribute?.value ?? null;\n }\n\n /**\n */\n get isCompleteSource(): boolean {\n const completeFilter =\n this.filterCollection.getFilterByAttributeKey(\"complete\");\n return completeFilter?.attribute?.value === \"true\";\n }\n}\n"],"mappings":";;;;;;;;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AAEA,IAAAC,cAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,iBAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,iBAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,iBAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,KAAA,GAAAJ,sBAAA,CAAAF,OAAA;AAEA,IAAAO,aAAA,GAAAL,sBAAA,CAAAF,OAAA;AAEA,IAAAQ,UAAA,GAAAR,OAAA;AAKA;AACA;AACA;AACA,MAAMS,QAAQ,GAAGA,CACfC,KAAoB,EACpBC,SAA0B,EAC1BC,YAA2B,KAE3B,IAAAC,IAAA,CAAAC,OAAA,EAAAJ,KAAK,EAAAK,IAAA,CAALL,KAAK,EAAMM,IAAI,IAAK;EAClB,MAAMC,IAAI,GAAG,IAAIC,yBAAgB,CAC/B;IACE,GAAGF,IAAI;IACPG,OAAO,EAAEH,IAAI,CAACI;EAChB,CAAC,EACDT,SAAS,EACTC,YACF,CAAC;EAED,IAAII,IAAI,CAACN,KAAK,EAAE;IACdO,IAAI,CAACP,KAAK,GAAGD,QAAQ,CAACO,IAAI,CAAC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IACvC,IAAI,CAAC,IAAI,CAACoB,iBAAiB,EAAE;MAAA,IAAAC,SAAA;MAC3B,IAAI,CAACD,iBAAiB,GAAG,IAAIE,yBAAgB,KAAAC,OAAA,CAAA1D,OAAA,EAC3C,IAAI,CAACgB,IAAI,GACT;QACEqB,MAAM,EAAE,IAAAqB,OAAA,CAAA1D,OAAA,EAAAwD,SAAA,OAAAE,OAAA,CAAA1D,OAAA,MAAI,CAACiB,aAAa,GAAAhB,IAAA,CAAAuD,SAAA,EAAgBnB,MAAM,IAAK;UAAA,IAAAsB,SAAA;UACnD,MAAM,CAACC,GAAG,CAAC,GAAG,IAAAC,KAAA,CAAA7D,OAAA,EAAYqC,MAAM,CAAC;UACjC,OAAO,IAAAyB,YAAG,GAAAH,SAAA,GAAC,IAAI,CAAC3C,IAAI,yBAAA0C,OAAA,CAAA1D,OAAA,EAAA2D,SAAA,GAAUC,GAAG,CAAC;QACpC,CAAC;MACH,CAAC,EACD,IAAI,CAAC9D,YACP,CAAC;IACH;IAEA,OAAO,IAAI,CAACyD,iBAAiB;EAC/B;;EAEA;AACF;AACA;EACE,IAAI1D,SAASA,CAAA,EAAoB;IAC/B,MAAMkE,iBAAiB,GAAG,IAAI,CAAC5B,gBAAgB,CAAC6B,uBAAuB,CACrEC,kCACF,CAAC;IAED,OAAOF,iBAAiB,EAAEG,SAAS,EAAE1B,KAAK,IAAI,IAAI;EACpD;;EAEA;AACF;EACE,IAAI2B,gBAAgBA,CAAA,EAAY;IAC9B,MAAMC,cAAc,GAClB,IAAI,CAACjC,gBAAgB,CAAC6B,uBAAuB,CAAC,UAAU,CAAC;IAC3D,OAAOI,cAAc,EAAEF,SAAS,EAAE1B,KAAK,KAAK,MAAM;EACpD;AACF;AAAC6B,OAAA,CAAArE,OAAA,GAAAQ,eAAA","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -117,6 +117,21 @@ export default class ContentTOCModel extends ResourceModel {
|
|
|
117
117
|
return href;
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
+
/**
|
|
121
|
+
* Get related concepts link
|
|
122
|
+
*/
|
|
123
|
+
get relatedConceptsHref(): Href | null {
|
|
124
|
+
const relatedConceptsLink = this.links.getLinkByKey("relatedConcepts");
|
|
125
|
+
|
|
126
|
+
if (relatedConceptsLink) {
|
|
127
|
+
const { href } = relatedConceptsLink;
|
|
128
|
+
href.addParameter("entryDate", this.entryDate);
|
|
129
|
+
return href;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
return null;
|
|
133
|
+
}
|
|
134
|
+
|
|
120
135
|
/**
|
|
121
136
|
*/
|
|
122
137
|
get selfContentLink(): ContentLinkModel {
|
|
@@ -27,6 +27,10 @@ describe("formalsource", () => {
|
|
|
27
27
|
"Grant Funding Agreement - Terms and Conditions",
|
|
28
28
|
);
|
|
29
29
|
|
|
30
|
+
expect(tocModel.relatedConceptsHref.toString()).toBe(
|
|
31
|
+
"/content/bundle-com.beinformed.source.GrantFundingAgreementTermsandConditions/Grant%20Funding%20Agreement.formalsource/relatedConcepts?entryDate=2025-05-28",
|
|
32
|
+
);
|
|
33
|
+
|
|
30
34
|
expect(tocModel.items).toHaveLength(6);
|
|
31
35
|
expect(tocModel.items[0].items).toBeUndefined();
|
|
32
36
|
expect(tocModel.items[1].items).toHaveLength(2);
|
|
@@ -64,6 +68,10 @@ describe("formalsource", () => {
|
|
|
64
68
|
expect(completeModel.abbreviation).toBe("GFA-TC-01");
|
|
65
69
|
expect(completeModel.isCompleteSource).toBe(true);
|
|
66
70
|
|
|
71
|
+
expect(completeModel.relatedConceptsHref.toString()).toBe(
|
|
72
|
+
"/content/bundle-com.beinformed.source.GrantFundingAgreementTermsandConditions/Grant%20Funding%20Agreement.formalsource/relatedConcepts?entryDate=2025-05-28",
|
|
73
|
+
);
|
|
74
|
+
|
|
67
75
|
const firstSection = completeModel.sections[0];
|
|
68
76
|
expect(firstSection.selfhref.toString()).toBe(
|
|
69
77
|
"/content/bundle-com.beinformed.source.GrantFundingAgreementTermsandConditions/Grant%20Funding%20Agreement.formalsource/Chapter1",
|
|
@@ -25,6 +25,9 @@
|
|
|
25
25
|
},
|
|
26
26
|
"contributions": {
|
|
27
27
|
"href": "/contributions/content/(content-identifier)"
|
|
28
|
+
},
|
|
29
|
+
"relatedConcepts": {
|
|
30
|
+
"href": "/content/bundle-com.beinformed.source.GrantFundingAgreementTermsandConditions/Grant%20Funding%20Agreement.formalsource/relatedConcepts"
|
|
28
31
|
}
|
|
29
32
|
},
|
|
30
33
|
"label": "Grant Funding Agreement - Terms and Conditions",
|