@etsoo/appscript 1.3.6 → 1.3.8
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 +14 -14
- package/lib/cjs/address/AddressUtils.d.ts +0 -20
- package/lib/cjs/address/AddressUtils.js +0 -60
- package/lib/cjs/app/CoreApp.d.ts +11 -1
- package/lib/cjs/app/CoreApp.js +18 -2
- package/lib/cjs/app/IApp.d.ts +6 -0
- package/lib/cjs/erp/AddressApi.d.ts +13 -9
- package/lib/cjs/erp/AddressApi.js +23 -25
- 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 +25 -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 +20 -0
- package/lib/cjs/i18n/zh-CN.json +20 -0
- package/lib/cjs/i18n/zh-HK.json +20 -0
- package/lib/cjs/index.d.ts +7 -7
- package/lib/cjs/index.js +10 -10
- package/lib/mjs/address/AddressUtils.d.ts +0 -20
- package/lib/mjs/address/AddressUtils.js +0 -37
- package/lib/mjs/app/CoreApp.d.ts +11 -1
- package/lib/mjs/app/CoreApp.js +18 -2
- package/lib/mjs/app/IApp.d.ts +6 -0
- package/lib/mjs/erp/AddressApi.d.ts +13 -9
- package/lib/mjs/erp/AddressApi.js +23 -25
- 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 +25 -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 +20 -0
- package/lib/mjs/i18n/zh-CN.json +20 -0
- package/lib/mjs/i18n/zh-HK.json +20 -0
- package/lib/mjs/index.d.ts +7 -7
- package/lib/mjs/index.js +10 -10
- package/package.json +4 -4
- package/src/address/AddressUtils.ts +0 -45
- package/src/app/CoreApp.ts +21 -2
- package/src/app/IApp.ts +7 -0
- package/src/erp/AddressApi.ts +19 -22
- 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 +29 -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 +20 -0
- package/src/i18n/zh-CN.json +20 -0
- package/src/i18n/zh-HK.json +20 -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/i18n/address.en-US.json +0 -21
- package/src/i18n/address.zh-CN.json +0 -21
- package/src/i18n/address.zh-HK.json +0 -21
- package/src/rq/LoginIdRQ.ts +0 -19
- package/src/rq/LoginRQ.ts +0 -26
package/lib/mjs/app/IApp.d.ts
CHANGED
|
@@ -284,6 +284,12 @@ export interface IApp {
|
|
|
284
284
|
* @returns Cached token
|
|
285
285
|
*/
|
|
286
286
|
getCacheToken(): string | undefined;
|
|
287
|
+
/**
|
|
288
|
+
* Get region label
|
|
289
|
+
* @param id Region id
|
|
290
|
+
* @returns Label
|
|
291
|
+
*/
|
|
292
|
+
getRegionLabel(id: string): string;
|
|
287
293
|
/**
|
|
288
294
|
* Get all regions
|
|
289
295
|
* @returns Regions
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { AddressContinent } from '../address/AddressContinent';
|
|
1
2
|
import { AddressRegion, AddressRegionDb } from '../address/AddressRegion';
|
|
2
3
|
import { AddressState } from '../address/AddressState';
|
|
3
|
-
import { IdLabelConditional } from '
|
|
4
|
+
import { IdLabelConditional } from './dto/IdLabelDto';
|
|
4
5
|
import { BaseApi } from './BaseApi';
|
|
5
6
|
/**
|
|
6
7
|
* Address Api
|
|
@@ -8,23 +9,26 @@ import { BaseApi } from './BaseApi';
|
|
|
8
9
|
export declare class AddressApi extends BaseApi {
|
|
9
10
|
/**
|
|
10
11
|
* Get all continents
|
|
11
|
-
* @param language Language
|
|
12
12
|
* @param isNumberKey Is number key or key as id
|
|
13
13
|
* @returns Continents
|
|
14
14
|
*/
|
|
15
|
-
continents<T extends boolean>(
|
|
15
|
+
continents<T extends boolean>(isNumberKey?: T): Promise<IdLabelConditional<T>>;
|
|
16
16
|
/**
|
|
17
|
-
* Get
|
|
18
|
-
* @param
|
|
17
|
+
* Get continent label
|
|
18
|
+
* @param id Region id
|
|
19
|
+
* @returns Label
|
|
20
|
+
*/
|
|
21
|
+
getContinentLabel(id: AddressContinent | string): string;
|
|
22
|
+
/**
|
|
23
|
+
* Get region list
|
|
19
24
|
* @param isLocal Is local version
|
|
20
25
|
* @returns Result
|
|
21
26
|
*/
|
|
22
|
-
regions<T extends boolean = true>(
|
|
27
|
+
regions<T extends boolean = true>(isLocal?: T): Promise<T extends true | undefined ? AddressRegion[] : AddressRegionDb[] | undefined>;
|
|
23
28
|
/**
|
|
24
|
-
* Get state list
|
|
29
|
+
* Get state list
|
|
25
30
|
* @param regionId Region id
|
|
26
|
-
* @param language Language
|
|
27
31
|
* @returns Result
|
|
28
32
|
*/
|
|
29
|
-
states(regionId: string
|
|
33
|
+
states(regionId: string): Promise<AddressState[] | undefined>;
|
|
30
34
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { DataTypes } from '@etsoo/shared';
|
|
2
2
|
import { AddressContinent } from '../address/AddressContinent';
|
|
3
3
|
import { AddressRegion } from '../address/AddressRegion';
|
|
4
|
-
import { AddressUtils } from '../address/AddressUtils';
|
|
5
4
|
import { BaseApi } from './BaseApi';
|
|
6
5
|
/**
|
|
7
6
|
* Address Api
|
|
@@ -9,49 +8,48 @@ import { BaseApi } from './BaseApi';
|
|
|
9
8
|
export class AddressApi extends BaseApi {
|
|
10
9
|
/**
|
|
11
10
|
* Get all continents
|
|
12
|
-
* @param language Language
|
|
13
11
|
* @param isNumberKey Is number key or key as id
|
|
14
12
|
* @returns Continents
|
|
15
13
|
*/
|
|
16
|
-
async continents(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
14
|
+
async continents(isNumberKey = false) {
|
|
15
|
+
return DataTypes.getEnumKeys(AddressContinent).map((key) => ({
|
|
16
|
+
id: isNumberKey
|
|
17
|
+
? DataTypes.getEnumByKey(AddressContinent, key)
|
|
18
|
+
: key.toString(),
|
|
19
|
+
label: this.getContinentLabel(key)
|
|
20
|
+
}));
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Get continent label
|
|
24
|
+
* @param id Region id
|
|
25
|
+
* @returns Label
|
|
26
|
+
*/
|
|
27
|
+
getContinentLabel(id) {
|
|
28
|
+
var _a;
|
|
29
|
+
return (_a = this.app.get('continent' + id)) !== null && _a !== void 0 ? _a : id;
|
|
27
30
|
}
|
|
28
31
|
/**
|
|
29
|
-
* Get region list
|
|
30
|
-
* @param language Language
|
|
32
|
+
* Get region list
|
|
31
33
|
* @param isLocal Is local version
|
|
32
34
|
* @returns Result
|
|
33
35
|
*/
|
|
34
|
-
async regions(
|
|
35
|
-
language = this.app.checkLanguage(language);
|
|
36
|
+
async regions(isLocal) {
|
|
36
37
|
if (isLocal == null || isLocal) {
|
|
37
|
-
const labels = await AddressUtils.getLabels(language);
|
|
38
38
|
return AddressRegion.all.map((region) => {
|
|
39
|
-
region.label =
|
|
39
|
+
region.label = this.app.getRegionLabel(region.id);
|
|
40
40
|
return { ...region };
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
else {
|
|
44
|
-
return (await this.
|
|
44
|
+
return (await this.api.get(`Address/RegionList?language=${this.app.culture}`, undefined, { defaultValue: [] }));
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
/**
|
|
48
|
-
* Get state list
|
|
48
|
+
* Get state list
|
|
49
49
|
* @param regionId Region id
|
|
50
|
-
* @param language Language
|
|
51
50
|
* @returns Result
|
|
52
51
|
*/
|
|
53
|
-
states(regionId
|
|
54
|
-
|
|
55
|
-
return this.app.api.get(`Address/StateList?regionId=${regionId}&language=${language}`, undefined, { defaultValue: [] });
|
|
52
|
+
states(regionId) {
|
|
53
|
+
return this.api.get(`Address/StateList?regionId=${regionId}&language=${this.app.culture}`, undefined, { defaultValue: [] });
|
|
56
54
|
}
|
|
57
55
|
}
|
package/lib/mjs/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/mjs/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,87 @@
|
|
|
1
|
+
import { BaseApi } from './BaseApi';
|
|
2
|
+
/**
|
|
3
|
+
* Entity API
|
|
4
|
+
* Follow com.etsoo.CoreFramework.Services.EntityServiceBase
|
|
5
|
+
*/
|
|
6
|
+
export class EntityApi extends BaseApi {
|
|
7
|
+
/**
|
|
8
|
+
* Constructor
|
|
9
|
+
* @param flag Identity flag, like 'Product' for product APIs
|
|
10
|
+
* @param app Application
|
|
11
|
+
*/
|
|
12
|
+
constructor(flag, app, api) {
|
|
13
|
+
super(app, api);
|
|
14
|
+
this.flag = flag;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Create
|
|
18
|
+
* @param data Modal data
|
|
19
|
+
* @param payload Payload
|
|
20
|
+
* @returns Result
|
|
21
|
+
*/
|
|
22
|
+
createBase(data, payload) {
|
|
23
|
+
return this.api.put(`${this.flag}/Create`, data, payload);
|
|
24
|
+
}
|
|
25
|
+
deleteBase(id, payload) {
|
|
26
|
+
const query = Array.isArray(id)
|
|
27
|
+
? '?' + id.map((item) => `ids=${item}`).join('&')
|
|
28
|
+
: id;
|
|
29
|
+
return this.api.delete(`${this.flag}/Delete/${query}`, undefined, payload);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* List
|
|
33
|
+
* @param rq Request data
|
|
34
|
+
* @param payload Payload
|
|
35
|
+
* @returns Result
|
|
36
|
+
*/
|
|
37
|
+
listBase(rq, payload) {
|
|
38
|
+
return this.api.post(`${this.flag}/List`, rq, payload);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Query
|
|
42
|
+
* @param rq Request data
|
|
43
|
+
* @param payload Payload
|
|
44
|
+
* @returns Result
|
|
45
|
+
*/
|
|
46
|
+
queryBase(rq, payload) {
|
|
47
|
+
return this.api.post(`${this.flag}/Query`, rq, payload);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Read
|
|
51
|
+
* @param id Id
|
|
52
|
+
* @param payload Payload
|
|
53
|
+
* @returns Result
|
|
54
|
+
*/
|
|
55
|
+
readBase(id, payload) {
|
|
56
|
+
return this.api.get(`${this.flag}/Read/${id}`, payload);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Sort
|
|
60
|
+
* @param items Items to sort
|
|
61
|
+
* @param payload Payload
|
|
62
|
+
* @returns Result
|
|
63
|
+
*/
|
|
64
|
+
sortBase(items, payload) {
|
|
65
|
+
const rq = {};
|
|
66
|
+
items.forEach((item, index) => (rq[item.id] = index));
|
|
67
|
+
return this.api.put(`${this.flag}/Sort`, rq, payload);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Update
|
|
71
|
+
* @param data Modal data
|
|
72
|
+
* @param payload Payload
|
|
73
|
+
* @returns Result
|
|
74
|
+
*/
|
|
75
|
+
updateBase(data, payload) {
|
|
76
|
+
return this.api.put(`${this.flag}/Update`, data, payload);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Read for update
|
|
80
|
+
* @param id Id
|
|
81
|
+
* @param payload Payload
|
|
82
|
+
* @returns Result
|
|
83
|
+
*/
|
|
84
|
+
updateReadBase(id, payload) {
|
|
85
|
+
return this.api.get(`${this.flag}/UpdateRead/${id}`, payload);
|
|
86
|
+
}
|
|
87
|
+
}
|
package/lib/mjs/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/mjs/erp/OrgApi.js
CHANGED
|
@@ -1,33 +1,51 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EntityApi } from './EntityApi';
|
|
2
2
|
/**
|
|
3
3
|
* Organization API
|
|
4
4
|
*/
|
|
5
|
-
export class OrgApi extends
|
|
5
|
+
export class OrgApi extends EntityApi {
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
8
|
-
* @param
|
|
9
|
-
|
|
7
|
+
* Constructor
|
|
8
|
+
* @param app Application
|
|
9
|
+
*/
|
|
10
|
+
constructor(app) {
|
|
11
|
+
super('Organization', app);
|
|
12
|
+
}
|
|
13
|
+
list(items, serviceId, payload) {
|
|
14
|
+
payload !== null && payload !== void 0 ? payload : (payload = { defaultValue: [], showLoading: false });
|
|
15
|
+
const rq = typeof items === 'object' ? items : { items, serviceId };
|
|
16
|
+
return this.listBase(rq, payload);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Query
|
|
20
|
+
* @param rq Request data
|
|
21
|
+
* @param payload Payload
|
|
10
22
|
* @returns Result
|
|
11
23
|
*/
|
|
12
|
-
|
|
13
|
-
return this.
|
|
14
|
-
items,
|
|
15
|
-
serviceId
|
|
16
|
-
}, { defaultValue: [], showLoading: false });
|
|
24
|
+
query(rq, payload) {
|
|
25
|
+
return this.queryBase(rq, payload);
|
|
17
26
|
}
|
|
18
27
|
/**
|
|
19
28
|
* Switch organization
|
|
20
29
|
* @param id Organization id
|
|
21
30
|
* @param serviceId Service id
|
|
22
31
|
*/
|
|
23
|
-
async switch(id, serviceId) {
|
|
32
|
+
async switch(id, serviceId, payload) {
|
|
24
33
|
const result = await this.app.api.put('Organization/Switch', {
|
|
25
34
|
id,
|
|
26
35
|
serviceId,
|
|
27
36
|
deviceId: this.app.deviceId
|
|
28
|
-
});
|
|
37
|
+
}, payload);
|
|
29
38
|
if (result)
|
|
30
39
|
return await this.app.refreshToken();
|
|
31
40
|
return result;
|
|
32
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* Update
|
|
44
|
+
* @param data Modal data
|
|
45
|
+
* @param payload Payload
|
|
46
|
+
* @returns Result
|
|
47
|
+
*/
|
|
48
|
+
update(data, payload) {
|
|
49
|
+
return super.updateBase(data, payload);
|
|
50
|
+
}
|
|
33
51
|
}
|
package/lib/mjs/erp/PublicApi.js
CHANGED
|
@@ -13,7 +13,7 @@ export class PublicApi extends BaseApi {
|
|
|
13
13
|
*/
|
|
14
14
|
async currencies(currencyNames) {
|
|
15
15
|
if (currencyNames == null)
|
|
16
|
-
return (await this.
|
|
16
|
+
return (await this.api.get('Public/GetCurrencies'));
|
|
17
17
|
else
|
|
18
18
|
return currencyNames.map((name) => {
|
|
19
19
|
var _a;
|
|
@@ -29,7 +29,7 @@ export class PublicApi extends BaseApi {
|
|
|
29
29
|
* @returns Result
|
|
30
30
|
*/
|
|
31
31
|
exchangeRate(currency) {
|
|
32
|
-
return this.
|
|
32
|
+
return this.api.get(`Public/ExchangeRate/${currency}`);
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
35
|
* Get exchange rate history
|
|
@@ -38,7 +38,7 @@ export class PublicApi extends BaseApi {
|
|
|
38
38
|
* @returns Result
|
|
39
39
|
*/
|
|
40
40
|
exchangeRateHistory(currencies, months) {
|
|
41
|
-
return this.
|
|
41
|
+
return this.api.post('Public/ExchangeRateHistory', { currencies, months }, { defaultValue: [] });
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
44
44
|
* Get product unit's label
|
|
@@ -71,7 +71,7 @@ export class PublicApi extends BaseApi {
|
|
|
71
71
|
* @param host Host URL
|
|
72
72
|
*/
|
|
73
73
|
mobileQRCode(id, host) {
|
|
74
|
-
return this.
|
|
74
|
+
return this.api.post('Public/MobileQRCode', { id, host });
|
|
75
75
|
}
|
|
76
76
|
/**
|
|
77
77
|
* Get public and valid product data
|
|
@@ -81,7 +81,7 @@ export class PublicApi extends BaseApi {
|
|
|
81
81
|
*/
|
|
82
82
|
product(id, culture) {
|
|
83
83
|
culture = this.app.checkLanguage(culture);
|
|
84
|
-
return this.
|
|
84
|
+
return this.api.post(`Public/Product/${id}/${culture}`);
|
|
85
85
|
}
|
|
86
86
|
/**
|
|
87
87
|
*
|
|
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,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Organization add/edit request data
|
|
3
|
+
*/
|
|
4
|
+
export declare type OrgRQ = {
|
|
5
|
+
/**
|
|
6
|
+
* Region id
|
|
7
|
+
*/
|
|
8
|
+
regionId: string;
|
|
9
|
+
/**
|
|
10
|
+
* Name
|
|
11
|
+
*/
|
|
12
|
+
name: string;
|
|
13
|
+
/**
|
|
14
|
+
* Identifier
|
|
15
|
+
*/
|
|
16
|
+
identifier: string;
|
|
17
|
+
/**
|
|
18
|
+
* Brand
|
|
19
|
+
*/
|
|
20
|
+
brand?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Trade as
|
|
23
|
+
*/
|
|
24
|
+
tradeAs?: string;
|
|
25
|
+
};
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|