@etsoo/smarterp-core 1.0.48 → 1.0.49

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.
@@ -15,6 +15,7 @@ if (isLocalTest) {
15
15
 
16
16
  const api = new OrgApi(app);
17
17
 
18
+ /*
18
19
  test("Test for create, delete", async () => {
19
20
  const guid = Utils.newGUID().slice(0, 20);
20
21
  const random = Date.now() % 2 == 0;
@@ -55,6 +56,7 @@ if (isLocalTest) {
55
56
 
56
57
  expect(deleteResult?.ok).toBeTruthy();
57
58
  });
59
+ */
58
60
 
59
61
  test("Test for query zero return", async () => {
60
62
  const result = await api.query({
@@ -82,8 +84,7 @@ if (isLocalTest) {
82
84
  enabled: true,
83
85
  excludedIds: [1, 2, 3],
84
86
  queryPaging: {
85
- keysets: ["青岛亿速", 1100],
86
- batchSize: 5,
87
+ batchSize: 2,
87
88
  orderBy: [{ field: "name" }, { field: "id", desc: true, unique: true }]
88
89
  }
89
90
  });
@@ -40,6 +40,12 @@ if (isLocalTest) {
40
40
  expect(result?.startsWith("data:image/png;base64")).toBeTruthy();
41
41
  });
42
42
 
43
+ test("Test for getCultures", async () => {
44
+ const result = await api.getCultures(["zh-CN", "en-US", "fr-FR"]);
45
+ expect(result).not.toBeNull();
46
+ expect(result?.length).toBe(3);
47
+ });
48
+
43
49
  test("Test for getCurrencies all", async () => {
44
50
  const result = await api.getCurrencies();
45
51
 
@@ -20,7 +20,7 @@ if (isLocalTest) {
20
20
  const core = result.find((a) => a.id === 1);
21
21
  expect(core).not.toBeNull();
22
22
 
23
- expect(core?.name).toBe("司友云ERP主控制台");
23
+ expect(core?.name).toBe("司友云ERP管理中心");
24
24
  });
25
25
  } else {
26
26
  test("Skip the test", () => {
@@ -6,7 +6,7 @@ import { OrgQueryDto } from "./dto/org/OrgQueryDto";
6
6
  import { OrgReadDto } from "./dto/org/OrgReadDto";
7
7
  import { OrgUpdateReadDto } from "./dto/org/OrgUpdateReadDto";
8
8
  import { OrgListDto } from "./dto/org/OrgListDto";
9
- import { AntiforgeryRequestToken, EntityApi, IApp, IdResultPayload, ResultPayload, StringIdResultPayload } from "@etsoo/appscript";
9
+ import { AntiforgeryRequestToken, CustomCulture, EntityApi, IApp, IdResultPayload, ResultPayload, StringIdResultPayload } from "@etsoo/appscript";
10
10
  import { OrgListRQ } from "./rq/org/OrgListRQ";
11
11
  import { OrgGetMyRQ } from "./rq/org/OrgGetMyRQ";
12
12
  import { OrgGetMyData } from "./dto/org/OrgGetMyData";
@@ -54,6 +54,13 @@ export declare class OrgApi extends EntityApi {
54
54
  * @returns Result
55
55
  */
56
56
  formatHtmlContent(content: string, payload?: IApiPayload<string>): Promise<string | undefined>;
57
+ /**
58
+ * Get current organization's custom resources
59
+ * @param culture Culture
60
+ * @param payload Payload
61
+ * @returns Result
62
+ */
63
+ getCustomResources(culture: string, payload?: IApiPayload<CustomCulture[]>): Promise<CustomCulture[] | undefined>;
57
64
  /**
58
65
  * Get user's latest accessed organizations
59
66
  * @param rq Request data
package/lib/cjs/OrgApi.js CHANGED
@@ -64,6 +64,15 @@ class OrgApi extends appscript_1.EntityApi {
64
64
  formatHtmlContent(content, payload) {
65
65
  return this.api.post(`${this.flag}/FormatHtmlContent`, content, payload);
66
66
  }
67
+ /**
68
+ * Get current organization's custom resources
69
+ * @param culture Culture
70
+ * @param payload Payload
71
+ * @returns Result
72
+ */
73
+ getCustomResources(culture, payload) {
74
+ return this.api.get(`${this.flag}/GetCustomResources/${culture}`, undefined, payload);
75
+ }
67
76
  /**
68
77
  * Get user's latest accessed organizations
69
78
  * @param rq Request data
@@ -6,7 +6,7 @@ import { CurrencyItem } from "./dto/public/CurrencyItem";
6
6
  import { RegionData } from "./dto/public/RegionData";
7
7
  import { PlaceQueryRQ } from "./rq/public/PlaceQueryRQ";
8
8
  import { PlaceCommon } from "./dto/public/PlaceCommon";
9
- import { BaseApi, Currency, IApp, ProductUnit, ResultPayload } from "@etsoo/appscript";
9
+ import { BaseApi, CultureItem, Currency, CustomCulture, IApp, ProductUnit, ResultPayload } from "@etsoo/appscript";
10
10
  import { MemberInvitationDto } from "./dto/public/MemberInvitationDto";
11
11
  import { AcceptInvitationRQ } from "./rq/public/AcceptInvitationRQ";
12
12
  import { ChinaPinData } from "./dto/public/ChinaPinData";
@@ -41,6 +41,13 @@ export declare class PublicApi extends BaseApi {
41
41
  * @returns Label
42
42
  */
43
43
  getCurrencyLabel(currency: Currency | string): string;
44
+ /**
45
+ * Get cultures
46
+ * @param ids Culture ids to include and order by
47
+ * @param payload Payload
48
+ * @returns Result
49
+ */
50
+ getCultures(ids: string[], payload?: IApiPayload<CultureItem[]>): Promise<CultureItem[] | undefined>;
44
51
  /**
45
52
  * Get currencies
46
53
  * @param ids Currency ids to include and order by
@@ -48,6 +55,13 @@ export declare class PublicApi extends BaseApi {
48
55
  * @returns Result
49
56
  */
50
57
  getCurrencies(ids?: string[], payload?: IApiPayload<CurrencyItem[]>): Promise<CurrencyItem[] | undefined>;
58
+ /**
59
+ * Get custom resources
60
+ * @param culture Culture
61
+ * @param payload Payload
62
+ * @returns Result
63
+ */
64
+ getCustomResources(culture: string, payload?: IApiPayload<CustomCulture[]>): Promise<CustomCulture[] | undefined>;
51
65
  /**
52
66
  * Get Pinyin
53
67
  * @param rq Request data
@@ -44,6 +44,18 @@ class PublicApi extends appscript_1.BaseApi {
44
44
  const c = `currency${currency}`;
45
45
  return this.app.get(c) ?? c;
46
46
  }
47
+ /**
48
+ * Get cultures
49
+ * @param ids Culture ids to include and order by
50
+ * @param payload Payload
51
+ * @returns Result
52
+ */
53
+ getCultures(ids, payload) {
54
+ return this.api.post("Public/GetCultures", ids, {
55
+ ...payload,
56
+ contentType: "application/json"
57
+ });
58
+ }
47
59
  /**
48
60
  * Get currencies
49
61
  * @param ids Currency ids to include and order by
@@ -51,7 +63,19 @@ class PublicApi extends appscript_1.BaseApi {
51
63
  * @returns Result
52
64
  */
53
65
  getCurrencies(ids, payload) {
54
- return this.api.post("Public/GetCurrencies", ids, payload);
66
+ return this.api.post("Public/GetCurrencies", ids, {
67
+ ...payload,
68
+ contentType: "application/json"
69
+ });
70
+ }
71
+ /**
72
+ * Get custom resources
73
+ * @param culture Culture
74
+ * @param payload Payload
75
+ * @returns Result
76
+ */
77
+ getCustomResources(culture, payload) {
78
+ return this.api.get(`Public/GetCustomResources/${culture}`, undefined, payload);
55
79
  }
56
80
  /**
57
81
  * Get Pinyin
@@ -69,7 +93,10 @@ class PublicApi extends appscript_1.BaseApi {
69
93
  * @returns Result
70
94
  */
71
95
  getRegions(ids, payload) {
72
- return this.api.post("Public/GetRegions", ids, payload);
96
+ return this.api.post("Public/GetRegions", ids, {
97
+ ...payload,
98
+ contentType: "application/json"
99
+ });
73
100
  }
74
101
  /**
75
102
  * Get product unit's label
@@ -6,7 +6,7 @@ import { OrgQueryDto } from "./dto/org/OrgQueryDto";
6
6
  import { OrgReadDto } from "./dto/org/OrgReadDto";
7
7
  import { OrgUpdateReadDto } from "./dto/org/OrgUpdateReadDto";
8
8
  import { OrgListDto } from "./dto/org/OrgListDto";
9
- import { AntiforgeryRequestToken, EntityApi, IApp, IdResultPayload, ResultPayload, StringIdResultPayload } from "@etsoo/appscript";
9
+ import { AntiforgeryRequestToken, CustomCulture, EntityApi, IApp, IdResultPayload, ResultPayload, StringIdResultPayload } from "@etsoo/appscript";
10
10
  import { OrgListRQ } from "./rq/org/OrgListRQ";
11
11
  import { OrgGetMyRQ } from "./rq/org/OrgGetMyRQ";
12
12
  import { OrgGetMyData } from "./dto/org/OrgGetMyData";
@@ -54,6 +54,13 @@ export declare class OrgApi extends EntityApi {
54
54
  * @returns Result
55
55
  */
56
56
  formatHtmlContent(content: string, payload?: IApiPayload<string>): Promise<string | undefined>;
57
+ /**
58
+ * Get current organization's custom resources
59
+ * @param culture Culture
60
+ * @param payload Payload
61
+ * @returns Result
62
+ */
63
+ getCustomResources(culture: string, payload?: IApiPayload<CustomCulture[]>): Promise<CustomCulture[] | undefined>;
57
64
  /**
58
65
  * Get user's latest accessed organizations
59
66
  * @param rq Request data
package/lib/mjs/OrgApi.js CHANGED
@@ -61,6 +61,15 @@ export class OrgApi extends EntityApi {
61
61
  formatHtmlContent(content, payload) {
62
62
  return this.api.post(`${this.flag}/FormatHtmlContent`, content, payload);
63
63
  }
64
+ /**
65
+ * Get current organization's custom resources
66
+ * @param culture Culture
67
+ * @param payload Payload
68
+ * @returns Result
69
+ */
70
+ getCustomResources(culture, payload) {
71
+ return this.api.get(`${this.flag}/GetCustomResources/${culture}`, undefined, payload);
72
+ }
64
73
  /**
65
74
  * Get user's latest accessed organizations
66
75
  * @param rq Request data
@@ -6,7 +6,7 @@ import { CurrencyItem } from "./dto/public/CurrencyItem";
6
6
  import { RegionData } from "./dto/public/RegionData";
7
7
  import { PlaceQueryRQ } from "./rq/public/PlaceQueryRQ";
8
8
  import { PlaceCommon } from "./dto/public/PlaceCommon";
9
- import { BaseApi, Currency, IApp, ProductUnit, ResultPayload } from "@etsoo/appscript";
9
+ import { BaseApi, CultureItem, Currency, CustomCulture, IApp, ProductUnit, ResultPayload } from "@etsoo/appscript";
10
10
  import { MemberInvitationDto } from "./dto/public/MemberInvitationDto";
11
11
  import { AcceptInvitationRQ } from "./rq/public/AcceptInvitationRQ";
12
12
  import { ChinaPinData } from "./dto/public/ChinaPinData";
@@ -41,6 +41,13 @@ export declare class PublicApi extends BaseApi {
41
41
  * @returns Label
42
42
  */
43
43
  getCurrencyLabel(currency: Currency | string): string;
44
+ /**
45
+ * Get cultures
46
+ * @param ids Culture ids to include and order by
47
+ * @param payload Payload
48
+ * @returns Result
49
+ */
50
+ getCultures(ids: string[], payload?: IApiPayload<CultureItem[]>): Promise<CultureItem[] | undefined>;
44
51
  /**
45
52
  * Get currencies
46
53
  * @param ids Currency ids to include and order by
@@ -48,6 +55,13 @@ export declare class PublicApi extends BaseApi {
48
55
  * @returns Result
49
56
  */
50
57
  getCurrencies(ids?: string[], payload?: IApiPayload<CurrencyItem[]>): Promise<CurrencyItem[] | undefined>;
58
+ /**
59
+ * Get custom resources
60
+ * @param culture Culture
61
+ * @param payload Payload
62
+ * @returns Result
63
+ */
64
+ getCustomResources(culture: string, payload?: IApiPayload<CustomCulture[]>): Promise<CustomCulture[] | undefined>;
51
65
  /**
52
66
  * Get Pinyin
53
67
  * @param rq Request data
@@ -41,6 +41,18 @@ export class PublicApi extends BaseApi {
41
41
  const c = `currency${currency}`;
42
42
  return this.app.get(c) ?? c;
43
43
  }
44
+ /**
45
+ * Get cultures
46
+ * @param ids Culture ids to include and order by
47
+ * @param payload Payload
48
+ * @returns Result
49
+ */
50
+ getCultures(ids, payload) {
51
+ return this.api.post("Public/GetCultures", ids, {
52
+ ...payload,
53
+ contentType: "application/json"
54
+ });
55
+ }
44
56
  /**
45
57
  * Get currencies
46
58
  * @param ids Currency ids to include and order by
@@ -48,7 +60,19 @@ export class PublicApi extends BaseApi {
48
60
  * @returns Result
49
61
  */
50
62
  getCurrencies(ids, payload) {
51
- return this.api.post("Public/GetCurrencies", ids, payload);
63
+ return this.api.post("Public/GetCurrencies", ids, {
64
+ ...payload,
65
+ contentType: "application/json"
66
+ });
67
+ }
68
+ /**
69
+ * Get custom resources
70
+ * @param culture Culture
71
+ * @param payload Payload
72
+ * @returns Result
73
+ */
74
+ getCustomResources(culture, payload) {
75
+ return this.api.get(`Public/GetCustomResources/${culture}`, undefined, payload);
52
76
  }
53
77
  /**
54
78
  * Get Pinyin
@@ -66,7 +90,10 @@ export class PublicApi extends BaseApi {
66
90
  * @returns Result
67
91
  */
68
92
  getRegions(ids, payload) {
69
- return this.api.post("Public/GetRegions", ids, payload);
93
+ return this.api.post("Public/GetRegions", ids, {
94
+ ...payload,
95
+ contentType: "application/json"
96
+ });
70
97
  }
71
98
  /**
72
99
  * Get product unit's label
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/smarterp-core",
3
- "version": "1.0.48",
3
+ "version": "1.0.49",
4
4
  "description": "TypeScript APIs for SmartERP Core",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -53,8 +53,8 @@
53
53
  "vitest": "^3.1.2"
54
54
  },
55
55
  "dependencies": {
56
- "@etsoo/appscript": "^1.6.26",
57
- "@etsoo/materialui": "^1.5.32",
56
+ "@etsoo/appscript": "^1.6.29",
57
+ "@etsoo/materialui": "^1.5.35",
58
58
  "@etsoo/react": "^1.8.40",
59
59
  "@etsoo/shared": "^1.2.69",
60
60
  "@etsoo/toolpad": "^1.0.26",
package/src/OrgApi.ts CHANGED
@@ -8,6 +8,7 @@ import { OrgUpdateReadDto } from "./dto/org/OrgUpdateReadDto";
8
8
  import { OrgListDto } from "./dto/org/OrgListDto";
9
9
  import {
10
10
  AntiforgeryRequestToken,
11
+ CustomCulture,
11
12
  EntityApi,
12
13
  IApp,
13
14
  IdResultPayload,
@@ -96,6 +97,20 @@ export class OrgApi extends EntityApi {
96
97
  return this.api.post(`${this.flag}/FormatHtmlContent`, content, payload);
97
98
  }
98
99
 
100
+ /**
101
+ * Get current organization's custom resources
102
+ * @param culture Culture
103
+ * @param payload Payload
104
+ * @returns Result
105
+ */
106
+ getCustomResources(culture: string, payload?: IApiPayload<CustomCulture[]>) {
107
+ return this.api.get(
108
+ `${this.flag}/GetCustomResources/${culture}`,
109
+ undefined,
110
+ payload
111
+ );
112
+ }
113
+
99
114
  /**
100
115
  * Get user's latest accessed organizations
101
116
  * @param rq Request data
package/src/PublicApi.ts CHANGED
@@ -8,7 +8,9 @@ import { PlaceQueryRQ } from "./rq/public/PlaceQueryRQ";
8
8
  import { PlaceCommon } from "./dto/public/PlaceCommon";
9
9
  import {
10
10
  BaseApi,
11
+ CultureItem,
11
12
  Currency,
13
+ CustomCulture,
12
14
  IApp,
13
15
  ProductUnit,
14
16
  RepeatOption,
@@ -64,6 +66,19 @@ export class PublicApi extends BaseApi {
64
66
  return this.app.get(c) ?? c;
65
67
  }
66
68
 
69
+ /**
70
+ * Get cultures
71
+ * @param ids Culture ids to include and order by
72
+ * @param payload Payload
73
+ * @returns Result
74
+ */
75
+ getCultures(ids: string[], payload?: IApiPayload<CultureItem[]>) {
76
+ return this.api.post("Public/GetCultures", ids, {
77
+ ...payload,
78
+ contentType: "application/json"
79
+ });
80
+ }
81
+
67
82
  /**
68
83
  * Get currencies
69
84
  * @param ids Currency ids to include and order by
@@ -71,7 +86,24 @@ export class PublicApi extends BaseApi {
71
86
  * @returns Result
72
87
  */
73
88
  getCurrencies(ids?: string[], payload?: IApiPayload<CurrencyItem[]>) {
74
- return this.api.post("Public/GetCurrencies", ids, payload);
89
+ return this.api.post("Public/GetCurrencies", ids, {
90
+ ...payload,
91
+ contentType: "application/json"
92
+ });
93
+ }
94
+
95
+ /**
96
+ * Get custom resources
97
+ * @param culture Culture
98
+ * @param payload Payload
99
+ * @returns Result
100
+ */
101
+ getCustomResources(culture: string, payload?: IApiPayload<CustomCulture[]>) {
102
+ return this.api.get(
103
+ `Public/GetCustomResources/${culture}`,
104
+ undefined,
105
+ payload
106
+ );
75
107
  }
76
108
 
77
109
  /**
@@ -91,7 +123,10 @@ export class PublicApi extends BaseApi {
91
123
  * @returns Result
92
124
  */
93
125
  getRegions(ids?: string[], payload?: IApiPayload<RegionData[]>) {
94
- return this.api.post("Public/GetRegions", ids, payload);
126
+ return this.api.post("Public/GetRegions", ids, {
127
+ ...payload,
128
+ contentType: "application/json"
129
+ });
95
130
  }
96
131
 
97
132
  /**