@etsoo/appscript 1.4.86 → 1.4.88
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/__tests__/app/CoreApp.ts +32 -3
- package/lib/cjs/business/BusinessUtils.d.ts +1 -10
- package/lib/cjs/business/BusinessUtils.js +0 -14
- package/lib/cjs/erp/rq/QueryRQ.d.ts +0 -4
- package/lib/cjs/erp/rq/TiplistRQ.d.ts +0 -4
- package/lib/cjs/result/ActionResultError.js +1 -5
- package/lib/mjs/business/BusinessUtils.d.ts +1 -10
- package/lib/mjs/business/BusinessUtils.js +0 -14
- package/lib/mjs/erp/rq/QueryRQ.d.ts +0 -4
- package/lib/mjs/erp/rq/TiplistRQ.d.ts +0 -4
- package/lib/mjs/result/ActionResultError.js +1 -5
- package/package.json +2 -2
- package/src/business/BusinessUtils.ts +1 -15
- package/src/erp/rq/QueryRQ.ts +0 -5
- package/src/erp/rq/TiplistRQ.ts +0 -5
- package/src/result/ActionResultError.ts +1 -5
package/__tests__/app/CoreApp.ts
CHANGED
|
@@ -7,7 +7,13 @@ import {
|
|
|
7
7
|
NotificationRenderProps
|
|
8
8
|
} from '@etsoo/notificationbase';
|
|
9
9
|
import { ApiAuthorizationScheme, createClient } from '@etsoo/restclient';
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
DataTypes,
|
|
12
|
+
DomUtils,
|
|
13
|
+
IActionResult,
|
|
14
|
+
Utils,
|
|
15
|
+
WindowStorage
|
|
16
|
+
} from '@etsoo/shared';
|
|
11
17
|
import {
|
|
12
18
|
AddressApi,
|
|
13
19
|
en,
|
|
@@ -211,13 +217,15 @@ test('Tests for formatFullName', () => {
|
|
|
211
217
|
});
|
|
212
218
|
|
|
213
219
|
test('Tests for getRoles', () => {
|
|
214
|
-
|
|
220
|
+
const roles = app.getRoles(
|
|
221
|
+
UserRole.User | UserRole.Manager | UserRole.Admin
|
|
222
|
+
);
|
|
215
223
|
expect(roles.length).toBe(3);
|
|
216
224
|
expect(roles.map((r) => r.id)).toEqual([8, 128, 8192]);
|
|
217
225
|
});
|
|
218
226
|
|
|
219
227
|
test('Tests for getStatusList', () => {
|
|
220
|
-
|
|
228
|
+
const statuses = app.getStatusList([
|
|
221
229
|
EntityStatus.Normal,
|
|
222
230
|
EntityStatus.Approved,
|
|
223
231
|
EntityStatus.Doing,
|
|
@@ -230,6 +238,27 @@ test('Tests for getStatusList', () => {
|
|
|
230
238
|
expect(app.getStatusList().length).toBe(9);
|
|
231
239
|
});
|
|
232
240
|
|
|
241
|
+
test('Tests for formatResult', () => {
|
|
242
|
+
const result: IActionResult = {
|
|
243
|
+
ok: false,
|
|
244
|
+
type: 'https://tools.ietf.org/html/rfc9110#section-15.5.1',
|
|
245
|
+
title: 'One or more validation errors occurred.',
|
|
246
|
+
status: 400,
|
|
247
|
+
errors: {
|
|
248
|
+
$: [
|
|
249
|
+
'JSON deserialization for type \u0027com.etsoo.CMS.RQ.User.UserCreateRQ\u0027 was missing required properties, including the following: password'
|
|
250
|
+
],
|
|
251
|
+
rq: ['The rq field is required.']
|
|
252
|
+
},
|
|
253
|
+
traceId: '00-ed96a4f0c83f066594ecc69b77da9803-df770e3cd714fedd-00'
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
const formatted = app.formatResult(result);
|
|
257
|
+
expect(formatted).toBe(
|
|
258
|
+
'One or more validation errors occurred. (400, https://tools.ietf.org/html/rfc9110#section-15.5.1)'
|
|
259
|
+
);
|
|
260
|
+
});
|
|
261
|
+
|
|
233
262
|
test('Tests for isValidPassword', () => {
|
|
234
263
|
expect(app.isValidPassword('12345678')).toBeFalsy();
|
|
235
264
|
expect(app.isValidPassword('abcd3')).toBeFalsy();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ListType, ListType1 } from '@etsoo/shared';
|
|
2
2
|
import { CultureGridItem } from './CultureItem';
|
|
3
3
|
/**
|
|
4
4
|
* Business utils
|
|
@@ -27,13 +27,4 @@ export declare namespace BusinessUtils {
|
|
|
27
27
|
* @returns 12 months
|
|
28
28
|
*/
|
|
29
29
|
function getMonths(monthLabels: string[], startMonth?: number): ListType[];
|
|
30
|
-
/**
|
|
31
|
-
* Set id value
|
|
32
|
-
* @param item QueryRQ or TiplistRQ or similiar item
|
|
33
|
-
* @param id Id value
|
|
34
|
-
*/
|
|
35
|
-
function setIdValue<T extends {
|
|
36
|
-
id?: number;
|
|
37
|
-
sid?: string;
|
|
38
|
-
}>(item: T, id?: IdType): void;
|
|
39
30
|
}
|
|
@@ -78,18 +78,4 @@ var BusinessUtils;
|
|
|
78
78
|
return months;
|
|
79
79
|
}
|
|
80
80
|
BusinessUtils.getMonths = getMonths;
|
|
81
|
-
/**
|
|
82
|
-
* Set id value
|
|
83
|
-
* @param item QueryRQ or TiplistRQ or similiar item
|
|
84
|
-
* @param id Id value
|
|
85
|
-
*/
|
|
86
|
-
function setIdValue(item, id) {
|
|
87
|
-
if (id == null)
|
|
88
|
-
return;
|
|
89
|
-
if (typeof id === 'number')
|
|
90
|
-
item.id = id;
|
|
91
|
-
else
|
|
92
|
-
item.sid = id;
|
|
93
|
-
}
|
|
94
|
-
BusinessUtils.setIdValue = setIdValue;
|
|
95
81
|
})(BusinessUtils || (exports.BusinessUtils = BusinessUtils = {}));
|
|
@@ -19,11 +19,7 @@ class ActionResultError extends Error {
|
|
|
19
19
|
if (result.field)
|
|
20
20
|
addtions.push(result.field);
|
|
21
21
|
const add = addtions.length > 0 ? ` (${addtions.join(', ')})` : '';
|
|
22
|
-
|
|
23
|
-
if (title && result.traceId) {
|
|
24
|
-
title += ` [${result.traceId}]`;
|
|
25
|
-
}
|
|
26
|
-
return `${title || 'Error'}${add}`;
|
|
22
|
+
return `${result.title || 'Error'}${add}`;
|
|
27
23
|
}
|
|
28
24
|
/**
|
|
29
25
|
* Constructor
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ListType, ListType1 } from '@etsoo/shared';
|
|
2
2
|
import { CultureGridItem } from './CultureItem';
|
|
3
3
|
/**
|
|
4
4
|
* Business utils
|
|
@@ -27,13 +27,4 @@ export declare namespace BusinessUtils {
|
|
|
27
27
|
* @returns 12 months
|
|
28
28
|
*/
|
|
29
29
|
function getMonths(monthLabels: string[], startMonth?: number): ListType[];
|
|
30
|
-
/**
|
|
31
|
-
* Set id value
|
|
32
|
-
* @param item QueryRQ or TiplistRQ or similiar item
|
|
33
|
-
* @param id Id value
|
|
34
|
-
*/
|
|
35
|
-
function setIdValue<T extends {
|
|
36
|
-
id?: number;
|
|
37
|
-
sid?: string;
|
|
38
|
-
}>(item: T, id?: IdType): void;
|
|
39
30
|
}
|
|
@@ -75,18 +75,4 @@ export var BusinessUtils;
|
|
|
75
75
|
return months;
|
|
76
76
|
}
|
|
77
77
|
BusinessUtils.getMonths = getMonths;
|
|
78
|
-
/**
|
|
79
|
-
* Set id value
|
|
80
|
-
* @param item QueryRQ or TiplistRQ or similiar item
|
|
81
|
-
* @param id Id value
|
|
82
|
-
*/
|
|
83
|
-
function setIdValue(item, id) {
|
|
84
|
-
if (id == null)
|
|
85
|
-
return;
|
|
86
|
-
if (typeof id === 'number')
|
|
87
|
-
item.id = id;
|
|
88
|
-
else
|
|
89
|
-
item.sid = id;
|
|
90
|
-
}
|
|
91
|
-
BusinessUtils.setIdValue = setIdValue;
|
|
92
78
|
})(BusinessUtils || (BusinessUtils = {}));
|
|
@@ -16,11 +16,7 @@ export class ActionResultError extends Error {
|
|
|
16
16
|
if (result.field)
|
|
17
17
|
addtions.push(result.field);
|
|
18
18
|
const add = addtions.length > 0 ? ` (${addtions.join(', ')})` : '';
|
|
19
|
-
|
|
20
|
-
if (title && result.traceId) {
|
|
21
|
-
title += ` [${result.traceId}]`;
|
|
22
|
-
}
|
|
23
|
-
return `${title || 'Error'}${add}`;
|
|
19
|
+
return `${result.title || 'Error'}${add}`;
|
|
24
20
|
}
|
|
25
21
|
/**
|
|
26
22
|
* Constructor
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/appscript",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.88",
|
|
4
4
|
"description": "Applications shared TypeScript framework",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/mjs/index.js",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@etsoo/notificationbase": "^1.1.42",
|
|
56
56
|
"@etsoo/restclient": "^1.1.3",
|
|
57
|
-
"@etsoo/shared": "^1.2.
|
|
57
|
+
"@etsoo/shared": "^1.2.40",
|
|
58
58
|
"crypto-js": "^4.2.0"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ListType, ListType1 } from '@etsoo/shared';
|
|
2
2
|
import { CultureGridItem } from './CultureItem';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -94,18 +94,4 @@ export namespace BusinessUtils {
|
|
|
94
94
|
|
|
95
95
|
return months;
|
|
96
96
|
}
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Set id value
|
|
100
|
-
* @param item QueryRQ or TiplistRQ or similiar item
|
|
101
|
-
* @param id Id value
|
|
102
|
-
*/
|
|
103
|
-
export function setIdValue<T extends { id?: number; sid?: string }>(
|
|
104
|
-
item: T,
|
|
105
|
-
id?: IdType
|
|
106
|
-
) {
|
|
107
|
-
if (id == null) return;
|
|
108
|
-
if (typeof id === 'number') item.id = id;
|
|
109
|
-
else item.sid = id;
|
|
110
|
-
}
|
|
111
97
|
}
|
package/src/erp/rq/QueryRQ.ts
CHANGED
package/src/erp/rq/TiplistRQ.ts
CHANGED
|
@@ -16,12 +16,8 @@ export class ActionResultError extends Error {
|
|
|
16
16
|
if (result.field) addtions.push(result.field);
|
|
17
17
|
|
|
18
18
|
const add = addtions.length > 0 ? ` (${addtions.join(', ')})` : '';
|
|
19
|
-
let title = result.title;
|
|
20
|
-
if (title && result.traceId) {
|
|
21
|
-
title += ` [${result.traceId}]`;
|
|
22
|
-
}
|
|
23
19
|
|
|
24
|
-
return `${title || 'Error'}${add}`;
|
|
20
|
+
return `${result.title || 'Error'}${add}`;
|
|
25
21
|
}
|
|
26
22
|
|
|
27
23
|
/**
|