@beinformed/ui 1.20.10 → 1.21.2

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 CHANGED
@@ -2,6 +2,27 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [1.21.2](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.21.1...v1.21.2) (2022-08-14)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * **error:** ErrorResponse messages ([7a153a8](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/7a153a8c48be43f8ae4c1449880f8f901110ba3a))
11
+
12
+ ### [1.21.1](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.21.0...v1.21.1) (2022-08-10)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * **error:** handle new error response messages ([9ce4d99](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/9ce4d9997a542a98164ff999e83ee0a8a40b0525))
18
+
19
+ ## [1.21.0](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.20.10...v1.21.0) (2022-08-10)
20
+
21
+
22
+ ### Features
23
+
24
+ * **error:** handle new error response messages ([4373b18](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/4373b18675b2c74119b37734ce106239252c0883))
25
+
5
26
  ### [1.20.10](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.20.9...v1.20.10) (2022-08-09)
6
27
 
7
28
  ### Bug Fixes
@@ -1,8 +1,9 @@
1
1
  import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
2
-
2
+ import LayoutHintCollection from "../layouthint/LayoutHintCollection";
3
3
  /**
4
4
  * Wrapper around an error message / object
5
5
  */
6
+
6
7
  class ErrorModel {
7
8
  /**
8
9
  * Contruct
@@ -18,10 +19,13 @@ class ErrorModel {
18
19
 
19
20
  _defineProperty(this, "_isClientConstraint", void 0);
20
21
 
22
+ _defineProperty(this, "_layouthint", void 0);
23
+
21
24
  this._id = id;
22
25
  this._parameters = parameters;
23
26
  this._defaultMessage = defaultMessage;
24
27
  this._isClientConstraint = isClientConstraint;
28
+ this._layouthint = new LayoutHintCollection();
25
29
  }
26
30
  /**
27
31
  * Get id of error
@@ -56,6 +60,13 @@ class ErrorModel {
56
60
  */
57
61
 
58
62
 
63
+ get layouthint() {
64
+ return this._layouthint;
65
+ }
66
+ /**
67
+ */
68
+
69
+
59
70
  get isMandatoryConstraint() {
60
71
  return this.id === "Constraint.Mandatory";
61
72
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ErrorModel.js","names":["ErrorModel","constructor","id","defaultMessage","parameters","isClientConstraint","_id","_parameters","_defaultMessage","_isClientConstraint","isMandatoryConstraint"],"sources":["../../../src/models/error/ErrorModel.js"],"sourcesContent":["// @flow\nimport type { MessageParameters } from \"../../i18n/types\";\n\n/**\n * Wrapper around an error message / object\n */\nclass ErrorModel {\n _id: string;\n _defaultMessage: ?string;\n _parameters: ?MessageParameters;\n _isClientConstraint: boolean;\n\n /**\n * Contruct\n */\n constructor(\n id: string,\n defaultMessage: ?string,\n parameters: ?MessageParameters,\n isClientConstraint: boolean = false\n ) {\n this._id = id;\n this._parameters = parameters;\n this._defaultMessage = defaultMessage;\n\n this._isClientConstraint = isClientConstraint;\n }\n\n /**\n * Get id of error\n */\n get id(): string {\n return this._id;\n }\n\n /**\n */\n get defaultMessage(): ?string {\n return this._defaultMessage;\n }\n\n /**\n */\n get parameters(): ?MessageParameters {\n return this._parameters;\n }\n\n /**\n */\n get isClientConstraint(): boolean {\n return this._isClientConstraint || false;\n }\n\n /**\n */\n get isMandatoryConstraint(): boolean {\n return this.id === \"Constraint.Mandatory\";\n }\n}\n\nexport default ErrorModel;\n"],"mappings":";;AAGA;AACA;AACA;AACA,MAAMA,UAAN,CAAiB;EAMf;AACF;AACA;EACEC,WAAW,CACTC,EADS,EAETC,cAFS,EAGTC,UAHS,EAKT;IAAA,IADAC,kBACA,uEAD8B,KAC9B;;IAAA;;IAAA;;IAAA;;IAAA;;IACA,KAAKC,GAAL,GAAWJ,EAAX;IACA,KAAKK,WAAL,GAAmBH,UAAnB;IACA,KAAKI,eAAL,GAAuBL,cAAvB;IAEA,KAAKM,mBAAL,GAA2BJ,kBAA3B;EACD;EAED;AACF;AACA;;;EACQ,IAAFH,EAAE,GAAW;IACf,OAAO,KAAKI,GAAZ;EACD;EAED;AACF;;;EACoB,IAAdH,cAAc,GAAY;IAC5B,OAAO,KAAKK,eAAZ;EACD;EAED;AACF;;;EACgB,IAAVJ,UAAU,GAAuB;IACnC,OAAO,KAAKG,WAAZ;EACD;EAED;AACF;;;EACwB,IAAlBF,kBAAkB,GAAY;IAChC,OAAO,KAAKI,mBAAL,IAA4B,KAAnC;EACD;EAED;AACF;;;EAC2B,IAArBC,qBAAqB,GAAY;IACnC,OAAO,KAAKR,EAAL,KAAY,sBAAnB;EACD;;AAnDc;;AAsDjB,eAAeF,UAAf"}
1
+ {"version":3,"file":"ErrorModel.js","names":["LayoutHintCollection","ErrorModel","constructor","id","defaultMessage","parameters","isClientConstraint","_id","_parameters","_defaultMessage","_isClientConstraint","_layouthint","layouthint","isMandatoryConstraint"],"sources":["../../../src/models/error/ErrorModel.js"],"sourcesContent":["// @flow\nimport type { MessageParameters } from \"../../i18n/types\";\nimport LayoutHintCollection from \"../layouthint/LayoutHintCollection\";\n\n/**\n * Wrapper around an error message / object\n */\nclass ErrorModel {\n _id: string;\n _defaultMessage: ?string;\n _parameters: ?MessageParameters;\n _isClientConstraint: boolean;\n _layouthint: LayoutHintCollection;\n\n /**\n * Contruct\n */\n constructor(\n id: string,\n defaultMessage: ?string,\n parameters: ?MessageParameters,\n isClientConstraint: boolean = false\n ) {\n this._id = id;\n this._parameters = parameters;\n this._defaultMessage = defaultMessage;\n this._isClientConstraint = isClientConstraint;\n this._layouthint = new LayoutHintCollection();\n }\n\n /**\n * Get id of error\n */\n get id(): string {\n return this._id;\n }\n\n /**\n */\n get defaultMessage(): ?string {\n return this._defaultMessage;\n }\n\n /**\n */\n get parameters(): ?MessageParameters {\n return this._parameters;\n }\n\n /**\n */\n get isClientConstraint(): boolean {\n return this._isClientConstraint || false;\n }\n\n /**\n */\n get layouthint(): LayoutHintCollection {\n return this._layouthint;\n }\n\n /**\n */\n get isMandatoryConstraint(): boolean {\n return this.id === \"Constraint.Mandatory\";\n }\n}\n\nexport default ErrorModel;\n"],"mappings":";AAEA,OAAOA,oBAAP,MAAiC,oCAAjC;AAEA;AACA;AACA;;AACA,MAAMC,UAAN,CAAiB;EAOf;AACF;AACA;EACEC,WAAW,CACTC,EADS,EAETC,cAFS,EAGTC,UAHS,EAKT;IAAA,IADAC,kBACA,uEAD8B,KAC9B;;IAAA;;IAAA;;IAAA;;IAAA;;IAAA;;IACA,KAAKC,GAAL,GAAWJ,EAAX;IACA,KAAKK,WAAL,GAAmBH,UAAnB;IACA,KAAKI,eAAL,GAAuBL,cAAvB;IACA,KAAKM,mBAAL,GAA2BJ,kBAA3B;IACA,KAAKK,WAAL,GAAmB,IAAIX,oBAAJ,EAAnB;EACD;EAED;AACF;AACA;;;EACQ,IAAFG,EAAE,GAAW;IACf,OAAO,KAAKI,GAAZ;EACD;EAED;AACF;;;EACoB,IAAdH,cAAc,GAAY;IAC5B,OAAO,KAAKK,eAAZ;EACD;EAED;AACF;;;EACgB,IAAVJ,UAAU,GAAuB;IACnC,OAAO,KAAKG,WAAZ;EACD;EAED;AACF;;;EACwB,IAAlBF,kBAAkB,GAAY;IAChC,OAAO,KAAKI,mBAAL,IAA4B,KAAnC;EACD;EAED;AACF;;;EACgB,IAAVE,UAAU,GAAyB;IACrC,OAAO,KAAKD,WAAZ;EACD;EAED;AACF;;;EAC2B,IAArBE,qBAAqB,GAAY;IACnC,OAAO,KAAKV,EAAL,KAAY,sBAAnB;EACD;;AA1Dc;;AA6DjB,eAAeF,UAAf"}
@@ -1,5 +1,8 @@
1
1
  import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
2
2
  import Href from "../href/Href";
3
+ import LayoutHintCollection from "../layouthint/LayoutHintCollection";
4
+ /**
5
+ */
3
6
 
4
7
  /**
5
8
  * Error response model
@@ -69,12 +72,128 @@ export default class ErrorResponse {
69
72
  get message() {
70
73
  return this.error.message || this.id;
71
74
  }
75
+ /**
76
+ * Return response error message
77
+ */
78
+
79
+
80
+ get responseMessage() {
81
+ return this.response.message || this.id;
82
+ }
83
+ /**
84
+ * Return response error title
85
+ */
86
+
87
+
88
+ get title() {
89
+ return this.response.title || null;
90
+ }
91
+ /**
92
+ * Return response error title message
93
+ */
94
+
95
+
96
+ get titleMessage() {
97
+ var _this$response$title;
98
+
99
+ return ((_this$response$title = this.response.title) === null || _this$response$title === void 0 ? void 0 : _this$response$title.message) || undefined;
100
+ }
101
+ /**
102
+ * Return response error title Id
103
+ */
104
+
105
+
106
+ get titleId() {
107
+ var _this$response$title2;
108
+
109
+ return ((_this$response$title2 = this.response.title) === null || _this$response$title2 === void 0 ? void 0 : _this$response$title2.id) || undefined;
110
+ }
111
+ /**
112
+ * Return response error title properties
113
+ */
114
+
115
+
116
+ get titleProperties() {
117
+ var _this$response$title3;
118
+
119
+ return ((_this$response$title3 = this.response.title) === null || _this$response$title3 === void 0 ? void 0 : _this$response$title3.properties) || null;
120
+ }
121
+ /**
122
+ * Return response error redirect
123
+ */
124
+
125
+
126
+ get redirect() {
127
+ return this.response.redirect || null;
128
+ }
129
+ /**
130
+ * Return response error redirect text
131
+ */
132
+
133
+
134
+ get redirectText() {
135
+ var _this$response$redire;
136
+
137
+ return ((_this$response$redire = this.response.redirect) === null || _this$response$redire === void 0 ? void 0 : _this$response$redire.text) || null;
138
+ }
139
+ /**
140
+ * Return response error redirect text id
141
+ */
142
+
143
+
144
+ get redirectTextID() {
145
+ var _this$response$redire2, _this$response$redire3;
146
+
147
+ return ((_this$response$redire2 = this.response.redirect) === null || _this$response$redire2 === void 0 ? void 0 : (_this$response$redire3 = _this$response$redire2.text) === null || _this$response$redire3 === void 0 ? void 0 : _this$response$redire3.id) || undefined;
148
+ }
149
+ /**
150
+ * Return response error redirect text properties
151
+ */
152
+
153
+
154
+ get redirectTextProperties() {
155
+ var _this$response$redire4, _this$response$redire5;
156
+
157
+ return ((_this$response$redire4 = this.response.redirect) === null || _this$response$redire4 === void 0 ? void 0 : (_this$response$redire5 = _this$response$redire4.text) === null || _this$response$redire5 === void 0 ? void 0 : _this$response$redire5.properties) || null;
158
+ }
159
+ /**
160
+ * Return response error redirect text message
161
+ */
162
+
163
+
164
+ get redirectMessage() {
165
+ var _this$response$redire6, _this$response$redire7;
166
+
167
+ return ((_this$response$redire6 = this.response.redirect) === null || _this$response$redire6 === void 0 ? void 0 : (_this$response$redire7 = _this$response$redire6.text) === null || _this$response$redire7 === void 0 ? void 0 : _this$response$redire7.message) || undefined;
168
+ }
169
+ /**
170
+ * Return response error redirect href
171
+ */
172
+
173
+
174
+ get redirectHref() {
175
+ var _this$response$redire8;
176
+
177
+ if ((_this$response$redire8 = this.response.redirect) !== null && _this$response$redire8 !== void 0 && _this$response$redire8.href) {
178
+ return new Href(this.response.redirect.href);
179
+ }
180
+
181
+ return new Href();
182
+ }
183
+ /**
184
+ * Return error response layouthint
185
+ */
186
+
187
+
188
+ get layouthint() {
189
+ return new LayoutHintCollection(this.response.layouthint);
190
+ }
72
191
  /**
73
192
  */
74
193
 
75
194
 
76
195
  get response() {
77
- return this.error.response || {};
196
+ return this.error.response.error || {};
78
197
  }
79
198
  /**
80
199
  */
@@ -1 +1 @@
1
- {"version":3,"file":"ErrorResponse.js","names":["Href","ErrorResponse","constructor","data","connectKey","_error","_connectKey","key","error","status","NO_RESPONSE_CODE","DECIMAL_RADIX","parseInt","id","isResourceNotFound","name","message","response","properties","parameters","RESOURCE_NOT_FOUND_RESPONSE_CODE","isResourceNotFoundAfterReload","isReload","isUnauthorized","UNAUTHORIZED_RESPONSE_CODE","hasUnauthorizedStatus","hasUnauthorizedErrorId","hasLoginAction","action","isChangePassword","isConcurrentUser","isConcurrentError","isBlocked","isInvalidUsername","isTimeoutError","isRemoteServiceException","changePasswordHref","redirect","isBasicAuthentication","loginFailed","shouldThrowOnServer"],"sources":["../../../src/models/error/ErrorResponse.js"],"sourcesContent":["// @flow\nimport Href from \"../href/Href\";\n\nimport type { MessageParameters } from \"../../i18n/types\";\n\n/**\n * Error response model\n */\nexport default class ErrorResponse {\n _error: Object;\n _connectKey: ?string;\n\n /**\n * Construct ErrorResponse\n */\n constructor(data: Object, connectKey?: string) {\n this._error = data;\n this._connectKey = connectKey;\n }\n\n /**\n */\n set connectKey(key: string) {\n this._connectKey = key;\n }\n\n /**\n */\n get connectKey(): ?string {\n return this._connectKey;\n }\n\n /**\n * Return error information\n */\n get error(): Object {\n return this._error ?? {};\n }\n\n /**\n * Get request status code\n */\n get status(): number {\n const NO_RESPONSE_CODE = 0;\n const DECIMAL_RADIX = 10;\n return this.error.status\n ? parseInt(this.error.status, DECIMAL_RADIX)\n : NO_RESPONSE_CODE;\n }\n\n /**\n * Return error type information\n */\n get id(): string {\n if (this.isResourceNotFound && this.error.id !== \"Error.NotAuthorized\") {\n return \"Error.ResourceNotFound\";\n }\n\n return this.error.id || this.error.name || \"Error.GeneralError\";\n }\n\n /**\n */\n get message(): string {\n return this.error.message || this.id;\n }\n\n /**\n */\n get response(): Object {\n return this.error.response || {};\n }\n\n /**\n */\n get properties(): Object {\n const { properties } = this.error;\n if (properties != null && typeof properties == \"object\") {\n return properties;\n }\n\n return {};\n }\n\n /**\n * Return error parameters\n */\n get parameters(): ?MessageParameters {\n return this.error.parameters || null;\n }\n\n /**\n */\n get isResourceNotFound(): boolean {\n const RESOURCE_NOT_FOUND_RESPONSE_CODE = 404;\n\n return this.status === RESOURCE_NOT_FOUND_RESPONSE_CODE;\n }\n\n /**\n */\n get isResourceNotFoundAfterReload(): boolean {\n return this.isResourceNotFound && this.error.isReload;\n }\n\n /**\n * Check if the error message is an authorization error\n */\n get isUnauthorized(): boolean {\n const UNAUTHORIZED_RESPONSE_CODE = 401;\n\n const hasUnauthorizedStatus = this.status === UNAUTHORIZED_RESPONSE_CODE;\n const hasUnauthorizedErrorId =\n this.id === \"Error.NotAuthorized\" ||\n this.id === \"Error.Authentication.Required\" ||\n this.id === \"Error.Authentication.InvalidUsername\" ||\n this.id === \"Error.Authentication.InvalidCredentials\";\n\n const hasLoginAction = this.error.action\n ? this.error.action.name === \"login\"\n : false;\n\n return hasUnauthorizedStatus || hasUnauthorizedErrorId || hasLoginAction;\n }\n\n /**\n */\n get isChangePassword(): boolean {\n return this.id === \"Error.ChangePasswordRequired\";\n }\n\n /**\n */\n get isConcurrentUser(): boolean {\n return this.id === \"Error.Authentication.ConcurrentUser\";\n }\n\n /**\n */\n get isConcurrentError(): boolean {\n return (\n this.id === \"Error.Case.ConcurrentModification\" ||\n this.id === \"Error.DataStore.ConcurrentModification\" ||\n this.id === \"Error.DataStore.RecordAlreadyExists\" ||\n this.id === \"Error.DataStore.RowCannotBeLocked\"\n );\n }\n\n /**\n */\n get isBlocked(): boolean {\n return this.id === \"Error.Authentication.BlockedUser\";\n }\n\n /**\n */\n get isInvalidUsername(): boolean {\n return this.id === \"Error.Authentication.InvalidUsername\";\n }\n\n /**\n */\n get isTimeoutError(): boolean {\n return this.id === \"Error.CodemapLookup.InvalidToken\";\n }\n\n /**\n * A RemoteServiceException occurs when an exception occurs connecting to an external system,\n * for example when using the service list panels\n */\n get isRemoteServiceException(): boolean {\n return this.id === \"Error.RemoteServiceException\";\n }\n\n /**\n * Get response url\n */\n get changePasswordHref(): ?Href {\n return this.properties.redirect ? new Href(this.properties.redirect) : null;\n }\n\n /**\n * When no action information is present in the unauthorized response, for now we assume it is Basic Authentication\n */\n get isBasicAuthentication(): boolean {\n const UNAUTHORIZED_RESPONSE_CODE = 401;\n return (\n this.isUnauthorized &&\n this.status === UNAUTHORIZED_RESPONSE_CODE &&\n this.response.error === \"No responseText\"\n );\n }\n\n /**\n * Retrieve a failed login attempt\n */\n get loginFailed(): boolean {\n return (\n this.id === \"Error.Authentication.Required\" ||\n this.id === \"Error.Authentication.InvalidCredentials\"\n );\n }\n\n /**\n */\n get shouldThrowOnServer(): boolean {\n return !this.isChangePassword && !this.isBlocked && !this.isConcurrentUser;\n }\n}\n"],"mappings":";AACA,OAAOA,IAAP,MAAiB,cAAjB;;AAIA;AACA;AACA;AACA,eAAe,MAAMC,aAAN,CAAoB;EAIjC;AACF;AACA;EACEC,WAAW,CAACC,IAAD,EAAeC,UAAf,EAAoC;IAAA;;IAAA;;IAC7C,KAAKC,MAAL,GAAcF,IAAd;IACA,KAAKG,WAAL,GAAmBF,UAAnB;EACD;EAED;AACF;;;EACgB,IAAVA,UAAU,CAACG,GAAD,EAAc;IAC1B,KAAKD,WAAL,GAAmBC,GAAnB;EACD;EAED;AACF;;;EACgB,IAAVH,UAAU,GAAY;IACxB,OAAO,KAAKE,WAAZ;EACD;EAED;AACF;AACA;;;EACW,IAALE,KAAK,GAAW;IAAA;;IAClB,uBAAO,KAAKH,MAAZ,uDAAsB,EAAtB;EACD;EAED;AACF;AACA;;;EACY,IAANI,MAAM,GAAW;IACnB,MAAMC,gBAAgB,GAAG,CAAzB;IACA,MAAMC,aAAa,GAAG,EAAtB;IACA,OAAO,KAAKH,KAAL,CAAWC,MAAX,GACHG,QAAQ,CAAC,KAAKJ,KAAL,CAAWC,MAAZ,EAAoBE,aAApB,CADL,GAEHD,gBAFJ;EAGD;EAED;AACF;AACA;;;EACQ,IAAFG,EAAE,GAAW;IACf,IAAI,KAAKC,kBAAL,IAA2B,KAAKN,KAAL,CAAWK,EAAX,KAAkB,qBAAjD,EAAwE;MACtE,OAAO,wBAAP;IACD;;IAED,OAAO,KAAKL,KAAL,CAAWK,EAAX,IAAiB,KAAKL,KAAL,CAAWO,IAA5B,IAAoC,oBAA3C;EACD;EAED;AACF;;;EACa,IAAPC,OAAO,G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0B,CAAC,KAAKG,SAAhC,IAA6C,CAAC,KAAKF,gBAA1D;EACD;;AAvMgC"}
1
+ {"version":3,"file":"ErrorResponse.js","names":["Href","LayoutHintCollection","ErrorResponse","constructor","data","connectKey","_error","_connectKey","key","error","status","NO_RESPONSE_CODE","DECIMAL_RADIX","parseInt","id","isResourceNotFound","name","message","responseMessage","response","title","titleMessage","undefined","titleId","titleProperties","properties","redirect","redirectText","text","redirectTextID","redirectTextProperties","redirectMessage","redirectHref","href","layouthint","parameters","RESOURCE_NOT_FOUND_RESPONSE_CODE","isResourceNotFoundAfterReload","isReload","isUnauthorized","UNAUTHORIZED_RESPONSE_CODE","hasUnauthorizedStatus","hasUnauthorizedErrorId","hasLoginAction","action","isChangePassword","isConcurrentUser","isConcurrentError","isBlocked","isInvalidUsername","isTimeoutError","isRemoteServiceException","changePasswordHref","isBasicAuthentication","loginFailed","shouldThrowOnServer"],"sources":["../../../src/models/error/ErrorResponse.js"],"sourcesContent":["// @flow\nimport Href from \"../href/Href\";\n\nimport type { MessageParameters } from \"../../i18n/types\";\nimport LayoutHintCollection from \"../layouthint/LayoutHintCollection\";\n\n/**\n */\nexport type TitleObject = {\n +id: string,\n +properties?: Object,\n +message?: string,\n};\n/**\n */\nexport type RedirectTextObject = {\n +id: string,\n +properties?: Object,\n +message?: string,\n};\n\n/**\n */\nexport type RedirectObject = {\n +href: Href,\n +text?: RedirectTextObject,\n};\n\n/**\n * Error response model\n */\nexport default class ErrorResponse {\n _error: Object;\n _connectKey: ?string;\n\n /**\n * Construct ErrorResponse\n */\n constructor(data: Object, connectKey?: string) {\n this._error = data;\n this._connectKey = connectKey;\n }\n\n /**\n */\n set connectKey(key: string) {\n this._connectKey = key;\n }\n\n /**\n */\n get connectKey(): ?string {\n return this._connectKey;\n }\n\n /**\n * Return error information\n */\n get error(): Object {\n return this._error ?? {};\n }\n\n /**\n * Get request status code\n */\n get status(): number {\n const NO_RESPONSE_CODE = 0;\n const DECIMAL_RADIX = 10;\n return this.error.status\n ? parseInt(this.error.status, DECIMAL_RADIX)\n : NO_RESPONSE_CODE;\n }\n\n /**\n * Return error type information\n */\n get id(): string {\n if (this.isResourceNotFound && this.error.id !== \"Error.NotAuthorized\") {\n return \"Error.ResourceNotFound\";\n }\n\n return this.error.id || this.error.name || \"Error.GeneralError\";\n }\n\n /**\n */\n get message(): string {\n return this.error.message || this.id;\n }\n\n /**\n * Return response error message\n */\n get responseMessage(): string {\n return this.response.message || this.id;\n }\n\n /**\n * Return response error title\n */\n get title(): TitleObject {\n return this.response.title || null;\n }\n\n /**\n * Return response error title message\n */\n get titleMessage(): string {\n return this.response.title?.message || undefined;\n }\n\n /**\n * Return response error title Id\n */\n get titleId(): string {\n return this.response.title?.id || undefined;\n }\n\n /**\n * Return response error title properties\n */\n get titleProperties(): Object {\n return this.response.title?.properties || null;\n }\n\n /**\n * Return response error redirect\n */\n get redirect(): RedirectObject {\n return this.response.redirect || null;\n }\n /**\n * Return response error redirect text\n */\n get redirectText(): RedirectTextObject {\n return this.response.redirect?.text || null;\n }\n\n /**\n * Return response error redirect text id\n */\n get redirectTextID(): string {\n return this.response.redirect?.text?.id || undefined;\n }\n\n /**\n * Return response error redirect text properties\n */\n get redirectTextProperties(): Object {\n return this.response.redirect?.text?.properties || null;\n }\n\n /**\n * Return response error redirect text message\n */\n get redirectMessage(): string {\n return this.response.redirect?.text?.message || undefined;\n }\n\n /**\n * Return response error redirect href\n */\n get redirectHref(): Href {\n if (this.response.redirect?.href) {\n return new Href(this.response.redirect.href);\n }\n return new Href();\n }\n\n /**\n * Return error response layouthint\n */\n get layouthint(): LayoutHintCollection {\n return new LayoutHintCollection(this.response.layouthint);\n }\n\n /**\n */\n get response(): Object {\n return this.error.response.error || {};\n }\n\n /**\n */\n get properties(): Object {\n const { properties } = this.error;\n if (properties != null && typeof properties == \"object\") {\n return properties;\n }\n\n return {};\n }\n\n /**\n * Return error parameters\n */\n get parameters(): ?MessageParameters {\n return this.error.parameters || null;\n }\n\n /**\n */\n get isResourceNotFound(): boolean {\n const RESOURCE_NOT_FOUND_RESPONSE_CODE = 404;\n\n return this.status === RESOURCE_NOT_FOUND_RESPONSE_CODE;\n }\n\n /**\n */\n get isResourceNotFoundAfterReload(): boolean {\n return this.isResourceNotFound && this.error.isReload;\n }\n\n /**\n * Check if the error message is an authorization error\n */\n get isUnauthorized(): boolean {\n const UNAUTHORIZED_RESPONSE_CODE = 401;\n\n const hasUnauthorizedStatus = this.status === UNAUTHORIZED_RESPONSE_CODE;\n const hasUnauthorizedErrorId =\n this.id === \"Error.NotAuthorized\" ||\n this.id === \"Error.Authentication.Required\" ||\n this.id === \"Error.Authentication.InvalidUsername\" ||\n this.id === \"Error.Authentication.InvalidCredentials\";\n\n const hasLoginAction = this.error.action\n ? this.error.action.name === \"login\"\n : false;\n\n return hasUnauthorizedStatus || hasUnauthorizedErrorId || hasLoginAction;\n }\n\n /**\n */\n get isChangePassword(): boolean {\n return this.id === \"Error.ChangePasswordRequired\";\n }\n\n /**\n */\n get isConcurrentUser(): boolean {\n return this.id === \"Error.Authentication.ConcurrentUser\";\n }\n\n /**\n */\n get isConcurrentError(): boolean {\n return (\n this.id === \"Error.Case.ConcurrentModification\" ||\n this.id === \"Error.DataStore.ConcurrentModification\" ||\n this.id === \"Error.DataStore.RecordAlreadyExists\" ||\n this.id === \"Error.DataStore.RowCannotBeLocked\"\n );\n }\n\n /**\n */\n get isBlocked(): boolean {\n return this.id === \"Error.Authentication.BlockedUser\";\n }\n\n /**\n */\n get isInvalidUsername(): boolean {\n return this.id === \"Error.Authentication.InvalidUsername\";\n }\n\n /**\n */\n get isTimeoutError(): boolean {\n return this.id === \"Error.CodemapLookup.InvalidToken\";\n }\n\n /**\n * A RemoteServiceException occurs when an exception occurs connecting to an external system,\n * for example when using the service list panels\n */\n get isRemoteServiceException(): boolean {\n return this.id === \"Error.RemoteServiceException\";\n }\n\n /**\n * Get response url\n */\n get changePasswordHref(): ?Href {\n return this.properties.redirect ? new Href(this.properties.redirect) : null;\n }\n\n /**\n * When no action information is present in the unauthorized response, for now we assume it is Basic Authentication\n */\n get isBasicAuthentication(): boolean {\n const UNAUTHORIZED_RESPONSE_CODE = 401;\n return (\n this.isUnauthorized &&\n this.status === UNAUTHORIZED_RESPONSE_CODE &&\n this.response.error === \"No responseText\"\n );\n }\n\n /**\n * Retrieve a failed login attempt\n */\n get loginFailed(): boolean {\n return (\n this.id === \"Error.Authentication.Required\" ||\n this.id === \"Error.Authentication.InvalidCredentials\"\n );\n }\n\n /**\n */\n get shouldThrowOnServer(): boolean {\n return !this.isChangePassword && !this.isBlocked && !this.isConcurrentUser;\n }\n}\n"],"mappings":";AACA,OAAOA,IAAP,MAAiB,cAAjB;AAGA,OAAOC,oBAAP,MAAiC,oCAAjC;AAEA;AACA;;AAqBA;AACA;AACA;AACA,eAAe,MAAMC,aAAN,CAAoB;EAIjC;AACF;AACA;EACEC,WAAW,CAACC,IAAD,EAAeC,UAAf,EAAoC;IAAA;;IAAA;;IAC7C,KAAKC,MAAL,GAAcF,IAAd;IACA,KAAKG,WAAL,GAAmBF,UAAnB;EACD;EAED;AACF;;;EACgB,IAAVA,UAAU,CAACG,GAAD,EAAc;IAC1B,KAAKD,WAAL,GAAmBC,GAAnB;EACD;EAED;AACF;;;EACgB,IAAVH,UAAU,GAAY;IACxB,OAAO,KAAKE,WAAZ;EACD;EAED;AACF;AACA;;;EACW,IAALE,KAAK,GAAW;IAAA;;IAClB,uBAAO,KAAKH,MAAZ,uDAAsB,EAAtB;EACD;EAED;AACF;AACA;;;EACY,IAANI,MAAM,GAAW;IACnB,MAAMC,gBAAgB,GAAG,CAAzB;IACA,MAAMC,aAAa,GAAG,EAAtB;IACA,OAAO,KAAKH,KAAL,CAAWC,MAAX,GACHG,QAAQ,CAAC,KAAKJ,KAAL,CAAWC,MAAZ,EAAoBE,aAApB,CADL,GAEHD,gBAFJ;EAGD;EAED;AACF;AACA;;;EACQ,IAAFG,EAAE,GAAW;IACf,IAAI,KAAKC,kBAAL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AAwB,GAAY;IACtC,OAAO,KAAKrC,EAAL,KAAY,8BAAnB;EACD;EAED;AACF;AACA;;;EACwB,IAAlBsC,kBAAkB,GAAU;IAC9B,OAAO,KAAK3B,UAAL,CAAgBC,QAAhB,GAA2B,IAAI1B,IAAJ,CAAS,KAAKyB,UAAL,CAAgBC,QAAzB,CAA3B,GAAgE,IAAvE;EACD;EAED;AACF;AACA;;;EAC2B,IAArB2B,qBAAqB,GAAY;IACnC,MAAMb,0BAA0B,GAAG,GAAnC;IACA,OACE,KAAKD,cAAL,IACA,KAAK7B,MAAL,KAAgB8B,0BADhB,IAEA,KAAKrB,QAAL,CAAcV,KAAd,KAAwB,iBAH1B;EAKD;EAED;AACF;AACA;;;EACiB,IAAX6C,WAAW,GAAY;IACzB,OACE,KAAKxC,EAAL,KAAY,+BAAZ,IACA,KAAKA,EAAL,KAAY,yCAFd;EAID;EAED;AACF;;;EACyB,IAAnByC,mBAAmB,GAAY;IACjC,OAAO,CAAC,KAAKV,gBAAN,IAA0B,CAAC,KAAKG,SAAhC,IAA6C,CAAC,KAAKF,gBAA1D;EACD;;AA7RgC"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../src/models/types.js"],"sourcesContent":["// @flow\nimport type ApplicationModel from \"./application/ApplicationModel\";\nimport type BooleanAttributeModel from \"./attributes/BooleanAttributeModel\";\nimport type CaptchaAttributeModel from \"./attributes/CaptchaAttributeModel\";\nimport type ChoiceAttributeModel from \"./attributes/ChoiceAttributeModel\";\nimport type CompositeAttributeModel from \"./attributes/CompositeAttributeModel\";\nimport type DatetimeAttributeModel from \"./attributes/DatetimeAttributeModel\";\nimport type HelptextAttributeModel from \"./attributes/HelptextAttributeModel\";\nimport type LabelAttributeModel from \"./attributes/LabelAttributeModel\";\nimport type MemoAttributeModel from \"./attributes/MemoAttributeModel\";\nimport type MoneyAttributeModel from \"./attributes/MoneyAttributeModel\";\nimport type NumberAttributeModel from \"./attributes/NumberAttributeModel\";\nimport type PasswordAttributeModel from \"./attributes/PasswordAttributeModel\";\nimport type StringAttributeModel from \"./attributes/StringAttributeModel\";\nimport type UploadAttributeModel from \"./attributes/UploadAttributeModel\";\nimport type XMLAttributeModel from \"./attributes/XMLAttributeModel\";\nimport type CaseViewModel from \"./caseview/CaseViewModel\";\nimport type BusinessScenarioModel from \"./concepts/BusinessScenarioModel\";\nimport type ConceptDetailModel from \"./concepts/ConceptDetailModel\";\nimport type ConceptIndexModel from \"./concepts/ConceptIndexModel\";\nimport type ConceptTypeDetailModel from \"./concepts/ConceptTypeDetailModel\";\nimport type ContentIndexModel from \"./content/ContentIndexModel\";\nimport type ContentModel from \"./content/ContentModel\";\nimport type SectionModel from \"./content/SectionModel\";\nimport type ContentTOCModel from \"./content/ContentTOCModel\";\nimport type ContentTypeModel from \"./content/ContentTypeModel\";\nimport type DetailModel from \"./detail/DetailModel\";\nimport type AssignmentFilterModel from \"./filters/AssignmentFilterModel\";\nimport type FilterModel from \"./filters/FilterModel\";\nimport type RangeFilterModel from \"./filters/RangeFilterModel\";\nimport type ConceptIndexFilterModel from \"./filters/ConceptIndexFilterModel\";\nimport type FormModel from \"./form/FormModel\";\nimport type ListDetailModel from \"./list/ListDetailModel\";\nimport type ListModel from \"./list/ListModel\";\nimport type ModelCatalogModel from \"./modelcatalog/ModelCatalogModel\";\nimport type GroupingPanelModel from \"./panels/GroupingPanelModel\";\nimport type CaseSearchModel from \"./search/CaseSearchModel\";\nimport type TabModel from \"./tab/TabModel\";\nimport type TaskGroupModel from \"./taskgroup/TaskGroupModel\";\nimport type UserModel from \"./user/UserModel\";\nimport type UserServicesModel from \"./user/UserServicesModel\";\nimport type LinkModel from \"./links/LinkModel\";\nimport type LookupOptionsModel from \"./lookup/LookupOptionsModel\";\nimport type BaseFilterModel from \"./filters/BaseFilterModel\";\nimport type AttributeCollection from \"./attributes/AttributeCollection\";\nimport type AttributeModel from \"./attributes/AttributeModel\";\nimport type LayoutHintCollection from \"./layouthint/LayoutHintCollection\";\n\nexport type ModularUIModel =\n | ApplicationModel\n | CaseSearchModel\n | CaseViewModel\n | ListDetailModel\n | DetailModel\n | FormModel\n | GroupingPanelModel\n | ListModel\n | TabModel\n | TaskGroupModel\n | UserModel\n | UserServicesModel\n | ModelCatalogModel\n | ConceptIndexModel\n | ConceptDetailModel\n | BusinessScenarioModel\n | ConceptTypeDetailModel\n | ContentIndexModel\n | ContentTOCModel\n | ContentModel\n | ContentTypeModel\n | LookupOptionsModel;\n\nexport type AttributeType =\n | BooleanAttributeModel\n | CaptchaAttributeModel\n | ChoiceAttributeModel\n | DatetimeAttributeModel\n | HelptextAttributeModel\n | LabelAttributeModel\n | MemoAttributeModel\n | MoneyAttributeModel\n | NumberAttributeModel\n | PasswordAttributeModel\n | CompositeAttributeModel\n | StringAttributeModel\n | UploadAttributeModel\n | XMLAttributeModel;\n\nexport type RangeChildAttributeType =\n | NumberAttributeModel\n | DatetimeAttributeModel;\n\nexport type FilterType =\n | BaseFilterModel\n | FilterModel\n | AssignmentFilterModel\n | RangeFilterModel\n | ConceptIndexFilterModel;\n\nexport type FormErrorAnchor = {\n id: string,\n properties?: {\n [propertyName: string]: string | number,\n },\n anchor?: {\n objectid: string,\n elementid?: string,\n _links?: Object,\n index?: number,\n \"index-identifier\"?: string,\n },\n message: string,\n param?: {\n name: string,\n },\n};\n\nexport type labelsJSON = {|\n _id: string,\n label: string,\n value: string,\n|};\n\nexport type propertyJSON = {|\n _id: string,\n type: string,\n mandatory: string,\n label: string,\n value: string,\n|};\n\nexport type textfragmentJSON = {|\n label: string,\n text: string,\n type: string,\n|};\n\nexport interface IConstraintModel {\n +id: string;\n +defaultMessage: string;\n +parameters: Object;\n +isMandatoryConstraint: boolean;\n validate(value: any): boolean;\n hasValidation(): boolean;\n}\n\nexport interface ILayoutHintRule {\n process(attribute: AttributeModel, attributes: AttributeCollection): void;\n}\n\nexport interface IModelWithChildModels {\n getInitialChildModelLinks(): Array<LinkModel>;\n setChildModels(models: Array<ModularUIModel>): void;\n}\n\nexport type AuthenticationType = {\n name: string,\n authentication: string,\n redirectUri: string,\n isPrimary: boolean,\n};\n\nexport type FileEntryType = {\n name: string,\n size?: number,\n progress: number,\n error?: string,\n token?: string,\n};\n\nexport type FilesType = {\n [filename: string]: FileEntryType,\n};\n\nexport type FiletypeConstraintsType = Array<{|\n extensions: Array<string>,\n mimeTypes: Array<string>,\n|}>;\n\nexport type FilesizeConstraintsType = {\n fileSize: ?number,\n maxTotalFileSize: ?number,\n isMaxTotal: boolean,\n};\n\nexport type PropertyData = { type: string, label: string, value: string };\nexport type TextFragmentData = {\n type: string,\n label: string,\n text: string | { id?: string, message: string, properties?: Object },\n};\nexport type SectionData = {\n id: string,\n type: string,\n label?: string,\n number?: string,\n body: string | { id?: string, message: string, properties?: Object },\n _links: { self: { href: string } },\n childSections: Array<SectionData>,\n subSections: Array<SectionData>,\n};\n\nexport type PropertyElement = {\n propertyElement: {\n label: string,\n layouthint: Array<string>,\n properties: Array<PropertyData>,\n },\n};\nexport type TextFragmentElement = {\n textFragmentElement: {\n label: string,\n layouthint: Array<string>,\n textfragments: Array<TextFragmentData>,\n },\n};\nexport type ContentElement = {\n contentElement: {\n label: string,\n layouthint: Array<string>,\n sections: Array<SectionData>,\n },\n};\n\nexport type PropertyElementMapped = {\n propertyElement: {\n label: string,\n layouthint: LayoutHintCollection,\n properties: Array<PropertyData>,\n },\n};\nexport type TextFragmentElementMapped = {\n textFragmentElement: {\n label: string,\n layouthint: LayoutHintCollection,\n textfragments: Array<TextFragmentData>,\n },\n};\nexport type ContentElementMapped = {\n contentElement: {\n label: string,\n layouthint: LayoutHintCollection,\n sections: Array<SectionModel>,\n },\n};\n\nexport type ContentAll = Array<\n PropertyElementMapped | TextFragmentElementMapped | ContentElementMapped\n>;\n\nexport type ContentData = {\n header: {\n label?: string,\n description?: { id?: string, message: string, properties?: Object },\n },\n label?: string,\n elements: Array<PropertyElement | TextFragmentElement | ContentElement>,\n};\n"],"mappings":""}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../src/models/types.js"],"sourcesContent":["// @flow\nimport type ApplicationModel from \"./application/ApplicationModel\";\nimport type BooleanAttributeModel from \"./attributes/BooleanAttributeModel\";\nimport type CaptchaAttributeModel from \"./attributes/CaptchaAttributeModel\";\nimport type ChoiceAttributeModel from \"./attributes/ChoiceAttributeModel\";\nimport type CompositeAttributeModel from \"./attributes/CompositeAttributeModel\";\nimport type DatetimeAttributeModel from \"./attributes/DatetimeAttributeModel\";\nimport type HelptextAttributeModel from \"./attributes/HelptextAttributeModel\";\nimport type LabelAttributeModel from \"./attributes/LabelAttributeModel\";\nimport type MemoAttributeModel from \"./attributes/MemoAttributeModel\";\nimport type MoneyAttributeModel from \"./attributes/MoneyAttributeModel\";\nimport type NumberAttributeModel from \"./attributes/NumberAttributeModel\";\nimport type PasswordAttributeModel from \"./attributes/PasswordAttributeModel\";\nimport type StringAttributeModel from \"./attributes/StringAttributeModel\";\nimport type UploadAttributeModel from \"./attributes/UploadAttributeModel\";\nimport type XMLAttributeModel from \"./attributes/XMLAttributeModel\";\nimport type CaseViewModel from \"./caseview/CaseViewModel\";\nimport type BusinessScenarioModel from \"./concepts/BusinessScenarioModel\";\nimport type ConceptDetailModel from \"./concepts/ConceptDetailModel\";\nimport type ConceptIndexModel from \"./concepts/ConceptIndexModel\";\nimport type ConceptTypeDetailModel from \"./concepts/ConceptTypeDetailModel\";\nimport type ContentIndexModel from \"./content/ContentIndexModel\";\nimport type ContentModel from \"./content/ContentModel\";\nimport type SectionModel from \"./content/SectionModel\";\nimport type ContentTOCModel from \"./content/ContentTOCModel\";\nimport type ContentTypeModel from \"./content/ContentTypeModel\";\nimport type DetailModel from \"./detail/DetailModel\";\nimport type AssignmentFilterModel from \"./filters/AssignmentFilterModel\";\nimport type FilterModel from \"./filters/FilterModel\";\nimport type RangeFilterModel from \"./filters/RangeFilterModel\";\nimport type ConceptIndexFilterModel from \"./filters/ConceptIndexFilterModel\";\nimport type FormModel from \"./form/FormModel\";\nimport type ListDetailModel from \"./list/ListDetailModel\";\nimport type ListModel from \"./list/ListModel\";\nimport type ModelCatalogModel from \"./modelcatalog/ModelCatalogModel\";\nimport type GroupingPanelModel from \"./panels/GroupingPanelModel\";\nimport type CaseSearchModel from \"./search/CaseSearchModel\";\nimport type TabModel from \"./tab/TabModel\";\nimport type TaskGroupModel from \"./taskgroup/TaskGroupModel\";\nimport type UserModel from \"./user/UserModel\";\nimport type UserServicesModel from \"./user/UserServicesModel\";\nimport type LinkModel from \"./links/LinkModel\";\nimport type LookupOptionsModel from \"./lookup/LookupOptionsModel\";\nimport type BaseFilterModel from \"./filters/BaseFilterModel\";\nimport type AttributeCollection from \"./attributes/AttributeCollection\";\nimport type AttributeModel from \"./attributes/AttributeModel\";\nimport type LayoutHintCollection from \"./layouthint/LayoutHintCollection\";\n\nexport type ModularUIModel =\n | ApplicationModel\n | CaseSearchModel\n | CaseViewModel\n | ListDetailModel\n | DetailModel\n | FormModel\n | GroupingPanelModel\n | ListModel\n | TabModel\n | TaskGroupModel\n | UserModel\n | UserServicesModel\n | ModelCatalogModel\n | ConceptIndexModel\n | ConceptDetailModel\n | BusinessScenarioModel\n | ConceptTypeDetailModel\n | ContentIndexModel\n | ContentTOCModel\n | ContentModel\n | ContentTypeModel\n | LookupOptionsModel;\n\nexport type AttributeType =\n | BooleanAttributeModel\n | CaptchaAttributeModel\n | ChoiceAttributeModel\n | DatetimeAttributeModel\n | HelptextAttributeModel\n | LabelAttributeModel\n | MemoAttributeModel\n | MoneyAttributeModel\n | NumberAttributeModel\n | PasswordAttributeModel\n | CompositeAttributeModel\n | StringAttributeModel\n | UploadAttributeModel\n | XMLAttributeModel;\n\nexport type RangeChildAttributeType =\n | NumberAttributeModel\n | DatetimeAttributeModel;\n\nexport type FilterType =\n | BaseFilterModel\n | FilterModel\n | AssignmentFilterModel\n | RangeFilterModel\n | ConceptIndexFilterModel;\n\nexport type FormErrorAnchor = {\n id: string,\n properties?: {\n [propertyName: string]: string | number,\n },\n anchor?: {\n objectid: string,\n elementid?: string,\n _links?: Object,\n index?: number,\n \"index-identifier\"?: string,\n },\n layouthint?: LayoutHintCollection,\n message: string,\n param?: {\n name: string,\n },\n};\n\nexport type labelsJSON = {|\n _id: string,\n label: string,\n value: string,\n|};\n\nexport type propertyJSON = {|\n _id: string,\n type: string,\n mandatory: string,\n label: string,\n value: string,\n|};\n\nexport type textfragmentJSON = {|\n label: string,\n text: string,\n type: string,\n|};\n\nexport interface IConstraintModel {\n +id: string;\n +defaultMessage: string;\n +parameters: Object;\n +isMandatoryConstraint: boolean;\n validate(value: any): boolean;\n hasValidation(): boolean;\n}\n\nexport interface ILayoutHintRule {\n process(attribute: AttributeModel, attributes: AttributeCollection): void;\n}\n\nexport interface IModelWithChildModels {\n getInitialChildModelLinks(): Array<LinkModel>;\n setChildModels(models: Array<ModularUIModel>): void;\n}\n\nexport type AuthenticationType = {\n name: string,\n authentication: string,\n redirectUri: string,\n isPrimary: boolean,\n};\n\nexport type FileEntryType = {\n name: string,\n size?: number,\n progress: number,\n error?: string,\n token?: string,\n};\n\nexport type FilesType = {\n [filename: string]: FileEntryType,\n};\n\nexport type FiletypeConstraintsType = Array<{|\n extensions: Array<string>,\n mimeTypes: Array<string>,\n|}>;\n\nexport type FilesizeConstraintsType = {\n fileSize: ?number,\n maxTotalFileSize: ?number,\n isMaxTotal: boolean,\n};\n\nexport type PropertyData = { type: string, label: string, value: string };\nexport type TextFragmentData = {\n type: string,\n label: string,\n text: string | { id?: string, message: string, properties?: Object },\n};\nexport type SectionData = {\n id: string,\n type: string,\n label?: string,\n number?: string,\n body: string | { id?: string, message: string, properties?: Object },\n _links: { self: { href: string } },\n childSections: Array<SectionData>,\n subSections: Array<SectionData>,\n};\n\nexport type PropertyElement = {\n propertyElement: {\n label: string,\n layouthint: Array<string>,\n properties: Array<PropertyData>,\n },\n};\nexport type TextFragmentElement = {\n textFragmentElement: {\n label: string,\n layouthint: Array<string>,\n textfragments: Array<TextFragmentData>,\n },\n};\nexport type ContentElement = {\n contentElement: {\n label: string,\n layouthint: Array<string>,\n sections: Array<SectionData>,\n },\n};\n\nexport type PropertyElementMapped = {\n propertyElement: {\n label: string,\n layouthint: LayoutHintCollection,\n properties: Array<PropertyData>,\n },\n};\nexport type TextFragmentElementMapped = {\n textFragmentElement: {\n label: string,\n layouthint: LayoutHintCollection,\n textfragments: Array<TextFragmentData>,\n },\n};\nexport type ContentElementMapped = {\n contentElement: {\n label: string,\n layouthint: LayoutHintCollection,\n sections: Array<SectionModel>,\n },\n};\n\nexport type ContentAll = Array<\n PropertyElementMapped | TextFragmentElementMapped | ContentElementMapped\n>;\n\nexport type ContentData = {\n header: {\n label?: string,\n description?: { id?: string, message: string, properties?: Object },\n },\n label?: string,\n elements: Array<PropertyElement | TextFragmentElement | ContentElement>,\n};\n"],"mappings":""}
@@ -9,6 +9,8 @@ exports.default = void 0;
9
9
 
10
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
11
11
 
12
+ var _LayoutHintCollection = _interopRequireDefault(require("../layouthint/LayoutHintCollection"));
13
+
12
14
  /**
13
15
  * Wrapper around an error message / object
14
16
  */
@@ -22,10 +24,12 @@ class ErrorModel {
22
24
  (0, _defineProperty2.default)(this, "_defaultMessage", void 0);
23
25
  (0, _defineProperty2.default)(this, "_parameters", void 0);
24
26
  (0, _defineProperty2.default)(this, "_isClientConstraint", void 0);
27
+ (0, _defineProperty2.default)(this, "_layouthint", void 0);
25
28
  this._id = id;
26
29
  this._parameters = parameters;
27
30
  this._defaultMessage = defaultMessage;
28
31
  this._isClientConstraint = isClientConstraint;
32
+ this._layouthint = new _LayoutHintCollection.default();
29
33
  }
30
34
  /**
31
35
  * Get id of error
@@ -60,6 +64,13 @@ class ErrorModel {
60
64
  */
61
65
 
62
66
 
67
+ get layouthint() {
68
+ return this._layouthint;
69
+ }
70
+ /**
71
+ */
72
+
73
+
63
74
  get isMandatoryConstraint() {
64
75
  return this.id === "Constraint.Mandatory";
65
76
  }
@@ -1,5 +1,6 @@
1
1
  // @flow
2
2
  import type { MessageParameters } from "../../i18n/types";
3
+ import LayoutHintCollection from "../layouthint/LayoutHintCollection";
3
4
 
4
5
  /**
5
6
  * Wrapper around an error message / object
@@ -9,6 +10,7 @@ class ErrorModel {
9
10
  _defaultMessage: ?string;
10
11
  _parameters: ?MessageParameters;
11
12
  _isClientConstraint: boolean;
13
+ _layouthint: LayoutHintCollection;
12
14
 
13
15
  /**
14
16
  * Contruct
@@ -22,8 +24,8 @@ class ErrorModel {
22
24
  this._id = id;
23
25
  this._parameters = parameters;
24
26
  this._defaultMessage = defaultMessage;
25
-
26
27
  this._isClientConstraint = isClientConstraint;
28
+ this._layouthint = new LayoutHintCollection();
27
29
  }
28
30
 
29
31
  /**
@@ -51,6 +53,12 @@ class ErrorModel {
51
53
  return this._isClientConstraint || false;
52
54
  }
53
55
 
56
+ /**
57
+ */
58
+ get layouthint(): LayoutHintCollection {
59
+ return this._layouthint;
60
+ }
61
+
54
62
  /**
55
63
  */
56
64
  get isMandatoryConstraint(): boolean {
@@ -1 +1 @@
1
- {"version":3,"file":"ErrorModel.js","names":["ErrorModel","constructor","id","defaultMessage","parameters","isClientConstraint","_id","_parameters","_defaultMessage","_isClientConstraint","isMandatoryConstraint"],"sources":["../../../src/models/error/ErrorModel.js"],"sourcesContent":["// @flow\nimport type { MessageParameters } from \"../../i18n/types\";\n\n/**\n * Wrapper around an error message / object\n */\nclass ErrorModel {\n _id: string;\n _defaultMessage: ?string;\n _parameters: ?MessageParameters;\n _isClientConstraint: boolean;\n\n /**\n * Contruct\n */\n constructor(\n id: string,\n defaultMessage: ?string,\n parameters: ?MessageParameters,\n isClientConstraint: boolean = false\n ) {\n this._id = id;\n this._parameters = parameters;\n this._defaultMessage = defaultMessage;\n\n this._isClientConstraint = isClientConstraint;\n }\n\n /**\n * Get id of error\n */\n get id(): string {\n return this._id;\n }\n\n /**\n */\n get defaultMessage(): ?string {\n return this._defaultMessage;\n }\n\n /**\n */\n get parameters(): ?MessageParameters {\n return this._parameters;\n }\n\n /**\n */\n get isClientConstraint(): boolean {\n return this._isClientConstraint || false;\n }\n\n /**\n */\n get isMandatoryConstraint(): boolean {\n return this.id === \"Constraint.Mandatory\";\n }\n}\n\nexport default ErrorModel;\n"],"mappings":";;;;;;;;;;;AAGA;AACA;AACA;AACA,MAAMA,UAAN,CAAiB;EAMf;AACF;AACA;EACEC,WAAW,CACTC,EADS,EAETC,cAFS,EAGTC,UAHS,EAKT;IAAA,IADAC,kBACA,uEAD8B,KAC9B;IAAA;IAAA;IAAA;IAAA;IACA,KAAKC,GAAL,GAAWJ,EAAX;IACA,KAAKK,WAAL,GAAmBH,UAAnB;IACA,KAAKI,eAAL,GAAuBL,cAAvB;IAEA,KAAKM,mBAAL,GAA2BJ,kBAA3B;EACD;EAED;AACF;AACA;;;EACQ,IAAFH,EAAE,GAAW;IACf,OAAO,KAAKI,GAAZ;EACD;EAED;AACF;;;EACoB,IAAdH,cAAc,GAAY;IAC5B,OAAO,KAAKK,eAAZ;EACD;EAED;AACF;;;EACgB,IAAVJ,UAAU,GAAuB;IACnC,OAAO,KAAKG,WAAZ;EACD;EAED;AACF;;;EACwB,IAAlBF,kBAAkB,GAAY;IAChC,OAAO,KAAKI,mBAAL,IAA4B,KAAnC;EACD;EAED;AACF;;;EAC2B,IAArBC,qBAAqB,GAAY;IACnC,OAAO,KAAKR,EAAL,KAAY,sBAAnB;EACD;;AAnDc;;eAsDFF,U"}
1
+ {"version":3,"file":"ErrorModel.js","names":["ErrorModel","constructor","id","defaultMessage","parameters","isClientConstraint","_id","_parameters","_defaultMessage","_isClientConstraint","_layouthint","LayoutHintCollection","layouthint","isMandatoryConstraint"],"sources":["../../../src/models/error/ErrorModel.js"],"sourcesContent":["// @flow\nimport type { MessageParameters } from \"../../i18n/types\";\nimport LayoutHintCollection from \"../layouthint/LayoutHintCollection\";\n\n/**\n * Wrapper around an error message / object\n */\nclass ErrorModel {\n _id: string;\n _defaultMessage: ?string;\n _parameters: ?MessageParameters;\n _isClientConstraint: boolean;\n _layouthint: LayoutHintCollection;\n\n /**\n * Contruct\n */\n constructor(\n id: string,\n defaultMessage: ?string,\n parameters: ?MessageParameters,\n isClientConstraint: boolean = false\n ) {\n this._id = id;\n this._parameters = parameters;\n this._defaultMessage = defaultMessage;\n this._isClientConstraint = isClientConstraint;\n this._layouthint = new LayoutHintCollection();\n }\n\n /**\n * Get id of error\n */\n get id(): string {\n return this._id;\n }\n\n /**\n */\n get defaultMessage(): ?string {\n return this._defaultMessage;\n }\n\n /**\n */\n get parameters(): ?MessageParameters {\n return this._parameters;\n }\n\n /**\n */\n get isClientConstraint(): boolean {\n return this._isClientConstraint || false;\n }\n\n /**\n */\n get layouthint(): LayoutHintCollection {\n return this._layouthint;\n }\n\n /**\n */\n get isMandatoryConstraint(): boolean {\n return this.id === \"Constraint.Mandatory\";\n }\n}\n\nexport default ErrorModel;\n"],"mappings":";;;;;;;;;;;AAEA;;AAEA;AACA;AACA;AACA,MAAMA,UAAN,CAAiB;EAOf;AACF;AACA;EACEC,WAAW,CACTC,EADS,EAETC,cAFS,EAGTC,UAHS,EAKT;IAAA,IADAC,kBACA,uEAD8B,KAC9B;IAAA;IAAA;IAAA;IAAA;IAAA;IACA,KAAKC,GAAL,GAAWJ,EAAX;IACA,KAAKK,WAAL,GAAmBH,UAAnB;IACA,KAAKI,eAAL,GAAuBL,cAAvB;IACA,KAAKM,mBAAL,GAA2BJ,kBAA3B;IACA,KAAKK,WAAL,GAAmB,IAAIC,6BAAJ,EAAnB;EACD;EAED;AACF;AACA;;;EACQ,IAAFT,EAAE,GAAW;IACf,OAAO,KAAKI,GAAZ;EACD;EAED;AACF;;;EACoB,IAAdH,cAAc,GAAY;IAC5B,OAAO,KAAKK,eAAZ;EACD;EAED;AACF;;;EACgB,IAAVJ,UAAU,GAAuB;IACnC,OAAO,KAAKG,WAAZ;EACD;EAED;AACF;;;EACwB,IAAlBF,kBAAkB,GAAY;IAChC,OAAO,KAAKI,mBAAL,IAA4B,KAAnC;EACD;EAED;AACF;;;EACgB,IAAVG,UAAU,GAAyB;IACrC,OAAO,KAAKF,WAAZ;EACD;EAED;AACF;;;EAC2B,IAArBG,qBAAqB,GAAY;IACnC,OAAO,KAAKX,EAAL,KAAY,sBAAnB;EACD;;AA1Dc;;eA6DFF,U"}
@@ -11,6 +11,8 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/he
11
11
 
12
12
  var _Href = _interopRequireDefault(require("../href/Href"));
13
13
 
14
+ var _LayoutHintCollection = _interopRequireDefault(require("../layouthint/LayoutHintCollection"));
15
+
14
16
  /**
15
17
  * Error response model
16
18
  */
@@ -77,12 +79,128 @@ class ErrorResponse {
77
79
  get message() {
78
80
  return this.error.message || this.id;
79
81
  }
82
+ /**
83
+ * Return response error message
84
+ */
85
+
86
+
87
+ get responseMessage() {
88
+ return this.response.message || this.id;
89
+ }
90
+ /**
91
+ * Return response error title
92
+ */
93
+
94
+
95
+ get title() {
96
+ return this.response.title || null;
97
+ }
98
+ /**
99
+ * Return response error title message
100
+ */
101
+
102
+
103
+ get titleMessage() {
104
+ var _this$response$title;
105
+
106
+ return ((_this$response$title = this.response.title) === null || _this$response$title === void 0 ? void 0 : _this$response$title.message) || undefined;
107
+ }
108
+ /**
109
+ * Return response error title Id
110
+ */
111
+
112
+
113
+ get titleId() {
114
+ var _this$response$title2;
115
+
116
+ return ((_this$response$title2 = this.response.title) === null || _this$response$title2 === void 0 ? void 0 : _this$response$title2.id) || undefined;
117
+ }
118
+ /**
119
+ * Return response error title properties
120
+ */
121
+
122
+
123
+ get titleProperties() {
124
+ var _this$response$title3;
125
+
126
+ return ((_this$response$title3 = this.response.title) === null || _this$response$title3 === void 0 ? void 0 : _this$response$title3.properties) || null;
127
+ }
128
+ /**
129
+ * Return response error redirect
130
+ */
131
+
132
+
133
+ get redirect() {
134
+ return this.response.redirect || null;
135
+ }
136
+ /**
137
+ * Return response error redirect text
138
+ */
139
+
140
+
141
+ get redirectText() {
142
+ var _this$response$redire;
143
+
144
+ return ((_this$response$redire = this.response.redirect) === null || _this$response$redire === void 0 ? void 0 : _this$response$redire.text) || null;
145
+ }
146
+ /**
147
+ * Return response error redirect text id
148
+ */
149
+
150
+
151
+ get redirectTextID() {
152
+ var _this$response$redire2, _this$response$redire3;
153
+
154
+ return ((_this$response$redire2 = this.response.redirect) === null || _this$response$redire2 === void 0 ? void 0 : (_this$response$redire3 = _this$response$redire2.text) === null || _this$response$redire3 === void 0 ? void 0 : _this$response$redire3.id) || undefined;
155
+ }
156
+ /**
157
+ * Return response error redirect text properties
158
+ */
159
+
160
+
161
+ get redirectTextProperties() {
162
+ var _this$response$redire4, _this$response$redire5;
163
+
164
+ return ((_this$response$redire4 = this.response.redirect) === null || _this$response$redire4 === void 0 ? void 0 : (_this$response$redire5 = _this$response$redire4.text) === null || _this$response$redire5 === void 0 ? void 0 : _this$response$redire5.properties) || null;
165
+ }
166
+ /**
167
+ * Return response error redirect text message
168
+ */
169
+
170
+
171
+ get redirectMessage() {
172
+ var _this$response$redire6, _this$response$redire7;
173
+
174
+ return ((_this$response$redire6 = this.response.redirect) === null || _this$response$redire6 === void 0 ? void 0 : (_this$response$redire7 = _this$response$redire6.text) === null || _this$response$redire7 === void 0 ? void 0 : _this$response$redire7.message) || undefined;
175
+ }
176
+ /**
177
+ * Return response error redirect href
178
+ */
179
+
180
+
181
+ get redirectHref() {
182
+ var _this$response$redire8;
183
+
184
+ if ((_this$response$redire8 = this.response.redirect) !== null && _this$response$redire8 !== void 0 && _this$response$redire8.href) {
185
+ return new _Href.default(this.response.redirect.href);
186
+ }
187
+
188
+ return new _Href.default();
189
+ }
190
+ /**
191
+ * Return error response layouthint
192
+ */
193
+
194
+
195
+ get layouthint() {
196
+ return new _LayoutHintCollection.default(this.response.layouthint);
197
+ }
80
198
  /**
81
199
  */
82
200
 
83
201
 
84
202
  get response() {
85
- return this.error.response || {};
203
+ return this.error.response.error || {};
86
204
  }
87
205
  /**
88
206
  */
@@ -2,6 +2,29 @@
2
2
  import Href from "../href/Href";
3
3
 
4
4
  import type { MessageParameters } from "../../i18n/types";
5
+ import LayoutHintCollection from "../layouthint/LayoutHintCollection";
6
+
7
+ /**
8
+ */
9
+ export type TitleObject = {
10
+ +id: string,
11
+ +properties?: Object,
12
+ +message?: string,
13
+ };
14
+ /**
15
+ */
16
+ export type RedirectTextObject = {
17
+ +id: string,
18
+ +properties?: Object,
19
+ +message?: string,
20
+ };
21
+
22
+ /**
23
+ */
24
+ export type RedirectObject = {
25
+ +href: Href,
26
+ +text?: RedirectTextObject,
27
+ };
5
28
 
6
29
  /**
7
30
  * Error response model
@@ -65,10 +88,96 @@ export default class ErrorResponse {
65
88
  return this.error.message || this.id;
66
89
  }
67
90
 
91
+ /**
92
+ * Return response error message
93
+ */
94
+ get responseMessage(): string {
95
+ return this.response.message || this.id;
96
+ }
97
+
98
+ /**
99
+ * Return response error title
100
+ */
101
+ get title(): TitleObject {
102
+ return this.response.title || null;
103
+ }
104
+
105
+ /**
106
+ * Return response error title message
107
+ */
108
+ get titleMessage(): string {
109
+ return this.response.title?.message || undefined;
110
+ }
111
+
112
+ /**
113
+ * Return response error title Id
114
+ */
115
+ get titleId(): string {
116
+ return this.response.title?.id || undefined;
117
+ }
118
+
119
+ /**
120
+ * Return response error title properties
121
+ */
122
+ get titleProperties(): Object {
123
+ return this.response.title?.properties || null;
124
+ }
125
+
126
+ /**
127
+ * Return response error redirect
128
+ */
129
+ get redirect(): RedirectObject {
130
+ return this.response.redirect || null;
131
+ }
132
+ /**
133
+ * Return response error redirect text
134
+ */
135
+ get redirectText(): RedirectTextObject {
136
+ return this.response.redirect?.text || null;
137
+ }
138
+
139
+ /**
140
+ * Return response error redirect text id
141
+ */
142
+ get redirectTextID(): string {
143
+ return this.response.redirect?.text?.id || undefined;
144
+ }
145
+
146
+ /**
147
+ * Return response error redirect text properties
148
+ */
149
+ get redirectTextProperties(): Object {
150
+ return this.response.redirect?.text?.properties || null;
151
+ }
152
+
153
+ /**
154
+ * Return response error redirect text message
155
+ */
156
+ get redirectMessage(): string {
157
+ return this.response.redirect?.text?.message || undefined;
158
+ }
159
+
160
+ /**
161
+ * Return response error redirect href
162
+ */
163
+ get redirectHref(): Href {
164
+ if (this.response.redirect?.href) {
165
+ return new Href(this.response.redirect.href);
166
+ }
167
+ return new Href();
168
+ }
169
+
170
+ /**
171
+ * Return error response layouthint
172
+ */
173
+ get layouthint(): LayoutHintCollection {
174
+ return new LayoutHintCollection(this.response.layouthint);
175
+ }
176
+
68
177
  /**
69
178
  */
70
179
  get response(): Object {
71
- return this.error.response || {};
180
+ return this.error.response.error || {};
72
181
  }
73
182
 
74
183
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"ErrorResponse.js","names":["ErrorResponse","constructor","data","connectKey","_error","_connectKey","key","error","status","NO_RESPONSE_CODE","DECIMAL_RADIX","parseInt","id","isResourceNotFound","name","message","response","properties","parameters","RESOURCE_NOT_FOUND_RESPONSE_CODE","isResourceNotFoundAfterReload","isReload","isUnauthorized","UNAUTHORIZED_RESPONSE_CODE","hasUnauthorizedStatus","hasUnauthorizedErrorId","hasLoginAction","action","isChangePassword","isConcurrentUser","isConcurrentError","isBlocked","isInvalidUsername","isTimeoutError","isRemoteServiceException","changePasswordHref","redirect","Href","isBasicAuthentication","loginFailed","shouldThrowOnServer"],"sources":["../../../src/models/error/ErrorResponse.js"],"sourcesContent":["// @flow\nimport Href from \"../href/Href\";\n\nimport type { MessageParameters } from \"../../i18n/types\";\n\n/**\n * Error response model\n */\nexport default class ErrorResponse {\n _error: Object;\n _connectKey: ?string;\n\n /**\n * Construct ErrorResponse\n */\n constructor(data: Object, connectKey?: string) {\n this._error = data;\n this._connectKey = connectKey;\n }\n\n /**\n */\n set connectKey(key: string) {\n this._connectKey = key;\n }\n\n /**\n */\n get connectKey(): ?string {\n return this._connectKey;\n }\n\n /**\n * Return error information\n */\n get error(): Object {\n return this._error ?? {};\n }\n\n /**\n * Get request status code\n */\n get status(): number {\n const NO_RESPONSE_CODE = 0;\n const DECIMAL_RADIX = 10;\n return this.error.status\n ? parseInt(this.error.status, DECIMAL_RADIX)\n : NO_RESPONSE_CODE;\n }\n\n /**\n * Return error type information\n */\n get id(): string {\n if (this.isResourceNotFound && this.error.id !== \"Error.NotAuthorized\") {\n return \"Error.ResourceNotFound\";\n }\n\n return this.error.id || this.error.name || \"Error.GeneralError\";\n }\n\n /**\n */\n get message(): string {\n return this.error.message || this.id;\n }\n\n /**\n */\n get response(): Object {\n return this.error.response || {};\n }\n\n /**\n */\n get properties(): Object {\n const { properties } = this.error;\n if (properties != null && typeof properties == \"object\") {\n return properties;\n }\n\n return {};\n }\n\n /**\n * Return error parameters\n */\n get parameters(): ?MessageParameters {\n return this.error.parameters || null;\n }\n\n /**\n */\n get isResourceNotFound(): boolean {\n const RESOURCE_NOT_FOUND_RESPONSE_CODE = 404;\n\n return this.status === RESOURCE_NOT_FOUND_RESPONSE_CODE;\n }\n\n /**\n */\n get isResourceNotFoundAfterReload(): boolean {\n return this.isResourceNotFound && this.error.isReload;\n }\n\n /**\n * Check if the error message is an authorization error\n */\n get isUnauthorized(): boolean {\n const UNAUTHORIZED_RESPONSE_CODE = 401;\n\n const hasUnauthorizedStatus = this.status === UNAUTHORIZED_RESPONSE_CODE;\n const hasUnauthorizedErrorId =\n this.id === \"Error.NotAuthorized\" ||\n this.id === \"Error.Authentication.Required\" ||\n this.id === \"Error.Authentication.InvalidUsername\" ||\n this.id === \"Error.Authentication.InvalidCredentials\";\n\n const hasLoginAction = this.error.action\n ? this.error.action.name === \"login\"\n : false;\n\n return hasUnauthorizedStatus || hasUnauthorizedErrorId || hasLoginAction;\n }\n\n /**\n */\n get isChangePassword(): boolean {\n return this.id === \"Error.ChangePasswordRequired\";\n }\n\n /**\n */\n get isConcurrentUser(): boolean {\n return this.id === \"Error.Authentication.ConcurrentUser\";\n }\n\n /**\n */\n get isConcurrentError(): boolean {\n return (\n this.id === \"Error.Case.ConcurrentModification\" ||\n this.id === \"Error.DataStore.ConcurrentModification\" ||\n this.id === \"Error.DataStore.RecordAlreadyExists\" ||\n this.id === \"Error.DataStore.RowCannotBeLocked\"\n );\n }\n\n /**\n */\n get isBlocked(): boolean {\n return this.id === \"Error.Authentication.BlockedUser\";\n }\n\n /**\n */\n get isInvalidUsername(): boolean {\n return this.id === \"Error.Authentication.InvalidUsername\";\n }\n\n /**\n */\n get isTimeoutError(): boolean {\n return this.id === \"Error.CodemapLookup.InvalidToken\";\n }\n\n /**\n * A RemoteServiceException occurs when an exception occurs connecting to an external system,\n * for example when using the service list panels\n */\n get isRemoteServiceException(): boolean {\n return this.id === \"Error.RemoteServiceException\";\n }\n\n /**\n * Get response url\n */\n get changePasswordHref(): ?Href {\n return this.properties.redirect ? new Href(this.properties.redirect) : null;\n }\n\n /**\n * When no action information is present in the unauthorized response, for now we assume it is Basic Authentication\n */\n get isBasicAuthentication(): boolean {\n const UNAUTHORIZED_RESPONSE_CODE = 401;\n return (\n this.isUnauthorized &&\n this.status === UNAUTHORIZED_RESPONSE_CODE &&\n this.response.error === \"No responseText\"\n );\n }\n\n /**\n * Retrieve a failed login attempt\n */\n get loginFailed(): boolean {\n return (\n this.id === \"Error.Authentication.Required\" ||\n this.id === \"Error.Authentication.InvalidCredentials\"\n );\n }\n\n /**\n */\n get shouldThrowOnServer(): boolean {\n return !this.isChangePassword && !this.isBlocked && !this.isConcurrentUser;\n }\n}\n"],"mappings":";;;;;;;;;;;AACA;;AAIA;AACA;AACA;AACe,MAAMA,aAAN,CAAoB;EAIjC;AACF;AACA;EACEC,WAAW,CAACC,IAAD,EAAeC,UAAf,EAAoC;IAAA;IAAA;IAC7C,KAAKC,MAAL,GAAcF,IAAd;IACA,KAAKG,WAAL,GAAmBF,UAAnB;EACD;EAED;AACF;;;EACgB,IAAVA,UAAU,CAACG,GAAD,EAAc;IAC1B,KAAKD,WAAL,GAAmBC,GAAnB;EACD;EAED;AACF;;;EACgB,IAAVH,UAAU,GAAY;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BsB,wBAAwB,GAAY;IACtC,OAAO,KAAKtB,EAAL,KAAY,8BAAnB;EACD;EAED;AACF;AACA;;;EACwB,IAAlBuB,kBAAkB,GAAU;IAC9B,OAAO,KAAKlB,UAAL,CAAgBmB,QAAhB,GAA2B,IAAIC,aAAJ,CAAS,KAAKpB,UAAL,CAAgBmB,QAAzB,CAA3B,GAAgE,IAAvE;EACD;EAED;AACF;AACA;;;EAC2B,IAArBE,qBAAqB,GAAY;IACnC,MAAMf,0BAA0B,GAAG,GAAnC;IACA,OACE,KAAKD,cAAL,IACA,KAAKd,MAAL,KAAgBe,0BADhB,IAEA,KAAKP,QAAL,CAAcT,KAAd,KAAwB,iBAH1B;EAKD;EAED;AACF;AACA;;;EACiB,IAAXgC,WAAW,GAAY;IACzB,OACE,KAAK3B,EAAL,KAAY,+BAAZ,IACA,KAAKA,EAAL,KAAY,yCAFd;EAID;EAED;AACF;;;EACyB,IAAnB4B,mBAAmB,GAAY;IACjC,OAAO,CAAC,KAAKZ,gBAAN,IAA0B,CAAC,KAAKG,SAAhC,IAA6C,CAAC,KAAKF,gBAA1D;EACD;;AAvMgC"}
1
+ {"version":3,"file":"ErrorResponse.js","names":["ErrorResponse","constructor","data","connectKey","_error","_connectKey","key","error","status","NO_RESPONSE_CODE","DECIMAL_RADIX","parseInt","id","isResourceNotFound","name","message","responseMessage","response","title","titleMessage","undefined","titleId","titleProperties","properties","redirect","redirectText","text","redirectTextID","redirectTextProperties","redirectMessage","redirectHref","href","Href","layouthint","LayoutHintCollection","parameters","RESOURCE_NOT_FOUND_RESPONSE_CODE","isResourceNotFoundAfterReload","isReload","isUnauthorized","UNAUTHORIZED_RESPONSE_CODE","hasUnauthorizedStatus","hasUnauthorizedErrorId","hasLoginAction","action","isChangePassword","isConcurrentUser","isConcurrentError","isBlocked","isInvalidUsername","isTimeoutError","isRemoteServiceException","changePasswordHref","isBasicAuthentication","loginFailed","shouldThrowOnServer"],"sources":["../../../src/models/error/ErrorResponse.js"],"sourcesContent":["// @flow\nimport Href from \"../href/Href\";\n\nimport type { MessageParameters } from \"../../i18n/types\";\nimport LayoutHintCollection from \"../layouthint/LayoutHintCollection\";\n\n/**\n */\nexport type TitleObject = {\n +id: string,\n +properties?: Object,\n +message?: string,\n};\n/**\n */\nexport type RedirectTextObject = {\n +id: string,\n +properties?: Object,\n +message?: string,\n};\n\n/**\n */\nexport type RedirectObject = {\n +href: Href,\n +text?: RedirectTextObject,\n};\n\n/**\n * Error response model\n */\nexport default class ErrorResponse {\n _error: Object;\n _connectKey: ?string;\n\n /**\n * Construct ErrorResponse\n */\n constructor(data: Object, connectKey?: string) {\n this._error = data;\n this._connectKey = connectKey;\n }\n\n /**\n */\n set connectKey(key: string) {\n this._connectKey = key;\n }\n\n /**\n */\n get connectKey(): ?string {\n return this._connectKey;\n }\n\n /**\n * Return error information\n */\n get error(): Object {\n return this._error ?? {};\n }\n\n /**\n * Get request status code\n */\n get status(): number {\n const NO_RESPONSE_CODE = 0;\n const DECIMAL_RADIX = 10;\n return this.error.status\n ? parseInt(this.error.status, DECIMAL_RADIX)\n : NO_RESPONSE_CODE;\n }\n\n /**\n * Return error type information\n */\n get id(): string {\n if (this.isResourceNotFound && this.error.id !== \"Error.NotAuthorized\") {\n return \"Error.ResourceNotFound\";\n }\n\n return this.error.id || this.error.name || \"Error.GeneralError\";\n }\n\n /**\n */\n get message(): string {\n return this.error.message || this.id;\n }\n\n /**\n * Return response error message\n */\n get responseMessage(): string {\n return this.response.message || this.id;\n }\n\n /**\n * Return response error title\n */\n get title(): TitleObject {\n return this.response.title || null;\n }\n\n /**\n * Return response error title message\n */\n get titleMessage(): string {\n return this.response.title?.message || undefined;\n }\n\n /**\n * Return response error title Id\n */\n get titleId(): string {\n return this.response.title?.id || undefined;\n }\n\n /**\n * Return response error title properties\n */\n get titleProperties(): Object {\n return this.response.title?.properties || null;\n }\n\n /**\n * Return response error redirect\n */\n get redirect(): RedirectObject {\n return this.response.redirect || null;\n }\n /**\n * Return response error redirect text\n */\n get redirectText(): RedirectTextObject {\n return this.response.redirect?.text || null;\n }\n\n /**\n * Return response error redirect text id\n */\n get redirectTextID(): string {\n return this.response.redirect?.text?.id || undefined;\n }\n\n /**\n * Return response error redirect text properties\n */\n get redirectTextProperties(): Object {\n return this.response.redirect?.text?.properties || null;\n }\n\n /**\n * Return response error redirect text message\n */\n get redirectMessage(): string {\n return this.response.redirect?.text?.message || undefined;\n }\n\n /**\n * Return response error redirect href\n */\n get redirectHref(): Href {\n if (this.response.redirect?.href) {\n return new Href(this.response.redirect.href);\n }\n return new Href();\n }\n\n /**\n * Return error response layouthint\n */\n get layouthint(): LayoutHintCollection {\n return new LayoutHintCollection(this.response.layouthint);\n }\n\n /**\n */\n get response(): Object {\n return this.error.response.error || {};\n }\n\n /**\n */\n get properties(): Object {\n const { properties } = this.error;\n if (properties != null && typeof properties == \"object\") {\n return properties;\n }\n\n return {};\n }\n\n /**\n * Return error parameters\n */\n get parameters(): ?MessageParameters {\n return this.error.parameters || null;\n }\n\n /**\n */\n get isResourceNotFound(): boolean {\n const RESOURCE_NOT_FOUND_RESPONSE_CODE = 404;\n\n return this.status === RESOURCE_NOT_FOUND_RESPONSE_CODE;\n }\n\n /**\n */\n get isResourceNotFoundAfterReload(): boolean {\n return this.isResourceNotFound && this.error.isReload;\n }\n\n /**\n * Check if the error message is an authorization error\n */\n get isUnauthorized(): boolean {\n const UNAUTHORIZED_RESPONSE_CODE = 401;\n\n const hasUnauthorizedStatus = this.status === UNAUTHORIZED_RESPONSE_CODE;\n const hasUnauthorizedErrorId =\n this.id === \"Error.NotAuthorized\" ||\n this.id === \"Error.Authentication.Required\" ||\n this.id === \"Error.Authentication.InvalidUsername\" ||\n this.id === \"Error.Authentication.InvalidCredentials\";\n\n const hasLoginAction = this.error.action\n ? this.error.action.name === \"login\"\n : false;\n\n return hasUnauthorizedStatus || hasUnauthorizedErrorId || hasLoginAction;\n }\n\n /**\n */\n get isChangePassword(): boolean {\n return this.id === \"Error.ChangePasswordRequired\";\n }\n\n /**\n */\n get isConcurrentUser(): boolean {\n return this.id === \"Error.Authentication.ConcurrentUser\";\n }\n\n /**\n */\n get isConcurrentError(): boolean {\n return (\n this.id === \"Error.Case.ConcurrentModification\" ||\n this.id === \"Error.DataStore.ConcurrentModification\" ||\n this.id === \"Error.DataStore.RecordAlreadyExists\" ||\n this.id === \"Error.DataStore.RowCannotBeLocked\"\n );\n }\n\n /**\n */\n get isBlocked(): boolean {\n return this.id === \"Error.Authentication.BlockedUser\";\n }\n\n /**\n */\n get isInvalidUsername(): boolean {\n return this.id === \"Error.Authentication.InvalidUsername\";\n }\n\n /**\n */\n get isTimeoutError(): boolean {\n return this.id === \"Error.CodemapLookup.InvalidToken\";\n }\n\n /**\n * A RemoteServiceException occurs when an exception occurs connecting to an external system,\n * for example when using the service list panels\n */\n get isRemoteServiceException(): boolean {\n return this.id === \"Error.RemoteServiceException\";\n }\n\n /**\n * Get response url\n */\n get changePasswordHref(): ?Href {\n return this.properties.redirect ? new Href(this.properties.redirect) : null;\n }\n\n /**\n * When no action information is present in the unauthorized response, for now we assume it is Basic Authentication\n */\n get isBasicAuthentication(): boolean {\n const UNAUTHORIZED_RESPONSE_CODE = 401;\n return (\n this.isUnauthorized &&\n this.status === UNAUTHORIZED_RESPONSE_CODE &&\n this.response.error === \"No responseText\"\n );\n }\n\n /**\n * Retrieve a failed login attempt\n */\n get loginFailed(): boolean {\n return (\n this.id === \"Error.Authentication.Required\" ||\n this.id === \"Error.Authentication.InvalidCredentials\"\n );\n }\n\n /**\n */\n get shouldThrowOnServer(): boolean {\n return !this.isChangePassword && !this.isBlocked && !this.isConcurrentUser;\n }\n}\n"],"mappings":";;;;;;;;;;;AACA;;AAGA;;AAwBA;AACA;AACA;AACe,MAAMA,aAAN,CAAoB;EAIjC;AACF;AACA;EACEC,WAAW,CAACC,IAAD,EAAeC,UAAf,EAAoC;IAAA;IAAA;IAC7C,KAAKC,MAAL,GAAcF,IAAd;IACA,KAAKG,WAAL,GAAm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KF,gBAA1D;EACD;;AA7RgC"}
@@ -109,6 +109,7 @@ export type FormErrorAnchor = {
109
109
  index?: number,
110
110
  "index-identifier"?: string,
111
111
  },
112
+ layouthint?: LayoutHintCollection,
112
113
  message: string,
113
114
  param?: {
114
115
  name: string,
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../src/models/types.js"],"sourcesContent":["// @flow\nimport type ApplicationModel from \"./application/ApplicationModel\";\nimport type BooleanAttributeModel from \"./attributes/BooleanAttributeModel\";\nimport type CaptchaAttributeModel from \"./attributes/CaptchaAttributeModel\";\nimport type ChoiceAttributeModel from \"./attributes/ChoiceAttributeModel\";\nimport type CompositeAttributeModel from \"./attributes/CompositeAttributeModel\";\nimport type DatetimeAttributeModel from \"./attributes/DatetimeAttributeModel\";\nimport type HelptextAttributeModel from \"./attributes/HelptextAttributeModel\";\nimport type LabelAttributeModel from \"./attributes/LabelAttributeModel\";\nimport type MemoAttributeModel from \"./attributes/MemoAttributeModel\";\nimport type MoneyAttributeModel from \"./attributes/MoneyAttributeModel\";\nimport type NumberAttributeModel from \"./attributes/NumberAttributeModel\";\nimport type PasswordAttributeModel from \"./attributes/PasswordAttributeModel\";\nimport type StringAttributeModel from \"./attributes/StringAttributeModel\";\nimport type UploadAttributeModel from \"./attributes/UploadAttributeModel\";\nimport type XMLAttributeModel from \"./attributes/XMLAttributeModel\";\nimport type CaseViewModel from \"./caseview/CaseViewModel\";\nimport type BusinessScenarioModel from \"./concepts/BusinessScenarioModel\";\nimport type ConceptDetailModel from \"./concepts/ConceptDetailModel\";\nimport type ConceptIndexModel from \"./concepts/ConceptIndexModel\";\nimport type ConceptTypeDetailModel from \"./concepts/ConceptTypeDetailModel\";\nimport type ContentIndexModel from \"./content/ContentIndexModel\";\nimport type ContentModel from \"./content/ContentModel\";\nimport type SectionModel from \"./content/SectionModel\";\nimport type ContentTOCModel from \"./content/ContentTOCModel\";\nimport type ContentTypeModel from \"./content/ContentTypeModel\";\nimport type DetailModel from \"./detail/DetailModel\";\nimport type AssignmentFilterModel from \"./filters/AssignmentFilterModel\";\nimport type FilterModel from \"./filters/FilterModel\";\nimport type RangeFilterModel from \"./filters/RangeFilterModel\";\nimport type ConceptIndexFilterModel from \"./filters/ConceptIndexFilterModel\";\nimport type FormModel from \"./form/FormModel\";\nimport type ListDetailModel from \"./list/ListDetailModel\";\nimport type ListModel from \"./list/ListModel\";\nimport type ModelCatalogModel from \"./modelcatalog/ModelCatalogModel\";\nimport type GroupingPanelModel from \"./panels/GroupingPanelModel\";\nimport type CaseSearchModel from \"./search/CaseSearchModel\";\nimport type TabModel from \"./tab/TabModel\";\nimport type TaskGroupModel from \"./taskgroup/TaskGroupModel\";\nimport type UserModel from \"./user/UserModel\";\nimport type UserServicesModel from \"./user/UserServicesModel\";\nimport type LinkModel from \"./links/LinkModel\";\nimport type LookupOptionsModel from \"./lookup/LookupOptionsModel\";\nimport type BaseFilterModel from \"./filters/BaseFilterModel\";\nimport type AttributeCollection from \"./attributes/AttributeCollection\";\nimport type AttributeModel from \"./attributes/AttributeModel\";\nimport type LayoutHintCollection from \"./layouthint/LayoutHintCollection\";\n\nexport type ModularUIModel =\n | ApplicationModel\n | CaseSearchModel\n | CaseViewModel\n | ListDetailModel\n | DetailModel\n | FormModel\n | GroupingPanelModel\n | ListModel\n | TabModel\n | TaskGroupModel\n | UserModel\n | UserServicesModel\n | ModelCatalogModel\n | ConceptIndexModel\n | ConceptDetailModel\n | BusinessScenarioModel\n | ConceptTypeDetailModel\n | ContentIndexModel\n | ContentTOCModel\n | ContentModel\n | ContentTypeModel\n | LookupOptionsModel;\n\nexport type AttributeType =\n | BooleanAttributeModel\n | CaptchaAttributeModel\n | ChoiceAttributeModel\n | DatetimeAttributeModel\n | HelptextAttributeModel\n | LabelAttributeModel\n | MemoAttributeModel\n | MoneyAttributeModel\n | NumberAttributeModel\n | PasswordAttributeModel\n | CompositeAttributeModel\n | StringAttributeModel\n | UploadAttributeModel\n | XMLAttributeModel;\n\nexport type RangeChildAttributeType =\n | NumberAttributeModel\n | DatetimeAttributeModel;\n\nexport type FilterType =\n | BaseFilterModel\n | FilterModel\n | AssignmentFilterModel\n | RangeFilterModel\n | ConceptIndexFilterModel;\n\nexport type FormErrorAnchor = {\n id: string,\n properties?: {\n [propertyName: string]: string | number,\n },\n anchor?: {\n objectid: string,\n elementid?: string,\n _links?: Object,\n index?: number,\n \"index-identifier\"?: string,\n },\n message: string,\n param?: {\n name: string,\n },\n};\n\nexport type labelsJSON = {|\n _id: string,\n label: string,\n value: string,\n|};\n\nexport type propertyJSON = {|\n _id: string,\n type: string,\n mandatory: string,\n label: string,\n value: string,\n|};\n\nexport type textfragmentJSON = {|\n label: string,\n text: string,\n type: string,\n|};\n\nexport interface IConstraintModel {\n +id: string;\n +defaultMessage: string;\n +parameters: Object;\n +isMandatoryConstraint: boolean;\n validate(value: any): boolean;\n hasValidation(): boolean;\n}\n\nexport interface ILayoutHintRule {\n process(attribute: AttributeModel, attributes: AttributeCollection): void;\n}\n\nexport interface IModelWithChildModels {\n getInitialChildModelLinks(): Array<LinkModel>;\n setChildModels(models: Array<ModularUIModel>): void;\n}\n\nexport type AuthenticationType = {\n name: string,\n authentication: string,\n redirectUri: string,\n isPrimary: boolean,\n};\n\nexport type FileEntryType = {\n name: string,\n size?: number,\n progress: number,\n error?: string,\n token?: string,\n};\n\nexport type FilesType = {\n [filename: string]: FileEntryType,\n};\n\nexport type FiletypeConstraintsType = Array<{|\n extensions: Array<string>,\n mimeTypes: Array<string>,\n|}>;\n\nexport type FilesizeConstraintsType = {\n fileSize: ?number,\n maxTotalFileSize: ?number,\n isMaxTotal: boolean,\n};\n\nexport type PropertyData = { type: string, label: string, value: string };\nexport type TextFragmentData = {\n type: string,\n label: string,\n text: string | { id?: string, message: string, properties?: Object },\n};\nexport type SectionData = {\n id: string,\n type: string,\n label?: string,\n number?: string,\n body: string | { id?: string, message: string, properties?: Object },\n _links: { self: { href: string } },\n childSections: Array<SectionData>,\n subSections: Array<SectionData>,\n};\n\nexport type PropertyElement = {\n propertyElement: {\n label: string,\n layouthint: Array<string>,\n properties: Array<PropertyData>,\n },\n};\nexport type TextFragmentElement = {\n textFragmentElement: {\n label: string,\n layouthint: Array<string>,\n textfragments: Array<TextFragmentData>,\n },\n};\nexport type ContentElement = {\n contentElement: {\n label: string,\n layouthint: Array<string>,\n sections: Array<SectionData>,\n },\n};\n\nexport type PropertyElementMapped = {\n propertyElement: {\n label: string,\n layouthint: LayoutHintCollection,\n properties: Array<PropertyData>,\n },\n};\nexport type TextFragmentElementMapped = {\n textFragmentElement: {\n label: string,\n layouthint: LayoutHintCollection,\n textfragments: Array<TextFragmentData>,\n },\n};\nexport type ContentElementMapped = {\n contentElement: {\n label: string,\n layouthint: LayoutHintCollection,\n sections: Array<SectionModel>,\n },\n};\n\nexport type ContentAll = Array<\n PropertyElementMapped | TextFragmentElementMapped | ContentElementMapped\n>;\n\nexport type ContentData = {\n header: {\n label?: string,\n description?: { id?: string, message: string, properties?: Object },\n },\n label?: string,\n elements: Array<PropertyElement | TextFragmentElement | ContentElement>,\n};\n"],"mappings":""}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../src/models/types.js"],"sourcesContent":["// @flow\nimport type ApplicationModel from \"./application/ApplicationModel\";\nimport type BooleanAttributeModel from \"./attributes/BooleanAttributeModel\";\nimport type CaptchaAttributeModel from \"./attributes/CaptchaAttributeModel\";\nimport type ChoiceAttributeModel from \"./attributes/ChoiceAttributeModel\";\nimport type CompositeAttributeModel from \"./attributes/CompositeAttributeModel\";\nimport type DatetimeAttributeModel from \"./attributes/DatetimeAttributeModel\";\nimport type HelptextAttributeModel from \"./attributes/HelptextAttributeModel\";\nimport type LabelAttributeModel from \"./attributes/LabelAttributeModel\";\nimport type MemoAttributeModel from \"./attributes/MemoAttributeModel\";\nimport type MoneyAttributeModel from \"./attributes/MoneyAttributeModel\";\nimport type NumberAttributeModel from \"./attributes/NumberAttributeModel\";\nimport type PasswordAttributeModel from \"./attributes/PasswordAttributeModel\";\nimport type StringAttributeModel from \"./attributes/StringAttributeModel\";\nimport type UploadAttributeModel from \"./attributes/UploadAttributeModel\";\nimport type XMLAttributeModel from \"./attributes/XMLAttributeModel\";\nimport type CaseViewModel from \"./caseview/CaseViewModel\";\nimport type BusinessScenarioModel from \"./concepts/BusinessScenarioModel\";\nimport type ConceptDetailModel from \"./concepts/ConceptDetailModel\";\nimport type ConceptIndexModel from \"./concepts/ConceptIndexModel\";\nimport type ConceptTypeDetailModel from \"./concepts/ConceptTypeDetailModel\";\nimport type ContentIndexModel from \"./content/ContentIndexModel\";\nimport type ContentModel from \"./content/ContentModel\";\nimport type SectionModel from \"./content/SectionModel\";\nimport type ContentTOCModel from \"./content/ContentTOCModel\";\nimport type ContentTypeModel from \"./content/ContentTypeModel\";\nimport type DetailModel from \"./detail/DetailModel\";\nimport type AssignmentFilterModel from \"./filters/AssignmentFilterModel\";\nimport type FilterModel from \"./filters/FilterModel\";\nimport type RangeFilterModel from \"./filters/RangeFilterModel\";\nimport type ConceptIndexFilterModel from \"./filters/ConceptIndexFilterModel\";\nimport type FormModel from \"./form/FormModel\";\nimport type ListDetailModel from \"./list/ListDetailModel\";\nimport type ListModel from \"./list/ListModel\";\nimport type ModelCatalogModel from \"./modelcatalog/ModelCatalogModel\";\nimport type GroupingPanelModel from \"./panels/GroupingPanelModel\";\nimport type CaseSearchModel from \"./search/CaseSearchModel\";\nimport type TabModel from \"./tab/TabModel\";\nimport type TaskGroupModel from \"./taskgroup/TaskGroupModel\";\nimport type UserModel from \"./user/UserModel\";\nimport type UserServicesModel from \"./user/UserServicesModel\";\nimport type LinkModel from \"./links/LinkModel\";\nimport type LookupOptionsModel from \"./lookup/LookupOptionsModel\";\nimport type BaseFilterModel from \"./filters/BaseFilterModel\";\nimport type AttributeCollection from \"./attributes/AttributeCollection\";\nimport type AttributeModel from \"./attributes/AttributeModel\";\nimport type LayoutHintCollection from \"./layouthint/LayoutHintCollection\";\n\nexport type ModularUIModel =\n | ApplicationModel\n | CaseSearchModel\n | CaseViewModel\n | ListDetailModel\n | DetailModel\n | FormModel\n | GroupingPanelModel\n | ListModel\n | TabModel\n | TaskGroupModel\n | UserModel\n | UserServicesModel\n | ModelCatalogModel\n | ConceptIndexModel\n | ConceptDetailModel\n | BusinessScenarioModel\n | ConceptTypeDetailModel\n | ContentIndexModel\n | ContentTOCModel\n | ContentModel\n | ContentTypeModel\n | LookupOptionsModel;\n\nexport type AttributeType =\n | BooleanAttributeModel\n | CaptchaAttributeModel\n | ChoiceAttributeModel\n | DatetimeAttributeModel\n | HelptextAttributeModel\n | LabelAttributeModel\n | MemoAttributeModel\n | MoneyAttributeModel\n | NumberAttributeModel\n | PasswordAttributeModel\n | CompositeAttributeModel\n | StringAttributeModel\n | UploadAttributeModel\n | XMLAttributeModel;\n\nexport type RangeChildAttributeType =\n | NumberAttributeModel\n | DatetimeAttributeModel;\n\nexport type FilterType =\n | BaseFilterModel\n | FilterModel\n | AssignmentFilterModel\n | RangeFilterModel\n | ConceptIndexFilterModel;\n\nexport type FormErrorAnchor = {\n id: string,\n properties?: {\n [propertyName: string]: string | number,\n },\n anchor?: {\n objectid: string,\n elementid?: string,\n _links?: Object,\n index?: number,\n \"index-identifier\"?: string,\n },\n layouthint?: LayoutHintCollection,\n message: string,\n param?: {\n name: string,\n },\n};\n\nexport type labelsJSON = {|\n _id: string,\n label: string,\n value: string,\n|};\n\nexport type propertyJSON = {|\n _id: string,\n type: string,\n mandatory: string,\n label: string,\n value: string,\n|};\n\nexport type textfragmentJSON = {|\n label: string,\n text: string,\n type: string,\n|};\n\nexport interface IConstraintModel {\n +id: string;\n +defaultMessage: string;\n +parameters: Object;\n +isMandatoryConstraint: boolean;\n validate(value: any): boolean;\n hasValidation(): boolean;\n}\n\nexport interface ILayoutHintRule {\n process(attribute: AttributeModel, attributes: AttributeCollection): void;\n}\n\nexport interface IModelWithChildModels {\n getInitialChildModelLinks(): Array<LinkModel>;\n setChildModels(models: Array<ModularUIModel>): void;\n}\n\nexport type AuthenticationType = {\n name: string,\n authentication: string,\n redirectUri: string,\n isPrimary: boolean,\n};\n\nexport type FileEntryType = {\n name: string,\n size?: number,\n progress: number,\n error?: string,\n token?: string,\n};\n\nexport type FilesType = {\n [filename: string]: FileEntryType,\n};\n\nexport type FiletypeConstraintsType = Array<{|\n extensions: Array<string>,\n mimeTypes: Array<string>,\n|}>;\n\nexport type FilesizeConstraintsType = {\n fileSize: ?number,\n maxTotalFileSize: ?number,\n isMaxTotal: boolean,\n};\n\nexport type PropertyData = { type: string, label: string, value: string };\nexport type TextFragmentData = {\n type: string,\n label: string,\n text: string | { id?: string, message: string, properties?: Object },\n};\nexport type SectionData = {\n id: string,\n type: string,\n label?: string,\n number?: string,\n body: string | { id?: string, message: string, properties?: Object },\n _links: { self: { href: string } },\n childSections: Array<SectionData>,\n subSections: Array<SectionData>,\n};\n\nexport type PropertyElement = {\n propertyElement: {\n label: string,\n layouthint: Array<string>,\n properties: Array<PropertyData>,\n },\n};\nexport type TextFragmentElement = {\n textFragmentElement: {\n label: string,\n layouthint: Array<string>,\n textfragments: Array<TextFragmentData>,\n },\n};\nexport type ContentElement = {\n contentElement: {\n label: string,\n layouthint: Array<string>,\n sections: Array<SectionData>,\n },\n};\n\nexport type PropertyElementMapped = {\n propertyElement: {\n label: string,\n layouthint: LayoutHintCollection,\n properties: Array<PropertyData>,\n },\n};\nexport type TextFragmentElementMapped = {\n textFragmentElement: {\n label: string,\n layouthint: LayoutHintCollection,\n textfragments: Array<TextFragmentData>,\n },\n};\nexport type ContentElementMapped = {\n contentElement: {\n label: string,\n layouthint: LayoutHintCollection,\n sections: Array<SectionModel>,\n },\n};\n\nexport type ContentAll = Array<\n PropertyElementMapped | TextFragmentElementMapped | ContentElementMapped\n>;\n\nexport type ContentData = {\n header: {\n label?: string,\n description?: { id?: string, message: string, properties?: Object },\n },\n label?: string,\n elements: Array<PropertyElement | TextFragmentElement | ContentElement>,\n};\n"],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beinformed/ui",
3
- "version": "1.20.10",
3
+ "version": "1.21.2",
4
4
  "description": "Toolbox for be informed javascript layouts",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "bugs": "http://support.beinformed.com",
@@ -1,5 +1,6 @@
1
1
  // @flow
2
2
  import type { MessageParameters } from "../../i18n/types";
3
+ import LayoutHintCollection from "../layouthint/LayoutHintCollection";
3
4
 
4
5
  /**
5
6
  * Wrapper around an error message / object
@@ -9,6 +10,7 @@ class ErrorModel {
9
10
  _defaultMessage: ?string;
10
11
  _parameters: ?MessageParameters;
11
12
  _isClientConstraint: boolean;
13
+ _layouthint: LayoutHintCollection;
12
14
 
13
15
  /**
14
16
  * Contruct
@@ -22,8 +24,8 @@ class ErrorModel {
22
24
  this._id = id;
23
25
  this._parameters = parameters;
24
26
  this._defaultMessage = defaultMessage;
25
-
26
27
  this._isClientConstraint = isClientConstraint;
28
+ this._layouthint = new LayoutHintCollection();
27
29
  }
28
30
 
29
31
  /**
@@ -51,6 +53,12 @@ class ErrorModel {
51
53
  return this._isClientConstraint || false;
52
54
  }
53
55
 
56
+ /**
57
+ */
58
+ get layouthint(): LayoutHintCollection {
59
+ return this._layouthint;
60
+ }
61
+
54
62
  /**
55
63
  */
56
64
  get isMandatoryConstraint(): boolean {
@@ -2,6 +2,29 @@
2
2
  import Href from "../href/Href";
3
3
 
4
4
  import type { MessageParameters } from "../../i18n/types";
5
+ import LayoutHintCollection from "../layouthint/LayoutHintCollection";
6
+
7
+ /**
8
+ */
9
+ export type TitleObject = {
10
+ +id: string,
11
+ +properties?: Object,
12
+ +message?: string,
13
+ };
14
+ /**
15
+ */
16
+ export type RedirectTextObject = {
17
+ +id: string,
18
+ +properties?: Object,
19
+ +message?: string,
20
+ };
21
+
22
+ /**
23
+ */
24
+ export type RedirectObject = {
25
+ +href: Href,
26
+ +text?: RedirectTextObject,
27
+ };
5
28
 
6
29
  /**
7
30
  * Error response model
@@ -65,10 +88,96 @@ export default class ErrorResponse {
65
88
  return this.error.message || this.id;
66
89
  }
67
90
 
91
+ /**
92
+ * Return response error message
93
+ */
94
+ get responseMessage(): string {
95
+ return this.response.message || this.id;
96
+ }
97
+
98
+ /**
99
+ * Return response error title
100
+ */
101
+ get title(): TitleObject {
102
+ return this.response.title || null;
103
+ }
104
+
105
+ /**
106
+ * Return response error title message
107
+ */
108
+ get titleMessage(): string {
109
+ return this.response.title?.message || undefined;
110
+ }
111
+
112
+ /**
113
+ * Return response error title Id
114
+ */
115
+ get titleId(): string {
116
+ return this.response.title?.id || undefined;
117
+ }
118
+
119
+ /**
120
+ * Return response error title properties
121
+ */
122
+ get titleProperties(): Object {
123
+ return this.response.title?.properties || null;
124
+ }
125
+
126
+ /**
127
+ * Return response error redirect
128
+ */
129
+ get redirect(): RedirectObject {
130
+ return this.response.redirect || null;
131
+ }
132
+ /**
133
+ * Return response error redirect text
134
+ */
135
+ get redirectText(): RedirectTextObject {
136
+ return this.response.redirect?.text || null;
137
+ }
138
+
139
+ /**
140
+ * Return response error redirect text id
141
+ */
142
+ get redirectTextID(): string {
143
+ return this.response.redirect?.text?.id || undefined;
144
+ }
145
+
146
+ /**
147
+ * Return response error redirect text properties
148
+ */
149
+ get redirectTextProperties(): Object {
150
+ return this.response.redirect?.text?.properties || null;
151
+ }
152
+
153
+ /**
154
+ * Return response error redirect text message
155
+ */
156
+ get redirectMessage(): string {
157
+ return this.response.redirect?.text?.message || undefined;
158
+ }
159
+
160
+ /**
161
+ * Return response error redirect href
162
+ */
163
+ get redirectHref(): Href {
164
+ if (this.response.redirect?.href) {
165
+ return new Href(this.response.redirect.href);
166
+ }
167
+ return new Href();
168
+ }
169
+
170
+ /**
171
+ * Return error response layouthint
172
+ */
173
+ get layouthint(): LayoutHintCollection {
174
+ return new LayoutHintCollection(this.response.layouthint);
175
+ }
176
+
68
177
  /**
69
178
  */
70
179
  get response(): Object {
71
- return this.error.response || {};
180
+ return this.error.response.error || {};
72
181
  }
73
182
 
74
183
  /**
@@ -109,6 +109,7 @@ export type FormErrorAnchor = {
109
109
  index?: number,
110
110
  "index-identifier"?: string,
111
111
  },
112
+ layouthint?: LayoutHintCollection,
112
113
  message: string,
113
114
  param?: {
114
115
  name: string,