@beinformed/ui 1.20.10 → 1.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/esm/models/error/ErrorModel.js +12 -1
- package/esm/models/error/ErrorModel.js.map +1 -1
- package/esm/models/error/ErrorResponse.js +111 -0
- package/esm/models/error/ErrorResponse.js.map +1 -1
- package/esm/models/types.js.map +1 -1
- package/lib/models/error/ErrorModel.js +11 -0
- package/lib/models/error/ErrorModel.js.flow +9 -1
- package/lib/models/error/ErrorModel.js.map +1 -1
- package/lib/models/error/ErrorResponse.js +110 -0
- package/lib/models/error/ErrorResponse.js.flow +102 -0
- package/lib/models/error/ErrorResponse.js.map +1 -1
- package/lib/models/types.js.flow +1 -0
- package/lib/models/types.js.map +1 -1
- package/package.json +1 -1
- package/src/models/error/ErrorModel.js +9 -1
- package/src/models/error/ErrorResponse.js +102 -0
- package/src/models/types.js +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [1.21.0](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.20.10...v1.21.0) (2022-08-10)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **error:** handle new error response messages ([4373b18](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/4373b18675b2c74119b37734ce106239252c0883))
|
|
11
|
+
|
|
5
12
|
### [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
13
|
|
|
7
14
|
### 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
|
|
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,GAA0B;IACtC,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,6 +72,114 @@ export default class ErrorResponse {
|
|
|
69
72
|
get message() {
|
|
70
73
|
return this.error.message || this.id;
|
|
71
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* Return error title
|
|
77
|
+
*/
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
get title() {
|
|
81
|
+
return this.error.title || null;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Return error title message
|
|
85
|
+
*/
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
get titleMessage() {
|
|
89
|
+
var _this$error$title;
|
|
90
|
+
|
|
91
|
+
return ((_this$error$title = this.error.title) === null || _this$error$title === void 0 ? void 0 : _this$error$title.message) || undefined;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Return error title Id
|
|
95
|
+
*/
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
get titleId() {
|
|
99
|
+
var _this$error$title2;
|
|
100
|
+
|
|
101
|
+
return ((_this$error$title2 = this.error.title) === null || _this$error$title2 === void 0 ? void 0 : _this$error$title2.id) || undefined;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Return error title properties
|
|
105
|
+
*/
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
get titleProperties() {
|
|
109
|
+
var _this$error$title3;
|
|
110
|
+
|
|
111
|
+
return ((_this$error$title3 = this.error.title) === null || _this$error$title3 === void 0 ? void 0 : _this$error$title3.properties) || null;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Return error redirect
|
|
115
|
+
*/
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
get redirect() {
|
|
119
|
+
return this.error.redirect || null;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Return error redirect text
|
|
123
|
+
*/
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
get redirectText() {
|
|
127
|
+
var _this$error$redirect;
|
|
128
|
+
|
|
129
|
+
return ((_this$error$redirect = this.error.redirect) === null || _this$error$redirect === void 0 ? void 0 : _this$error$redirect.text) || null;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Return error redirect text id
|
|
133
|
+
*/
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
get redirectTextID() {
|
|
137
|
+
var _this$error$redirect2, _this$error$redirect3;
|
|
138
|
+
|
|
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;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Return error redirect text properties
|
|
143
|
+
*/
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
get redirectTextProperties() {
|
|
147
|
+
var _this$error$redirect4, _this$error$redirect5;
|
|
148
|
+
|
|
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;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Return error redirect text message
|
|
153
|
+
*/
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
get redirectMessage() {
|
|
157
|
+
var _this$error$redirect6, _this$error$redirect7;
|
|
158
|
+
|
|
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;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Return error redirect href
|
|
163
|
+
*/
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
get redirectHref() {
|
|
167
|
+
var _this$error$redirect8;
|
|
168
|
+
|
|
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);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
return new Href();
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Return error layouthint
|
|
177
|
+
*/
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
get layouthint() {
|
|
181
|
+
return new LayoutHintCollection(this.error.layouthint);
|
|
182
|
+
}
|
|
72
183
|
/**
|
|
73
184
|
*/
|
|
74
185
|
|
|
@@ -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;;IA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BAAZ,IACA,KAAKA,EAAL,KAAY,yCAFd;EAID;EAED;AACF;;;EACyB,IAAnB2B,mBAAmB,GAAY;IACjC,OAAO,CAAC,KAAKX,gBAAN,IAA0B,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","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,GAEHD,gBAFJ;EAGD;EAED;AACF;AACA;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;;;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"}
|
package/esm/models/types.js.map
CHANGED
|
@@ -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
|
|
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,GAA0B;IACtC,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,6 +79,114 @@ class ErrorResponse {
|
|
|
77
79
|
get message() {
|
|
78
80
|
return this.error.message || this.id;
|
|
79
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* Return error title
|
|
84
|
+
*/
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
get title() {
|
|
88
|
+
return this.error.title || null;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Return error title message
|
|
92
|
+
*/
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
get titleMessage() {
|
|
96
|
+
var _this$error$title;
|
|
97
|
+
|
|
98
|
+
return ((_this$error$title = this.error.title) === null || _this$error$title === void 0 ? void 0 : _this$error$title.message) || undefined;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Return error title Id
|
|
102
|
+
*/
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
get titleId() {
|
|
106
|
+
var _this$error$title2;
|
|
107
|
+
|
|
108
|
+
return ((_this$error$title2 = this.error.title) === null || _this$error$title2 === void 0 ? void 0 : _this$error$title2.id) || undefined;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Return error title properties
|
|
112
|
+
*/
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
get titleProperties() {
|
|
116
|
+
var _this$error$title3;
|
|
117
|
+
|
|
118
|
+
return ((_this$error$title3 = this.error.title) === null || _this$error$title3 === void 0 ? void 0 : _this$error$title3.properties) || null;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Return error redirect
|
|
122
|
+
*/
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
get redirect() {
|
|
126
|
+
return this.error.redirect || null;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Return error redirect text
|
|
130
|
+
*/
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
get redirectText() {
|
|
134
|
+
var _this$error$redirect;
|
|
135
|
+
|
|
136
|
+
return ((_this$error$redirect = this.error.redirect) === null || _this$error$redirect === void 0 ? void 0 : _this$error$redirect.text) || null;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Return error redirect text id
|
|
140
|
+
*/
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
get redirectTextID() {
|
|
144
|
+
var _this$error$redirect2, _this$error$redirect3;
|
|
145
|
+
|
|
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;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Return error redirect text properties
|
|
150
|
+
*/
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
get redirectTextProperties() {
|
|
154
|
+
var _this$error$redirect4, _this$error$redirect5;
|
|
155
|
+
|
|
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;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Return error redirect text message
|
|
160
|
+
*/
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
get redirectMessage() {
|
|
164
|
+
var _this$error$redirect6, _this$error$redirect7;
|
|
165
|
+
|
|
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;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Return error redirect href
|
|
170
|
+
*/
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
get redirectHref() {
|
|
174
|
+
var _this$error$redirect8;
|
|
175
|
+
|
|
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);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
return new _Href.default();
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Return error layouthint
|
|
184
|
+
*/
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
get layouthint() {
|
|
188
|
+
return new _LayoutHintCollection.default(this.error.layouthint);
|
|
189
|
+
}
|
|
80
190
|
/**
|
|
81
191
|
*/
|
|
82
192
|
|
|
@@ -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,6 +88,85 @@ export default class ErrorResponse {
|
|
|
65
88
|
return this.error.message || this.id;
|
|
66
89
|
}
|
|
67
90
|
|
|
91
|
+
/**
|
|
92
|
+
* Return error title
|
|
93
|
+
*/
|
|
94
|
+
get title(): TitleObject {
|
|
95
|
+
return this.error.title || null;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Return error title message
|
|
100
|
+
*/
|
|
101
|
+
get titleMessage(): string {
|
|
102
|
+
return this.error.title?.message || undefined;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Return error title Id
|
|
107
|
+
*/
|
|
108
|
+
get titleId(): string {
|
|
109
|
+
return this.error.title?.id || undefined;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Return error title properties
|
|
114
|
+
*/
|
|
115
|
+
get titleProperties(): Object {
|
|
116
|
+
return this.error.title?.properties || null;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Return error redirect
|
|
121
|
+
*/
|
|
122
|
+
get redirect(): RedirectObject {
|
|
123
|
+
return this.error.redirect || null;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Return error redirect text
|
|
127
|
+
*/
|
|
128
|
+
get redirectText(): RedirectTextObject {
|
|
129
|
+
return this.error.redirect?.text || null;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Return error redirect text id
|
|
134
|
+
*/
|
|
135
|
+
get redirectTextID(): string {
|
|
136
|
+
return this.error.redirect?.text?.id || undefined;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Return error redirect text properties
|
|
141
|
+
*/
|
|
142
|
+
get redirectTextProperties(): Object {
|
|
143
|
+
return this.error.redirect?.text?.properties || null;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Return error redirect text message
|
|
148
|
+
*/
|
|
149
|
+
get redirectMessage(): string {
|
|
150
|
+
return this.error.redirect?.text?.message || undefined;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Return error redirect href
|
|
155
|
+
*/
|
|
156
|
+
get redirectHref(): Href {
|
|
157
|
+
if (this.error.redirect?.href) {
|
|
158
|
+
return new Href(this.error.redirect.href);
|
|
159
|
+
}
|
|
160
|
+
return new Href();
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Return error layouthint
|
|
165
|
+
*/
|
|
166
|
+
get layouthint(): LayoutHintCollection {
|
|
167
|
+
return new LayoutHintCollection(this.error.layouthint);
|
|
168
|
+
}
|
|
169
|
+
|
|
68
170
|
/**
|
|
69
171
|
*/
|
|
70
172
|
get response(): Object {
|
|
@@ -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;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,CAD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AKD,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","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,CAAW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AED;AACF;AACA;AACA;;;EAC8B,IAAxBsC,wBAAwB,GAAY;IACtC,OAAO,KAAKtC,EAAL,KAAY,8BAAnB;EACD;EAED;AACF;AACA;;;EACwB,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"}
|
package/lib/models/types.js.flow
CHANGED
package/lib/models/types.js.map
CHANGED
|
@@ -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,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,6 +88,85 @@ export default class ErrorResponse {
|
|
|
65
88
|
return this.error.message || this.id;
|
|
66
89
|
}
|
|
67
90
|
|
|
91
|
+
/**
|
|
92
|
+
* Return error title
|
|
93
|
+
*/
|
|
94
|
+
get title(): TitleObject {
|
|
95
|
+
return this.error.title || null;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Return error title message
|
|
100
|
+
*/
|
|
101
|
+
get titleMessage(): string {
|
|
102
|
+
return this.error.title?.message || undefined;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Return error title Id
|
|
107
|
+
*/
|
|
108
|
+
get titleId(): string {
|
|
109
|
+
return this.error.title?.id || undefined;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Return error title properties
|
|
114
|
+
*/
|
|
115
|
+
get titleProperties(): Object {
|
|
116
|
+
return this.error.title?.properties || null;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Return error redirect
|
|
121
|
+
*/
|
|
122
|
+
get redirect(): RedirectObject {
|
|
123
|
+
return this.error.redirect || null;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Return error redirect text
|
|
127
|
+
*/
|
|
128
|
+
get redirectText(): RedirectTextObject {
|
|
129
|
+
return this.error.redirect?.text || null;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Return error redirect text id
|
|
134
|
+
*/
|
|
135
|
+
get redirectTextID(): string {
|
|
136
|
+
return this.error.redirect?.text?.id || undefined;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Return error redirect text properties
|
|
141
|
+
*/
|
|
142
|
+
get redirectTextProperties(): Object {
|
|
143
|
+
return this.error.redirect?.text?.properties || null;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Return error redirect text message
|
|
148
|
+
*/
|
|
149
|
+
get redirectMessage(): string {
|
|
150
|
+
return this.error.redirect?.text?.message || undefined;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Return error redirect href
|
|
155
|
+
*/
|
|
156
|
+
get redirectHref(): Href {
|
|
157
|
+
if (this.error.redirect?.href) {
|
|
158
|
+
return new Href(this.error.redirect.href);
|
|
159
|
+
}
|
|
160
|
+
return new Href();
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Return error layouthint
|
|
165
|
+
*/
|
|
166
|
+
get layouthint(): LayoutHintCollection {
|
|
167
|
+
return new LayoutHintCollection(this.error.layouthint);
|
|
168
|
+
}
|
|
169
|
+
|
|
68
170
|
/**
|
|
69
171
|
*/
|
|
70
172
|
get response(): Object {
|