@etsoo/appscript 1.3.7 → 1.3.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/README.md +2 -14
- package/__tests__/app/CoreApp.ts +11 -0
- package/lib/cjs/app/CoreApp.d.ts +1 -1
- package/lib/cjs/erp/AddressApi.d.ts +1 -1
- package/lib/cjs/erp/AddressApi.js +2 -2
- package/lib/cjs/erp/BaseApi.d.ts +5 -3
- package/lib/cjs/erp/BaseApi.js +3 -1
- package/lib/cjs/erp/EntityApi.d.ts +78 -0
- package/lib/cjs/erp/EntityApi.js +91 -0
- package/lib/cjs/erp/OrgApi.d.ts +32 -5
- package/lib/cjs/erp/OrgApi.js +30 -12
- package/lib/cjs/erp/PublicApi.js +5 -5
- package/lib/cjs/{dto → erp/dto}/IdLabelDto.d.ts +0 -0
- package/lib/cjs/{dto → erp/dto}/IdLabelDto.js +0 -0
- package/lib/cjs/{dto → erp/dto}/IdLabelPrimaryDto.d.ts +0 -0
- package/lib/cjs/{dto → erp/dto}/IdLabelPrimaryDto.js +0 -0
- package/lib/cjs/{dto → erp/dto}/InitCallDto.d.ts +0 -0
- package/lib/cjs/{dto → erp/dto}/InitCallDto.js +0 -0
- package/lib/cjs/erp/dto/OrgQueryDto.d.ts +21 -0
- package/lib/cjs/{rq/LoginIdRQ.js → erp/dto/OrgQueryDto.js} +0 -0
- package/lib/cjs/erp/rq/OrgListRQ.d.ts +10 -0
- package/lib/cjs/{rq/LoginRQ.js → erp/rq/OrgListRQ.js} +0 -0
- package/lib/cjs/erp/rq/OrgQueryRQ.d.ts +14 -0
- package/lib/cjs/{rq/QueryRQ.js → erp/rq/OrgQueryRQ.js} +0 -0
- package/lib/cjs/erp/rq/OrgRQ.d.ts +29 -0
- package/lib/cjs/{rq/TiplistRQ.js → erp/rq/OrgRQ.js} +0 -0
- package/lib/cjs/{rq → erp/rq}/QueryRQ.d.ts +0 -0
- package/lib/cjs/erp/rq/QueryRQ.js +2 -0
- package/lib/cjs/erp/rq/RefreshTokenRQ.d.ts +29 -0
- package/lib/cjs/erp/rq/RefreshTokenRQ.js +2 -0
- package/lib/cjs/{rq → erp/rq}/TiplistRQ.d.ts +0 -0
- package/lib/cjs/erp/rq/TiplistRQ.js +2 -0
- package/lib/cjs/i18n/en-US.json +1 -0
- package/lib/cjs/i18n/zh-CN.json +1 -0
- package/lib/cjs/i18n/zh-HK.json +1 -0
- package/lib/cjs/index.d.ts +7 -7
- package/lib/cjs/index.js +10 -10
- package/lib/mjs/app/CoreApp.d.ts +1 -1
- package/lib/mjs/erp/AddressApi.d.ts +1 -1
- package/lib/mjs/erp/AddressApi.js +2 -2
- package/lib/mjs/erp/BaseApi.d.ts +5 -3
- package/lib/mjs/erp/BaseApi.js +3 -1
- package/lib/mjs/erp/EntityApi.d.ts +78 -0
- package/lib/mjs/erp/EntityApi.js +87 -0
- package/lib/mjs/erp/OrgApi.d.ts +32 -5
- package/lib/mjs/erp/OrgApi.js +30 -12
- package/lib/mjs/erp/PublicApi.js +5 -5
- package/lib/mjs/{dto → erp/dto}/IdLabelDto.d.ts +0 -0
- package/lib/mjs/{dto → erp/dto}/IdLabelDto.js +0 -0
- package/lib/mjs/{dto → erp/dto}/IdLabelPrimaryDto.d.ts +0 -0
- package/lib/mjs/{dto → erp/dto}/IdLabelPrimaryDto.js +0 -0
- package/lib/mjs/{dto → erp/dto}/InitCallDto.d.ts +0 -0
- package/lib/mjs/{dto → erp/dto}/InitCallDto.js +0 -0
- package/lib/mjs/erp/dto/OrgQueryDto.d.ts +21 -0
- package/lib/mjs/{rq/LoginIdRQ.js → erp/dto/OrgQueryDto.js} +0 -0
- package/lib/mjs/erp/rq/OrgListRQ.d.ts +10 -0
- package/lib/mjs/{rq/LoginRQ.js → erp/rq/OrgListRQ.js} +0 -0
- package/lib/mjs/erp/rq/OrgQueryRQ.d.ts +14 -0
- package/lib/mjs/{rq/QueryRQ.js → erp/rq/OrgQueryRQ.js} +0 -0
- package/lib/mjs/erp/rq/OrgRQ.d.ts +29 -0
- package/lib/mjs/{rq/TiplistRQ.js → erp/rq/OrgRQ.js} +0 -0
- package/lib/mjs/{rq → erp/rq}/QueryRQ.d.ts +0 -0
- package/lib/mjs/erp/rq/QueryRQ.js +1 -0
- package/lib/mjs/erp/rq/RefreshTokenRQ.d.ts +29 -0
- package/lib/mjs/erp/rq/RefreshTokenRQ.js +1 -0
- package/lib/mjs/{rq → erp/rq}/TiplistRQ.d.ts +0 -0
- package/lib/mjs/erp/rq/TiplistRQ.js +1 -0
- package/lib/mjs/i18n/en-US.json +1 -0
- package/lib/mjs/i18n/zh-CN.json +1 -0
- package/lib/mjs/i18n/zh-HK.json +1 -0
- package/lib/mjs/index.d.ts +7 -7
- package/lib/mjs/index.js +10 -10
- package/package.json +2 -2
- package/src/app/CoreApp.ts +1 -1
- package/src/erp/AddressApi.ts +3 -3
- package/src/erp/BaseApi.ts +3 -2
- package/src/erp/EntityApi.ts +142 -0
- package/src/erp/OrgApi.ts +66 -19
- package/src/erp/PublicApi.ts +5 -7
- package/src/{dto → erp/dto}/IdLabelDto.ts +0 -0
- package/src/{dto → erp/dto}/IdLabelPrimaryDto.ts +0 -0
- package/src/{dto → erp/dto}/InitCallDto.ts +0 -0
- package/src/erp/dto/OrgQueryDto.ts +24 -0
- package/src/erp/rq/OrgListRQ.ts +11 -0
- package/src/erp/rq/OrgQueryRQ.ts +16 -0
- package/src/erp/rq/OrgRQ.ts +34 -0
- package/src/{rq → erp/rq}/QueryRQ.ts +0 -0
- package/src/erp/rq/RefreshTokenRQ.ts +34 -0
- package/src/{rq → erp/rq}/TiplistRQ.ts +0 -0
- package/src/i18n/en-US.json +1 -0
- package/src/i18n/zh-CN.json +1 -0
- package/src/i18n/zh-HK.json +1 -0
- package/src/index.ts +11 -12
- package/lib/cjs/rq/LoginIdRQ.d.ts +0 -17
- package/lib/cjs/rq/LoginRQ.d.ts +0 -22
- package/lib/mjs/rq/LoginIdRQ.d.ts +0 -17
- package/lib/mjs/rq/LoginRQ.d.ts +0 -22
- package/src/rq/LoginIdRQ.ts +0 -19
- package/src/rq/LoginRQ.ts +0 -26
package/README.md
CHANGED
|
@@ -91,20 +91,6 @@ $ yarn add @etsoo/appscript
|
|
|
91
91
|
#### ListItem.ts ####
|
|
92
92
|
- ListItem - List item definition
|
|
93
93
|
|
|
94
|
-
### dto - Data transfer object
|
|
95
|
-
|
|
96
|
-
#### IdDto.ts ####
|
|
97
|
-
- IdDto - Dto with id field
|
|
98
|
-
|
|
99
|
-
#### IdLabelDto.ts ####
|
|
100
|
-
- IdLabelDto - Dto with id and label field
|
|
101
|
-
|
|
102
|
-
#### IdLabelPrimaryDto.ts ####
|
|
103
|
-
- IdLabelPrimaryDto - Dto with id, label and primary field
|
|
104
|
-
|
|
105
|
-
#### IdLabelPrimaryDto.ts ####
|
|
106
|
-
- InitCallDto - Init call dto
|
|
107
|
-
|
|
108
94
|
### i18n - Multiple cultures
|
|
109
95
|
|
|
110
96
|
### result - API action result
|
|
@@ -126,6 +112,8 @@ $ yarn add @etsoo/appscript
|
|
|
126
112
|
- InitCallResultData - Init call result data
|
|
127
113
|
- InitCallResult - Init call result
|
|
128
114
|
|
|
115
|
+
### erp - SmartERP APIs
|
|
116
|
+
|
|
129
117
|
### state - State management
|
|
130
118
|
|
|
131
119
|
#### Culture.ts ####
|
package/__tests__/app/CoreApp.ts
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
enUS,
|
|
14
14
|
ExternalSettings,
|
|
15
15
|
IUser,
|
|
16
|
+
OrgApi,
|
|
16
17
|
PublicApi,
|
|
17
18
|
UserRole
|
|
18
19
|
} from '../../src';
|
|
@@ -130,12 +131,14 @@ class CoreAppTest extends CoreApp<
|
|
|
130
131
|
}
|
|
131
132
|
}
|
|
132
133
|
|
|
134
|
+
// Mixins example
|
|
133
135
|
function EnhanceApp<TBase extends DataTypes.MConstructor<CoreAppTest>>(
|
|
134
136
|
Base: TBase
|
|
135
137
|
) {
|
|
136
138
|
return class extends Base {
|
|
137
139
|
readonly addressApi = new AddressApi(this);
|
|
138
140
|
readonly publicApi = new PublicApi(this);
|
|
141
|
+
readonly orgApi = new OrgApi(this);
|
|
139
142
|
};
|
|
140
143
|
}
|
|
141
144
|
|
|
@@ -218,4 +221,12 @@ test('Tests for publicApi', async () => {
|
|
|
218
221
|
|
|
219
222
|
const currencies = await app.publicApi.currencies(['NZD', 'AUD', 'USD']);
|
|
220
223
|
expect(currencies[1].id).toBe('AUD');
|
|
224
|
+
|
|
225
|
+
/*
|
|
226
|
+
const orgs = await app.orgApi.list();
|
|
227
|
+
console.log(orgs);
|
|
228
|
+
|
|
229
|
+
const orgsQuery = await app.orgApi.query({ currentPage: 1, batchSize: 2 });
|
|
230
|
+
console.log(orgsQuery);
|
|
231
|
+
*/
|
|
221
232
|
});
|
package/lib/cjs/app/CoreApp.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { INotifier, NotificationAlign, NotificationCallProps, NotificationConten
|
|
|
2
2
|
import { ApiDataError, IApi, IPData } from '@etsoo/restclient';
|
|
3
3
|
import { DataTypes, DateUtils, IStorage, ListType, ListType1 } from '@etsoo/shared';
|
|
4
4
|
import { AddressRegion } from '../address/AddressRegion';
|
|
5
|
-
import { InitCallDto } from '../dto/InitCallDto';
|
|
5
|
+
import { InitCallDto } from '../erp/dto/InitCallDto';
|
|
6
6
|
import { IActionResult } from '../result/IActionResult';
|
|
7
7
|
import { InitCallResult, InitCallResultData } from '../result/InitCallResult';
|
|
8
8
|
import { IUser } from '../state/User';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AddressContinent } from '../address/AddressContinent';
|
|
2
2
|
import { AddressRegion, AddressRegionDb } from '../address/AddressRegion';
|
|
3
3
|
import { AddressState } from '../address/AddressState';
|
|
4
|
-
import { IdLabelConditional } from '
|
|
4
|
+
import { IdLabelConditional } from './dto/IdLabelDto';
|
|
5
5
|
import { BaseApi } from './BaseApi';
|
|
6
6
|
/**
|
|
7
7
|
* Address Api
|
|
@@ -44,7 +44,7 @@ class AddressApi extends BaseApi_1.BaseApi {
|
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
46
|
else {
|
|
47
|
-
return (await this.
|
|
47
|
+
return (await this.api.get(`Address/RegionList?language=${this.app.culture}`, undefined, { defaultValue: [] }));
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
/**
|
|
@@ -53,7 +53,7 @@ class AddressApi extends BaseApi_1.BaseApi {
|
|
|
53
53
|
* @returns Result
|
|
54
54
|
*/
|
|
55
55
|
states(regionId) {
|
|
56
|
-
return this.
|
|
56
|
+
return this.api.get(`Address/StateList?regionId=${regionId}&language=${this.app.culture}`, undefined, { defaultValue: [] });
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
exports.AddressApi = AddressApi;
|
package/lib/cjs/erp/BaseApi.d.ts
CHANGED
|
@@ -2,11 +2,13 @@ import { IApp } from '../app/IApp';
|
|
|
2
2
|
/**
|
|
3
3
|
* SmartERP base API
|
|
4
4
|
*/
|
|
5
|
-
export declare class BaseApi {
|
|
6
|
-
protected app:
|
|
5
|
+
export declare class BaseApi<T extends IApp = IApp> {
|
|
6
|
+
protected app: T;
|
|
7
|
+
protected api: import("@etsoo/restclient").IApi<any>;
|
|
7
8
|
/**
|
|
8
9
|
* Constructor
|
|
9
10
|
* @param app Application
|
|
11
|
+
* @param api API
|
|
10
12
|
*/
|
|
11
|
-
constructor(app:
|
|
13
|
+
constructor(app: T, api?: import("@etsoo/restclient").IApi<any>);
|
|
12
14
|
}
|
package/lib/cjs/erp/BaseApi.js
CHANGED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { IApi, IApiPayload } from '@etsoo/restclient';
|
|
2
|
+
import { DataTypes } from '@etsoo/shared';
|
|
3
|
+
import { IApp } from '../app/IApp';
|
|
4
|
+
import { IActionResult } from '../result/IActionResult';
|
|
5
|
+
import { BaseApi } from './BaseApi';
|
|
6
|
+
import { QueryRQ } from './rq/QueryRQ';
|
|
7
|
+
import { TiplistRQ } from './rq/TiplistRQ';
|
|
8
|
+
/**
|
|
9
|
+
* Entity API
|
|
10
|
+
* Follow com.etsoo.CoreFramework.Services.EntityServiceBase
|
|
11
|
+
*/
|
|
12
|
+
export declare class EntityApi<T extends IApp = IApp> extends BaseApi<T> {
|
|
13
|
+
protected flag: string;
|
|
14
|
+
/**
|
|
15
|
+
* Constructor
|
|
16
|
+
* @param flag Identity flag, like 'Product' for product APIs
|
|
17
|
+
* @param app Application
|
|
18
|
+
*/
|
|
19
|
+
constructor(flag: string, app: T, api?: IApi);
|
|
20
|
+
/**
|
|
21
|
+
* Create
|
|
22
|
+
* @param data Modal data
|
|
23
|
+
* @param payload Payload
|
|
24
|
+
* @returns Result
|
|
25
|
+
*/
|
|
26
|
+
protected createBase<R extends IActionResult>(data: object, payload?: IApiPayload<R, any>): Promise<R | undefined>;
|
|
27
|
+
/**
|
|
28
|
+
* Delete
|
|
29
|
+
* @param id Id or ids
|
|
30
|
+
* @param payload Payload
|
|
31
|
+
*/
|
|
32
|
+
protected deleteBase<R extends IActionResult>(id: DataTypes.IdType, payload?: IApiPayload<R, any>): R;
|
|
33
|
+
protected deleteBase<R extends IActionResult>(ids: DataTypes.IdType[], payload?: IApiPayload<R, any>): R;
|
|
34
|
+
/**
|
|
35
|
+
* List
|
|
36
|
+
* @param rq Request data
|
|
37
|
+
* @param payload Payload
|
|
38
|
+
* @returns Result
|
|
39
|
+
*/
|
|
40
|
+
protected listBase<RQ extends TiplistRQ, R extends object>(rq: RQ, payload?: IApiPayload<R[], any>): Promise<R[] | undefined>;
|
|
41
|
+
/**
|
|
42
|
+
* Query
|
|
43
|
+
* @param rq Request data
|
|
44
|
+
* @param payload Payload
|
|
45
|
+
* @returns Result
|
|
46
|
+
*/
|
|
47
|
+
protected queryBase<RQ extends QueryRQ, R extends object>(rq: RQ, payload?: IApiPayload<R[], any>): Promise<R[] | undefined>;
|
|
48
|
+
/**
|
|
49
|
+
* Read
|
|
50
|
+
* @param id Id
|
|
51
|
+
* @param payload Payload
|
|
52
|
+
* @returns Result
|
|
53
|
+
*/
|
|
54
|
+
protected readBase<R extends object>(id: DataTypes.IdType, payload?: IApiPayload<R, any>): Promise<R | undefined>;
|
|
55
|
+
/**
|
|
56
|
+
* Sort
|
|
57
|
+
* @param items Items to sort
|
|
58
|
+
* @param payload Payload
|
|
59
|
+
* @returns Result
|
|
60
|
+
*/
|
|
61
|
+
protected sortBase<RQ extends {
|
|
62
|
+
id: DataTypes.IdType;
|
|
63
|
+
}>(items: RQ[], payload?: IApiPayload<number, any>): Promise<number | undefined>;
|
|
64
|
+
/**
|
|
65
|
+
* Update
|
|
66
|
+
* @param data Modal data
|
|
67
|
+
* @param payload Payload
|
|
68
|
+
* @returns Result
|
|
69
|
+
*/
|
|
70
|
+
protected updateBase<R extends IActionResult>(data: object, payload?: IApiPayload<R, any>): Promise<R | undefined>;
|
|
71
|
+
/**
|
|
72
|
+
* Read for update
|
|
73
|
+
* @param id Id
|
|
74
|
+
* @param payload Payload
|
|
75
|
+
* @returns Result
|
|
76
|
+
*/
|
|
77
|
+
protected updateReadBase<R extends object>(id: DataTypes.IdType, payload?: IApiPayload<R, any>): Promise<R | undefined>;
|
|
78
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EntityApi = void 0;
|
|
4
|
+
const BaseApi_1 = require("./BaseApi");
|
|
5
|
+
/**
|
|
6
|
+
* Entity API
|
|
7
|
+
* Follow com.etsoo.CoreFramework.Services.EntityServiceBase
|
|
8
|
+
*/
|
|
9
|
+
class EntityApi extends BaseApi_1.BaseApi {
|
|
10
|
+
/**
|
|
11
|
+
* Constructor
|
|
12
|
+
* @param flag Identity flag, like 'Product' for product APIs
|
|
13
|
+
* @param app Application
|
|
14
|
+
*/
|
|
15
|
+
constructor(flag, app, api) {
|
|
16
|
+
super(app, api);
|
|
17
|
+
this.flag = flag;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Create
|
|
21
|
+
* @param data Modal data
|
|
22
|
+
* @param payload Payload
|
|
23
|
+
* @returns Result
|
|
24
|
+
*/
|
|
25
|
+
createBase(data, payload) {
|
|
26
|
+
return this.api.put(`${this.flag}/Create`, data, payload);
|
|
27
|
+
}
|
|
28
|
+
deleteBase(id, payload) {
|
|
29
|
+
const query = Array.isArray(id)
|
|
30
|
+
? '?' + id.map((item) => `ids=${item}`).join('&')
|
|
31
|
+
: id;
|
|
32
|
+
return this.api.delete(`${this.flag}/Delete/${query}`, undefined, payload);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* List
|
|
36
|
+
* @param rq Request data
|
|
37
|
+
* @param payload Payload
|
|
38
|
+
* @returns Result
|
|
39
|
+
*/
|
|
40
|
+
listBase(rq, payload) {
|
|
41
|
+
return this.api.post(`${this.flag}/List`, rq, payload);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Query
|
|
45
|
+
* @param rq Request data
|
|
46
|
+
* @param payload Payload
|
|
47
|
+
* @returns Result
|
|
48
|
+
*/
|
|
49
|
+
queryBase(rq, payload) {
|
|
50
|
+
return this.api.post(`${this.flag}/Query`, rq, payload);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Read
|
|
54
|
+
* @param id Id
|
|
55
|
+
* @param payload Payload
|
|
56
|
+
* @returns Result
|
|
57
|
+
*/
|
|
58
|
+
readBase(id, payload) {
|
|
59
|
+
return this.api.get(`${this.flag}/Read/${id}`, payload);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Sort
|
|
63
|
+
* @param items Items to sort
|
|
64
|
+
* @param payload Payload
|
|
65
|
+
* @returns Result
|
|
66
|
+
*/
|
|
67
|
+
sortBase(items, payload) {
|
|
68
|
+
const rq = {};
|
|
69
|
+
items.forEach((item, index) => (rq[item.id] = index));
|
|
70
|
+
return this.api.put(`${this.flag}/Sort`, rq, payload);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Update
|
|
74
|
+
* @param data Modal data
|
|
75
|
+
* @param payload Payload
|
|
76
|
+
* @returns Result
|
|
77
|
+
*/
|
|
78
|
+
updateBase(data, payload) {
|
|
79
|
+
return this.api.put(`${this.flag}/Update`, data, payload);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Read for update
|
|
83
|
+
* @param id Id
|
|
84
|
+
* @param payload Payload
|
|
85
|
+
* @returns Result
|
|
86
|
+
*/
|
|
87
|
+
updateReadBase(id, payload) {
|
|
88
|
+
return this.api.get(`${this.flag}/UpdateRead/${id}`, payload);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
exports.EntityApi = EntityApi;
|
package/lib/cjs/erp/OrgApi.d.ts
CHANGED
|
@@ -1,20 +1,47 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { IApiPayload } from '@etsoo/restclient';
|
|
2
|
+
import { DataTypes, ListType } from '@etsoo/shared';
|
|
3
|
+
import { IApp } from '../app/IApp';
|
|
4
|
+
import { IdActionResult } from '../result/IActionResult';
|
|
5
|
+
import { OrgQueryDto } from './dto/OrgQueryDto';
|
|
6
|
+
import { EntityApi } from './EntityApi';
|
|
7
|
+
import { OrgListRQ } from './rq/OrgListRQ';
|
|
8
|
+
import { OrgQueryRQ } from './rq/OrgQueryRQ';
|
|
9
|
+
import { OrgRQ } from './rq/OrgRQ';
|
|
3
10
|
/**
|
|
4
11
|
* Organization API
|
|
5
12
|
*/
|
|
6
|
-
export declare class OrgApi extends
|
|
13
|
+
export declare class OrgApi extends EntityApi {
|
|
14
|
+
/**
|
|
15
|
+
* Constructor
|
|
16
|
+
* @param app Application
|
|
17
|
+
*/
|
|
18
|
+
constructor(app: IApp);
|
|
7
19
|
/**
|
|
8
20
|
* Get organization list
|
|
9
|
-
* @param items Max items
|
|
21
|
+
* @param items Max items or request data
|
|
10
22
|
* @param serviceId Service id
|
|
11
23
|
* @returns Result
|
|
12
24
|
*/
|
|
13
25
|
list(items?: number, serviceId?: number): Promise<ListType[] | undefined>;
|
|
26
|
+
list(rq: OrgListRQ): Promise<ListType[] | undefined>;
|
|
27
|
+
/**
|
|
28
|
+
* Query
|
|
29
|
+
* @param rq Request data
|
|
30
|
+
* @param payload Payload
|
|
31
|
+
* @returns Result
|
|
32
|
+
*/
|
|
33
|
+
query(rq: OrgQueryRQ, payload?: IApiPayload<OrgQueryDto[], any>): Promise<OrgQueryDto[] | undefined>;
|
|
14
34
|
/**
|
|
15
35
|
* Switch organization
|
|
16
36
|
* @param id Organization id
|
|
17
37
|
* @param serviceId Service id
|
|
18
38
|
*/
|
|
19
|
-
switch(id: number, serviceId?: number): Promise<boolean | undefined>;
|
|
39
|
+
switch(id: number, serviceId?: number, payload?: IApiPayload<boolean, any>): Promise<boolean | undefined>;
|
|
40
|
+
/**
|
|
41
|
+
* Update
|
|
42
|
+
* @param data Modal data
|
|
43
|
+
* @param payload Payload
|
|
44
|
+
* @returns Result
|
|
45
|
+
*/
|
|
46
|
+
update(data: DataTypes.AddOrEditType<OrgRQ, true>, payload?: IApiPayload<IdActionResult, any>): Promise<IdActionResult<number> | undefined>;
|
|
20
47
|
}
|
package/lib/cjs/erp/OrgApi.js
CHANGED
|
@@ -1,37 +1,55 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.OrgApi = void 0;
|
|
4
|
-
const
|
|
4
|
+
const EntityApi_1 = require("./EntityApi");
|
|
5
5
|
/**
|
|
6
6
|
* Organization API
|
|
7
7
|
*/
|
|
8
|
-
class OrgApi extends
|
|
8
|
+
class OrgApi extends EntityApi_1.EntityApi {
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
11
|
-
* @param
|
|
12
|
-
|
|
10
|
+
* Constructor
|
|
11
|
+
* @param app Application
|
|
12
|
+
*/
|
|
13
|
+
constructor(app) {
|
|
14
|
+
super('Organization', app);
|
|
15
|
+
}
|
|
16
|
+
list(items, serviceId, payload) {
|
|
17
|
+
payload !== null && payload !== void 0 ? payload : (payload = { defaultValue: [], showLoading: false });
|
|
18
|
+
const rq = typeof items === 'object' ? items : { items, serviceId };
|
|
19
|
+
return this.listBase(rq, payload);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Query
|
|
23
|
+
* @param rq Request data
|
|
24
|
+
* @param payload Payload
|
|
13
25
|
* @returns Result
|
|
14
26
|
*/
|
|
15
|
-
|
|
16
|
-
return this.
|
|
17
|
-
items,
|
|
18
|
-
serviceId
|
|
19
|
-
}, { defaultValue: [], showLoading: false });
|
|
27
|
+
query(rq, payload) {
|
|
28
|
+
return this.queryBase(rq, payload);
|
|
20
29
|
}
|
|
21
30
|
/**
|
|
22
31
|
* Switch organization
|
|
23
32
|
* @param id Organization id
|
|
24
33
|
* @param serviceId Service id
|
|
25
34
|
*/
|
|
26
|
-
async switch(id, serviceId) {
|
|
35
|
+
async switch(id, serviceId, payload) {
|
|
27
36
|
const result = await this.app.api.put('Organization/Switch', {
|
|
28
37
|
id,
|
|
29
38
|
serviceId,
|
|
30
39
|
deviceId: this.app.deviceId
|
|
31
|
-
});
|
|
40
|
+
}, payload);
|
|
32
41
|
if (result)
|
|
33
42
|
return await this.app.refreshToken();
|
|
34
43
|
return result;
|
|
35
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Update
|
|
47
|
+
* @param data Modal data
|
|
48
|
+
* @param payload Payload
|
|
49
|
+
* @returns Result
|
|
50
|
+
*/
|
|
51
|
+
update(data, payload) {
|
|
52
|
+
return super.updateBase(data, payload);
|
|
53
|
+
}
|
|
36
54
|
}
|
|
37
55
|
exports.OrgApi = OrgApi;
|
package/lib/cjs/erp/PublicApi.js
CHANGED
|
@@ -16,7 +16,7 @@ class PublicApi extends BaseApi_1.BaseApi {
|
|
|
16
16
|
*/
|
|
17
17
|
async currencies(currencyNames) {
|
|
18
18
|
if (currencyNames == null)
|
|
19
|
-
return (await this.
|
|
19
|
+
return (await this.api.get('Public/GetCurrencies'));
|
|
20
20
|
else
|
|
21
21
|
return currencyNames.map((name) => {
|
|
22
22
|
var _a;
|
|
@@ -32,7 +32,7 @@ class PublicApi extends BaseApi_1.BaseApi {
|
|
|
32
32
|
* @returns Result
|
|
33
33
|
*/
|
|
34
34
|
exchangeRate(currency) {
|
|
35
|
-
return this.
|
|
35
|
+
return this.api.get(`Public/ExchangeRate/${currency}`);
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
38
|
* Get exchange rate history
|
|
@@ -41,7 +41,7 @@ class PublicApi extends BaseApi_1.BaseApi {
|
|
|
41
41
|
* @returns Result
|
|
42
42
|
*/
|
|
43
43
|
exchangeRateHistory(currencies, months) {
|
|
44
|
-
return this.
|
|
44
|
+
return this.api.post('Public/ExchangeRateHistory', { currencies, months }, { defaultValue: [] });
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
47
|
* Get product unit's label
|
|
@@ -74,7 +74,7 @@ class PublicApi extends BaseApi_1.BaseApi {
|
|
|
74
74
|
* @param host Host URL
|
|
75
75
|
*/
|
|
76
76
|
mobileQRCode(id, host) {
|
|
77
|
-
return this.
|
|
77
|
+
return this.api.post('Public/MobileQRCode', { id, host });
|
|
78
78
|
}
|
|
79
79
|
/**
|
|
80
80
|
* Get public and valid product data
|
|
@@ -84,7 +84,7 @@ class PublicApi extends BaseApi_1.BaseApi {
|
|
|
84
84
|
*/
|
|
85
85
|
product(id, culture) {
|
|
86
86
|
culture = this.app.checkLanguage(culture);
|
|
87
|
-
return this.
|
|
87
|
+
return this.api.post(`Public/Product/${id}/${culture}`);
|
|
88
88
|
}
|
|
89
89
|
/**
|
|
90
90
|
*
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Organization query data
|
|
3
|
+
*/
|
|
4
|
+
export declare type OrgQueryDto = {
|
|
5
|
+
/**
|
|
6
|
+
* Id
|
|
7
|
+
*/
|
|
8
|
+
id: number;
|
|
9
|
+
/**
|
|
10
|
+
* Brand, like ETSOO
|
|
11
|
+
*/
|
|
12
|
+
brand?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Name, like ETSOO NZ LIMITED
|
|
15
|
+
*/
|
|
16
|
+
name: string;
|
|
17
|
+
/**
|
|
18
|
+
* Creation
|
|
19
|
+
*/
|
|
20
|
+
creation: string | Date;
|
|
21
|
+
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Organization add/edit request data
|
|
3
|
+
*/
|
|
4
|
+
export declare type OrgRQ = {
|
|
5
|
+
/**
|
|
6
|
+
* Id
|
|
7
|
+
*/
|
|
8
|
+
id: number;
|
|
9
|
+
/**
|
|
10
|
+
* Region id
|
|
11
|
+
*/
|
|
12
|
+
regionId: string;
|
|
13
|
+
/**
|
|
14
|
+
* Name
|
|
15
|
+
*/
|
|
16
|
+
name: string;
|
|
17
|
+
/**
|
|
18
|
+
* Identifier
|
|
19
|
+
*/
|
|
20
|
+
identifier: string;
|
|
21
|
+
/**
|
|
22
|
+
* Brand
|
|
23
|
+
*/
|
|
24
|
+
brand?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Trade as
|
|
27
|
+
*/
|
|
28
|
+
tradeAs?: string;
|
|
29
|
+
};
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Refresh token request data
|
|
3
|
+
*/
|
|
4
|
+
export declare type RefreshTokenRQ = {
|
|
5
|
+
/**
|
|
6
|
+
* Device id
|
|
7
|
+
*/
|
|
8
|
+
deviceId: string;
|
|
9
|
+
/**
|
|
10
|
+
* Login password
|
|
11
|
+
*/
|
|
12
|
+
pwd?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Service device id
|
|
15
|
+
*/
|
|
16
|
+
serviceDeviceId?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Service id
|
|
19
|
+
*/
|
|
20
|
+
serviceId?: number;
|
|
21
|
+
/**
|
|
22
|
+
* Service Uid
|
|
23
|
+
*/
|
|
24
|
+
serviceUid?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Time zone
|
|
27
|
+
*/
|
|
28
|
+
timezone?: string;
|
|
29
|
+
};
|
|
File without changes
|
package/lib/cjs/i18n/en-US.json
CHANGED
package/lib/cjs/i18n/zh-CN.json
CHANGED