@singularsystems/neo-core 1.0.0-beta.7 → 1.0.0-beta.9
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/dist/AppServices/Config/ConfigModel.d.ts +3 -1
- package/dist/AppServices/Config/ConfigService.d.ts +15 -4
- package/dist/AppServices/Config/ConfigService.js +38 -17
- package/dist/AxiosUtils.d.ts +27 -0
- package/dist/AxiosUtils.js +104 -0
- package/dist/Components/ErrorHandler.d.ts +11 -9
- package/dist/Components/ErrorHandler.js +10 -30
- package/dist/IndexDb/IDbSet.d.ts +9 -0
- package/dist/IndexDb/IDbSet.js +1 -0
- package/dist/Localisation/NeoStrings.d.ts +3 -0
- package/dist/Localisation/NeoStrings.js +3 -0
- package/dist/Model/Decorators.d.ts +2 -2
- package/dist/Model/Decorators.js +3 -2
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export interface
|
|
1
|
+
export interface IConfigModelData {
|
|
2
2
|
readonly baseUrl: string;
|
|
3
3
|
/**
|
|
4
4
|
* True by default if the NODE_ENV environment variable is "development".
|
|
@@ -8,6 +8,8 @@ export interface IConfigModel {
|
|
|
8
8
|
* This must be specified in your config file to be set to true.
|
|
9
9
|
*/
|
|
10
10
|
isTest: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface IConfigModel extends IConfigModelData {
|
|
11
13
|
readonly isTestOrDevelopment: boolean;
|
|
12
14
|
initialise(): void;
|
|
13
15
|
}
|
|
@@ -1,15 +1,26 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AxiosPromise } from "axios";
|
|
2
|
+
import { IConfigModel, IConfigModelData } from './ConfigModel';
|
|
3
|
+
import { IDbSet } from "../../IndexDb/IDbSet";
|
|
2
4
|
export interface IConfigService {
|
|
3
5
|
/**
|
|
4
|
-
* Load the config file from the specified path.
|
|
6
|
+
* Load and process the config file from the specified path.
|
|
5
7
|
* Path will default to [baseUrl]/config.json
|
|
6
8
|
* @param path Optional path.
|
|
9
|
+
* @param store Offline store to allow offline retrieval.
|
|
7
10
|
*/
|
|
8
|
-
loadConfig(path?: string): Promise<IConfigModel>;
|
|
11
|
+
loadConfig(path?: string, store?: IDbSet<IConfigModelData>): Promise<IConfigModel>;
|
|
12
|
+
/** Fetch the raw config data from the server. */
|
|
13
|
+
fetchConfig(path?: string): Promise<any>;
|
|
14
|
+
/**
|
|
15
|
+
* Sets the raw config data.
|
|
16
|
+
* Use this if `loadConfig` fails, and you have an offline copy of the config data. */
|
|
17
|
+
setConfig(configData: any): IConfigModel;
|
|
9
18
|
}
|
|
10
19
|
export declare class ConfigService implements IConfigService {
|
|
11
20
|
private config;
|
|
12
21
|
constructor(config: IConfigModel);
|
|
13
|
-
loadConfig(path?: string): Promise<IConfigModel>;
|
|
22
|
+
loadConfig(path?: string, store?: IDbSet<IConfigModelData>): Promise<IConfigModel>;
|
|
23
|
+
fetchConfig(path?: string | undefined): AxiosPromise<any>;
|
|
24
|
+
setConfig(configData: any): IConfigModel;
|
|
14
25
|
static get isDevelopment(): boolean;
|
|
15
26
|
}
|
|
@@ -2,37 +2,58 @@ import { __awaiter, __decorate, __generator, __metadata, __param } from "tslib";
|
|
|
2
2
|
import { injectable, inject } from 'inversify';
|
|
3
3
|
import Axios from "axios";
|
|
4
4
|
import NeoTypes from '../NeoTypes';
|
|
5
|
+
import AxiosUtils from "../../AxiosUtils";
|
|
5
6
|
export var ConfigService = /** @class */ (function () {
|
|
6
7
|
function ConfigService(config) {
|
|
7
8
|
this.config = config;
|
|
8
9
|
}
|
|
9
|
-
ConfigService.prototype.loadConfig = function (path) {
|
|
10
|
+
ConfigService.prototype.loadConfig = function (path, store) {
|
|
10
11
|
return __awaiter(this, void 0, void 0, function () {
|
|
11
|
-
var
|
|
12
|
+
var configData, e_1;
|
|
12
13
|
return __generator(this, function (_a) {
|
|
13
14
|
switch (_a.label) {
|
|
14
15
|
case 0:
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
_a.trys.push([0, 4, , 7]);
|
|
17
|
+
return [4 /*yield*/, this.fetchConfig(path)];
|
|
17
18
|
case 1:
|
|
18
|
-
_a.
|
|
19
|
-
|
|
20
|
-
return [4 /*yield*/,
|
|
19
|
+
configData = (_a.sent()).data;
|
|
20
|
+
if (!store) return [3 /*break*/, 3];
|
|
21
|
+
return [4 /*yield*/, store.putAsync(configData, 1)];
|
|
21
22
|
case 2:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return [
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
23
|
+
_a.sent();
|
|
24
|
+
_a.label = 3;
|
|
25
|
+
case 3: return [3 /*break*/, 7];
|
|
26
|
+
case 4:
|
|
27
|
+
e_1 = _a.sent();
|
|
28
|
+
if (!(store && AxiosUtils.isNetworkError(e_1) && !window.navigator.onLine)) return [3 /*break*/, 6];
|
|
29
|
+
return [4 /*yield*/, store.getAsync(1)];
|
|
30
|
+
case 5:
|
|
31
|
+
// get config from index db
|
|
32
|
+
configData = _a.sent();
|
|
33
|
+
_a.label = 6;
|
|
34
|
+
case 6:
|
|
35
|
+
if (!configData) {
|
|
36
|
+
throw new Error("ConfigService - Error loading configuration: ".concat(e_1));
|
|
37
|
+
}
|
|
38
|
+
return [3 /*break*/, 7];
|
|
39
|
+
case 7: return [2 /*return*/, this.setConfig(configData)];
|
|
32
40
|
}
|
|
33
41
|
});
|
|
34
42
|
});
|
|
35
43
|
};
|
|
44
|
+
ConfigService.prototype.fetchConfig = function (path) {
|
|
45
|
+
path = path !== null && path !== void 0 ? path : "".concat(this.config.baseUrl, "/config.json");
|
|
46
|
+
// Fetch config with timestamp to prevent caching
|
|
47
|
+
var timestamp = new Date().getTime();
|
|
48
|
+
return Axios.get("".concat(path, "?").concat(timestamp));
|
|
49
|
+
};
|
|
50
|
+
ConfigService.prototype.setConfig = function (configData) {
|
|
51
|
+
// The raw parsed json objects properties are copied into the config model.
|
|
52
|
+
// It is up to the config model to transform its properties if required (in the initialise method).
|
|
53
|
+
Object.assign(this.config, configData);
|
|
54
|
+
this.config.initialise();
|
|
55
|
+
return this.config;
|
|
56
|
+
};
|
|
36
57
|
Object.defineProperty(ConfigService, "isDevelopment", {
|
|
37
58
|
get: function () {
|
|
38
59
|
return process.env.NODE_ENV === "development";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { AxiosError, AxiosPromise, AxiosResponse } from "axios";
|
|
2
|
+
import { IErrorDetails } from "./Components/ErrorHandler";
|
|
3
|
+
interface ISuccessResponse<TData> {
|
|
4
|
+
success: true;
|
|
5
|
+
data: TData;
|
|
6
|
+
}
|
|
7
|
+
interface IFailedResponse<TData> extends IErrorDetails<TData> {
|
|
8
|
+
success: false;
|
|
9
|
+
}
|
|
10
|
+
export default class AxiosUtils {
|
|
11
|
+
/**
|
|
12
|
+
* Awaits an axios promise and returns an object indicating success or failure.
|
|
13
|
+
* @param filter Only errors matching this filter will be caught.
|
|
14
|
+
*/
|
|
15
|
+
static catchErrors<TData>(request: AxiosPromise<TData>, filter?: (r?: AxiosResponse) => boolean): Promise<ISuccessResponse<TData> | IFailedResponse<any>>;
|
|
16
|
+
/** Reads the properties of an axios error. */
|
|
17
|
+
static readError(e: AxiosError): Promise<IFailedResponse<any>>;
|
|
18
|
+
/**
|
|
19
|
+
* Checks if the error data is a blob object, and reads from it if that is the case.
|
|
20
|
+
*/
|
|
21
|
+
static ensureAxiosErrorData(responseData: any): Promise<any>;
|
|
22
|
+
static isClientError(response?: AxiosResponse): boolean;
|
|
23
|
+
static isServerError(response?: AxiosResponse): boolean;
|
|
24
|
+
/** Returns true if the error was raised from axios, and is a network error. E.g. no response was received from the server. */
|
|
25
|
+
static isNetworkError(e: any): boolean;
|
|
26
|
+
}
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { __awaiter, __generator } from "tslib";
|
|
2
|
+
import { isAxiosError } from "axios";
|
|
3
|
+
var AxiosUtils = /** @class */ (function () {
|
|
4
|
+
function AxiosUtils() {
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Awaits an axios promise and returns an object indicating success or failure.
|
|
8
|
+
* @param filter Only errors matching this filter will be caught.
|
|
9
|
+
*/
|
|
10
|
+
AxiosUtils.catchErrors = function (request, filter) {
|
|
11
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
12
|
+
var waited, e_1;
|
|
13
|
+
return __generator(this, function (_a) {
|
|
14
|
+
switch (_a.label) {
|
|
15
|
+
case 0:
|
|
16
|
+
_a.trys.push([0, 2, , 3]);
|
|
17
|
+
return [4 /*yield*/, request];
|
|
18
|
+
case 1:
|
|
19
|
+
waited = _a.sent();
|
|
20
|
+
return [2 /*return*/, {
|
|
21
|
+
data: waited.data,
|
|
22
|
+
success: true,
|
|
23
|
+
}];
|
|
24
|
+
case 2:
|
|
25
|
+
e_1 = _a.sent();
|
|
26
|
+
if (isAxiosError(e_1)) {
|
|
27
|
+
if (filter === undefined || filter(e_1.response)) {
|
|
28
|
+
return [2 /*return*/, this.readError(e_1)];
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
throw e_1;
|
|
32
|
+
case 3: return [2 /*return*/];
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
/** Reads the properties of an axios error. */
|
|
38
|
+
AxiosUtils.readError = function (e) {
|
|
39
|
+
var _a, _b;
|
|
40
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
41
|
+
var data, isServerError;
|
|
42
|
+
return __generator(this, function (_c) {
|
|
43
|
+
switch (_c.label) {
|
|
44
|
+
case 0:
|
|
45
|
+
data = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data;
|
|
46
|
+
if (!data) return [3 /*break*/, 2];
|
|
47
|
+
return [4 /*yield*/, this.ensureAxiosErrorData(data)];
|
|
48
|
+
case 1:
|
|
49
|
+
data = _c.sent();
|
|
50
|
+
_c.label = 2;
|
|
51
|
+
case 2:
|
|
52
|
+
isServerError = false;
|
|
53
|
+
if ((_b = e.response) === null || _b === void 0 ? void 0 : _b.status) {
|
|
54
|
+
isServerError = this.isServerError(e.response);
|
|
55
|
+
}
|
|
56
|
+
return [2 /*return*/, {
|
|
57
|
+
success: false,
|
|
58
|
+
isServerError: isServerError,
|
|
59
|
+
isNetworkError: e.response === undefined,
|
|
60
|
+
data: data,
|
|
61
|
+
error: e,
|
|
62
|
+
}];
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Checks if the error data is a blob object, and reads from it if that is the case.
|
|
69
|
+
*/
|
|
70
|
+
AxiosUtils.ensureAxiosErrorData = function (responseData) {
|
|
71
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
72
|
+
var errorText;
|
|
73
|
+
return __generator(this, function (_a) {
|
|
74
|
+
switch (_a.label) {
|
|
75
|
+
case 0:
|
|
76
|
+
if (!(responseData instanceof Blob)) return [3 /*break*/, 2];
|
|
77
|
+
return [4 /*yield*/, responseData.text()];
|
|
78
|
+
case 1:
|
|
79
|
+
errorText = _a.sent();
|
|
80
|
+
if (responseData.type.toLowerCase().includes('json')) {
|
|
81
|
+
return [2 /*return*/, JSON.parse(errorText)];
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
return [2 /*return*/, errorText];
|
|
85
|
+
}
|
|
86
|
+
_a.label = 2;
|
|
87
|
+
case 2: return [2 /*return*/, responseData];
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
AxiosUtils.isClientError = function (response) {
|
|
93
|
+
return response !== undefined && response.status >= 400 && response.status < 500;
|
|
94
|
+
};
|
|
95
|
+
AxiosUtils.isServerError = function (response) {
|
|
96
|
+
return response !== undefined && response.status >= 500 && response.status < 600;
|
|
97
|
+
};
|
|
98
|
+
/** Returns true if the error was raised from axios, and is a network error. E.g. no response was received from the server. */
|
|
99
|
+
AxiosUtils.isNetworkError = function (e) {
|
|
100
|
+
return isAxiosError(e) && e.response === undefined;
|
|
101
|
+
};
|
|
102
|
+
return AxiosUtils;
|
|
103
|
+
}());
|
|
104
|
+
export default AxiosUtils;
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
import { AxiosError, AxiosResponse } from 'axios';
|
|
2
2
|
import { INotificationHelper } from './Notifications/INotificationHelper';
|
|
3
|
-
export interface
|
|
4
|
-
header: string;
|
|
3
|
+
export interface IErrorDetails<TData> {
|
|
5
4
|
statusCode?: number;
|
|
6
5
|
statusText?: string;
|
|
7
|
-
|
|
8
|
-
data?: IErrorData;
|
|
6
|
+
data?: TData;
|
|
9
7
|
/** True if this is a 500 type error from the server. */
|
|
10
8
|
isServerError?: boolean;
|
|
9
|
+
/** True if the server could not be reached. */
|
|
10
|
+
isNetworkError?: boolean;
|
|
11
|
+
/** Original axios error. */
|
|
12
|
+
error: AxiosError;
|
|
13
|
+
}
|
|
14
|
+
export interface IErrorDisplay extends IErrorDetails<IErrorData> {
|
|
15
|
+
header: string;
|
|
16
|
+
body: any;
|
|
11
17
|
/** Cancels displaying of the error. */
|
|
12
18
|
cancelDisplay?: boolean;
|
|
13
19
|
}
|
|
@@ -52,11 +58,7 @@ export declare class ErrorHandler implements IErrorHandler {
|
|
|
52
58
|
* @param error Axios error.
|
|
53
59
|
*/
|
|
54
60
|
parseAxiosError(header: string, body: string, error: AxiosError): Promise<IErrorDisplay>;
|
|
55
|
-
|
|
56
|
-
* Checks if the error data is a blob object, and reads from it if that is the case.
|
|
57
|
-
*/
|
|
58
|
-
protected ensureAxiosErrorData(responseData: any): Promise<any>;
|
|
59
|
-
protected getGeneralError(error: any): IErrorDisplay;
|
|
61
|
+
protected getGeneralError(error: AxiosError): IErrorDisplay;
|
|
60
62
|
protected displayError(displayType: ErrorDisplayType, error: any, errorDisplay: IErrorDisplay): void;
|
|
61
63
|
protected displayModal(error: any, errorDisplay: IErrorDisplay): void;
|
|
62
64
|
protected displayNotification(error: any, errorDisplay: IErrorDisplay): void;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { __awaiter, __decorate, __generator, __metadata, __param } from "tslib";
|
|
2
2
|
import { injectable, inject } from 'inversify';
|
|
3
|
+
import { isAxiosError } from 'axios';
|
|
3
4
|
import { ModalUtils } from './Modal/ModalUtils';
|
|
4
5
|
import NeoTypes from '../AppServices/NeoTypes';
|
|
5
6
|
import NeoStrings from '../Localisation/NeoStrings';
|
|
7
|
+
import AxiosUtils from "../AxiosUtils";
|
|
6
8
|
export var ErrorDisplayType;
|
|
7
9
|
(function (ErrorDisplayType) {
|
|
8
10
|
/** Show the error text in a modal. */
|
|
@@ -41,7 +43,7 @@ export var ErrorHandler = /** @class */ (function () {
|
|
|
41
43
|
return __generator(this, function (_a) {
|
|
42
44
|
switch (_a.label) {
|
|
43
45
|
case 0:
|
|
44
|
-
if (!error
|
|
46
|
+
if (!isAxiosError(error)) return [3 /*break*/, 2];
|
|
45
47
|
return [4 /*yield*/, this.getAxiosError(error, error.response)];
|
|
46
48
|
case 1: return [2 /*return*/, _a.sent()];
|
|
47
49
|
case 2: return [2 /*return*/, this.getGeneralError(error)];
|
|
@@ -90,6 +92,7 @@ export var ErrorHandler = /** @class */ (function () {
|
|
|
90
92
|
errorDisplay = this.getGeneralError(error);
|
|
91
93
|
// Add status code of -1 to differentiate network errors from code exceptions.
|
|
92
94
|
errorDisplay.statusCode = -1;
|
|
95
|
+
errorDisplay.isNetworkError = true;
|
|
93
96
|
_b.label = 13;
|
|
94
97
|
case 13: return [2 /*return*/, errorDisplay];
|
|
95
98
|
}
|
|
@@ -97,7 +100,9 @@ export var ErrorHandler = /** @class */ (function () {
|
|
|
97
100
|
});
|
|
98
101
|
};
|
|
99
102
|
ErrorHandler.prototype.get400Error = function (error) {
|
|
100
|
-
|
|
103
|
+
var _a;
|
|
104
|
+
var isGet = ((_a = error.response) === null || _a === void 0 ? void 0 : _a.config.method) === "get";
|
|
105
|
+
return this.parseAxiosError(NeoStrings.errors.invalidDataTitle, isGet ? NeoStrings.errors.invalidDataBodyGet : NeoStrings.errors.invalidDataBody, error);
|
|
101
106
|
};
|
|
102
107
|
ErrorHandler.prototype.get401Error = function (error) {
|
|
103
108
|
return this.parseAxiosError(NeoStrings.errors.notAuthenticatedTitle, NeoStrings.errors.notAuthenticatedBody, error);
|
|
@@ -121,9 +126,9 @@ export var ErrorHandler = /** @class */ (function () {
|
|
|
121
126
|
return __generator(this, function (_b) {
|
|
122
127
|
switch (_b.label) {
|
|
123
128
|
case 0:
|
|
124
|
-
errorDisplay = { header: header, body: body, statusText: error.message, statusCode: (_a = error.response) === null || _a === void 0 ? void 0 : _a.status };
|
|
129
|
+
errorDisplay = { header: header, body: body, statusText: error.message, statusCode: (_a = error.response) === null || _a === void 0 ? void 0 : _a.status, error: error };
|
|
125
130
|
if (!error.response.data) return [3 /*break*/, 2];
|
|
126
|
-
return [4 /*yield*/,
|
|
131
|
+
return [4 /*yield*/, AxiosUtils.ensureAxiosErrorData(error.response.data)];
|
|
127
132
|
case 1:
|
|
128
133
|
rawErrorData_1 = _b.sent();
|
|
129
134
|
if (rawErrorData_1.title) {
|
|
@@ -156,34 +161,9 @@ export var ErrorHandler = /** @class */ (function () {
|
|
|
156
161
|
});
|
|
157
162
|
});
|
|
158
163
|
};
|
|
159
|
-
/**
|
|
160
|
-
* Checks if the error data is a blob object, and reads from it if that is the case.
|
|
161
|
-
*/
|
|
162
|
-
ErrorHandler.prototype.ensureAxiosErrorData = function (responseData) {
|
|
163
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
164
|
-
var errorText;
|
|
165
|
-
return __generator(this, function (_a) {
|
|
166
|
-
switch (_a.label) {
|
|
167
|
-
case 0:
|
|
168
|
-
if (!(responseData instanceof this.blobType)) return [3 /*break*/, 2];
|
|
169
|
-
return [4 /*yield*/, responseData.text()];
|
|
170
|
-
case 1:
|
|
171
|
-
errorText = _a.sent();
|
|
172
|
-
if (responseData.type.toLowerCase().includes('json')) {
|
|
173
|
-
return [2 /*return*/, JSON.parse(errorText)];
|
|
174
|
-
}
|
|
175
|
-
else {
|
|
176
|
-
return [2 /*return*/, errorText];
|
|
177
|
-
}
|
|
178
|
-
_a.label = 2;
|
|
179
|
-
case 2: return [2 /*return*/, responseData];
|
|
180
|
-
}
|
|
181
|
-
});
|
|
182
|
-
});
|
|
183
|
-
};
|
|
184
164
|
ErrorHandler.prototype.getGeneralError = function (error) {
|
|
185
165
|
var errorDescription = error.message ? error.message : error;
|
|
186
|
-
return { header: NeoStrings.errors.generalTitle, body: errorDescription };
|
|
166
|
+
return { header: NeoStrings.errors.generalTitle, body: errorDescription, error: error };
|
|
187
167
|
};
|
|
188
168
|
ErrorHandler.prototype.displayError = function (displayType, error, errorDisplay) {
|
|
189
169
|
if (error instanceof Error) {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Represents a table in a data store. */
|
|
2
|
+
export interface IDbSet<T> {
|
|
3
|
+
/** Gets the first item matching the key, or key range. */
|
|
4
|
+
getAsync(key: IDBValidKey | IDBKeyRange): Promise<T | undefined>;
|
|
5
|
+
/** Adds or updates an item. */
|
|
6
|
+
putAsync(value: T, keyValue?: IDBValidKey): Promise<void>;
|
|
7
|
+
/** Adds or updates multiple items in a transaction. */
|
|
8
|
+
putAsync(value: T[]): Promise<void>;
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -4,7 +4,10 @@ declare const NeoStrings: {
|
|
|
4
4
|
concurrencyBody: string;
|
|
5
5
|
generalTitle: string;
|
|
6
6
|
invalidDataTitle: string;
|
|
7
|
+
/** 400 error for non get requests */
|
|
7
8
|
invalidDataBody: string;
|
|
9
|
+
/** 400 error for get requests */
|
|
10
|
+
invalidDataBodyGet: string;
|
|
8
11
|
notAuthenticatedTitle: string;
|
|
9
12
|
notAuthenticatedBody: string;
|
|
10
13
|
unAuthorisedTitle: string;
|
|
@@ -4,7 +4,10 @@ var NeoStrings = {
|
|
|
4
4
|
concurrencyBody: "Someone else modified the record before you saved it. Please reload it and try again.",
|
|
5
5
|
generalTitle: "Error",
|
|
6
6
|
invalidDataTitle: "Invalid data",
|
|
7
|
+
/** 400 error for non get requests */
|
|
7
8
|
invalidDataBody: "Cannot continue due to the following validation errors:",
|
|
9
|
+
/** 400 error for get requests */
|
|
10
|
+
invalidDataBodyGet: "Incorrect data was provided.",
|
|
8
11
|
notAuthenticatedTitle: "Not authenticated",
|
|
9
12
|
notAuthenticatedBody: "You are not logged in. Please reload the page to login again.",
|
|
10
13
|
unAuthorisedTitle: "Unauthorised",
|
|
@@ -43,8 +43,8 @@ export declare function OnChanged<T>(callback: (target: T) => (oldValue: any, ne
|
|
|
43
43
|
export declare function Debounce(value?: boolean): (type: any, propertyKey: string) => void;
|
|
44
44
|
/** Converts a getter into a computed. Note, when using NeoModel you do not need to do this. */
|
|
45
45
|
export declare function Computed(isComputed?: boolean): (type: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
|
|
46
|
-
/** Specifies whether a method is a mobx action.
|
|
47
|
-
*
|
|
46
|
+
/** Specifies whether a method is a mobx action.
|
|
47
|
+
* Change the default behaviour at a class level in the makeObservable options passed to makeObservable. */
|
|
48
48
|
export declare function Action(isAction?: boolean): (type: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
|
|
49
49
|
/** Sets this property as the display member to be used in drop downs / radio lists etc. */
|
|
50
50
|
export declare function DisplayMember(): (type: any, propertyKey: string) => void;
|
package/dist/Model/Decorators.js
CHANGED
|
@@ -173,9 +173,10 @@ export function Computed(isComputed) {
|
|
|
173
173
|
ensureTypeInfo(type.constructor).neo.addComputed(propertyKey, descriptor, isComputed);
|
|
174
174
|
};
|
|
175
175
|
}
|
|
176
|
-
/** Specifies whether a method is a mobx action.
|
|
177
|
-
*
|
|
176
|
+
/** Specifies whether a method is a mobx action.
|
|
177
|
+
* Change the default behaviour at a class level in the makeObservable options passed to makeObservable. */
|
|
178
178
|
export function Action(isAction) {
|
|
179
|
+
if (isAction === void 0) { isAction = true; }
|
|
179
180
|
return function (type, propertyKey, descriptor) {
|
|
180
181
|
ensureTypeInfo(type.constructor).neo.addMethod(propertyKey).isAction = isAction;
|
|
181
182
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import "reflect-metadata";
|
|
2
2
|
import './Extensions';
|
|
3
|
+
import AxiosUtils from "./AxiosUtils";
|
|
3
4
|
import List from './Model/List';
|
|
4
5
|
import NeoModel from './Model/NeoModel';
|
|
5
6
|
import DateUtils from './Dates/DateUtils';
|
|
@@ -30,7 +31,7 @@ import * as SignalR from './SignalR';
|
|
|
30
31
|
import * as Validation from './Validation';
|
|
31
32
|
import * as Views from './Views/IViewBase';
|
|
32
33
|
declare const NotifyUtils: Components.INotificationHelper;
|
|
33
|
-
export { AppServices, Attributes, Components, Data, DateUtils, DebounceHelper, EnumHelper, FileUtils, JsonSchema, Localisation, List, MenuUtils, Misc, ModalUtils, Model, NeoModel, NeoStrings, Network, NotifyUtils, Numeric, NumberUtils, Routing, Rules, Security, SignalR, StringUtils, Validation, Views, };
|
|
34
|
+
export { AxiosUtils, AppServices, Attributes, Components, Data, DateUtils, DebounceHelper, EnumHelper, FileUtils, JsonSchema, Localisation, List, MenuUtils, Misc, ModalUtils, Model, NeoModel, NeoStrings, Network, NotifyUtils, Numeric, NumberUtils, Routing, Rules, Security, SignalR, StringUtils, Validation, Views, };
|
|
34
35
|
export { runInTask, createProperty };
|
|
35
36
|
export { default as ModelBase } from './Model/ModelBase';
|
|
36
37
|
export { default as ValueObject } from './Model/ValueObject';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import "reflect-metadata";
|
|
2
2
|
import './Extensions';
|
|
3
3
|
// Individual exports
|
|
4
|
+
import AxiosUtils from "./AxiosUtils";
|
|
4
5
|
import List from './Model/List';
|
|
5
6
|
import NeoModel from './Model/NeoModel';
|
|
6
7
|
import DateUtils from './Dates/DateUtils';
|
|
@@ -35,7 +36,7 @@ import * as Views from './Views/IViewBase';
|
|
|
35
36
|
import { NotificationHelper } from './Components/Notifications/NotificationHelper';
|
|
36
37
|
var NotifyUtils = new NotificationHelper();
|
|
37
38
|
// Types
|
|
38
|
-
export { AppServices, Attributes, Components, Data, DateUtils, DebounceHelper, EnumHelper, FileUtils, JsonSchema, Localisation, List, MenuUtils, Misc, ModalUtils, Model, NeoModel, NeoStrings, Network, NotifyUtils, Numeric, NumberUtils, Routing, Rules, Security, SignalR, StringUtils, Validation, Views, };
|
|
39
|
+
export { AxiosUtils, AppServices, Attributes, Components, Data, DateUtils, DebounceHelper, EnumHelper, FileUtils, JsonSchema, Localisation, List, MenuUtils, Misc, ModalUtils, Model, NeoModel, NeoStrings, Network, NotifyUtils, Numeric, NumberUtils, Routing, Rules, Security, SignalR, StringUtils, Validation, Views, };
|
|
39
40
|
// Functions
|
|
40
41
|
export { runInTask, createProperty };
|
|
41
42
|
export { default as ModelBase } from './Model/ModelBase';
|