@etsoo/appscript 1.3.41 → 1.3.43

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.
@@ -3,6 +3,7 @@ import { DataTypes, ListType } from '@etsoo/shared';
3
3
  import { IApp } from '../app/IApp';
4
4
  import { OrgDto } from './dto/OrgDto';
5
5
  import { OrgQueryDto } from './dto/OrgQueryDto';
6
+ import { OrgViewDto } from './dto/OrgViewDto';
6
7
  import { IdResultPayload } from './dto/ResultPayload';
7
8
  import { EntityApi } from './EntityApi';
8
9
  import { OrgListRQ } from './rq/OrgListRQ';
@@ -32,6 +33,14 @@ export declare class OrgApi extends EntityApi {
32
33
  * @returns Result
33
34
  */
34
35
  query(rq: OrgQueryRQ, payload?: IApiPayload<OrgQueryDto[]>): Promise<OrgQueryDto[] | undefined>;
36
+ /**
37
+ * Read
38
+ * @param id Id
39
+ * @param payload Payload
40
+ * @param reload Reload data
41
+ * @returns Result
42
+ */
43
+ read(id: number, payload?: IApiPayload<OrgViewDto>, reload?: boolean): Promise<OrgViewDto | undefined>;
35
44
  /**
36
45
  * Switch organization
37
46
  * @param id Organization id
@@ -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
  */
@@ -34,6 +35,22 @@ class OrgApi extends EntityApi_1.EntityApi {
34
35
  query(rq, payload) {
35
36
  return this.queryBase(rq, payload);
36
37
  }
38
+ /**
39
+ * Read
40
+ * @param id Id
41
+ * @param payload Payload
42
+ * @param reload Reload data
43
+ * @returns Result
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;
53
+ }
37
54
  /**
38
55
  * Switch organization
39
56
  * @param id Organization id
@@ -0,0 +1,59 @@
1
+ import { EntityStatus } from '../../business/EntityStatus';
2
+ export type OrgViewDto = {
3
+ /**
4
+ * Id
5
+ */
6
+ id: number;
7
+ /**
8
+ * Entity id
9
+ */
10
+ entityId: number;
11
+ /**
12
+ * Trade as
13
+ */
14
+ tradeAs?: string;
15
+ /**
16
+ * Brand, like ETSOO
17
+ */
18
+ brand?: string;
19
+ /**
20
+ * Name, like ETSOO NZ LIMITED
21
+ */
22
+ name: string;
23
+ /**
24
+ * Country or region id, like CN = China
25
+ */
26
+ regionId?: string;
27
+ /**
28
+ * State id
29
+ */
30
+ stateId?: string;
31
+ /**
32
+ * City id
33
+ */
34
+ cityId?: string;
35
+ /**
36
+ * Identifier id
37
+ */
38
+ identifier?: string;
39
+ /**
40
+ * Avatar or logo
41
+ */
42
+ avatar?: string;
43
+ /**
44
+ * Corporate or personal
45
+ */
46
+ corporate?: boolean;
47
+ /**
48
+ * Expiry time
49
+ */
50
+ expiry?: string | Date;
51
+ /**
52
+ * Entity status
53
+ */
54
+ entityStatus: EntityStatus;
55
+ /**
56
+ * Creation
57
+ */
58
+ creation: string | Date;
59
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -25,6 +25,7 @@ export * from './erp/dto/IdLabelPrimaryDto';
25
25
  export * from './erp/dto/InitCallDto';
26
26
  export * from './erp/dto/OrgDto';
27
27
  export * from './erp/dto/OrgQueryDto';
28
+ export * from './erp/dto/OrgViewDto';
28
29
  export * from './erp/dto/PublicProductDto';
29
30
  export * from './erp/dto/ResultPayload';
30
31
  export * from './erp/rq/MemberListRQ';
package/lib/cjs/index.js CHANGED
@@ -48,6 +48,7 @@ __exportStar(require("./erp/dto/IdLabelPrimaryDto"), exports);
48
48
  __exportStar(require("./erp/dto/InitCallDto"), exports);
49
49
  __exportStar(require("./erp/dto/OrgDto"), exports);
50
50
  __exportStar(require("./erp/dto/OrgQueryDto"), exports);
51
+ __exportStar(require("./erp/dto/OrgViewDto"), exports);
51
52
  __exportStar(require("./erp/dto/PublicProductDto"), exports);
52
53
  __exportStar(require("./erp/dto/ResultPayload"), exports);
53
54
  // erp rq
@@ -3,6 +3,7 @@ import { DataTypes, ListType } from '@etsoo/shared';
3
3
  import { IApp } from '../app/IApp';
4
4
  import { OrgDto } from './dto/OrgDto';
5
5
  import { OrgQueryDto } from './dto/OrgQueryDto';
6
+ import { OrgViewDto } from './dto/OrgViewDto';
6
7
  import { IdResultPayload } from './dto/ResultPayload';
7
8
  import { EntityApi } from './EntityApi';
8
9
  import { OrgListRQ } from './rq/OrgListRQ';
@@ -32,6 +33,14 @@ export declare class OrgApi extends EntityApi {
32
33
  * @returns Result
33
34
  */
34
35
  query(rq: OrgQueryRQ, payload?: IApiPayload<OrgQueryDto[]>): Promise<OrgQueryDto[] | undefined>;
36
+ /**
37
+ * Read
38
+ * @param id Id
39
+ * @param payload Payload
40
+ * @param reload Reload data
41
+ * @returns Result
42
+ */
43
+ read(id: number, payload?: IApiPayload<OrgViewDto>, reload?: boolean): Promise<OrgViewDto | undefined>;
35
44
  /**
36
45
  * Switch organization
37
46
  * @param id Organization id
@@ -1,4 +1,5 @@
1
1
  import { EntityApi } from './EntityApi';
2
+ const cachedOrgs = {};
2
3
  /**
3
4
  * Organization API
4
5
  */
@@ -31,6 +32,22 @@ export class OrgApi extends EntityApi {
31
32
  query(rq, payload) {
32
33
  return this.queryBase(rq, payload);
33
34
  }
35
+ /**
36
+ * Read
37
+ * @param id Id
38
+ * @param payload Payload
39
+ * @param reload Reload data
40
+ * @returns Result
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;
50
+ }
34
51
  /**
35
52
  * Switch organization
36
53
  * @param id Organization id
@@ -0,0 +1,59 @@
1
+ import { EntityStatus } from '../../business/EntityStatus';
2
+ export type OrgViewDto = {
3
+ /**
4
+ * Id
5
+ */
6
+ id: number;
7
+ /**
8
+ * Entity id
9
+ */
10
+ entityId: number;
11
+ /**
12
+ * Trade as
13
+ */
14
+ tradeAs?: string;
15
+ /**
16
+ * Brand, like ETSOO
17
+ */
18
+ brand?: string;
19
+ /**
20
+ * Name, like ETSOO NZ LIMITED
21
+ */
22
+ name: string;
23
+ /**
24
+ * Country or region id, like CN = China
25
+ */
26
+ regionId?: string;
27
+ /**
28
+ * State id
29
+ */
30
+ stateId?: string;
31
+ /**
32
+ * City id
33
+ */
34
+ cityId?: string;
35
+ /**
36
+ * Identifier id
37
+ */
38
+ identifier?: string;
39
+ /**
40
+ * Avatar or logo
41
+ */
42
+ avatar?: string;
43
+ /**
44
+ * Corporate or personal
45
+ */
46
+ corporate?: boolean;
47
+ /**
48
+ * Expiry time
49
+ */
50
+ expiry?: string | Date;
51
+ /**
52
+ * Entity status
53
+ */
54
+ entityStatus: EntityStatus;
55
+ /**
56
+ * Creation
57
+ */
58
+ creation: string | Date;
59
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -25,6 +25,7 @@ export * from './erp/dto/IdLabelPrimaryDto';
25
25
  export * from './erp/dto/InitCallDto';
26
26
  export * from './erp/dto/OrgDto';
27
27
  export * from './erp/dto/OrgQueryDto';
28
+ export * from './erp/dto/OrgViewDto';
28
29
  export * from './erp/dto/PublicProductDto';
29
30
  export * from './erp/dto/ResultPayload';
30
31
  export * from './erp/rq/MemberListRQ';
package/lib/mjs/index.js CHANGED
@@ -31,6 +31,7 @@ export * from './erp/dto/IdLabelPrimaryDto';
31
31
  export * from './erp/dto/InitCallDto';
32
32
  export * from './erp/dto/OrgDto';
33
33
  export * from './erp/dto/OrgQueryDto';
34
+ export * from './erp/dto/OrgViewDto';
34
35
  export * from './erp/dto/PublicProductDto';
35
36
  export * from './erp/dto/ResultPayload';
36
37
  // erp rq
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/appscript",
3
- "version": "1.3.41",
3
+ "version": "1.3.43",
4
4
  "description": "Applications shared TypeScript framework",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -60,13 +60,13 @@
60
60
  },
61
61
  "devDependencies": {
62
62
  "@babel/cli": "^7.19.3",
63
- "@babel/core": "^7.20.2",
63
+ "@babel/core": "^7.20.5",
64
64
  "@babel/plugin-transform-runtime": "^7.19.6",
65
65
  "@babel/preset-env": "^7.20.2",
66
- "@babel/runtime-corejs3": "^7.20.1",
66
+ "@babel/runtime-corejs3": "^7.20.6",
67
67
  "@types/jest": "^29.2.3",
68
- "@typescript-eslint/eslint-plugin": "^5.44.0",
69
- "@typescript-eslint/parser": "^5.44.0",
68
+ "@typescript-eslint/eslint-plugin": "^5.45.0",
69
+ "@typescript-eslint/parser": "^5.45.0",
70
70
  "eslint": "^8.28.0",
71
71
  "eslint-config-airbnb-base": "^15.0.0",
72
72
  "eslint-plugin-import": "^2.26.0",
package/src/erp/OrgApi.ts CHANGED
@@ -3,11 +3,14 @@ import { DataTypes, ListType } from '@etsoo/shared';
3
3
  import { IApp } from '../app/IApp';
4
4
  import { OrgDto } from './dto/OrgDto';
5
5
  import { OrgQueryDto } from './dto/OrgQueryDto';
6
+ import { OrgViewDto } from './dto/OrgViewDto';
6
7
  import { IdResultPayload } from './dto/ResultPayload';
7
8
  import { EntityApi } from './EntityApi';
8
9
  import { OrgListRQ } from './rq/OrgListRQ';
9
10
  import { OrgQueryRQ } from './rq/OrgQueryRQ';
10
11
 
12
+ const cachedOrgs: { [P: number]: OrgViewDto | undefined | null } = {};
13
+
11
14
  /**
12
15
  * Organization API
13
16
  */
@@ -58,6 +61,26 @@ export class OrgApi extends EntityApi {
58
61
  return this.queryBase(rq, payload);
59
62
  }
60
63
 
64
+ /**
65
+ * Read
66
+ * @param id Id
67
+ * @param payload Payload
68
+ * @param reload Reload data
69
+ * @returns Result
70
+ */
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;
82
+ }
83
+
61
84
  /**
62
85
  * Switch organization
63
86
  * @param id Organization id
@@ -0,0 +1,73 @@
1
+ import { EntityStatus } from '../../business/EntityStatus';
2
+
3
+ export type OrgViewDto = {
4
+ /**
5
+ * Id
6
+ */
7
+ id: number;
8
+
9
+ /**
10
+ * Entity id
11
+ */
12
+ entityId: number;
13
+
14
+ /**
15
+ * Trade as
16
+ */
17
+ tradeAs?: string;
18
+
19
+ /**
20
+ * Brand, like ETSOO
21
+ */
22
+ brand?: string;
23
+
24
+ /**
25
+ * Name, like ETSOO NZ LIMITED
26
+ */
27
+ name: string;
28
+
29
+ /**
30
+ * Country or region id, like CN = China
31
+ */
32
+ regionId?: string;
33
+
34
+ /**
35
+ * State id
36
+ */
37
+ stateId?: string;
38
+
39
+ /**
40
+ * City id
41
+ */
42
+ cityId?: string;
43
+
44
+ /**
45
+ * Identifier id
46
+ */
47
+ identifier?: string;
48
+
49
+ /**
50
+ * Avatar or logo
51
+ */
52
+ avatar?: string;
53
+
54
+ /**
55
+ * Corporate or personal
56
+ */
57
+ corporate?: boolean;
58
+
59
+ /**
60
+ * Expiry time
61
+ */
62
+ expiry?: string | Date;
63
+
64
+ /**
65
+ * Entity status
66
+ */
67
+ entityStatus: EntityStatus;
68
+
69
+ /**
70
+ * Creation
71
+ */
72
+ creation: string | Date;
73
+ };
package/src/index.ts CHANGED
@@ -36,6 +36,7 @@ export * from './erp/dto/IdLabelPrimaryDto';
36
36
  export * from './erp/dto/InitCallDto';
37
37
  export * from './erp/dto/OrgDto';
38
38
  export * from './erp/dto/OrgQueryDto';
39
+ export * from './erp/dto/OrgViewDto';
39
40
  export * from './erp/dto/PublicProductDto';
40
41
  export * from './erp/dto/ResultPayload';
41
42