@singularsystems/neo-core 0.10.64 → 0.10.65

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.
Files changed (90) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/ApiClient/ReadApiClient.d.ts +1 -1
  3. package/dist/ApiClient/ReadApiClient.js +1 -1
  4. package/dist/ApiClient/UpdateableApiClient.js +4 -4
  5. package/dist/AppServices/Config/ConfigModel.js +1 -1
  6. package/dist/AppServices/Config/ConfigService.js +4 -4
  7. package/dist/AppServices/ServiceIdentifier.js +1 -1
  8. package/dist/Components/AnimationHelper.js +1 -1
  9. package/dist/Components/BootstrapTypes.js +1 -0
  10. package/dist/Components/ButtonOptions.js +1 -0
  11. package/dist/Components/ContextMenu/ContextMenu.js +1 -0
  12. package/dist/Components/DatePicker/DatePicker.js +3 -5
  13. package/dist/Components/ErrorHandler.d.ts +13 -9
  14. package/dist/Components/ErrorHandler.js +134 -62
  15. package/dist/Components/FileManager/FileManager.js +7 -7
  16. package/dist/Components/FileManager/FileUploadBatch.js +3 -3
  17. package/dist/Components/FileManager/IFileManagerOptions.js +1 -0
  18. package/dist/Components/FormOptions.js +1 -0
  19. package/dist/Components/ICollapsableOptions.js +1 -0
  20. package/dist/Components/Modal/ModalHelper.js +4 -4
  21. package/dist/Components/Modal/ModalOptions.js +1 -0
  22. package/dist/Components/Notifications/INotificationHelper.js +1 -0
  23. package/dist/Components/Notifications/NotificationHelper.js +1 -1
  24. package/dist/Components/TaskRunner/ProgressState.js +1 -1
  25. package/dist/Components/TaskRunner/TaskRunner.js +36 -27
  26. package/dist/Components/TooltipOptions.js +1 -0
  27. package/dist/Components/index.js +1 -0
  28. package/dist/ConnectionManager.js +2 -2
  29. package/dist/Data/ApiDataSource.js +2 -2
  30. package/dist/Data/AsyncDataSource.js +1 -1
  31. package/dist/Data/DataCacheEntry.js +3 -3
  32. package/dist/Data/DataView.js +7 -7
  33. package/dist/Data/Deserialiser.js +4 -5
  34. package/dist/Data/Paging/PageManager.js +9 -9
  35. package/dist/Data/Serialiser.js +1 -1
  36. package/dist/Data/StaticDataSource.js +1 -1
  37. package/dist/Data/WindowedDataView.js +1 -1
  38. package/dist/Dates/DateUtils.js +3 -4
  39. package/dist/Dates/TimeSpan.js +4 -4
  40. package/dist/Extensions.js +5 -5
  41. package/dist/Globals.js +5 -5
  42. package/dist/JsonSchema/JsonSchemaTypes.js +1 -0
  43. package/dist/JsonSchema/TypeCache.js +2 -2
  44. package/dist/JsonSchema/TypeMetadata.js +4 -4
  45. package/dist/Localisation/ILocalisationService.js +1 -0
  46. package/dist/Localisation/index.js +1 -0
  47. package/dist/Model/BaseModels/UserEvent.js +1 -1
  48. package/dist/Model/Decorators.d.ts +1 -1
  49. package/dist/Model/Decorators.js +1 -1
  50. package/dist/Model/IAutoRunner.js +1 -0
  51. package/dist/Model/IModelBase.js +1 -0
  52. package/dist/Model/IModelCreatorBase.js +1 -0
  53. package/dist/Model/List.js +5 -5
  54. package/dist/Model/ModelBase.js +4 -4
  55. package/dist/Model/ModelCreatorBase.js +1 -1
  56. package/dist/Model/ModelGraphTraverser.js +1 -1
  57. package/dist/Model/NeoTypeInfo.js +11 -12
  58. package/dist/Model/ObservableValue.js +1 -1
  59. package/dist/Model/PropertyInfo.js +8 -8
  60. package/dist/Model/PropertyInstance.js +8 -8
  61. package/dist/Routing/IMenuItemProvider.js +1 -0
  62. package/dist/Routing/IMenuRoute.js +1 -0
  63. package/dist/Routing/INavigationHelper.js +1 -0
  64. package/dist/Routing/IRoute.js +1 -0
  65. package/dist/Routing/IRouteSecurityService.js +1 -0
  66. package/dist/Security/IAuthenticationService.js +1 -0
  67. package/dist/Security/IAuthorisationService.js +1 -0
  68. package/dist/Security/ILoginErrorHandler.js +1 -0
  69. package/dist/Security/ISecurityService.js +1 -0
  70. package/dist/Security/IUser.js +1 -0
  71. package/dist/Security/IUserRole.js +1 -0
  72. package/dist/Security/LoginErrorHandler.js +1 -1
  73. package/dist/Security/Oidc/OidcAuthService.js +2 -2
  74. package/dist/Security/Oidc/OidcTypes.js +1 -0
  75. package/dist/Security/Oidc/OidcUser.js +3 -3
  76. package/dist/Security/SecurityService.js +2 -2
  77. package/dist/Security/User.js +2 -2
  78. package/dist/SignalR/HubBase.js +5 -5
  79. package/dist/StringUtils.js +1 -1
  80. package/dist/Utils.js +7 -7
  81. package/dist/Validation/DisplayHelper.js +2 -2
  82. package/dist/Validation/RuleContext.js +2 -3
  83. package/dist/Validation/ValidationHelpers.js +1 -1
  84. package/dist/Validation/ValidationState.js +2 -2
  85. package/dist/Validation/Validators/IModelValidator.js +1 -0
  86. package/dist/Validation/Validators/ModelValidator.js +2 -2
  87. package/dist/Validation/Validators/PropertyValidator.js +2 -2
  88. package/dist/Validation/Validators/RuleValidator.js +2 -2
  89. package/dist/Views/IViewBase.js +1 -0
  90. package/package.json +2 -2
package/CHANGELOG.md ADDED
@@ -0,0 +1,15 @@
1
+
2
+
3
+ # Breaking changes
4
+
5
+ ## 0.10.65 (6 March 2023)
6
+
7
+ * `IErrorHandler` now requires the return type to be `Promise<IErrorDisplay>` instead of `IErrorDisplay`.
8
+ * Most of the protected methods in `ErrorHandler` have been changed to `async`.
9
+ * These changes were required in order to be able to read errors from axios blob responses.
10
+
11
+ # Change Log
12
+
13
+ ## 0.10.65 (6 March 2023)
14
+
15
+ * Fixed error handler not parsing axios responses when response type is `blob`.
@@ -12,5 +12,5 @@ export declare class ReadApiClient<TModel, TKey extends string | number> extends
12
12
  /** Gets a list of entities */
13
13
  get(): AxiosPromise<PlainObject<TModel>[]>;
14
14
  /** Gets a single entity using the provided id. */
15
- getById(id: TKey): AxiosPromise<{ [P_1 in keyof Pick<TModel, Exclude<keyof TModel, "meta" | "update" | "isSuspended" | "validator" | "markOld" | "toJSObject" | "toQueryObject" | "toQueryObjectAuto" | "onAnyPropertyChanged" | "getIcon" | "set" | "entityIdentifier" | "isSelfDirty" | "isNew" | "isSelfValid" | "isValid" | "isDirty" | "readyToSave"> & { [P in keyof TModel]: TModel[P] extends Function ? never : P; }[keyof TModel]>]: Pick<TModel, Exclude<keyof TModel, "meta" | "update" | "isSuspended" | "validator" | "markOld" | "toJSObject" | "toQueryObject" | "toQueryObjectAuto" | "onAnyPropertyChanged" | "getIcon" | "set" | "entityIdentifier" | "isSelfDirty" | "isNew" | "isSelfValid" | "isValid" | "isDirty" | "readyToSave"> & { [P in keyof TModel]: TModel[P] extends Function ? never : P; }[keyof TModel]>[P_1] extends import("..").List<infer I> ? I[] : Pick<TModel, Exclude<keyof TModel, "meta" | "update" | "isSuspended" | "validator" | "markOld" | "toJSObject" | "toQueryObject" | "toQueryObjectAuto" | "onAnyPropertyChanged" | "getIcon" | "set" | "entityIdentifier" | "isSelfDirty" | "isNew" | "isSelfValid" | "isValid" | "isDirty" | "readyToSave"> & { [P in keyof TModel]: TModel[P] extends Function ? never : P; }[keyof TModel]>[P_1]; }>;
15
+ getById(id: TKey): AxiosPromise<{ [P_2 in Exclude<keyof TModel, keyof import("../Model/IModelBase").IModelBase> & { [P_1 in keyof TModel]: TModel[P_1] extends Function ? never : P_1; }[keyof TModel]]: TModel[P_2]; } extends infer T ? { [P in keyof T]: { [P_2 in Exclude<keyof TModel, keyof import("../Model/IModelBase").IModelBase> & { [P_1 in keyof TModel]: TModel[P_1] extends Function ? never : P_1; }[keyof TModel]]: TModel[P_2]; }[P] extends import("..").List<infer I> ? I[] : { [P_2 in Exclude<keyof TModel, keyof import("../Model/IModelBase").IModelBase> & { [P_1 in keyof TModel]: TModel[P_1] extends Function ? never : P_1; }[keyof TModel]]: TModel[P_2]; }[P]; } : never>;
16
16
  }
@@ -17,7 +17,7 @@ var ReadApiClient = /** @class */ (function (_super) {
17
17
  };
18
18
  /** Gets a single entity using the provided id. */
19
19
  ReadApiClient.prototype.getById = function (id) {
20
- return this.axios.get(this.apiPath + "/" + id);
20
+ return this.axios.get("".concat(this.apiPath, "/").concat(id));
21
21
  };
22
22
  return ReadApiClient;
23
23
  }(ApiClientBase));
@@ -10,7 +10,7 @@ var UpdateableApiClient = /** @class */ (function (_super) {
10
10
  }
11
11
  /** Deletes an entity using the provided id. */
12
12
  UpdateableApiClient.prototype.delete = function (id) {
13
- return this.axios.delete(this.apiPath + "/" + id);
13
+ return this.axios.delete("".concat(this.apiPath, "/").concat(id));
14
14
  };
15
15
  /** Inserts the entity. */
16
16
  UpdateableApiClient.prototype.post = function (model) {
@@ -18,15 +18,15 @@ var UpdateableApiClient = /** @class */ (function (_super) {
18
18
  };
19
19
  /** Updates the entity */
20
20
  UpdateableApiClient.prototype.put = function (id, model) {
21
- return this.axios.put(this.apiPath + "/" + id, model);
21
+ return this.axios.put("".concat(this.apiPath, "/").concat(id), model);
22
22
  };
23
23
  /** Saves the entity, using it's tracking state to determine the operation. */
24
24
  UpdateableApiClient.prototype.save = function (model) {
25
- return this.axios.post(this.apiPath + "/Save", model);
25
+ return this.axios.post("".concat(this.apiPath, "/Save"), model);
26
26
  };
27
27
  /** Saves a list of entities, using each entities tracking state to determine the operation. */
28
28
  UpdateableApiClient.prototype.saveList = function (model) {
29
- return this.axios.post(this.apiPath + "/SaveList", model);
29
+ return this.axios.post("".concat(this.apiPath, "/SaveList"), model);
30
30
  };
31
31
  return UpdateableApiClient;
32
32
  }(ReadApiClient));
@@ -7,7 +7,7 @@ var ConfigModel = /** @class */ (function () {
7
7
  get: function () {
8
8
  return this.isDevelopment || this.isTest;
9
9
  },
10
- enumerable: true,
10
+ enumerable: false,
11
11
  configurable: true
12
12
  });
13
13
  ConfigModel.prototype.initialise = function () {
@@ -14,12 +14,12 @@ var ConfigService = /** @class */ (function () {
14
14
  case 0:
15
15
  baseTag = document.getElementsByTagName('base')[0];
16
16
  baseUrl = baseTag ? baseTag.getAttribute("href") || "" : "";
17
- path = (path !== null && path !== void 0 ? path : baseUrl + "/config.json");
17
+ path = path !== null && path !== void 0 ? path : "".concat(baseUrl, "/config.json");
18
18
  _a.label = 1;
19
19
  case 1:
20
20
  _a.trys.push([1, 3, , 4]);
21
21
  timestamp = new Date().getTime();
22
- return [4 /*yield*/, Axios.get(path + "?" + timestamp)];
22
+ return [4 /*yield*/, Axios.get("".concat(path, "?").concat(timestamp))];
23
23
  case 2:
24
24
  response = _a.sent();
25
25
  // The raw parsed json objects properties are copied into the config model.
@@ -30,7 +30,7 @@ var ConfigService = /** @class */ (function () {
30
30
  return [2 /*return*/, this.config];
31
31
  case 3:
32
32
  error_1 = _a.sent();
33
- throw new Error("ConfigService - Error loading configuration: " + error_1);
33
+ throw new Error("ConfigService - Error loading configuration: ".concat(error_1));
34
34
  case 4: return [2 /*return*/];
35
35
  }
36
36
  });
@@ -40,7 +40,7 @@ var ConfigService = /** @class */ (function () {
40
40
  get: function () {
41
41
  return process.env.NODE_ENV === "development";
42
42
  },
43
- enumerable: true,
43
+ enumerable: false,
44
44
  configurable: true
45
45
  });
46
46
  ConfigService = __decorate([
@@ -11,7 +11,7 @@ var ServiceIdentifier = /** @class */ (function () {
11
11
  if (symbol === void 0) { symbol = Symbol(name); }
12
12
  this.symbol = symbol;
13
13
  if (ServiceIdentifier.typeNames.has(name)) {
14
- console.error("Warning: Service type " + name + " has already been registered!");
14
+ console.error("Warning: Service type ".concat(name, " has already been registered!"));
15
15
  }
16
16
  else {
17
17
  ServiceIdentifier.typeNames.add(name);
@@ -117,7 +117,7 @@ var CollapseAnimationHelper = /** @class */ (function () {
117
117
  this.afterTransitionedDelegate = this.afterTransitioned.bind(this);
118
118
  element.addEventListener("transitionend", this.afterTransitionedDelegate);
119
119
  this.afterTransitioned();
120
- this.defaultOverflow = (_a = window.getComputedStyle(element).overflowY, (_a !== null && _a !== void 0 ? _a : "visible"));
120
+ this.defaultOverflow = (_a = window.getComputedStyle(element).overflowY) !== null && _a !== void 0 ? _a : "visible";
121
121
  }
122
122
  /** Restores the element to its normal height. */
123
123
  CollapseAnimationHelper.prototype.restore = function (force) {
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -179,7 +179,6 @@ var DatePicker = /** @class */ (function () {
179
179
  * @param options New options.
180
180
  */
181
181
  DatePicker.prototype.update = function (options, bindProperty, isReadOnly) {
182
- var _a, _b;
183
182
  if (bindProperty && bindProperty !== this.bindProperty) {
184
183
  this.bindProperty = bindProperty;
185
184
  }
@@ -188,8 +187,8 @@ var DatePicker = /** @class */ (function () {
188
187
  }
189
188
  this.isReadOnly = isReadOnly;
190
189
  this.today = DateUtils.today();
191
- if (this.currentBindValue !== ((_a = bindProperty) === null || _a === void 0 ? void 0 : _a.value)) {
192
- this.currentBindValue = (_b = bindProperty) === null || _b === void 0 ? void 0 : _b.value;
190
+ if (this.currentBindValue !== (bindProperty === null || bindProperty === void 0 ? void 0 : bindProperty.value)) {
191
+ this.currentBindValue = bindProperty === null || bindProperty === void 0 ? void 0 : bindProperty.value;
193
192
  this.resetCurrentViewDate();
194
193
  if (this.options.alwaysShow) {
195
194
  if (!this.suspendLayout) {
@@ -397,14 +396,13 @@ var DatePicker = /** @class */ (function () {
397
396
  cellContent.innerText = innerText;
398
397
  };
399
398
  DatePicker.prototype.contentClick = function (e) {
400
- var _a;
401
399
  e.preventDefault();
402
400
  if (e.target) {
403
401
  var element = e.target;
404
402
  if (!element.dataset["date"]) {
405
403
  element = element.parentElement;
406
404
  }
407
- var dateString = (_a = element) === null || _a === void 0 ? void 0 : _a.dataset["date"];
405
+ var dateString = element === null || element === void 0 ? void 0 : element.dataset["date"];
408
406
  if (dateString) {
409
407
  if (this.currentViewType == ViewType.Days) {
410
408
  this.dayClicked(dateString);
@@ -21,7 +21,7 @@ export interface IErrorProperty {
21
21
  }
22
22
  export interface IErrorHandler {
23
23
  showError(error: any, displayType: ErrorDisplayType): void;
24
- parseError(error: any): IErrorDisplay;
24
+ parseError(error: any): Promise<IErrorDisplay>;
25
25
  }
26
26
  export declare enum ErrorDisplayType {
27
27
  /** Show the error text in a modal. */
@@ -34,20 +34,24 @@ export declare enum ErrorDisplayType {
34
34
  export declare class ErrorHandler implements IErrorHandler {
35
35
  private notifications;
36
36
  constructor(notifications: INotificationHelper);
37
- showError(error: any, displayType: ErrorDisplayType): void;
38
- parseError(error: any): IErrorDisplay;
39
- protected getAxiosError(error: AxiosError, response?: AxiosResponse): IErrorDisplay;
40
- protected get400Error(error: AxiosError): IErrorDisplay;
41
- protected get401Error(error: AxiosError): IErrorDisplay;
42
- protected get403Error(error: AxiosError): IErrorDisplay;
43
- protected get409Error(error: AxiosError): IErrorDisplay;
37
+ showError(error: any, displayType: ErrorDisplayType): Promise<void>;
38
+ parseError(error: any): Promise<IErrorDisplay>;
39
+ protected getAxiosError(error: AxiosError, response?: AxiosResponse): Promise<IErrorDisplay>;
40
+ protected get400Error(error: AxiosError): Promise<IErrorDisplay>;
41
+ protected get401Error(error: AxiosError): Promise<IErrorDisplay>;
42
+ protected get403Error(error: AxiosError): Promise<IErrorDisplay>;
43
+ protected get409Error(error: AxiosError): Promise<IErrorDisplay>;
44
44
  /**
45
45
  * Parses an axios response into an IErrorDisplay object.
46
46
  * @param header Header to include in result.
47
47
  * @param body Body to include if the responses title is missing.
48
48
  * @param error Axios error.
49
49
  */
50
- parseAxiosError(header: string, body: string, error: AxiosError): IErrorDisplay;
50
+ parseAxiosError(header: string, body: string, error: AxiosError): Promise<IErrorDisplay>;
51
+ /**
52
+ * Checks if the error data is a blob object, and reads from it if that is the case.
53
+ */
54
+ protected ensureAxiosErrorData(responseData: any): Promise<any>;
51
55
  protected getGeneralError(error: any): IErrorDisplay;
52
56
  protected displayError(displayType: ErrorDisplayType, error: any, errorDisplay: IErrorDisplay): void;
53
57
  protected displayModal(error: any, errorDisplay: IErrorDisplay): void;
@@ -1,4 +1,4 @@
1
- import { __decorate, __metadata, __param } from "tslib";
1
+ import { __awaiter, __decorate, __generator, __metadata, __param } from "tslib";
2
2
  import { injectable, inject } from 'inversify';
3
3
  import { ModalUtils } from './Modal/ModalUtils';
4
4
  import NeoTypes from '../AppServices/NeoTypes';
@@ -16,45 +16,82 @@ var ErrorHandler = /** @class */ (function () {
16
16
  this.notifications = notifications;
17
17
  }
18
18
  ErrorHandler.prototype.showError = function (error, displayType) {
19
- if (displayType !== ErrorDisplayType.ThrowError) {
20
- this.displayError(displayType, error, this.parseError(error));
21
- }
19
+ return __awaiter(this, void 0, void 0, function () {
20
+ var _a, _b;
21
+ return __generator(this, function (_c) {
22
+ switch (_c.label) {
23
+ case 0:
24
+ if (!(displayType !== ErrorDisplayType.ThrowError)) return [3 /*break*/, 2];
25
+ _a = this.displayError;
26
+ _b = [displayType, error];
27
+ return [4 /*yield*/, this.parseError(error)];
28
+ case 1:
29
+ _a.apply(this, _b.concat([_c.sent()]));
30
+ _c.label = 2;
31
+ case 2: return [2 /*return*/];
32
+ }
33
+ });
34
+ });
22
35
  };
23
36
  ErrorHandler.prototype.parseError = function (error) {
24
- if (error.isAxiosError) {
25
- return this.getAxiosError(error, error.response);
26
- }
27
- else {
28
- return this.getGeneralError(error);
29
- }
37
+ return __awaiter(this, void 0, void 0, function () {
38
+ return __generator(this, function (_a) {
39
+ switch (_a.label) {
40
+ case 0:
41
+ if (!error.isAxiosError) return [3 /*break*/, 2];
42
+ return [4 /*yield*/, this.getAxiosError(error, error.response)];
43
+ case 1: return [2 /*return*/, _a.sent()];
44
+ case 2: return [2 /*return*/, this.getGeneralError(error)];
45
+ }
46
+ });
47
+ });
30
48
  };
31
49
  ErrorHandler.prototype.getAxiosError = function (error, response) {
32
- var errorDisplay;
33
- if (response) {
34
- switch (response.status) {
35
- case 400:
36
- errorDisplay = this.get400Error(error);
37
- break;
38
- case 401:
39
- errorDisplay = this.get401Error(error);
40
- break;
41
- case 403:
42
- errorDisplay = this.get403Error(error);
43
- break;
44
- case 409:
45
- errorDisplay = this.get409Error(error);
46
- break;
47
- default:
48
- errorDisplay = this.parseAxiosError(error.message, error.message, error);
49
- errorDisplay.isServerError = true;
50
- }
51
- }
52
- else {
53
- errorDisplay = this.getGeneralError(error);
54
- // Add status code of -1 to differentiate network errors from code exceptions.
55
- errorDisplay.statusCode = -1;
56
- }
57
- return errorDisplay;
50
+ return __awaiter(this, void 0, void 0, function () {
51
+ var errorDisplay, _a;
52
+ return __generator(this, function (_b) {
53
+ switch (_b.label) {
54
+ case 0:
55
+ if (!response) return [3 /*break*/, 12];
56
+ _a = response.status;
57
+ switch (_a) {
58
+ case 400: return [3 /*break*/, 1];
59
+ case 401: return [3 /*break*/, 3];
60
+ case 403: return [3 /*break*/, 5];
61
+ case 409: return [3 /*break*/, 7];
62
+ }
63
+ return [3 /*break*/, 9];
64
+ case 1: return [4 /*yield*/, this.get400Error(error)];
65
+ case 2:
66
+ errorDisplay = _b.sent();
67
+ return [3 /*break*/, 11];
68
+ case 3: return [4 /*yield*/, this.get401Error(error)];
69
+ case 4:
70
+ errorDisplay = _b.sent();
71
+ return [3 /*break*/, 11];
72
+ case 5: return [4 /*yield*/, this.get403Error(error)];
73
+ case 6:
74
+ errorDisplay = _b.sent();
75
+ return [3 /*break*/, 11];
76
+ case 7: return [4 /*yield*/, this.get409Error(error)];
77
+ case 8:
78
+ errorDisplay = _b.sent();
79
+ return [3 /*break*/, 11];
80
+ case 9: return [4 /*yield*/, this.parseAxiosError(error.message, error.message, error)];
81
+ case 10:
82
+ errorDisplay = _b.sent();
83
+ errorDisplay.isServerError = true;
84
+ _b.label = 11;
85
+ case 11: return [3 /*break*/, 13];
86
+ case 12:
87
+ errorDisplay = this.getGeneralError(error);
88
+ // Add status code of -1 to differentiate network errors from code exceptions.
89
+ errorDisplay.statusCode = -1;
90
+ _b.label = 13;
91
+ case 13: return [2 /*return*/, errorDisplay];
92
+ }
93
+ });
94
+ });
58
95
  };
59
96
  ErrorHandler.prototype.get400Error = function (error) {
60
97
  return this.parseAxiosError("Invalid data", "Cannot continue due to the following validation errors:", error);
@@ -76,35 +113,70 @@ var ErrorHandler = /** @class */ (function () {
76
113
  */
77
114
  ErrorHandler.prototype.parseAxiosError = function (header, body, error) {
78
115
  var _a;
79
- var errorDisplay = { header: header, body: body, statusText: error.message, statusCode: (_a = error.response) === null || _a === void 0 ? void 0 : _a.status };
80
- if (error.response.data) {
81
- var rawErrorData_1 = error.response.data;
82
- if (rawErrorData_1.title) {
83
- errorDisplay.body = rawErrorData_1.title;
84
- rawErrorData_1 = rawErrorData_1.errors;
85
- }
86
- if (rawErrorData_1) {
87
- if (typeof rawErrorData_1 === "string") {
88
- errorDisplay.body = rawErrorData_1;
89
- }
90
- else {
91
- var errorData_1 = { errors: [], properties: [] };
92
- errorDisplay.data = errorData_1;
93
- if (rawErrorData_1[""]) {
94
- errorData_1.errors = rawErrorData_1[""];
95
- }
96
- Object.keys(rawErrorData_1).forEach(function (key) {
97
- if (key !== "$id" && key !== "") {
98
- var propertyErrors = rawErrorData_1[key];
99
- if (propertyErrors && propertyErrors instanceof Array) {
100
- errorData_1.properties.push({ key: key, errors: propertyErrors.join(", ") });
116
+ return __awaiter(this, void 0, void 0, function () {
117
+ var errorDisplay, rawErrorData_1, errorData_1;
118
+ return __generator(this, function (_b) {
119
+ switch (_b.label) {
120
+ case 0:
121
+ errorDisplay = { header: header, body: body, statusText: error.message, statusCode: (_a = error.response) === null || _a === void 0 ? void 0 : _a.status };
122
+ if (!error.response.data) return [3 /*break*/, 2];
123
+ return [4 /*yield*/, this.ensureAxiosErrorData(error.response.data)];
124
+ case 1:
125
+ rawErrorData_1 = _b.sent();
126
+ if (rawErrorData_1.title) {
127
+ errorDisplay.body = rawErrorData_1.title;
128
+ rawErrorData_1 = rawErrorData_1.errors;
129
+ }
130
+ if (rawErrorData_1) {
131
+ if (typeof rawErrorData_1 === "string") {
132
+ errorDisplay.body = rawErrorData_1;
133
+ }
134
+ else {
135
+ errorData_1 = { errors: [], properties: [] };
136
+ errorDisplay.data = errorData_1;
137
+ if (rawErrorData_1[""]) {
138
+ errorData_1.errors = rawErrorData_1[""];
139
+ }
140
+ Object.keys(rawErrorData_1).forEach(function (key) {
141
+ if (key !== "$id" && key !== "") {
142
+ var propertyErrors = rawErrorData_1[key];
143
+ if (propertyErrors && propertyErrors instanceof Array) {
144
+ errorData_1.properties.push({ key: key, errors: propertyErrors.join(", ") });
145
+ }
146
+ }
147
+ });
101
148
  }
102
149
  }
103
- });
150
+ _b.label = 2;
151
+ case 2: return [2 /*return*/, errorDisplay];
104
152
  }
105
- }
106
- }
107
- return errorDisplay;
153
+ });
154
+ });
155
+ };
156
+ /**
157
+ * Checks if the error data is a blob object, and reads from it if that is the case.
158
+ */
159
+ ErrorHandler.prototype.ensureAxiosErrorData = function (responseData) {
160
+ return __awaiter(this, void 0, void 0, function () {
161
+ var errorText;
162
+ return __generator(this, function (_a) {
163
+ switch (_a.label) {
164
+ case 0:
165
+ if (!(responseData instanceof Blob)) return [3 /*break*/, 2];
166
+ return [4 /*yield*/, responseData.text()];
167
+ case 1:
168
+ errorText = _a.sent();
169
+ if (responseData.type.toLowerCase().includes('json')) {
170
+ return [2 /*return*/, JSON.parse(errorText)];
171
+ }
172
+ else {
173
+ return [2 /*return*/, errorText];
174
+ }
175
+ _a.label = 2;
176
+ case 2: return [2 /*return*/];
177
+ }
178
+ });
179
+ });
108
180
  };
109
181
  ErrorHandler.prototype.getGeneralError = function (error) {
110
182
  var errorDescription = error.message ? error.message : error;
@@ -23,7 +23,7 @@ var FileManagerBase = /** @class */ (function () {
23
23
  get: function () {
24
24
  return this.currentUploads.length > 0;
25
25
  },
26
- enumerable: true,
26
+ enumerable: false,
27
27
  configurable: true
28
28
  });
29
29
  Object.defineProperty(FileManagerBase.prototype, "uploadPercent", {
@@ -37,21 +37,21 @@ var FileManagerBase = /** @class */ (function () {
37
37
  }
38
38
  return totalSize === 0 ? 1 : (totalProgress / totalSize);
39
39
  },
40
- enumerable: true,
40
+ enumerable: false,
41
41
  configurable: true
42
42
  });
43
43
  Object.defineProperty(FileManagerBase.prototype, "uploadEndpoint", {
44
44
  get: function () {
45
45
  return this._uploadEndpoint;
46
46
  },
47
- enumerable: true,
47
+ enumerable: false,
48
48
  configurable: true
49
49
  });
50
50
  Object.defineProperty(FileManagerBase.prototype, "allowMultiple", {
51
51
  get: function () {
52
52
  return false;
53
53
  },
54
- enumerable: true,
54
+ enumerable: false,
55
55
  configurable: true
56
56
  });
57
57
  /**
@@ -126,8 +126,8 @@ var FileManagerBase = /** @class */ (function () {
126
126
  };
127
127
  FileManagerBase.prototype.uploadFiles = function (files, options) {
128
128
  var _this = this;
129
- if (options === void 0) { options = {}; }
130
129
  var _a;
130
+ if (options === void 0) { options = {}; }
131
131
  if (!this.uploadEndpoint) {
132
132
  throw Error("uploadFiles() can only be called if an uploadEndpoint has been specified.");
133
133
  }
@@ -262,9 +262,9 @@ var FileManager = /** @class */ (function (_super) {
262
262
  Object.defineProperty(FileManager.prototype, "allowMultiple", {
263
263
  get: function () {
264
264
  var _a;
265
- return _a = this.options.multiple, (_a !== null && _a !== void 0 ? _a : false);
265
+ return (_a = this.options.multiple) !== null && _a !== void 0 ? _a : false;
266
266
  },
267
- enumerable: true,
267
+ enumerable: false,
268
268
  configurable: true
269
269
  });
270
270
  FileManager = __decorate([
@@ -15,7 +15,7 @@ var FileUploadBatch = /** @class */ (function () {
15
15
  get: function () {
16
16
  return this.files.reduce(function (p, c) { return p + c.size; }, 0);
17
17
  },
18
- enumerable: true,
18
+ enumerable: false,
19
19
  configurable: true
20
20
  });
21
21
  /**
@@ -26,7 +26,7 @@ var FileUploadBatch = /** @class */ (function () {
26
26
  * @param options Additional options.
27
27
  */
28
28
  FileUploadBatch.prototype.createRecords = function (recordType, fileDescriptorKey, fileDescriptorType, options) {
29
- options = (options !== null && options !== void 0 ? options : {});
29
+ options = options !== null && options !== void 0 ? options : {};
30
30
  var records = [];
31
31
  for (var _i = 0, _a = this.files; _i < _a.length; _i++) {
32
32
  var file = _a[_i];
@@ -59,7 +59,7 @@ var FileUploadBatch = /** @class */ (function () {
59
59
  }
60
60
  };
61
61
  FileUploadBatch.prototype.toString = function () {
62
- return this.files.length === 1 ? this.files[0].name : this.files.length + " files";
62
+ return this.files.length === 1 ? this.files[0].name : "".concat(this.files.length, " files");
63
63
  };
64
64
  __decorate([
65
65
  Observable(),
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -7,11 +7,11 @@ var ModalHelper = /** @class */ (function () {
7
7
  var _a;
8
8
  this.modals = [];
9
9
  this.rootClassName = "";
10
- this.rootClassName = (_a = props.className, (_a !== null && _a !== void 0 ? _a : ""));
10
+ this.rootClassName = (_a = props.className) !== null && _a !== void 0 ? _a : "";
11
11
  this.rootContainer = document.createElement("div");
12
12
  this.rootContainer.className = this.rootClassName;
13
13
  this.rootContainer.tabIndex = -1;
14
- ((container !== null && container !== void 0 ? container : Misc.Globals.rootElement)).appendChild(this.rootContainer);
14
+ (container !== null && container !== void 0 ? container : Misc.Globals.rootElement).appendChild(this.rootContainer);
15
15
  // Create the container for all the modals
16
16
  var modalsContainer = document.createElement("div");
17
17
  modalsContainer.className = "modal fade";
@@ -42,7 +42,7 @@ var ModalHelper = /** @class */ (function () {
42
42
  }
43
43
  return ModalHelper._instance;
44
44
  },
45
- enumerable: true,
45
+ enumerable: false,
46
46
  configurable: true
47
47
  });
48
48
  ModalHelper.initialise = function (props, container) {
@@ -52,7 +52,7 @@ var ModalHelper = /** @class */ (function () {
52
52
  };
53
53
  ModalHelper.prototype.updateProps = function (props) {
54
54
  var _a;
55
- this.rootClassName = (_a = props.className, (_a !== null && _a !== void 0 ? _a : ""));
55
+ this.rootClassName = (_a = props.className) !== null && _a !== void 0 ? _a : "";
56
56
  };
57
57
  ModalHelper.prototype.addModal = function (modal, options, onDismiss) {
58
58
  modal.className = "modal-container";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -18,7 +18,7 @@ var NotificationHelper = /** @class */ (function () {
18
18
  }
19
19
  return this._store;
20
20
  },
21
- enumerable: true,
21
+ enumerable: false,
22
22
  configurable: true
23
23
  });
24
24
  /** Adds a notification using the primary style. See `add` for more details */
@@ -18,7 +18,7 @@ var ProgressState = /** @class */ (function () {
18
18
  this._progress = Math.max(0, Math.min(value, 1));
19
19
  this.stop();
20
20
  },
21
- enumerable: true,
21
+ enumerable: false,
22
22
  configurable: true
23
23
  });
24
24
  /**