@beinformed/ui 1.57.0-contextpath.0 → 1.57.0
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 +63 -0
- package/esm/constants/Settings.js +10 -2
- package/esm/constants/Settings.js.map +1 -1
- package/esm/hooks/useModularUI.js +24 -18
- package/esm/hooks/useModularUI.js.map +1 -1
- package/esm/hooks/useModularUIBasic.js +52 -41
- package/esm/hooks/useModularUIBasic.js.map +1 -1
- package/esm/models/concepts/ConceptDetailModel.js +1 -8
- package/esm/models/concepts/ConceptDetailModel.js.map +1 -1
- package/esm/models/concepts/ConceptIndexModel.js +1 -1
- package/esm/models/concepts/ConceptIndexModel.js.map +1 -1
- package/esm/models/concepts/ConceptLinkModel.js +8 -9
- package/esm/models/concepts/ConceptLinkModel.js.map +1 -1
- package/esm/models/concepts/ConceptTypeDetailModel.js +3 -20
- package/esm/models/concepts/ConceptTypeDetailModel.js.map +1 -1
- package/esm/models/concepts/SourceReferenceCollection.js +3 -1
- package/esm/models/concepts/SourceReferenceCollection.js.map +1 -1
- package/esm/models/concepts/SourceReferenceModel.js +9 -3
- package/esm/models/concepts/SourceReferenceModel.js.map +1 -1
- package/esm/models/content/ContentLinkModel.js +10 -4
- package/esm/models/content/ContentLinkModel.js.map +1 -1
- package/esm/models/content/SectionModel.js +10 -6
- package/esm/models/content/SectionModel.js.map +1 -1
- package/esm/models/error/ErrorResponse.js +20 -5
- package/esm/models/error/ErrorResponse.js.map +1 -1
- package/esm/models/href/Href.js +21 -4
- package/esm/models/href/Href.js.map +1 -1
- package/esm/models/list/ListItemCollection.js +1 -1
- package/esm/models/list/ListItemCollection.js.map +1 -1
- package/esm/modularui/CaptchaRequest.js +12 -3
- package/esm/modularui/CaptchaRequest.js.map +1 -1
- package/esm/modularui/ModularUIRequest.js +1 -1
- package/esm/modularui/ModularUIRequest.js.map +1 -1
- package/esm/modularui/UploadRequest.js +7 -3
- package/esm/modularui/UploadRequest.js.map +1 -1
- package/esm/redux/_modularui/ModularUIActions.js +11 -9
- package/esm/redux/_modularui/ModularUIActions.js.map +1 -1
- package/esm/redux/_modularui/ModularUIMiddleware.js +4 -1
- package/esm/redux/_modularui/ModularUIMiddleware.js.map +1 -1
- package/esm/redux/_modularui/ModularUIReducer.js +2 -1
- package/esm/redux/_modularui/ModularUIReducer.js.map +1 -1
- package/esm/redux/_modularui/ModularUISelectors.js +7 -6
- package/esm/redux/_modularui/ModularUISelectors.js.map +1 -1
- package/esm/redux/_modularui/types.js.map +1 -1
- package/esm/redux/actions/Application.js +11 -6
- package/esm/redux/actions/Application.js.map +1 -1
- package/esm/redux/connectors/PanelRenderer.js +0 -2
- package/esm/redux/connectors/PanelRenderer.js.map +1 -1
- package/esm/utils/helpers/checkResource.js +0 -2
- package/esm/utils/helpers/checkResource.js.map +1 -1
- package/esm/utils/helpers/repositoryResource.js +6 -5
- package/esm/utils/helpers/repositoryResource.js.map +1 -1
- package/lib/constants/Settings.js +10 -2
- package/lib/constants/Settings.js.flow +8 -2
- package/lib/constants/Settings.js.map +1 -1
- package/lib/hooks/__tests__/UseModularUIModel.spec.js.flow +11 -4
- package/lib/hooks/__tests__/useAuthentication.spec.js.flow +2 -8
- package/lib/hooks/__tests__/useForm.spec.js.flow +14 -12
- package/lib/hooks/__tests__/useModelCatalog.spec.js.flow +10 -4
- package/lib/hooks/__tests__/useModels.spec.js.flow +3 -12
- package/lib/hooks/__tests__/useModularUIBasic.spec.js.flow +9 -8
- package/lib/hooks/useModularUI.js +23 -17
- package/lib/hooks/useModularUI.js.flow +31 -16
- package/lib/hooks/useModularUI.js.map +1 -1
- package/lib/hooks/useModularUIBasic.js +52 -41
- package/lib/hooks/useModularUIBasic.js.flow +66 -50
- package/lib/hooks/useModularUIBasic.js.map +1 -1
- package/lib/models/concepts/ConceptDetailModel.js +1 -8
- package/lib/models/concepts/ConceptDetailModel.js.flow +2 -7
- package/lib/models/concepts/ConceptDetailModel.js.map +1 -1
- package/lib/models/concepts/ConceptIndexModel.js +1 -1
- package/lib/models/concepts/ConceptIndexModel.js.flow +7 -1
- package/lib/models/concepts/ConceptIndexModel.js.map +1 -1
- package/lib/models/concepts/ConceptLinkModel.js +8 -9
- package/lib/models/concepts/ConceptLinkModel.js.flow +14 -9
- package/lib/models/concepts/ConceptLinkModel.js.map +1 -1
- package/lib/models/concepts/ConceptTypeDetailModel.js +3 -20
- package/lib/models/concepts/ConceptTypeDetailModel.js.flow +3 -25
- package/lib/models/concepts/ConceptTypeDetailModel.js.map +1 -1
- package/lib/models/concepts/SourceReferenceCollection.js +3 -1
- package/lib/models/concepts/SourceReferenceCollection.js.flow +8 -1
- package/lib/models/concepts/SourceReferenceCollection.js.map +1 -1
- package/lib/models/concepts/SourceReferenceModel.js +9 -3
- package/lib/models/concepts/SourceReferenceModel.js.flow +19 -3
- package/lib/models/concepts/SourceReferenceModel.js.map +1 -1
- package/lib/models/concepts/__mock__/conceptindex.js.flow +15 -0
- package/lib/models/concepts/__tests__/ConceptIndexModel.spec.js.flow +30 -2
- package/lib/models/concepts/__tests__/ConceptTypeDetailModel.spec.js.flow +1 -18
- package/lib/models/content/ContentLinkModel.js +9 -4
- package/lib/models/content/ContentLinkModel.js.flow +19 -4
- package/lib/models/content/ContentLinkModel.js.map +1 -1
- package/lib/models/content/SectionModel.js +10 -6
- package/lib/models/content/SectionModel.js.flow +31 -5
- package/lib/models/content/SectionModel.js.map +1 -1
- package/lib/models/error/ErrorResponse.js +20 -5
- package/lib/models/error/ErrorResponse.js.flow +34 -5
- package/lib/models/error/ErrorResponse.js.map +1 -1
- package/lib/models/href/Href.js +21 -4
- package/lib/models/href/Href.js.flow +21 -4
- package/lib/models/href/Href.js.map +1 -1
- package/lib/models/href/__tests__/Href.spec.js.flow +9 -3
- package/lib/models/list/ListItemCollection.js +1 -1
- package/lib/models/list/ListItemCollection.js.flow +2 -0
- package/lib/models/list/ListItemCollection.js.map +1 -1
- package/lib/modularui/CaptchaRequest.js +11 -2
- package/lib/modularui/CaptchaRequest.js.flow +17 -3
- package/lib/modularui/CaptchaRequest.js.map +1 -1
- package/lib/modularui/ModularUIRequest.js +1 -1
- package/lib/modularui/ModularUIRequest.js.flow +3 -1
- package/lib/modularui/ModularUIRequest.js.map +1 -1
- package/lib/modularui/UploadRequest.js +6 -2
- package/lib/modularui/UploadRequest.js.flow +12 -2
- package/lib/modularui/UploadRequest.js.map +1 -1
- package/lib/redux/_modularui/ModularUIActions.js +11 -9
- package/lib/redux/_modularui/ModularUIActions.js.flow +20 -10
- package/lib/redux/_modularui/ModularUIActions.js.map +1 -1
- package/lib/redux/_modularui/ModularUIMiddleware.js +3 -0
- package/lib/redux/_modularui/ModularUIMiddleware.js.flow +6 -3
- package/lib/redux/_modularui/ModularUIMiddleware.js.map +1 -1
- package/lib/redux/_modularui/ModularUIReducer.js +2 -1
- package/lib/redux/_modularui/ModularUIReducer.js.flow +1 -0
- package/lib/redux/_modularui/ModularUIReducer.js.map +1 -1
- package/lib/redux/_modularui/ModularUISelectors.js +5 -6
- package/lib/redux/_modularui/ModularUISelectors.js.flow +22 -10
- package/lib/redux/_modularui/ModularUISelectors.js.map +1 -1
- package/lib/redux/_modularui/__tests__/actions.spec.js.flow +1 -4
- package/lib/redux/_modularui/types.js.flow +1 -0
- package/lib/redux/_modularui/types.js.map +1 -1
- package/lib/redux/actions/Application.js +10 -5
- package/lib/redux/actions/Application.js.flow +16 -5
- package/lib/redux/actions/Application.js.map +1 -1
- package/lib/redux/actions/__tests__/Application.spec.js.flow +1 -8
- package/lib/redux/actions/__tests__/Authorization.spec.js.flow +0 -4
- package/lib/redux/connectors/PanelRenderer.js +0 -2
- package/lib/redux/connectors/PanelRenderer.js.flow +0 -1
- package/lib/redux/connectors/PanelRenderer.js.map +1 -1
- package/lib/utils/helpers/checkResource.js +0 -2
- package/lib/utils/helpers/checkResource.js.flow +0 -2
- package/lib/utils/helpers/checkResource.js.map +1 -1
- package/lib/utils/helpers/repositoryResource.js +6 -5
- package/lib/utils/helpers/repositoryResource.js.flow +8 -6
- package/lib/utils/helpers/repositoryResource.js.map +1 -1
- package/package.json +18 -18
- package/src/constants/Settings.js +8 -2
- package/src/hooks/__tests__/UseModularUIModel.spec.js +11 -4
- package/src/hooks/__tests__/useAuthentication.spec.js +2 -8
- package/src/hooks/__tests__/useForm.spec.js +14 -12
- package/src/hooks/__tests__/useModelCatalog.spec.js +10 -4
- package/src/hooks/__tests__/useModels.spec.js +3 -12
- package/src/hooks/__tests__/useModularUIBasic.spec.js +9 -8
- package/src/hooks/useModularUI.js +31 -16
- package/src/hooks/useModularUIBasic.js +66 -50
- package/src/models/concepts/ConceptDetailModel.js +2 -7
- package/src/models/concepts/ConceptIndexModel.js +7 -1
- package/src/models/concepts/ConceptLinkModel.js +14 -9
- package/src/models/concepts/ConceptTypeDetailModel.js +3 -25
- package/src/models/concepts/SourceReferenceCollection.js +8 -1
- package/src/models/concepts/SourceReferenceModel.js +19 -3
- package/src/models/concepts/__mock__/conceptindex.js +15 -0
- package/src/models/concepts/__mock__/conceptindex_contributions.json +86 -0
- package/src/models/concepts/__mock__/conceptindex_data.json +323 -0
- package/src/models/concepts/__mock__/concepttype_hierarchy.json +1 -11
- package/src/models/concepts/__tests__/ConceptIndexModel.spec.js +30 -2
- package/src/models/concepts/__tests__/ConceptTypeDetailModel.spec.js +1 -18
- package/src/models/content/ContentLinkModel.js +19 -4
- package/src/models/content/SectionModel.js +31 -5
- package/src/models/error/ErrorResponse.js +34 -5
- package/src/models/href/Href.js +21 -4
- package/src/models/href/__tests__/Href.spec.js +9 -3
- package/src/models/list/ListItemCollection.js +2 -0
- package/src/modularui/CaptchaRequest.js +17 -3
- package/src/modularui/ModularUIRequest.js +3 -1
- package/src/modularui/UploadRequest.js +12 -2
- package/src/redux/_modularui/ModularUIActions.js +20 -10
- package/src/redux/_modularui/ModularUIMiddleware.js +6 -3
- package/src/redux/_modularui/ModularUIReducer.js +1 -0
- package/src/redux/_modularui/ModularUISelectors.js +22 -10
- package/src/redux/_modularui/__tests__/actions.spec.js +1 -4
- package/src/redux/_modularui/types.js +1 -0
- package/src/redux/actions/Application.js +16 -5
- package/src/redux/actions/__tests__/Application.spec.js +1 -8
- package/src/redux/actions/__tests__/Authorization.spec.js +0 -4
- package/src/redux/connectors/PanelRenderer.js +0 -1
- package/src/utils/helpers/checkResource.js +0 -2
- package/src/utils/helpers/repositoryResource.js +8 -6
|
@@ -5,6 +5,7 @@ import LinkModel from "../links/LinkModel";
|
|
|
5
5
|
import LinkCollection from "../links/LinkCollection";
|
|
6
6
|
import ConceptTypeDetailModel from "./ConceptTypeDetailModel";
|
|
7
7
|
import { TIMEVERSION_FILTER_NAME } from "../../constants/Constants";
|
|
8
|
+
import { getBasePath } from "../../constants";
|
|
8
9
|
/**
|
|
9
10
|
* Link to a concept
|
|
10
11
|
*/
|
|
@@ -14,11 +15,17 @@ export default class ConceptLinkModel extends BaseModel {
|
|
|
14
15
|
*/
|
|
15
16
|
constructor(data) {
|
|
16
17
|
let entryDate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
18
|
+
let origin = arguments.length > 2 ? arguments[2] : undefined;
|
|
19
|
+
let contextPath = arguments.length > 3 ? arguments[3] : undefined;
|
|
17
20
|
super(data, {});
|
|
18
21
|
_defineProperty(this, "_links", void 0);
|
|
19
22
|
_defineProperty(this, "_entryDate", void 0);
|
|
20
23
|
_defineProperty(this, "_conceptType", void 0);
|
|
24
|
+
_defineProperty(this, "_origin", "");
|
|
25
|
+
_defineProperty(this, "_contextPath", getBasePath());
|
|
21
26
|
this._entryDate = entryDate;
|
|
27
|
+
this._origin = origin || "";
|
|
28
|
+
this._contextPath = contextPath || getBasePath();
|
|
22
29
|
}
|
|
23
30
|
|
|
24
31
|
/**
|
|
@@ -80,7 +87,7 @@ export default class ConceptLinkModel extends BaseModel {
|
|
|
80
87
|
*/
|
|
81
88
|
get links() {
|
|
82
89
|
if (!this._links) {
|
|
83
|
-
this._links = new LinkCollection(Array.isArray(this.data._links) ? this.data._links[0] : this.data._links);
|
|
90
|
+
this._links = new LinkCollection(Array.isArray(this.data._links) ? this.data._links[0] : this.data._links, null, this._contextPath, this._origin);
|
|
84
91
|
}
|
|
85
92
|
return this._links;
|
|
86
93
|
}
|
|
@@ -128,7 +135,6 @@ export default class ConceptLinkModel extends BaseModel {
|
|
|
128
135
|
/**
|
|
129
136
|
*/
|
|
130
137
|
asLinkModel() {
|
|
131
|
-
// TODO SBO: origin and contextpath
|
|
132
138
|
const link = LinkModel.create(this.key, this.selfhref.href, this.label);
|
|
133
139
|
link.href = this.selfhref;
|
|
134
140
|
return link;
|
|
@@ -140,12 +146,5 @@ export default class ConceptLinkModel extends BaseModel {
|
|
|
140
146
|
isOfConceptType(conceptTypeId) {
|
|
141
147
|
return this.conceptType?.isOfConceptType(conceptTypeId) ?? false;
|
|
142
148
|
}
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* Indicates if the given metamodel functional identifier exists in the hierarchy of concept types for this concept
|
|
146
|
-
*/
|
|
147
|
-
hasMetamodelIdInConceptTypeHierarchy(metamodelId) {
|
|
148
|
-
return this.conceptType?.hasMetamodelIdInHierarchy(metamodelId) ?? false;
|
|
149
|
-
}
|
|
150
149
|
}
|
|
151
150
|
//# sourceMappingURL=ConceptLinkModel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConceptLinkModel.js","names":["BaseModel","LinkModel","LinkCollection","ConceptTypeDetailModel","TIMEVERSION_FILTER_NAME","ConceptLinkModel","constructor","data","entryDate","arguments","length","undefined","_defineProperty","_entryDate","getInitialChildModelLinks","conceptTypeLink","isCacheable","setChildModels","models","href","conceptTypeModel","_findInstanceProperty","call","model","selfhref","equalsWithParameters","type","conceptType","_conceptType","key","_id","label","getData","links","_links","Array","isArray","selflink","getLinkByKey","Error","addParameter","concepttypeHref","taxonomyType","asLinkModel","link","create","isOfConceptType","conceptTypeId"
|
|
1
|
+
{"version":3,"file":"ConceptLinkModel.js","names":["BaseModel","LinkModel","LinkCollection","ConceptTypeDetailModel","TIMEVERSION_FILTER_NAME","getBasePath","ConceptLinkModel","constructor","data","entryDate","arguments","length","undefined","origin","contextPath","_defineProperty","_entryDate","_origin","_contextPath","getInitialChildModelLinks","conceptTypeLink","isCacheable","setChildModels","models","href","conceptTypeModel","_findInstanceProperty","call","model","selfhref","equalsWithParameters","type","conceptType","_conceptType","key","_id","label","getData","links","_links","Array","isArray","selflink","getLinkByKey","Error","addParameter","concepttypeHref","taxonomyType","asLinkModel","link","create","isOfConceptType","conceptTypeId"],"sources":["../../../src/models/concepts/ConceptLinkModel.js"],"sourcesContent":["// @flow\nimport BaseModel from \"../base/BaseModel\";\nimport LinkModel from \"../links/LinkModel\";\nimport LinkCollection from \"../links/LinkCollection\";\nimport ConceptTypeDetailModel from \"./ConceptTypeDetailModel\";\nimport { TIMEVERSION_FILTER_NAME } from \"../../constants/Constants\";\n\nimport type { IModelWithChildModels, ModularUIModel } from \"../types\";\nimport type Href from \"../href/Href\";\nimport { getBasePath } from \"../../constants\";\n/**\n * Link to a concept\n */\nexport default class ConceptLinkModel\n extends BaseModel\n implements IModelWithChildModels\n{\n _links: ?LinkCollection;\n _entryDate: ?ISO_DATE;\n _conceptType: ?ConceptTypeDetailModel;\n _origin: string = \"\";\n _contextPath: string = getBasePath();\n\n /**\n * Construct ConceptLinkModel\n */\n constructor(\n data: Object,\n entryDate: ?ISO_DATE = null,\n origin?: string,\n contextPath?: string,\n ) {\n super(data, {});\n\n this._entryDate = entryDate;\n this._origin = origin || \"\";\n this._contextPath = contextPath || getBasePath();\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n if (this.conceptTypeLink) {\n this.conceptTypeLink.isCacheable = true;\n return [this.conceptTypeLink];\n }\n\n return [];\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n if (this.conceptTypeLink) {\n const href = this.conceptTypeLink.href;\n const conceptTypeModel = models.find((model) =>\n model.selfhref.equalsWithParameters(href),\n );\n\n if (conceptTypeModel?.type === \"ConceptTypeDetail\") {\n this.conceptType = conceptTypeModel;\n }\n }\n }\n\n /**\n * Retrieve concept type\n */\n get conceptType(): ?ConceptTypeDetailModel {\n return this._conceptType;\n }\n\n /**\n * Set concept type\n */\n set conceptType(conceptType: ?ModularUIModel) {\n this._conceptType =\n conceptType instanceof ConceptTypeDetailModel ? conceptType : null;\n }\n\n /**\n * Retrieve key\n */\n get key(): string {\n return this.data._id;\n }\n\n /**\n * Retrieve label\n */\n get label(): string {\n const label = this.getData(\"label\");\n\n if (label) {\n return label;\n }\n\n return this.getData(\"conceptLabel\", \"\");\n }\n\n /**\n * Getting the links of the resource\n */\n get links(): LinkCollection {\n if (!this._links) {\n this._links = new LinkCollection(\n Array.isArray(this.data._links)\n ? this.data._links[0]\n : this.data._links,\n null,\n this._contextPath,\n this._origin,\n );\n }\n\n return this._links;\n }\n\n /**\n * Get self link of model\n */\n get selflink(): LinkModel {\n const selflink = this.links.getLinkByKey(\"self\");\n\n if (selflink === null) {\n throw new Error(\n `Could not find self link for ${\n this.key === null ? \"unknown\" : this.key\n }`,\n );\n }\n\n return selflink;\n }\n\n /**\n * Self href of concept\n */\n get selfhref(): Href {\n if (this._entryDate !== null) {\n return this.selflink.href.addParameter(\n TIMEVERSION_FILTER_NAME,\n this._entryDate,\n );\n }\n\n return this.selflink.href;\n }\n\n /**\n */\n get conceptTypeLink(): LinkModel | null {\n return this.links.getLinkByKey(\"concepttype\");\n }\n\n /**\n * Concept type href of concept\n */\n get concepttypeHref(): Href | null {\n return this.conceptTypeLink?.href ?? null;\n }\n\n /**\n */\n get taxonomyType(): string {\n return \"default\";\n }\n\n /**\n */\n asLinkModel(): LinkModel {\n const link = LinkModel.create(this.key, this.selfhref.href, this.label);\n link.href = this.selfhref;\n\n return link;\n }\n\n /**\n * Indicates if the given concept type id or href exists in the hierarchy of concept types for this concept\n */\n isOfConceptType(conceptTypeId: string): boolean {\n return this.conceptType?.isOfConceptType(conceptTypeId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B,eAAe,CAACC,aAAa,CAAC,IAAI,KAAK;EAClE;AACF","ignoreList":[]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _startsWithInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/starts-with";
|
|
2
1
|
import ResourceModel from "../base/ResourceModel";
|
|
3
2
|
/**
|
|
4
3
|
* Model for concept details, available through modelcatalog
|
|
@@ -8,8 +7,8 @@ class ConceptTypeDetailModel extends ResourceModel {
|
|
|
8
7
|
* The name of the concept type consists of the functional id of the kmt and the functional id of the concept type separated by a #.<br>
|
|
9
8
|
* For example BEI_CaseManagement#Case
|
|
10
9
|
*/
|
|
11
|
-
get
|
|
12
|
-
return this.getData("
|
|
10
|
+
get kmtId() {
|
|
11
|
+
return this.getData("kmtId", "");
|
|
13
12
|
}
|
|
14
13
|
|
|
15
14
|
/**
|
|
@@ -112,26 +111,10 @@ class ConceptTypeDetailModel extends ResourceModel {
|
|
|
112
111
|
return this.getData("sectionReferenceTypes", []);
|
|
113
112
|
}
|
|
114
113
|
|
|
115
|
-
/**
|
|
116
|
-
*/
|
|
117
|
-
get conceptTypeHierarchy() {
|
|
118
|
-
return this.links.getLinksByGroup("conceptTypeHierarchy");
|
|
119
|
-
}
|
|
120
|
-
|
|
121
114
|
/**
|
|
122
115
|
*/
|
|
123
116
|
isOfConceptType(conceptTypeId) {
|
|
124
|
-
return this.
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Indicates if the given metamodel functional identifier exists in the hierarchy of concept types
|
|
129
|
-
*/
|
|
130
|
-
hasMetamodelIdInHierarchy(metamodelId) {
|
|
131
|
-
return this.conceptTypeHierarchy?.all.some(link => {
|
|
132
|
-
var _context;
|
|
133
|
-
return _startsWithInstanceProperty(_context = link.key).call(_context, metamodelId + "#");
|
|
134
|
-
}) || false;
|
|
117
|
+
return this.selfhref.equals(conceptTypeId);
|
|
135
118
|
}
|
|
136
119
|
}
|
|
137
120
|
export default ConceptTypeDetailModel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConceptTypeDetailModel.js","names":["ResourceModel","ConceptTypeDetailModel","
|
|
1
|
+
{"version":3,"file":"ConceptTypeDetailModel.js","names":["ResourceModel","ConceptTypeDetailModel","kmtId","getData","type","modelName","isApplicableModel","data","contributions","resourcetype","key","_id","label","modelCategory","isCoreTaxonomy","icon","textColor","backgroundColor","borderColor","labelTypes","propertyTypes","textFragmentTypes","sectionReferenceTypes","isOfConceptType","conceptTypeId","selfhref","equals"],"sources":["../../../src/models/concepts/ConceptTypeDetailModel.js"],"sourcesContent":["// @flow\nimport ResourceModel from \"../base/ResourceModel\";\n\nimport type ModularUIResponse from \"../../modularui/ModularUIResponse\";\n\n/**\n * Model for concept details, available through modelcatalog\n */\nclass ConceptTypeDetailModel extends ResourceModel {\n /**\n * The name of the concept type consists of the functional id of the kmt and the functional id of the concept type separated by a #.<br>\n * For example BEI_CaseManagement#Case\n */\n get kmtId(): string {\n return this.getData(\"kmtId\", \"\");\n }\n\n /**\n */\n get type(): string {\n return \"ConceptTypeDetail\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"ConceptTypeDetailModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return (\n data.contributions.resourcetype &&\n data.contributions.resourcetype === \"ConceptTypeDetail\"\n );\n }\n\n /**\n */\n get key(): string {\n return this.data._id;\n }\n\n /**\n * Get concept type label\n */\n get label(): string {\n return this.getData(\"label\", \"\");\n }\n\n /**\n * Get model category of the concept type\n */\n get modelCategory(): string {\n return this.getData(\"modelCategory\", \"\");\n }\n\n /**\n */\n get isCoreTaxonomy(): boolean {\n return this.getData(\"coreTaxonomy\", \"false\") === \"true\";\n }\n\n /**\n * Get concept type icon\n */\n get icon(): string {\n return this.getData(\"icon\", \"\");\n }\n\n /**\n * Get concept type text color\n */\n get textColor(): string {\n return this.getData(\"textColor\", \"#000\");\n }\n\n /**\n * Get concept type background color\n */\n get backgroundColor(): string {\n return this.getData(\"backgroundColor\", \"#fff\");\n }\n\n /**\n * Get concept line color\n */\n get borderColor(): string {\n return this.getData(\"lineColor\", \"#000\");\n }\n\n /**\n * Get label types\n */\n get labelTypes(): ?Array<Object> {\n return this.data.labelTypes;\n }\n\n /**\n * Get propertyTypes\n */\n get propertyTypes(): Array<Object> {\n return this.getData(\"propertyTypes\", []);\n }\n\n /**\n * Get textFragmentTypes\n */\n get textFragmentTypes(): Array<Object> {\n return this.getData(\"textFragmentTypes\", []);\n }\n\n /**\n * Get sectionReferenceTypes\n */\n get sectionReferenceTypes(): Array<Object> {\n return this.getData(\"sectionReferenceTypes\", []);\n }\n\n /**\n */\n isOfConceptType(conceptTypeId: string): boolean {\n return this.selfhref.equals(conceptTypeId);\n }\n}\n\nexport default ConceptTypeDetailModel;\n"],"mappings":"AACA,OAAOA,aAAa,MAAM,uBAAuB;AAIjD;AACA;AACA;AACA,MAAMC,sBAAsB,SAASD,aAAa,CAAC;EACjD;AACF;AACA;AACA;EACE,IAAIE,KAAKA,CAAA,EAAW;IAClB,OAAO,IAAI,CAACC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC;EAClC;;EAEA;AACF;EACE,IAAIC,IAAIA,CAAA,EAAW;IACjB,OAAO,mBAAmB;EAC5B;;EAEA;AACF;EACE,WAAWC,SAASA,CAAA,EAAW;IAC7B,OAAO,wBAAwB;EACjC;;EAEA;AACF;EACE,OAAOC,iBAAiBA,CAACC,IAAuB,EAAW;IACzD,OACEA,IAAI,CAACC,aAAa,CAACC,YAAY,IAC/BF,IAAI,CAACC,aAAa,CAACC,YAAY,KAAK,mBAAmB;EAE3D;;EAEA;AACF;EACE,IAAIC,GAAGA,CAAA,EAAW;IAChB,OAAO,IAAI,CAACH,IAAI,CAACI,GAAG;EACtB;;EAEA;AACF;AACA;EACE,IAAIC,KAAKA,CAAA,EAAW;IAClB,OAAO,IAAI,CAACT,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC;EAClC;;EAEA;AACF;AACA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AACC,MAAM,CAACF,aAAa,CAAC;EAC5C;AACF;AAEA,eAAevB,sBAAsB","ignoreList":[]}
|
|
@@ -13,8 +13,10 @@ export default class SourceReferenceCollection extends BaseCollection {
|
|
|
13
13
|
constructor() {
|
|
14
14
|
let sourceReferences = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
15
15
|
let entryDate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
16
|
+
let origin = arguments.length > 2 ? arguments[2] : undefined;
|
|
17
|
+
let contextPath = arguments.length > 3 ? arguments[3] : undefined;
|
|
16
18
|
super();
|
|
17
|
-
this.collection = sourceReferences ? _mapInstanceProperty(sourceReferences).call(sourceReferences, sourceReference => new SourceReferenceModel(sourceReference, entryDate)) : [];
|
|
19
|
+
this.collection = sourceReferences ? _mapInstanceProperty(sourceReferences).call(sourceReferences, sourceReference => new SourceReferenceModel(sourceReference, entryDate, origin, contextPath)) : [];
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SourceReferenceCollection.js","names":["BaseCollection","SourceReferenceModel","SourceReferenceCollection","constructor","sourceReferences","arguments","length","undefined","entryDate","collection","_mapInstanceProperty","call","sourceReference","byTypes","types","_context","_filterInstanceProperty","sourceRef","_includesInstanceProperty","type"],"sources":["../../../src/models/concepts/SourceReferenceCollection.js"],"sourcesContent":["// @flow\nimport BaseCollection from \"../base/BaseCollection\";\nimport SourceReferenceModel from \"./SourceReferenceModel\";\n\n/**\n * Source reference collection\n */\nexport default class SourceReferenceCollection extends BaseCollection<SourceReferenceModel> {\n /**\n */\n constructor(\n sourceReferences: Array<Object> = [],\n entryDate: ?ISO_DATE = null,\n ) {\n super();\n\n this.collection = sourceReferences\n ? sourceReferences.map(\n (sourceReference) =>\n new SourceReferenceModel(sourceReference
|
|
1
|
+
{"version":3,"file":"SourceReferenceCollection.js","names":["BaseCollection","SourceReferenceModel","SourceReferenceCollection","constructor","sourceReferences","arguments","length","undefined","entryDate","origin","contextPath","collection","_mapInstanceProperty","call","sourceReference","byTypes","types","_context","_filterInstanceProperty","sourceRef","_includesInstanceProperty","type"],"sources":["../../../src/models/concepts/SourceReferenceCollection.js"],"sourcesContent":["// @flow\nimport BaseCollection from \"../base/BaseCollection\";\nimport SourceReferenceModel from \"./SourceReferenceModel\";\n\n/**\n * Source reference collection\n */\nexport default class SourceReferenceCollection extends BaseCollection<SourceReferenceModel> {\n /**\n */\n constructor(\n sourceReferences: Array<Object> = [],\n entryDate: ?ISO_DATE = null,\n origin?: string,\n contextPath?: string,\n ) {\n super();\n\n this.collection = sourceReferences\n ? sourceReferences.map(\n (sourceReference) =>\n new SourceReferenceModel(\n sourceReference,\n entryDate,\n origin,\n contextPath,\n ),\n )\n : [];\n }\n\n /**\n */\n byTypes(types: string): Array<SourceReferenceModel> {\n return this.filter((sourceRef) => types.includes(sourceRef.type));\n }\n}\n"],"mappings":";;;AACA,OAAOA,cAAc,MAAM,wBAAwB;AACnD,OAAOC,oBAAoB,MAAM,wBAAwB;;AAEzD;AACA;AACA;AACA,eAAe,MAAMC,yBAAyB,SAASF,cAAc,CAAuB;EAC1F;AACF;EACEG,WAAWA,CAAA,EAKT;IAAA,IAJAC,gBAA+B,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE;IAAA,IACpCG,SAAoB,GAAAH,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,IAAI;IAAA,IAC3BI,MAAe,GAAAJ,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;IAAA,IACfG,WAAoB,GAAAL,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;IAEpB,KAAK,CAAC,CAAC;IAEP,IAAI,CAACI,UAAU,GAAGP,gBAAgB,GAC9BQ,oBAAA,CAAAR,gBAAgB,EAAAS,IAAA,CAAhBT,gBAAgB,EACbU,eAAe,IACd,IAAIb,oBAAoB,CACtBa,eAAe,EACfN,SAAS,EACTC,MAAM,EACNC,WACF,CACJ,CAAC,GACD,EAAE;EACR;;EAEA;AACF;EACEK,OAAOA,CAACC,KAAa,EAA+B;IAAA,IAAAC,QAAA;IAClD,OAAOC,uBAAA,CAAAD,QAAA,OAAI,EAAAJ,IAAA,CAAAI,QAAA,EAASE,SAAS,IAAKC,yBAAA,CAAAJ,KAAK,EAAAH,IAAA,CAALG,KAAK,EAAUG,SAAS,CAACE,IAAI,CAAC,CAAC;EACnE;AACF","ignoreList":[]}
|
|
@@ -2,6 +2,7 @@ import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
|
|
2
2
|
import { createHashFromHref } from "../../utils/helpers/createHash";
|
|
3
3
|
import ContentLinkModel from "../content/ContentLinkModel";
|
|
4
4
|
import Href from "../href/Href";
|
|
5
|
+
import { getBasePath } from "../../constants";
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
*/
|
|
@@ -10,10 +11,16 @@ class SourceReferenceModel {
|
|
|
10
11
|
*/
|
|
11
12
|
constructor(sourceReference) {
|
|
12
13
|
let entryDate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
14
|
+
let origin = arguments.length > 2 ? arguments[2] : undefined;
|
|
15
|
+
let contextPath = arguments.length > 3 ? arguments[3] : undefined;
|
|
13
16
|
_defineProperty(this, "_sourceReference", void 0);
|
|
14
17
|
_defineProperty(this, "_entryDate", void 0);
|
|
18
|
+
_defineProperty(this, "_origin", "");
|
|
19
|
+
_defineProperty(this, "_contextPath", getBasePath());
|
|
15
20
|
this._sourceReference = sourceReference;
|
|
16
21
|
this._entryDate = entryDate;
|
|
22
|
+
this._origin = origin || "";
|
|
23
|
+
this._contextPath = contextPath || getBasePath();
|
|
17
24
|
}
|
|
18
25
|
|
|
19
26
|
/**
|
|
@@ -23,14 +30,13 @@ class SourceReferenceModel {
|
|
|
23
30
|
return new ContentLinkModel({
|
|
24
31
|
...this._sourceReference,
|
|
25
32
|
section
|
|
26
|
-
}, this._entryDate);
|
|
33
|
+
}, this._entryDate, this._origin, this._contextPath);
|
|
27
34
|
}
|
|
28
35
|
|
|
29
36
|
/**
|
|
30
37
|
*/
|
|
31
38
|
get selfhref() {
|
|
32
|
-
|
|
33
|
-
return new Href(this._sourceReference._links.self.href, "SourceReference");
|
|
39
|
+
return new Href(this._sourceReference._links.self.href, "SourceReference", this._origin, this._contextPath);
|
|
34
40
|
}
|
|
35
41
|
|
|
36
42
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SourceReferenceModel.js","names":["createHashFromHref","ContentLinkModel","Href","SourceReferenceModel","constructor","sourceReference","entryDate","arguments","length","undefined","_defineProperty","_sourceReference","_entryDate","link","section","_links","self","href","replace","content","selfhref","type","label","sourceLabel","referenceHash"],"sources":["../../../src/models/concepts/SourceReferenceModel.js"],"sourcesContent":["// @flow\nimport { createHashFromHref } from \"../../utils/helpers/createHash\";\n\nimport ContentLinkModel from \"../content/ContentLinkModel\";\nimport Href from \"../href/Href\";\n\n/**\n */\nclass SourceReferenceModel {\n _sourceReference: Object;\n _entryDate: ?ISO_DATE;\n\n /**\n */\n constructor(sourceReference: Object
|
|
1
|
+
{"version":3,"file":"SourceReferenceModel.js","names":["createHashFromHref","ContentLinkModel","Href","getBasePath","SourceReferenceModel","constructor","sourceReference","entryDate","arguments","length","undefined","origin","contextPath","_defineProperty","_sourceReference","_entryDate","_origin","_contextPath","link","section","_links","self","href","replace","content","selfhref","type","label","sourceLabel","referenceHash"],"sources":["../../../src/models/concepts/SourceReferenceModel.js"],"sourcesContent":["// @flow\nimport { createHashFromHref } from \"../../utils/helpers/createHash\";\n\nimport ContentLinkModel from \"../content/ContentLinkModel\";\nimport Href from \"../href/Href\";\nimport { getBasePath } from \"../../constants\";\n\n/**\n */\nclass SourceReferenceModel {\n _sourceReference: Object;\n _entryDate: ?ISO_DATE;\n _origin: string = \"\";\n _contextPath: string = getBasePath();\n\n /**\n */\n constructor(\n sourceReference: Object,\n entryDate: ?ISO_DATE = null,\n origin?: string,\n contextPath?: string,\n ) {\n this._sourceReference = sourceReference;\n this._entryDate = entryDate;\n this._origin = origin || \"\";\n this._contextPath = contextPath || getBasePath();\n }\n\n /**\n */\n get link(): ContentLinkModel {\n const section = this._sourceReference._links.self.href.replace(\n `${this._sourceReference._links.content.href}/`,\n \"\",\n );\n\n return new ContentLinkModel(\n {\n ...this._sourceReference,\n section,\n },\n this._entryDate,\n this._origin,\n this._contextPath,\n );\n }\n\n /**\n */\n get selfhref(): Href {\n return new Href(\n this._sourceReference._links.self.href,\n \"SourceReference\",\n this._origin,\n this._contextPath,\n );\n }\n\n /**\n */\n get type(): string {\n return this._sourceReference.type;\n }\n\n /**\n */\n get label(): string {\n return this._sourceReference.label;\n }\n\n /**\n */\n get sourceLabel(): string {\n return this._sourceReference.sourceLabel;\n }\n\n /**\n */\n get referenceHash(): number {\n return createHashFromHref(this.selfhref);\n }\n}\n\nexport default SourceReferenceModel;\n"],"mappings":";AACA,SAASA,kBAAkB,QAAQ,gCAAgC;AAEnE,OAAOC,gBAAgB,MAAM,6BAA6B;AAC1D,OAAOC,IAAI,MAAM,cAAc;AAC/B,SAASC,WAAW,QAAQ,iBAAiB;;AAE7C;AACA;AACA,MAAMC,oBAAoB,CAAC;EAMzB;AACF;EACEC,WAAWA,CACTC,eAAuB,EAIvB;IAAA,IAHAC,SAAoB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,IAAI;IAAA,IAC3BG,MAAe,GAAAH,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;IAAA,IACfE,WAAoB,GAAAJ,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;IAAAG,eAAA;IAAAA,eAAA;IAAAA,eAAA,kBATJ,EAAE;IAAAA,eAAA,uBACGV,WAAW,CAAC,CAAC;IAUlC,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6,6 +6,8 @@ import LinkModel from "../links/LinkModel";
|
|
|
6
6
|
import ContentTypeModel from "./ContentTypeModel";
|
|
7
7
|
import { TIMEVERSION_FILTER_NAME } from "../../constants/Constants";
|
|
8
8
|
import LinkCollection from "../links/LinkCollection";
|
|
9
|
+
import { getBasePath } from "../../constants";
|
|
10
|
+
|
|
9
11
|
/**
|
|
10
12
|
* Link to a concept
|
|
11
13
|
*/
|
|
@@ -14,12 +16,18 @@ export default class ContentLinkModel extends BaseModel {
|
|
|
14
16
|
*/
|
|
15
17
|
constructor(data) {
|
|
16
18
|
let entryDate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
19
|
+
let origin = arguments.length > 2 ? arguments[2] : undefined;
|
|
20
|
+
let contextPath = arguments.length > 3 ? arguments[3] : undefined;
|
|
17
21
|
super(data, {});
|
|
18
22
|
_defineProperty(this, "_links", void 0);
|
|
19
23
|
_defineProperty(this, "_entryDate", void 0);
|
|
20
24
|
_defineProperty(this, "_contentType", null);
|
|
21
25
|
_defineProperty(this, "_items", void 0);
|
|
26
|
+
_defineProperty(this, "_origin", "");
|
|
27
|
+
_defineProperty(this, "_contextPath", getBasePath());
|
|
22
28
|
this._entryDate = entryDate;
|
|
29
|
+
this._origin = origin || "";
|
|
30
|
+
this._contextPath = contextPath || getBasePath();
|
|
23
31
|
}
|
|
24
32
|
|
|
25
33
|
/**
|
|
@@ -90,9 +98,8 @@ export default class ContentLinkModel extends BaseModel {
|
|
|
90
98
|
/**
|
|
91
99
|
*/
|
|
92
100
|
createEncodedHref() {
|
|
93
|
-
// TODO SBO: origin and context
|
|
94
101
|
const startURI = "/content/";
|
|
95
|
-
const selfHref = new Href(this.data._links.self.href);
|
|
102
|
+
const selfHref = new Href(this.data._links.self.href, this._origin, this._contextPath);
|
|
96
103
|
const href = selfHref.path;
|
|
97
104
|
const section = this.data.section;
|
|
98
105
|
const sourceId = section ? href.substring(startURI.length, href.lastIndexOf("/")) : href.substring(startURI.length);
|
|
@@ -121,8 +128,7 @@ export default class ContentLinkModel extends BaseModel {
|
|
|
121
128
|
*/
|
|
122
129
|
get links() {
|
|
123
130
|
if (!this._links) {
|
|
124
|
-
|
|
125
|
-
this._links = new LinkCollection(Array.isArray(this.data._links) ? this.data._links[0] : this.data._links);
|
|
131
|
+
this._links = new LinkCollection(Array.isArray(this.data._links) ? this.data._links[0] : this.data._links, null, this._origin, this._contextPath);
|
|
126
132
|
}
|
|
127
133
|
return this._links;
|
|
128
134
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentLinkModel.js","names":["BaseModel","Href","LinkModel","ContentTypeModel","TIMEVERSION_FILTER_NAME","LinkCollection","ContentLinkModel","constructor","data","entryDate","arguments","length","undefined","_defineProperty","_entryDate","getInitialChildModelLinks","contentTypeLink","isCacheable","setChildModels","models","href","contentTypeModel","_findInstanceProperty","call","model","selfhref","equalsWithParameters","type","contentType","_contentType","key","getData","label","sourceLabel","createEncodedHref","startURI","selfHref","_links","self","path","section","sourceId","substring","lastIndexOf","encodeURIComponent","encodedHref","addParameter","links","Array","isArray","selflink","getLinkByKey","Error","subSectionID","hash","contentTypeHref","items","_items"],"sources":["../../../src/models/content/ContentLinkModel.js"],"sourcesContent":["// @flow\nimport BaseModel from \"../base/BaseModel\";\nimport Href from \"../href/Href\";\nimport LinkModel from \"../links/LinkModel\";\nimport ContentTypeModel from \"./ContentTypeModel\";\nimport { TIMEVERSION_FILTER_NAME } from \"../../constants/Constants\";\n\nimport LinkCollection from \"../links/LinkCollection\";\n\nimport type { ModularUIModel, IModelWithChildModels } from \"../types\";\n\n/**\n * Link to a concept\n */\nexport default class ContentLinkModel\n extends BaseModel\n implements IModelWithChildModels\n{\n _links: ?LinkCollection;\n _entryDate: ?ISO_DATE;\n _contentType: ContentTypeModel | null = null;\n _items: Array<ContentLinkModel>;\n\n /**\n */\n constructor(data: Object, entryDate: ?ISO_DATE = null) {\n super(data, {});\n\n this._entryDate = entryDate;\n }\n\n /**\n */\n // $FlowFixMe[method-unbinding]\n getInitialChildModelLinks(): Array<LinkModel> {\n if (this.contentTypeLink) {\n this.contentTypeLink.isCacheable = true;\n return [this.contentTypeLink];\n }\n\n return [];\n }\n\n /**\n */\n // $FlowFixMe[method-unbinding]\n setChildModels(models: Array<ModularUIModel>) {\n if (this.contentTypeLink) {\n const href = this.contentTypeLink.href;\n const contentTypeModel = models.find((model) =>\n model.selfhref.equalsWithParameters(href),\n );\n\n if (contentTypeModel?.type === \"ContentType\") {\n this.contentType = contentTypeModel;\n }\n }\n }\n\n /**\n * Retrieve content type\n */\n get contentType(): ?ContentTypeModel | null {\n return this._contentType;\n }\n\n /**\n * Set concept type\n */\n set contentType(contentType: ?ModularUIModel) {\n this._contentType =\n contentType instanceof ContentTypeModel ? contentType : null;\n }\n\n /**\n */\n set entryDate(entryDate: ISO_DATE) {\n this._entryDate = entryDate;\n }\n\n /**\n * Retrieve key\n */\n get key(): string {\n return this.getData(\"_id\", \"\");\n }\n\n /**\n * Retrieve label\n */\n get label(): string {\n return this.getData(\"label\", \"\");\n }\n\n /**\n * Retrieve the label of the source a link to a section belongs to\n */\n get sourceLabel(): string | null {\n return this.getData(\"sourceLabel\");\n }\n\n /**\n */\n createEncodedHref(): Href {\n // TODO SBO: origin and context\n const startURI = \"/content/\";\n const selfHref = new Href(this.data._links.self.href);\n const href = selfHref.path;\n\n const section = this.data.section;\n const sourceId = section\n ? href.substring(startURI.length, href.lastIndexOf(\"/\"))\n : href.substring(startURI.length);\n\n if (section) {\n selfHref.path = `${startURI}${encodeURIComponent(sourceId)}/${encodeURIComponent(section)}`;\n } else {\n selfHref.path = `${startURI}${encodeURIComponent(sourceId)}`;\n }\n\n return selfHref;\n }\n\n /**\n * Encode the content-identifier of the path to the content resource.\n * This makes it a single uri part, which can be used on routes to make nested routes\n */\n get encodedHref(): Href {\n const href = this.createEncodedHref();\n\n if (this._entryDate !== null) {\n return href.addParameter(TIMEVERSION_FILTER_NAME, this._entryDate);\n }\n\n return href;\n }\n\n /**\n * Getting the links of the resource\n */\n get links(): LinkCollection {\n if (!this._links) {\n // TODO SBO: origin and context\n this._links = new LinkCollection(\n Array.isArray(this.data._links)\n ? this.data._links[0]\n : this.data._links,\n );\n }\n\n return this._links;\n }\n\n /**\n * Get self link of model\n */\n get selflink(): LinkModel {\n const selflink = this.links.getLinkByKey(\"self\");\n\n if (selflink === null) {\n throw new Error(\n `Could not find self link for ${\n this.key === null ? \"unknown\" : this.key\n }`,\n );\n }\n\n return selflink;\n }\n\n /**\n * Self href of concept\n */\n get selfhref(): Href {\n if (this._entryDate !== null) {\n return this.selflink.href.addParameter(\n TIMEVERSION_FILTER_NAME,\n this._entryDate,\n );\n }\n\n return this.selflink.href;\n }\n\n /**\n */\n get subSectionID(): string {\n return this.selfhref.hash;\n }\n\n /**\n */\n get contentTypeLink(): LinkModel | null {\n return this.links.getLinkByKey(\"contenttype\");\n }\n\n /**\n * Concept type href of concept\n */\n get contentTypeHref(): Href | null {\n if (this.contentTypeLink) {\n return this.contentTypeLink.href;\n }\n\n return null;\n }\n\n /**\n * Children of link model in TOC\n */\n set items(items: Array<ContentLinkModel>) {\n this._items = items;\n }\n\n /**\n */\n get items(): Array<ContentLinkModel> {\n return this._items;\n }\n}\n"],"mappings":";;AACA,OAAOA,SAAS,MAAM,mBAAmB;AACzC,OAAOC,IAAI,MAAM,cAAc;AAC/B,OAAOC,SAAS,MAAM,oBAAoB;AAC1C,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,SAASC,uBAAuB,QAAQ,2BAA2B;AAEnE,OAAOC,cAAc,MAAM,yBAAyB;AAIpD;AACA;AACA;AACA,eAAe,MAAMC,gBAAgB,SAC3BN,SAAS,CAEnB;EAME;AACF;EACEO,WAAWA,CAACC,IAAY,EAA+B;IAAA,IAA7BC,SAAoB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,IAAI;IACnD,KAAK,CAACF,IAAI,EAAE,CAAC,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AO,IAAI,CAACA,eAAe,CAACI,IAAI;IAClC;IAEA,OAAO,IAAI;EACb;;EAEA;AACF;AACA;EACE,IAAIoC,KAAKA,CAACA,KAA8B,EAAE;IACxC,IAAI,CAACC,MAAM,GAAGD,KAAK;EACrB;;EAEA;AACF;EACE,IAAIA,KAAKA,CAAA,EAA4B;IACnC,OAAO,IAAI,CAACC,MAAM;EACpB;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"ContentLinkModel.js","names":["BaseModel","Href","LinkModel","ContentTypeModel","TIMEVERSION_FILTER_NAME","LinkCollection","getBasePath","ContentLinkModel","constructor","data","entryDate","arguments","length","undefined","origin","contextPath","_defineProperty","_entryDate","_origin","_contextPath","getInitialChildModelLinks","contentTypeLink","isCacheable","setChildModels","models","href","contentTypeModel","_findInstanceProperty","call","model","selfhref","equalsWithParameters","type","contentType","_contentType","key","getData","label","sourceLabel","createEncodedHref","startURI","selfHref","_links","self","path","section","sourceId","substring","lastIndexOf","encodeURIComponent","encodedHref","addParameter","links","Array","isArray","selflink","getLinkByKey","Error","subSectionID","hash","contentTypeHref","items","_items"],"sources":["../../../src/models/content/ContentLinkModel.js"],"sourcesContent":["// @flow\nimport BaseModel from \"../base/BaseModel\";\nimport Href from \"../href/Href\";\nimport LinkModel from \"../links/LinkModel\";\nimport ContentTypeModel from \"./ContentTypeModel\";\nimport { TIMEVERSION_FILTER_NAME } from \"../../constants/Constants\";\n\nimport LinkCollection from \"../links/LinkCollection\";\n\nimport type { ModularUIModel, IModelWithChildModels } from \"../types\";\nimport { getBasePath } from \"../../constants\";\n\n/**\n * Link to a concept\n */\nexport default class ContentLinkModel\n extends BaseModel\n implements IModelWithChildModels\n{\n _links: ?LinkCollection;\n _entryDate: ?ISO_DATE;\n _contentType: ContentTypeModel | null = null;\n _items: Array<ContentLinkModel>;\n _origin: string = \"\";\n _contextPath: string = getBasePath();\n\n /**\n */\n constructor(\n data: Object,\n entryDate: ?ISO_DATE = null,\n origin?: string,\n contextPath?: string,\n ) {\n super(data, {});\n\n this._entryDate = entryDate;\n this._origin = origin || \"\";\n this._contextPath = contextPath || getBasePath();\n }\n\n /**\n */\n // $FlowFixMe[method-unbinding]\n getInitialChildModelLinks(): Array<LinkModel> {\n if (this.contentTypeLink) {\n this.contentTypeLink.isCacheable = true;\n return [this.contentTypeLink];\n }\n\n return [];\n }\n\n /**\n */\n // $FlowFixMe[method-unbinding]\n setChildModels(models: Array<ModularUIModel>) {\n if (this.contentTypeLink) {\n const href = this.contentTypeLink.href;\n const contentTypeModel = models.find((model) =>\n model.selfhref.equalsWithParameters(href),\n );\n\n if (contentTypeModel?.type === \"ContentType\") {\n this.contentType = contentTypeModel;\n }\n }\n }\n\n /**\n * Retrieve content type\n */\n get contentType(): ?ContentTypeModel | null {\n return this._contentType;\n }\n\n /**\n * Set concept type\n */\n set contentType(contentType: ?ModularUIModel) {\n this._contentType =\n contentType instanceof ContentTypeModel ? contentType : null;\n }\n\n /**\n */\n set entryDate(entryDate: ISO_DATE) {\n this._entryDate = entryDate;\n }\n\n /**\n * Retrieve key\n */\n get key(): string {\n return this.getData(\"_id\", \"\");\n }\n\n /**\n * Retrieve label\n */\n get label(): string {\n return this.getData(\"label\", \"\");\n }\n\n /**\n * Retrieve the label of the source a link to a section belongs to\n */\n get sourceLabel(): string | null {\n return this.getData(\"sourceLabel\");\n }\n\n /**\n */\n createEncodedHref(): Href {\n const startURI = \"/content/\";\n const selfHref = new Href(\n this.data._links.self.href,\n this._origin,\n this._contextPath,\n );\n const href = selfHref.path;\n\n const section = this.data.section;\n const sourceId = section\n ? href.substring(startURI.length, href.lastIndexOf(\"/\"))\n : href.substring(startURI.length);\n\n if (section) {\n selfHref.path = `${startURI}${encodeURIComponent(sourceId)}/${encodeURIComponent(section)}`;\n } else {\n selfHref.path = `${startURI}${encodeURIComponent(sourceId)}`;\n }\n\n return selfHref;\n }\n\n /**\n * Encode the content-identifier of the path to the content resource.\n * This makes it a single uri part, which can be used on routes to make nested routes\n */\n get encodedHref(): Href {\n const href = this.createEncodedHref();\n\n if (this._entryDate !== null) {\n return href.addParameter(TIMEVERSION_FILTER_NAME, this._entryDate);\n }\n\n return href;\n }\n\n /**\n * Getting the links of the resource\n */\n get links(): LinkCollection {\n if (!this._links) {\n this._links = new LinkCollection(\n Array.isArray(this.data._links)\n ? this.data._links[0]\n : this.data._links,\n null,\n this._origin,\n this._contextPath,\n );\n }\n\n return this._links;\n }\n\n /**\n * Get self link of model\n */\n get selflink(): LinkModel {\n const selflink = this.links.getLinkByKey(\"self\");\n\n if (selflink === null) {\n throw new Error(\n `Could not find self link for ${\n this.key === null ? \"unknown\" : this.key\n }`,\n );\n }\n\n return selflink;\n }\n\n /**\n * Self href of concept\n */\n get selfhref(): Href {\n if (this._entryDate !== null) {\n return this.selflink.href.addParameter(\n TIMEVERSION_FILTER_NAME,\n this._entryDate,\n );\n }\n\n return this.selflink.href;\n }\n\n /**\n */\n get subSectionID(): string {\n return this.selfhref.hash;\n }\n\n /**\n */\n get contentTypeLink(): LinkModel | null {\n return this.links.getLinkByKey(\"contenttype\");\n }\n\n /**\n * Concept type href of concept\n */\n get contentTypeHref(): Href | null {\n if (this.contentTypeLink) {\n return this.contentTypeLink.href;\n }\n\n return null;\n }\n\n /**\n * Children of link model in TOC\n */\n set items(items: Array<ContentLinkModel>) {\n this._items = items;\n }\n\n /**\n */\n get items(): Array<ContentLinkModel> {\n return this._items;\n }\n}\n"],"mappings":";;AACA,OAAOA,SAAS,MAAM,mBAAmB;AACzC,OAAOC,IAAI,MAAM,cAAc;AAC/B,OAAOC,SAAS,MAAM,oBAAoB;AAC1C,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,SAASC,uBAAuB,QAAQ,2BAA2B;AAEnE,OAAOC,cAAc,MAAM,yBAAyB;AAGpD,SAASC,WAAW,QAAQ,iBAAiB;;AAE7C;AACA;AACA;AACA,eAAe,MAAMC,gBAAgB,SAC3BP,SAAS,CAEnB;EAQE;AACF;EACEQ,WAAWA,CACTC,I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;EACjB;;EAEA;AACF;AACA;EACE,IAAIzB,QAAQA,CAAA,EAAS;IACnB,IAAI,IAAI,CAACb,UAAU,KAAK,IAAI,EAAE;MAC5B,OAAO,IAAI,CAACsC,QAAQ,CAAC9B,IAAI,CAAC0B,YAAY,CACpC/C,uBAAuB,EACvB,IAAI,CAACa,UACP,CAAC;IACH;IAEA,OAAO,IAAI,CAACsC,QAAQ,CAAC9B,IAAI;EAC3B;;EAEA;AACF;EACE,IAAIiC,YAAYA,CAAA,EAAW;IACzB,OAAO,IAAI,CAAC5B,QAAQ,CAAC6B,IAAI;EAC3B;;EAEA;AACF;EACE,IAAItC,eAAeA,CAAA,EAAqB;IACtC,OAAO,IAAI,CAAC+B,KAAK,CAACI,YAAY,CAAC,aAAa,CAAC;EAC/C;;EAEA;AACF;AACA;EACE,IAAII,eAAeA,CAAA,EAAgB;IACjC,IAAI,IAAI,CAACvC,eAAe,EAAE;MACxB,OAAO,IAAI,CAACA,eAAe,CAACI,IAAI;IAClC;IAEA,OAAO,IAAI;EACb;;EAEA;AACF;AACA;EACE,IAAIoC,KAAKA,CAACA,KAA8B,EAAE;IACxC,IAAI,CAACC,MAAM,GAAGD,KAAK;EACrB;;EAEA;AACF;EACE,IAAIA,KAAKA,CAAA,EAA4B;IACnC,OAAO,IAAI,CAACC,MAAM;EACpB;AACF","ignoreList":[]}
|
|
@@ -7,16 +7,21 @@ import SubSectionModel from "./SubSectionModel";
|
|
|
7
7
|
import { createHashFromHref } from "../../utils/helpers/createHash";
|
|
8
8
|
import LinkModel from "../links/LinkModel";
|
|
9
9
|
import { retrieveText } from "../../utils";
|
|
10
|
+
import { getBasePath } from "../../constants";
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
*/
|
|
13
14
|
class SectionModel extends BaseModel {
|
|
14
|
-
constructor(data, entryDate) {
|
|
15
|
+
constructor(data, entryDate, origin, contextPath) {
|
|
15
16
|
super(data, {});
|
|
16
17
|
_defineProperty(this, "_entryDate", void 0);
|
|
17
18
|
_defineProperty(this, "_selflink", void 0);
|
|
18
19
|
_defineProperty(this, "_childSections", void 0);
|
|
20
|
+
_defineProperty(this, "_origin", "");
|
|
21
|
+
_defineProperty(this, "_contextPath", getBasePath());
|
|
19
22
|
this._entryDate = entryDate;
|
|
23
|
+
this._origin = origin || "";
|
|
24
|
+
this._contextPath = contextPath || getBasePath();
|
|
20
25
|
}
|
|
21
26
|
|
|
22
27
|
/**
|
|
@@ -29,8 +34,7 @@ class SectionModel extends BaseModel {
|
|
|
29
34
|
*/
|
|
30
35
|
get selflink() {
|
|
31
36
|
if (!this._selflink) {
|
|
32
|
-
|
|
33
|
-
this._selflink = new LinkModel(this.data._links?.self);
|
|
37
|
+
this._selflink = new LinkModel(this.data._links?.self, null, this._origin, this._contextPath);
|
|
34
38
|
}
|
|
35
39
|
return this._selflink;
|
|
36
40
|
}
|
|
@@ -103,7 +107,7 @@ class SectionModel extends BaseModel {
|
|
|
103
107
|
label: childSection.label,
|
|
104
108
|
sourceLabel: childSection.sourceLabel,
|
|
105
109
|
_links: childSection._links
|
|
106
|
-
}, this.entryDate)) : [];
|
|
110
|
+
}, this.entryDate, this._origin, this._contextPath)) : [];
|
|
107
111
|
}
|
|
108
112
|
|
|
109
113
|
/**
|
|
@@ -115,7 +119,7 @@ class SectionModel extends BaseModel {
|
|
|
115
119
|
label: this.data.label,
|
|
116
120
|
sourceLabel: this.data.sourceLabel,
|
|
117
121
|
_links: this.data._links
|
|
118
|
-
}, this.entryDate);
|
|
122
|
+
}, this.entryDate, this._origin, this._contextPath);
|
|
119
123
|
}
|
|
120
124
|
|
|
121
125
|
/**
|
|
@@ -124,7 +128,7 @@ class SectionModel extends BaseModel {
|
|
|
124
128
|
get childSections() {
|
|
125
129
|
if (!this._childSections && this.data.childSections) {
|
|
126
130
|
var _context2, _context3;
|
|
127
|
-
this._childSections = _mapInstanceProperty(_context2 = _filterInstanceProperty(_context3 = this.data.childSections).call(_context3, childSection => "body" in childSection)).call(_context2, childSection => new SectionModel(childSection, this.entryDate));
|
|
131
|
+
this._childSections = _mapInstanceProperty(_context2 = _filterInstanceProperty(_context3 = this.data.childSections).call(_context3, childSection => "body" in childSection)).call(_context2, childSection => new SectionModel(childSection, this.entryDate, this._origin, this._contextPath));
|
|
128
132
|
}
|
|
129
133
|
return this._childSections || [];
|
|
130
134
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SectionModel.js","names":["BaseModel","ContentLinkModel","SubSectionModel","createHashFromHref","LinkModel","retrieveText","SectionModel","constructor","data","entryDate","_defineProperty","_entryDate","referred","selflink","_selflink","_links","self","selfhref","href","type","sourceLabel","id","_id","key","label","getData","number","body","childSectionLinks","_context","childSections","_mapInstanceProperty","call","childSection","section","selfContentLink","_childSections","_context2","_context3","_filterInstanceProperty","sections","subSections","_context4","subSection","referenceHash","getReferredSections","push","referredChilds"],"sources":["../../../src/models/content/SectionModel.js"],"sourcesContent":["// @flow\nimport BaseModel from \"../base/BaseModel\";\nimport ContentLinkModel from \"./ContentLinkModel\";\nimport SubSectionModel from \"./SubSectionModel\";\n\nimport { createHashFromHref } from \"../../utils/helpers/createHash\";\nimport LinkModel from \"../links/LinkModel\";\n\nimport type Href from \"../href/Href\";\nimport { retrieveText } from \"../../utils\";\n\n/**\n */\nclass SectionModel extends BaseModel {\n _entryDate: ISO_DATE | null;\n _selflink: ?LinkModel;\n _childSections: Array<SectionModel>;\n\n constructor(data: Object
|
|
1
|
+
{"version":3,"file":"SectionModel.js","names":["BaseModel","ContentLinkModel","SubSectionModel","createHashFromHref","LinkModel","retrieveText","getBasePath","SectionModel","constructor","data","entryDate","origin","contextPath","_defineProperty","_entryDate","_origin","_contextPath","referred","selflink","_selflink","_links","self","selfhref","href","type","sourceLabel","id","_id","key","label","getData","number","body","childSectionLinks","_context","childSections","_mapInstanceProperty","call","childSection","section","selfContentLink","_childSections","_context2","_context3","_filterInstanceProperty","sections","subSections","_context4","subSection","referenceHash","getReferredSections","push","referredChilds"],"sources":["../../../src/models/content/SectionModel.js"],"sourcesContent":["// @flow\nimport BaseModel from \"../base/BaseModel\";\nimport ContentLinkModel from \"./ContentLinkModel\";\nimport SubSectionModel from \"./SubSectionModel\";\n\nimport { createHashFromHref } from \"../../utils/helpers/createHash\";\nimport LinkModel from \"../links/LinkModel\";\n\nimport type Href from \"../href/Href\";\nimport { retrieveText } from \"../../utils\";\nimport { getBasePath } from \"../../constants\";\n\n/**\n */\nclass SectionModel extends BaseModel {\n _entryDate: ISO_DATE | null;\n _selflink: ?LinkModel;\n _childSections: Array<SectionModel>;\n _origin: string = \"\";\n _contextPath: string = getBasePath();\n\n constructor(\n data: Object,\n entryDate: ISO_DATE | null,\n origin?: string,\n contextPath?: string,\n ) {\n super(data, {});\n\n this._entryDate = entryDate;\n this._origin = origin || \"\";\n this._contextPath = contextPath || getBasePath();\n }\n\n /**\n */\n get referred(): boolean {\n return this.data.referred;\n }\n\n /**\n */\n get selflink(): LinkModel {\n if (!this._selflink) {\n this._selflink = new LinkModel(\n this.data._links?.self,\n null,\n this._origin,\n this._contextPath,\n );\n }\n return this._selflink;\n }\n\n /**\n */\n get selfhref(): Href {\n return this.selflink.href;\n }\n\n /**\n */\n get entryDate(): ISO_DATE | null {\n return this._entryDate;\n }\n\n /**\n */\n get type(): string {\n return this.data.type;\n }\n\n /**\n */\n get sourceLabel(): string {\n return this.data.sourceLabel;\n }\n\n /**\n */\n get id(): string {\n return this.data.id || this.data._id;\n }\n\n /**\n */\n get key(): string {\n return this.id;\n }\n\n /**\n * Get content label\n */\n get label(): string {\n return this.getData(\"label\", \"\");\n }\n\n /**\n * Retrieve number of section\n */\n get number(): string | null {\n return this.data.number ?? null;\n }\n\n /**\n * Get content body\n */\n get body(): ?string {\n return retrieveText(this.data.body);\n }\n\n /**\n * Retrieve child section links\n */\n get childSectionLinks(): Array<ContentLinkModel> {\n return this.data.childSections\n ? this.data.childSections.map(\n (childSection) =>\n new ContentLinkModel(\n {\n section: childSection.id || childSection._id,\n _id: childSection.id || childSection._id,\n label: childSection.label,\n sourceLabel: childSection.sourceLabel,\n _links: childSection._links,\n },\n this.entryDate,\n this._origin,\n this._contextPath,\n ),\n )\n : [];\n }\n\n /**\n */\n get selfContentLink(): ContentLinkModel {\n return new ContentLinkModel(\n {\n section: this.id,\n _id: this.id,\n label: this.data.label,\n sourceLabel: this.data.sourceLabel,\n _links: this.data._links,\n },\n this.entryDate,\n this._origin,\n this._contextPath,\n );\n }\n\n /**\n * Get tree of child sections\n */\n get childSections(): Array<SectionModel> {\n if (!this._childSections && this.data.childSections) {\n this._childSections = this.data.childSections\n .filter((childSection) => \"body\" in childSection)\n .map(\n (childSection) =>\n new SectionModel(\n childSection,\n this.entryDate,\n this._origin,\n this._contextPath,\n ),\n );\n }\n return this._childSections || [];\n }\n\n /**\n * set resolved child sections\n */\n set childSections(sections: Array<SectionModel>) {\n this._childSections = sections || [];\n }\n\n /**\n * Get sub sections\n */\n get subSections(): Array<SubSectionModel> {\n return this.data.subSections\n ? this.data.subSections.map(\n (subSection) => new SubSectionModel(subSection),\n )\n : [];\n }\n\n /**\n */\n get referenceHash(): number {\n return createHashFromHref(this.selfhref);\n }\n\n /**\n */\n getReferredSections(): Array<SubSectionModel | SectionModel> {\n const sections = [];\n\n for (const subSection of this.subSections) {\n if (subSection.referred) {\n sections.push(subSection);\n }\n\n const referredChilds = subSection.getReferredSections();\n sections.push(...referredChilds);\n }\n\n for (const childSection of this.childSections) {\n if (childSection.referred) {\n sections.push(childSection);\n }\n\n const referredChilds = childSection.getReferredSections();\n sections.push(...referredChilds);\n }\n\n return sections;\n }\n}\n\nexport default SectionModel;\n"],"mappings":";;;AACA,OAAOA,SAAS,MAAM,mBAAmB;AACzC,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,OAAOC,eAAe,MAAM,mBAAmB;AAE/C,SAASC,kBAAkB,QAAQ,gCAAgC;AACnE,OAAOC,SAAS,MAAM,oBAAoB;AAG1C,SAASC,YAAY,QAAQ,aAAa;AAC1C,SA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EACR;;EAEA;AACF;EACE,IAAIC,aAAaA,CAAA,EAAW;IAC1B,OAAO9C,kBAAkB,CAAC,IAAI,CAACmB,QAAQ,CAAC;EAC1C;;EAEA;AACF;EACE4B,mBAAmBA,CAAA,EAA0C;IAC3D,MAAML,QAAQ,GAAG,EAAE;IAEnB,KAAK,MAAMG,UAAU,IAAI,IAAI,CAACF,WAAW,EAAE;MACzC,IAAIE,UAAU,CAAC/B,QAAQ,EAAE;QACvB4B,QAAQ,CAACM,IAAI,CAACH,UAAU,CAAC;MAC3B;MAEA,MAAMI,cAAc,GAAGJ,UAAU,CAACE,mBAAmB,CAAC,CAAC;MACvDL,QAAQ,CAACM,IAAI,CAAC,GAAGC,cAAc,CAAC;IAClC;IAEA,KAAK,MAAMd,YAAY,IAAI,IAAI,CAACH,aAAa,EAAE;MAC7C,IAAIG,YAAY,CAACrB,QAAQ,EAAE;QACzB4B,QAAQ,CAACM,IAAI,CAACb,YAAY,CAAC;MAC7B;MAEA,MAAMc,cAAc,GAAGd,YAAY,CAACY,mBAAmB,CAAC,CAAC;MACzDL,QAAQ,CAACM,IAAI,CAAC,GAAGC,cAAc,CAAC;IAClC;IAEA,OAAOP,QAAQ;EACjB;AACF;AAEA,eAAetC,YAAY","ignoreList":[]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
|
2
2
|
import Href from "../href/Href";
|
|
3
3
|
import LayoutHintCollection from "../layouthint/LayoutHintCollection";
|
|
4
|
+
import { getBasePath } from "../../constants";
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
*/
|
|
@@ -18,11 +19,15 @@ export default class ErrorResponse {
|
|
|
18
19
|
/**
|
|
19
20
|
* Construct ErrorResponse
|
|
20
21
|
*/
|
|
21
|
-
constructor(data, connectKey) {
|
|
22
|
+
constructor(data, connectKey, origin, contextPath) {
|
|
22
23
|
_defineProperty(this, "_error", void 0);
|
|
23
24
|
_defineProperty(this, "_connectKey", void 0);
|
|
25
|
+
_defineProperty(this, "_origin", "");
|
|
26
|
+
_defineProperty(this, "_contextPath", getBasePath());
|
|
24
27
|
this._error = data;
|
|
25
28
|
this._connectKey = connectKey;
|
|
29
|
+
this._origin = origin || "";
|
|
30
|
+
this._contextPath = contextPath || getBasePath();
|
|
26
31
|
}
|
|
27
32
|
|
|
28
33
|
/**
|
|
@@ -37,6 +42,18 @@ export default class ErrorResponse {
|
|
|
37
42
|
return this._connectKey;
|
|
38
43
|
}
|
|
39
44
|
|
|
45
|
+
/**
|
|
46
|
+
*/
|
|
47
|
+
get origin() {
|
|
48
|
+
return this._origin;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
*/
|
|
53
|
+
get contextPath() {
|
|
54
|
+
return this._contextPath;
|
|
55
|
+
}
|
|
56
|
+
|
|
40
57
|
/**
|
|
41
58
|
* Return error information
|
|
42
59
|
*/
|
|
@@ -142,9 +159,8 @@ export default class ErrorResponse {
|
|
|
142
159
|
* Return response error redirect href
|
|
143
160
|
*/
|
|
144
161
|
get redirectHref() {
|
|
145
|
-
// TODO SBO: origin and context
|
|
146
162
|
if (this.response.redirect?.href) {
|
|
147
|
-
return new Href(this.response.redirect?.href);
|
|
163
|
+
return new Href(this.response.redirect?.href, "", this.origin, this.contextPath);
|
|
148
164
|
}
|
|
149
165
|
return new Href();
|
|
150
166
|
}
|
|
@@ -259,8 +275,7 @@ export default class ErrorResponse {
|
|
|
259
275
|
* Get response url
|
|
260
276
|
*/
|
|
261
277
|
get changePasswordHref() {
|
|
262
|
-
|
|
263
|
-
return this.properties.redirect ? new Href(this.properties.redirect) : null;
|
|
278
|
+
return this.properties.redirect ? new Href(this.properties.redirect, "", this.origin, this.contextPath) : null;
|
|
264
279
|
}
|
|
265
280
|
|
|
266
281
|
/**
|