@beinformed/ui 1.21.1 → 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,13 @@
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
+
5
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)
6
13
 
7
14
 
@@ -73,119 +73,127 @@ export default class ErrorResponse {
73
73
  return this.error.message || this.id;
74
74
  }
75
75
  /**
76
- * Return error title
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
77
85
  */
78
86
 
79
87
 
80
88
  get title() {
81
- return this.error.title || null;
89
+ return this.response.title || null;
82
90
  }
83
91
  /**
84
- * Return error title message
92
+ * Return response error title message
85
93
  */
86
94
 
87
95
 
88
96
  get titleMessage() {
89
- var _this$error$title;
97
+ var _this$response$title;
90
98
 
91
- return ((_this$error$title = this.error.title) === null || _this$error$title === void 0 ? void 0 : _this$error$title.message) || undefined;
99
+ return ((_this$response$title = this.response.title) === null || _this$response$title === void 0 ? void 0 : _this$response$title.message) || undefined;
92
100
  }
93
101
  /**
94
- * Return error title Id
102
+ * Return response error title Id
95
103
  */
96
104
 
97
105
 
98
106
  get titleId() {
99
- var _this$error$title2;
107
+ var _this$response$title2;
100
108
 
101
- return ((_this$error$title2 = this.error.title) === null || _this$error$title2 === void 0 ? void 0 : _this$error$title2.id) || undefined;
109
+ return ((_this$response$title2 = this.response.title) === null || _this$response$title2 === void 0 ? void 0 : _this$response$title2.id) || undefined;
102
110
  }
103
111
  /**
104
- * Return error title properties
112
+ * Return response error title properties
105
113
  */
106
114
 
107
115
 
108
116
  get titleProperties() {
109
- var _this$error$title3;
117
+ var _this$response$title3;
110
118
 
111
- return ((_this$error$title3 = this.error.title) === null || _this$error$title3 === void 0 ? void 0 : _this$error$title3.properties) || null;
119
+ return ((_this$response$title3 = this.response.title) === null || _this$response$title3 === void 0 ? void 0 : _this$response$title3.properties) || null;
112
120
  }
113
121
  /**
114
- * Return error redirect
122
+ * Return response error redirect
115
123
  */
116
124
 
117
125
 
118
126
  get redirect() {
119
- return this.error.redirect || null;
127
+ return this.response.redirect || null;
120
128
  }
121
129
  /**
122
- * Return error redirect text
130
+ * Return response error redirect text
123
131
  */
124
132
 
125
133
 
126
134
  get redirectText() {
127
- var _this$error$redirect;
135
+ var _this$response$redire;
128
136
 
129
- return ((_this$error$redirect = this.error.redirect) === null || _this$error$redirect === void 0 ? void 0 : _this$error$redirect.text) || null;
137
+ return ((_this$response$redire = this.response.redirect) === null || _this$response$redire === void 0 ? void 0 : _this$response$redire.text) || null;
130
138
  }
131
139
  /**
132
- * Return error redirect text id
140
+ * Return response error redirect text id
133
141
  */
134
142
 
135
143
 
136
144
  get redirectTextID() {
137
- var _this$error$redirect2, _this$error$redirect3;
145
+ var _this$response$redire2, _this$response$redire3;
138
146
 
139
- return ((_this$error$redirect2 = this.error.redirect) === null || _this$error$redirect2 === void 0 ? void 0 : (_this$error$redirect3 = _this$error$redirect2.text) === null || _this$error$redirect3 === void 0 ? void 0 : _this$error$redirect3.id) || undefined;
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;
140
148
  }
141
149
  /**
142
- * Return error redirect text properties
150
+ * Return response error redirect text properties
143
151
  */
144
152
 
145
153
 
146
154
  get redirectTextProperties() {
147
- var _this$error$redirect4, _this$error$redirect5;
155
+ var _this$response$redire4, _this$response$redire5;
148
156
 
149
- return ((_this$error$redirect4 = this.error.redirect) === null || _this$error$redirect4 === void 0 ? void 0 : (_this$error$redirect5 = _this$error$redirect4.text) === null || _this$error$redirect5 === void 0 ? void 0 : _this$error$redirect5.properties) || null;
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;
150
158
  }
151
159
  /**
152
- * Return error redirect text message
160
+ * Return response error redirect text message
153
161
  */
154
162
 
155
163
 
156
164
  get redirectMessage() {
157
- var _this$error$redirect6, _this$error$redirect7;
165
+ var _this$response$redire6, _this$response$redire7;
158
166
 
159
- return ((_this$error$redirect6 = this.error.redirect) === null || _this$error$redirect6 === void 0 ? void 0 : (_this$error$redirect7 = _this$error$redirect6.text) === null || _this$error$redirect7 === void 0 ? void 0 : _this$error$redirect7.message) || undefined;
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;
160
168
  }
161
169
  /**
162
- * Return error redirect href
170
+ * Return response error redirect href
163
171
  */
164
172
 
165
173
 
166
174
  get redirectHref() {
167
- var _this$error$redirect8;
175
+ var _this$response$redire8;
168
176
 
169
- if ((_this$error$redirect8 = this.error.redirect) !== null && _this$error$redirect8 !== void 0 && _this$error$redirect8.href) {
170
- return new Href(this.error.redirect.href);
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);
171
179
  }
172
180
 
173
181
  return new Href();
174
182
  }
175
183
  /**
176
- * Return error layouthint
184
+ * Return error response layouthint
177
185
  */
178
186
 
179
187
 
180
188
  get layouthint() {
181
- return new LayoutHintCollection(this.error.layouthint);
189
+ return new LayoutHintCollection(this.response.layouthint);
182
190
  }
183
191
  /**
184
192
  */
185
193
 
186
194
 
187
195
  get response() {
188
- return this.error.response || {};
196
+ return this.error.response.error || {};
189
197
  }
190
198
  /**
191
199
  */
@@ -1 +1 @@
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","title","titleMessage","undefined","titleId","titleProperties","properties","redirect","redirectText","text","redirectTextID","redirectTextProperties","redirectMessage","redirectHref","href","layouthint","response","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 error title\n */\n get title(): TitleObject {\n return this.error.title || null;\n }\n\n /**\n * Return error title message\n */\n get titleMessage(): string {\n return this.error.title?.message || undefined;\n }\n\n /**\n * Return error title Id\n */\n get titleId(): string {\n return this.error.title?.id || undefined;\n }\n\n /**\n * Return error title properties\n */\n get titleProperties(): Object {\n return this.error.title?.properties || null;\n }\n\n /**\n * Return error redirect\n */\n get redirect(): RedirectObject {\n return this.error.redirect || null;\n }\n /**\n * Return error redirect text\n */\n get redirectText(): RedirectTextObject {\n return this.error.redirect?.text || null;\n }\n\n /**\n * Return error redirect text id\n */\n get redirectTextID(): string {\n return this.error.redirect?.text?.id || undefined;\n }\n\n /**\n * Return error redirect text properties\n */\n get redirectTextProperties(): Object {\n return this.error.redirect?.text?.properties || null;\n }\n\n /**\n * Return error redirect text message\n */\n get redirectMessage(): string {\n return this.error.redirect?.text?.message || undefined;\n }\n\n /**\n * Return error redirect href\n */\n get redirectHref(): Href {\n if (this.error.redirect?.href) {\n return new Href(this.error.redirect.href);\n }\n return new Href();\n }\n\n /**\n * Return error layouthint\n */\n get layouthint(): LayoutHintCollection {\n return new LayoutHintCollection(this.error.layouthint);\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;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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AAL,KAAY,8BAAnB;EACD;EAED;AACF;AACA;;;EACwB,IAAlBqC,kBAAkB,GAAU;IAC9B,OAAO,KAAK5B,UAAL,CAAgBC,QAAhB,GAA2B,IAAIxB,IAAJ,CAAS,KAAKuB,UAAL,CAAgBC,QAAzB,CAA3B,GAAgE,IAAvE;EACD;EAED;AACF;AACA;;;EAC2B,IAArB4B,qBAAqB,GAAY;IACnC,MAAMb,0BAA0B,GAAG,GAAnC;IACA,OACE,KAAKD,cAAL,IACA,KAAK5B,MAAL,KAAgB6B,0BADhB,IAEA,KAAKN,QAAL,CAAcxB,KAAd,KAAwB,iBAH1B;EAKD;EAED;AACF;AACA;;;EACiB,IAAX4C,WAAW,GAAY;IACzB,OACE,KAAKvC,EAAL,KAAY,+BAAZ,IACA,KAAKA,EAAL,KAAY,yCAFd;EAID;EAED;AACF;;;EACyB,IAAnBwC,mBAAmB,GAAY;IACjC,OAAO,CAAC,KAAKV,gBAAN,IAA0B,CAAC,KAAKG,SAAhC,IAA6C,CAAC,KAAKF,gBAA1D;EACD;;AAtRgC"}
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,IAA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KG,SAAhC,IAA6C,CAAC,KAAKF,gBAA1D;EACD;;AA7RgC"}
@@ -80,119 +80,127 @@ class ErrorResponse {
80
80
  return this.error.message || this.id;
81
81
  }
82
82
  /**
83
- * Return error title
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
84
92
  */
85
93
 
86
94
 
87
95
  get title() {
88
- return this.error.title || null;
96
+ return this.response.title || null;
89
97
  }
90
98
  /**
91
- * Return error title message
99
+ * Return response error title message
92
100
  */
93
101
 
94
102
 
95
103
  get titleMessage() {
96
- var _this$error$title;
104
+ var _this$response$title;
97
105
 
98
- return ((_this$error$title = this.error.title) === null || _this$error$title === void 0 ? void 0 : _this$error$title.message) || undefined;
106
+ return ((_this$response$title = this.response.title) === null || _this$response$title === void 0 ? void 0 : _this$response$title.message) || undefined;
99
107
  }
100
108
  /**
101
- * Return error title Id
109
+ * Return response error title Id
102
110
  */
103
111
 
104
112
 
105
113
  get titleId() {
106
- var _this$error$title2;
114
+ var _this$response$title2;
107
115
 
108
- return ((_this$error$title2 = this.error.title) === null || _this$error$title2 === void 0 ? void 0 : _this$error$title2.id) || undefined;
116
+ return ((_this$response$title2 = this.response.title) === null || _this$response$title2 === void 0 ? void 0 : _this$response$title2.id) || undefined;
109
117
  }
110
118
  /**
111
- * Return error title properties
119
+ * Return response error title properties
112
120
  */
113
121
 
114
122
 
115
123
  get titleProperties() {
116
- var _this$error$title3;
124
+ var _this$response$title3;
117
125
 
118
- return ((_this$error$title3 = this.error.title) === null || _this$error$title3 === void 0 ? void 0 : _this$error$title3.properties) || null;
126
+ return ((_this$response$title3 = this.response.title) === null || _this$response$title3 === void 0 ? void 0 : _this$response$title3.properties) || null;
119
127
  }
120
128
  /**
121
- * Return error redirect
129
+ * Return response error redirect
122
130
  */
123
131
 
124
132
 
125
133
  get redirect() {
126
- return this.error.redirect || null;
134
+ return this.response.redirect || null;
127
135
  }
128
136
  /**
129
- * Return error redirect text
137
+ * Return response error redirect text
130
138
  */
131
139
 
132
140
 
133
141
  get redirectText() {
134
- var _this$error$redirect;
142
+ var _this$response$redire;
135
143
 
136
- return ((_this$error$redirect = this.error.redirect) === null || _this$error$redirect === void 0 ? void 0 : _this$error$redirect.text) || null;
144
+ return ((_this$response$redire = this.response.redirect) === null || _this$response$redire === void 0 ? void 0 : _this$response$redire.text) || null;
137
145
  }
138
146
  /**
139
- * Return error redirect text id
147
+ * Return response error redirect text id
140
148
  */
141
149
 
142
150
 
143
151
  get redirectTextID() {
144
- var _this$error$redirect2, _this$error$redirect3;
152
+ var _this$response$redire2, _this$response$redire3;
145
153
 
146
- return ((_this$error$redirect2 = this.error.redirect) === null || _this$error$redirect2 === void 0 ? void 0 : (_this$error$redirect3 = _this$error$redirect2.text) === null || _this$error$redirect3 === void 0 ? void 0 : _this$error$redirect3.id) || undefined;
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;
147
155
  }
148
156
  /**
149
- * Return error redirect text properties
157
+ * Return response error redirect text properties
150
158
  */
151
159
 
152
160
 
153
161
  get redirectTextProperties() {
154
- var _this$error$redirect4, _this$error$redirect5;
162
+ var _this$response$redire4, _this$response$redire5;
155
163
 
156
- return ((_this$error$redirect4 = this.error.redirect) === null || _this$error$redirect4 === void 0 ? void 0 : (_this$error$redirect5 = _this$error$redirect4.text) === null || _this$error$redirect5 === void 0 ? void 0 : _this$error$redirect5.properties) || null;
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;
157
165
  }
158
166
  /**
159
- * Return error redirect text message
167
+ * Return response error redirect text message
160
168
  */
161
169
 
162
170
 
163
171
  get redirectMessage() {
164
- var _this$error$redirect6, _this$error$redirect7;
172
+ var _this$response$redire6, _this$response$redire7;
165
173
 
166
- return ((_this$error$redirect6 = this.error.redirect) === null || _this$error$redirect6 === void 0 ? void 0 : (_this$error$redirect7 = _this$error$redirect6.text) === null || _this$error$redirect7 === void 0 ? void 0 : _this$error$redirect7.message) || undefined;
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;
167
175
  }
168
176
  /**
169
- * Return error redirect href
177
+ * Return response error redirect href
170
178
  */
171
179
 
172
180
 
173
181
  get redirectHref() {
174
- var _this$error$redirect8;
182
+ var _this$response$redire8;
175
183
 
176
- if ((_this$error$redirect8 = this.error.redirect) !== null && _this$error$redirect8 !== void 0 && _this$error$redirect8.href) {
177
- return new _Href.default(this.error.redirect.href);
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);
178
186
  }
179
187
 
180
188
  return new _Href.default();
181
189
  }
182
190
  /**
183
- * Return error layouthint
191
+ * Return error response layouthint
184
192
  */
185
193
 
186
194
 
187
195
  get layouthint() {
188
- return new _LayoutHintCollection.default(this.error.layouthint);
196
+ return new _LayoutHintCollection.default(this.response.layouthint);
189
197
  }
190
198
  /**
191
199
  */
192
200
 
193
201
 
194
202
  get response() {
195
- return this.error.response || {};
203
+ return this.error.response.error || {};
196
204
  }
197
205
  /**
198
206
  */
@@ -89,88 +89,95 @@ export default class ErrorResponse {
89
89
  }
90
90
 
91
91
  /**
92
- * Return error title
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
93
100
  */
94
101
  get title(): TitleObject {
95
- return this.error.title || null;
102
+ return this.response.title || null;
96
103
  }
97
104
 
98
105
  /**
99
- * Return error title message
106
+ * Return response error title message
100
107
  */
101
108
  get titleMessage(): string {
102
- return this.error.title?.message || undefined;
109
+ return this.response.title?.message || undefined;
103
110
  }
104
111
 
105
112
  /**
106
- * Return error title Id
113
+ * Return response error title Id
107
114
  */
108
115
  get titleId(): string {
109
- return this.error.title?.id || undefined;
116
+ return this.response.title?.id || undefined;
110
117
  }
111
118
 
112
119
  /**
113
- * Return error title properties
120
+ * Return response error title properties
114
121
  */
115
122
  get titleProperties(): Object {
116
- return this.error.title?.properties || null;
123
+ return this.response.title?.properties || null;
117
124
  }
118
125
 
119
126
  /**
120
- * Return error redirect
127
+ * Return response error redirect
121
128
  */
122
129
  get redirect(): RedirectObject {
123
- return this.error.redirect || null;
130
+ return this.response.redirect || null;
124
131
  }
125
132
  /**
126
- * Return error redirect text
133
+ * Return response error redirect text
127
134
  */
128
135
  get redirectText(): RedirectTextObject {
129
- return this.error.redirect?.text || null;
136
+ return this.response.redirect?.text || null;
130
137
  }
131
138
 
132
139
  /**
133
- * Return error redirect text id
140
+ * Return response error redirect text id
134
141
  */
135
142
  get redirectTextID(): string {
136
- return this.error.redirect?.text?.id || undefined;
143
+ return this.response.redirect?.text?.id || undefined;
137
144
  }
138
145
 
139
146
  /**
140
- * Return error redirect text properties
147
+ * Return response error redirect text properties
141
148
  */
142
149
  get redirectTextProperties(): Object {
143
- return this.error.redirect?.text?.properties || null;
150
+ return this.response.redirect?.text?.properties || null;
144
151
  }
145
152
 
146
153
  /**
147
- * Return error redirect text message
154
+ * Return response error redirect text message
148
155
  */
149
156
  get redirectMessage(): string {
150
- return this.error.redirect?.text?.message || undefined;
157
+ return this.response.redirect?.text?.message || undefined;
151
158
  }
152
159
 
153
160
  /**
154
- * Return error redirect href
161
+ * Return response error redirect href
155
162
  */
156
163
  get redirectHref(): Href {
157
- if (this.error.redirect?.href) {
158
- return new Href(this.error.redirect.href);
164
+ if (this.response.redirect?.href) {
165
+ return new Href(this.response.redirect.href);
159
166
  }
160
167
  return new Href();
161
168
  }
162
169
 
163
170
  /**
164
- * Return error layouthint
171
+ * Return error response layouthint
165
172
  */
166
173
  get layouthint(): LayoutHintCollection {
167
- return new LayoutHintCollection(this.error.layouthint);
174
+ return new LayoutHintCollection(this.response.layouthint);
168
175
  }
169
176
 
170
177
  /**
171
178
  */
172
179
  get response(): Object {
173
- return this.error.response || {};
180
+ return this.error.response.error || {};
174
181
  }
175
182
 
176
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","title","titleMessage","undefined","titleId","titleProperties","properties","redirect","redirectText","text","redirectTextID","redirectTextProperties","redirectMessage","redirectHref","href","Href","layouthint","LayoutHintCollection","response","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 error title\n */\n get title(): TitleObject {\n return this.error.title || null;\n }\n\n /**\n * Return error title message\n */\n get titleMessage(): string {\n return this.error.title?.message || undefined;\n }\n\n /**\n * Return error title Id\n */\n get titleId(): string {\n return this.error.title?.id || undefined;\n }\n\n /**\n * Return error title properties\n */\n get titleProperties(): Object {\n return this.error.title?.properties || null;\n }\n\n /**\n * Return error redirect\n */\n get redirect(): RedirectObject {\n return this.error.redirect || null;\n }\n /**\n * Return error redirect text\n */\n get redirectText(): RedirectTextObject {\n return this.error.redirect?.text || null;\n }\n\n /**\n * Return error redirect text id\n */\n get redirectTextID(): string {\n return this.error.redirect?.text?.id || undefined;\n }\n\n /**\n * Return error redirect text properties\n */\n get redirectTextProperties(): Object {\n return this.error.redirect?.text?.properties || null;\n }\n\n /**\n * Return error redirect text message\n */\n get redirectMessage(): string {\n return this.error.redirect?.text?.message || undefined;\n }\n\n /**\n * Return error redirect href\n */\n get redirectHref(): Href {\n if (this.error.redirect?.href) {\n return new Href(this.error.redirect.href);\n }\n return new Href();\n }\n\n /**\n * Return error layouthint\n */\n get layouthint(): LayoutHintCollection {\n return new LayoutHintCollection(this.error.layouthint);\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;;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,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,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IAAlBuC,kBAAkB,GAAU;IAC9B,OAAO,KAAK9B,UAAL,CAAgBC,QAAhB,GAA2B,IAAIQ,aAAJ,CAAS,KAAKT,UAAL,CAAgBC,QAAzB,CAA3B,GAAgE,IAAvE;EACD;EAED;AACF;AACA;;;EAC2B,IAArB8B,qBAAqB,GAAY;IACnC,MAAMb,0BAA0B,GAAG,GAAnC;IACA,OACE,KAAKD,cAAL,IACA,KAAK9B,MAAL,KAAgB+B,0BADhB,IAEA,KAAKN,QAAL,CAAc1B,KAAd,KAAwB,iBAH1B;EAKD;EAED;AACF;AACA;;;EACiB,IAAX8C,WAAW,GAAY;IACzB,OACE,KAAKzC,EAAL,KAAY,+BAAZ,IACA,KAAKA,EAAL,KAAY,yCAFd;EAID;EAED;AACF;;;EACyB,IAAnB0C,mBAAmB,GAAY;IACjC,OAAO,CAAC,KAAKV,gBAAN,IAA0B,CAAC,KAAKG,SAAhC,IAA6C,CAAC,KAAKF,gBAA1D;EACD;;AAtRgC"}
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,GAAmBF,UAAnB;EACD;EAED;AACF;;;EACgB,IAAVA,UAAU,CAACG,GAAD,EAAc;IAC1B,KAAKD,WAAL,G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/ui",
3
- "version": "1.21.1",
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",
@@ -89,88 +89,95 @@ export default class ErrorResponse {
89
89
  }
90
90
 
91
91
  /**
92
- * Return error title
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
93
100
  */
94
101
  get title(): TitleObject {
95
- return this.error.title || null;
102
+ return this.response.title || null;
96
103
  }
97
104
 
98
105
  /**
99
- * Return error title message
106
+ * Return response error title message
100
107
  */
101
108
  get titleMessage(): string {
102
- return this.error.title?.message || undefined;
109
+ return this.response.title?.message || undefined;
103
110
  }
104
111
 
105
112
  /**
106
- * Return error title Id
113
+ * Return response error title Id
107
114
  */
108
115
  get titleId(): string {
109
- return this.error.title?.id || undefined;
116
+ return this.response.title?.id || undefined;
110
117
  }
111
118
 
112
119
  /**
113
- * Return error title properties
120
+ * Return response error title properties
114
121
  */
115
122
  get titleProperties(): Object {
116
- return this.error.title?.properties || null;
123
+ return this.response.title?.properties || null;
117
124
  }
118
125
 
119
126
  /**
120
- * Return error redirect
127
+ * Return response error redirect
121
128
  */
122
129
  get redirect(): RedirectObject {
123
- return this.error.redirect || null;
130
+ return this.response.redirect || null;
124
131
  }
125
132
  /**
126
- * Return error redirect text
133
+ * Return response error redirect text
127
134
  */
128
135
  get redirectText(): RedirectTextObject {
129
- return this.error.redirect?.text || null;
136
+ return this.response.redirect?.text || null;
130
137
  }
131
138
 
132
139
  /**
133
- * Return error redirect text id
140
+ * Return response error redirect text id
134
141
  */
135
142
  get redirectTextID(): string {
136
- return this.error.redirect?.text?.id || undefined;
143
+ return this.response.redirect?.text?.id || undefined;
137
144
  }
138
145
 
139
146
  /**
140
- * Return error redirect text properties
147
+ * Return response error redirect text properties
141
148
  */
142
149
  get redirectTextProperties(): Object {
143
- return this.error.redirect?.text?.properties || null;
150
+ return this.response.redirect?.text?.properties || null;
144
151
  }
145
152
 
146
153
  /**
147
- * Return error redirect text message
154
+ * Return response error redirect text message
148
155
  */
149
156
  get redirectMessage(): string {
150
- return this.error.redirect?.text?.message || undefined;
157
+ return this.response.redirect?.text?.message || undefined;
151
158
  }
152
159
 
153
160
  /**
154
- * Return error redirect href
161
+ * Return response error redirect href
155
162
  */
156
163
  get redirectHref(): Href {
157
- if (this.error.redirect?.href) {
158
- return new Href(this.error.redirect.href);
164
+ if (this.response.redirect?.href) {
165
+ return new Href(this.response.redirect.href);
159
166
  }
160
167
  return new Href();
161
168
  }
162
169
 
163
170
  /**
164
- * Return error layouthint
171
+ * Return error response layouthint
165
172
  */
166
173
  get layouthint(): LayoutHintCollection {
167
- return new LayoutHintCollection(this.error.layouthint);
174
+ return new LayoutHintCollection(this.response.layouthint);
168
175
  }
169
176
 
170
177
  /**
171
178
  */
172
179
  get response(): Object {
173
- return this.error.response || {};
180
+ return this.error.response.error || {};
174
181
  }
175
182
 
176
183
  /**