@etsoo/appscript 1.3.42 → 1.3.44
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/lib/cjs/erp/OrgApi.d.ts +3 -2
- package/lib/cjs/erp/OrgApi.js +10 -2
- package/lib/cjs/erp/dto/OrgViewDto.d.ts +4 -0
- package/lib/mjs/erp/OrgApi.d.ts +3 -2
- package/lib/mjs/erp/OrgApi.js +10 -2
- package/lib/mjs/erp/dto/OrgViewDto.d.ts +4 -0
- package/package.json +3 -3
- package/src/erp/OrgApi.ts +15 -3
- package/src/erp/dto/OrgViewDto.ts +5 -0
package/lib/cjs/erp/OrgApi.d.ts
CHANGED
|
@@ -37,9 +37,10 @@ export declare class OrgApi extends EntityApi {
|
|
|
37
37
|
* Read
|
|
38
38
|
* @param id Id
|
|
39
39
|
* @param payload Payload
|
|
40
|
+
* @param reload Reload data
|
|
40
41
|
* @returns Result
|
|
41
42
|
*/
|
|
42
|
-
read(id: number, payload?: IApiPayload<
|
|
43
|
+
read(id: number, payload?: IApiPayload<OrgViewDto>, reload?: boolean): Promise<OrgViewDto | undefined>;
|
|
43
44
|
/**
|
|
44
45
|
* Switch organization
|
|
45
46
|
* @param id Organization id
|
|
@@ -53,7 +54,7 @@ export declare class OrgApi extends EntityApi {
|
|
|
53
54
|
* @param payload Payload
|
|
54
55
|
* @returns Result
|
|
55
56
|
*/
|
|
56
|
-
update(data: DataTypes.AddOrEditType<
|
|
57
|
+
update(data: DataTypes.AddOrEditType<OrgDto, true>, payload?: IdResultPayload): Promise<import("..").IdActionResult<number> | undefined>;
|
|
57
58
|
/**
|
|
58
59
|
* Read for update
|
|
59
60
|
* @param id Id
|
package/lib/cjs/erp/OrgApi.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.OrgApi = void 0;
|
|
4
4
|
const EntityApi_1 = require("./EntityApi");
|
|
5
|
+
const cachedOrgs = {};
|
|
5
6
|
/**
|
|
6
7
|
* Organization API
|
|
7
8
|
*/
|
|
@@ -38,10 +39,17 @@ class OrgApi extends EntityApi_1.EntityApi {
|
|
|
38
39
|
* Read
|
|
39
40
|
* @param id Id
|
|
40
41
|
* @param payload Payload
|
|
42
|
+
* @param reload Reload data
|
|
41
43
|
* @returns Result
|
|
42
44
|
*/
|
|
43
|
-
read(id, payload) {
|
|
44
|
-
|
|
45
|
+
async read(id, payload, reload = false) {
|
|
46
|
+
let data = cachedOrgs[id];
|
|
47
|
+
if (data == null || reload) {
|
|
48
|
+
data = await this.readBase(id, payload);
|
|
49
|
+
if (data != null)
|
|
50
|
+
cachedOrgs[id] = data;
|
|
51
|
+
}
|
|
52
|
+
return data;
|
|
45
53
|
}
|
|
46
54
|
/**
|
|
47
55
|
* Switch organization
|
package/lib/mjs/erp/OrgApi.d.ts
CHANGED
|
@@ -37,9 +37,10 @@ export declare class OrgApi extends EntityApi {
|
|
|
37
37
|
* Read
|
|
38
38
|
* @param id Id
|
|
39
39
|
* @param payload Payload
|
|
40
|
+
* @param reload Reload data
|
|
40
41
|
* @returns Result
|
|
41
42
|
*/
|
|
42
|
-
read(id: number, payload?: IApiPayload<
|
|
43
|
+
read(id: number, payload?: IApiPayload<OrgViewDto>, reload?: boolean): Promise<OrgViewDto | undefined>;
|
|
43
44
|
/**
|
|
44
45
|
* Switch organization
|
|
45
46
|
* @param id Organization id
|
|
@@ -53,7 +54,7 @@ export declare class OrgApi extends EntityApi {
|
|
|
53
54
|
* @param payload Payload
|
|
54
55
|
* @returns Result
|
|
55
56
|
*/
|
|
56
|
-
update(data: DataTypes.AddOrEditType<
|
|
57
|
+
update(data: DataTypes.AddOrEditType<OrgDto, true>, payload?: IdResultPayload): Promise<import("..").IdActionResult<number> | undefined>;
|
|
57
58
|
/**
|
|
58
59
|
* Read for update
|
|
59
60
|
* @param id Id
|
package/lib/mjs/erp/OrgApi.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { EntityApi } from './EntityApi';
|
|
2
|
+
const cachedOrgs = {};
|
|
2
3
|
/**
|
|
3
4
|
* Organization API
|
|
4
5
|
*/
|
|
@@ -35,10 +36,17 @@ export class OrgApi extends EntityApi {
|
|
|
35
36
|
* Read
|
|
36
37
|
* @param id Id
|
|
37
38
|
* @param payload Payload
|
|
39
|
+
* @param reload Reload data
|
|
38
40
|
* @returns Result
|
|
39
41
|
*/
|
|
40
|
-
read(id, payload) {
|
|
41
|
-
|
|
42
|
+
async read(id, payload, reload = false) {
|
|
43
|
+
let data = cachedOrgs[id];
|
|
44
|
+
if (data == null || reload) {
|
|
45
|
+
data = await this.readBase(id, payload);
|
|
46
|
+
if (data != null)
|
|
47
|
+
cachedOrgs[id] = data;
|
|
48
|
+
}
|
|
49
|
+
return data;
|
|
42
50
|
}
|
|
43
51
|
/**
|
|
44
52
|
* Switch organization
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/appscript",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.44",
|
|
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.18",
|
|
56
56
|
"@etsoo/restclient": "^1.0.79",
|
|
57
|
-
"@etsoo/shared": "^1.1.
|
|
57
|
+
"@etsoo/shared": "^1.1.79",
|
|
58
58
|
"@types/crypto-js": "^4.1.1",
|
|
59
59
|
"crypto-js": "^4.1.1"
|
|
60
60
|
},
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"@types/jest": "^29.2.3",
|
|
68
68
|
"@typescript-eslint/eslint-plugin": "^5.45.0",
|
|
69
69
|
"@typescript-eslint/parser": "^5.45.0",
|
|
70
|
-
"eslint": "^8.
|
|
70
|
+
"eslint": "^8.29.0",
|
|
71
71
|
"eslint-config-airbnb-base": "^15.0.0",
|
|
72
72
|
"eslint-plugin-import": "^2.26.0",
|
|
73
73
|
"jest": "^29.3.1",
|
package/src/erp/OrgApi.ts
CHANGED
|
@@ -9,6 +9,8 @@ import { EntityApi } from './EntityApi';
|
|
|
9
9
|
import { OrgListRQ } from './rq/OrgListRQ';
|
|
10
10
|
import { OrgQueryRQ } from './rq/OrgQueryRQ';
|
|
11
11
|
|
|
12
|
+
const cachedOrgs: { [P: number]: OrgViewDto | undefined | null } = {};
|
|
13
|
+
|
|
12
14
|
/**
|
|
13
15
|
* Organization API
|
|
14
16
|
*/
|
|
@@ -63,10 +65,20 @@ export class OrgApi extends EntityApi {
|
|
|
63
65
|
* Read
|
|
64
66
|
* @param id Id
|
|
65
67
|
* @param payload Payload
|
|
68
|
+
* @param reload Reload data
|
|
66
69
|
* @returns Result
|
|
67
70
|
*/
|
|
68
|
-
read(
|
|
69
|
-
|
|
71
|
+
async read(
|
|
72
|
+
id: number,
|
|
73
|
+
payload?: IApiPayload<OrgViewDto>,
|
|
74
|
+
reload: boolean = false
|
|
75
|
+
) {
|
|
76
|
+
let data = cachedOrgs[id];
|
|
77
|
+
if (data == null || reload) {
|
|
78
|
+
data = await this.readBase(id, payload);
|
|
79
|
+
if (data != null) cachedOrgs[id] = data;
|
|
80
|
+
}
|
|
81
|
+
return data;
|
|
70
82
|
}
|
|
71
83
|
|
|
72
84
|
/**
|
|
@@ -100,7 +112,7 @@ export class OrgApi extends EntityApi {
|
|
|
100
112
|
* @returns Result
|
|
101
113
|
*/
|
|
102
114
|
update(
|
|
103
|
-
data: DataTypes.AddOrEditType<
|
|
115
|
+
data: DataTypes.AddOrEditType<OrgDto, true>,
|
|
104
116
|
payload?: IdResultPayload
|
|
105
117
|
) {
|
|
106
118
|
return super.updateBase(data, payload);
|