@etsoo/appscript 1.4.9 → 1.4.11

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.
@@ -151,6 +151,16 @@ test('Test for properties', () => {
151
151
  expect(app.settings.currentRegion.label).toBe('中国大陆');
152
152
  });
153
153
 
154
+ test('Test for formatAction', () => {
155
+ Object.assign(app.settings.currentCulture.resources, {
156
+ appName: '司友®云ERP'
157
+ });
158
+ expect(app.formatAction('修改', '客户A')).toBe('[司友®云ERP] 修改 - 客户A');
159
+ expect(app.formatAction('修改', '客户A', '企业')).toBe(
160
+ '[司友®云ERP] 修改 - 客户A, 企业'
161
+ );
162
+ });
163
+
154
164
  test('Tests for addRootUrl', () => {
155
165
  expect(app.addRootUrl('/home')).toBe('/cms/home');
156
166
  expect(app.addRootUrl('./home')).toBe('/cms/./home');
@@ -294,6 +294,14 @@ export declare abstract class CoreApp<U extends IUser, S extends IAppSettings, N
294
294
  * @returns Enhanced passphrase
295
295
  */
296
296
  protected encryptionEnhance(passphrase: string, timestamp: string): string;
297
+ /**
298
+ * Format action
299
+ * @param action Action
300
+ * @param target Target name or title
301
+ * @param items More items
302
+ * @returns Result
303
+ */
304
+ formatAction(action: string, target: string, ...items: string[]): string;
297
305
  /**
298
306
  * Format date to string
299
307
  * @param input Input date
@@ -757,6 +757,17 @@ class CoreApp {
757
757
  passphrase += passphrase.length.toString();
758
758
  return passphrase;
759
759
  }
760
+ /**
761
+ * Format action
762
+ * @param action Action
763
+ * @param target Target name or title
764
+ * @param items More items
765
+ * @returns Result
766
+ */
767
+ formatAction(action, target, ...items) {
768
+ let more = items.join(', ');
769
+ return `[${this.get('appName')}] ${action} - ${target}${more ? `, ${more}` : more}`;
770
+ }
760
771
  /**
761
772
  * Format date to string
762
773
  * @param input Input date
@@ -233,6 +233,14 @@ export interface IApp {
233
233
  * @returns string
234
234
  */
235
235
  formatDate(input?: Date | string, options?: DateUtils.FormatOptions, timeZone?: string): string | undefined;
236
+ /**
237
+ * Format action
238
+ * @param action Action
239
+ * @param target Target name or title
240
+ * @param items More items
241
+ * @returns Result
242
+ */
243
+ formatAction(action: string, target: string, ...items: string[]): string;
236
244
  /**
237
245
  * Format error
238
246
  * @param error Error
@@ -8,6 +8,7 @@ import { IdResultPayload } from './dto/ResultPayload';
8
8
  import { EntityApi } from './EntityApi';
9
9
  import { OrgListRQ } from './rq/OrgListRQ';
10
10
  import { OrgQueryRQ } from './rq/OrgQueryRQ';
11
+ import { SendActionMessageRQ } from './rq/SendActionMessageRQ';
11
12
  /**
12
13
  * Organization API
13
14
  */
@@ -41,6 +42,13 @@ export declare class OrgApi extends EntityApi {
41
42
  * @returns Result
42
43
  */
43
44
  read(id: number, payload?: IApiPayload<OrgViewDto>, reload?: boolean): Promise<OrgViewDto | undefined>;
45
+ /**
46
+ * Send action message
47
+ * @param rq Request data
48
+ * @param payload Payload
49
+ * @returns Result
50
+ */
51
+ sendActionMessage(rq: SendActionMessageRQ, payload?: IApiPayload<void>): Promise<void | undefined>;
44
52
  /**
45
53
  * Switch organization
46
54
  * @param id Organization id
@@ -51,6 +51,17 @@ class OrgApi extends EntityApi_1.EntityApi {
51
51
  }
52
52
  return data;
53
53
  }
54
+ /**
55
+ * Send action message
56
+ * @param rq Request data
57
+ * @param payload Payload
58
+ * @returns Result
59
+ */
60
+ sendActionMessage(rq, payload) {
61
+ const appId = 'serviceId' in this.app.settings ? this.app.settings.serviceId : 0;
62
+ payload !== null && payload !== void 0 ? payload : (payload = { showLoading: false });
63
+ return this.api.post('System/SendActionMessage', { ...rq, appId }, payload);
64
+ }
54
65
  /**
55
66
  * Switch organization
56
67
  * @param id Organization id
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Send action message request data
3
+ * 发送操作信息请求数据
4
+ */
5
+ export type SendActionMessageRQ = {
6
+ /**
7
+ * Kind
8
+ * 类型
9
+ */
10
+ kind: string;
11
+ /**
12
+ * Title
13
+ * 标题
14
+ */
15
+ title: string;
16
+ /**
17
+ * Related id
18
+ * 相关编号
19
+ */
20
+ relatedId?: number;
21
+ /**
22
+ * More data
23
+ * 更多数据
24
+ */
25
+ data?: Record<string, unknown>;
26
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -51,6 +51,7 @@ export * from './erp/rq/QueryRQ';
51
51
  export * from './erp/rq/RefreshTokenRQ';
52
52
  export * from './erp/rq/RegionsRQ';
53
53
  export * from './erp/rq/ResetPasswordRQ';
54
+ export * from './erp/rq/SendActionMessageRQ';
54
55
  export * from './erp/rq/TiplistRQ';
55
56
  export * from './erp/rq/UpdateStatusRQ';
56
57
  export * from './erp/AddressApi';
package/lib/cjs/index.js CHANGED
@@ -75,6 +75,7 @@ __exportStar(require("./erp/rq/QueryRQ"), exports);
75
75
  __exportStar(require("./erp/rq/RefreshTokenRQ"), exports);
76
76
  __exportStar(require("./erp/rq/RegionsRQ"), exports);
77
77
  __exportStar(require("./erp/rq/ResetPasswordRQ"), exports);
78
+ __exportStar(require("./erp/rq/SendActionMessageRQ"), exports);
78
79
  __exportStar(require("./erp/rq/TiplistRQ"), exports);
79
80
  __exportStar(require("./erp/rq/UpdateStatusRQ"), exports);
80
81
  // erp api
@@ -294,6 +294,14 @@ export declare abstract class CoreApp<U extends IUser, S extends IAppSettings, N
294
294
  * @returns Enhanced passphrase
295
295
  */
296
296
  protected encryptionEnhance(passphrase: string, timestamp: string): string;
297
+ /**
298
+ * Format action
299
+ * @param action Action
300
+ * @param target Target name or title
301
+ * @param items More items
302
+ * @returns Result
303
+ */
304
+ formatAction(action: string, target: string, ...items: string[]): string;
297
305
  /**
298
306
  * Format date to string
299
307
  * @param input Input date
@@ -731,6 +731,17 @@ export class CoreApp {
731
731
  passphrase += passphrase.length.toString();
732
732
  return passphrase;
733
733
  }
734
+ /**
735
+ * Format action
736
+ * @param action Action
737
+ * @param target Target name or title
738
+ * @param items More items
739
+ * @returns Result
740
+ */
741
+ formatAction(action, target, ...items) {
742
+ let more = items.join(', ');
743
+ return `[${this.get('appName')}] ${action} - ${target}${more ? `, ${more}` : more}`;
744
+ }
734
745
  /**
735
746
  * Format date to string
736
747
  * @param input Input date
@@ -233,6 +233,14 @@ export interface IApp {
233
233
  * @returns string
234
234
  */
235
235
  formatDate(input?: Date | string, options?: DateUtils.FormatOptions, timeZone?: string): string | undefined;
236
+ /**
237
+ * Format action
238
+ * @param action Action
239
+ * @param target Target name or title
240
+ * @param items More items
241
+ * @returns Result
242
+ */
243
+ formatAction(action: string, target: string, ...items: string[]): string;
236
244
  /**
237
245
  * Format error
238
246
  * @param error Error
@@ -8,6 +8,7 @@ import { IdResultPayload } from './dto/ResultPayload';
8
8
  import { EntityApi } from './EntityApi';
9
9
  import { OrgListRQ } from './rq/OrgListRQ';
10
10
  import { OrgQueryRQ } from './rq/OrgQueryRQ';
11
+ import { SendActionMessageRQ } from './rq/SendActionMessageRQ';
11
12
  /**
12
13
  * Organization API
13
14
  */
@@ -41,6 +42,13 @@ export declare class OrgApi extends EntityApi {
41
42
  * @returns Result
42
43
  */
43
44
  read(id: number, payload?: IApiPayload<OrgViewDto>, reload?: boolean): Promise<OrgViewDto | undefined>;
45
+ /**
46
+ * Send action message
47
+ * @param rq Request data
48
+ * @param payload Payload
49
+ * @returns Result
50
+ */
51
+ sendActionMessage(rq: SendActionMessageRQ, payload?: IApiPayload<void>): Promise<void | undefined>;
44
52
  /**
45
53
  * Switch organization
46
54
  * @param id Organization id
@@ -48,6 +48,17 @@ export class OrgApi extends EntityApi {
48
48
  }
49
49
  return data;
50
50
  }
51
+ /**
52
+ * Send action message
53
+ * @param rq Request data
54
+ * @param payload Payload
55
+ * @returns Result
56
+ */
57
+ sendActionMessage(rq, payload) {
58
+ const appId = 'serviceId' in this.app.settings ? this.app.settings.serviceId : 0;
59
+ payload !== null && payload !== void 0 ? payload : (payload = { showLoading: false });
60
+ return this.api.post('System/SendActionMessage', { ...rq, appId }, payload);
61
+ }
51
62
  /**
52
63
  * Switch organization
53
64
  * @param id Organization id
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Send action message request data
3
+ * 发送操作信息请求数据
4
+ */
5
+ export type SendActionMessageRQ = {
6
+ /**
7
+ * Kind
8
+ * 类型
9
+ */
10
+ kind: string;
11
+ /**
12
+ * Title
13
+ * 标题
14
+ */
15
+ title: string;
16
+ /**
17
+ * Related id
18
+ * 相关编号
19
+ */
20
+ relatedId?: number;
21
+ /**
22
+ * More data
23
+ * 更多数据
24
+ */
25
+ data?: Record<string, unknown>;
26
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -51,6 +51,7 @@ export * from './erp/rq/QueryRQ';
51
51
  export * from './erp/rq/RefreshTokenRQ';
52
52
  export * from './erp/rq/RegionsRQ';
53
53
  export * from './erp/rq/ResetPasswordRQ';
54
+ export * from './erp/rq/SendActionMessageRQ';
54
55
  export * from './erp/rq/TiplistRQ';
55
56
  export * from './erp/rq/UpdateStatusRQ';
56
57
  export * from './erp/AddressApi';
package/lib/mjs/index.js CHANGED
@@ -58,6 +58,7 @@ export * from './erp/rq/QueryRQ';
58
58
  export * from './erp/rq/RefreshTokenRQ';
59
59
  export * from './erp/rq/RegionsRQ';
60
60
  export * from './erp/rq/ResetPasswordRQ';
61
+ export * from './erp/rq/SendActionMessageRQ';
61
62
  export * from './erp/rq/TiplistRQ';
62
63
  export * from './erp/rq/UpdateStatusRQ';
63
64
  // erp api
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/appscript",
3
- "version": "1.4.9",
3
+ "version": "1.4.11",
4
4
  "description": "Applications shared TypeScript framework",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -1025,6 +1025,20 @@ export abstract class CoreApp<
1025
1025
  return passphrase;
1026
1026
  }
1027
1027
 
1028
+ /**
1029
+ * Format action
1030
+ * @param action Action
1031
+ * @param target Target name or title
1032
+ * @param items More items
1033
+ * @returns Result
1034
+ */
1035
+ formatAction(action: string, target: string, ...items: string[]) {
1036
+ let more = items.join(', ');
1037
+ return `[${this.get('appName')}] ${action} - ${target}${
1038
+ more ? `, ${more}` : more
1039
+ }`;
1040
+ }
1041
+
1028
1042
  /**
1029
1043
  * Format date to string
1030
1044
  * @param input Input date
package/src/app/IApp.ts CHANGED
@@ -315,6 +315,15 @@ export interface IApp {
315
315
  timeZone?: string
316
316
  ): string | undefined;
317
317
 
318
+ /**
319
+ * Format action
320
+ * @param action Action
321
+ * @param target Target name or title
322
+ * @param items More items
323
+ * @returns Result
324
+ */
325
+ formatAction(action: string, target: string, ...items: string[]): string;
326
+
318
327
  /**
319
328
  * Format error
320
329
  * @param error Error
package/src/erp/OrgApi.ts CHANGED
@@ -8,6 +8,7 @@ import { IdResultPayload } from './dto/ResultPayload';
8
8
  import { EntityApi } from './EntityApi';
9
9
  import { OrgListRQ } from './rq/OrgListRQ';
10
10
  import { OrgQueryRQ } from './rq/OrgQueryRQ';
11
+ import { SendActionMessageRQ } from './rq/SendActionMessageRQ';
11
12
 
12
13
  const cachedOrgs: { [P: number]: OrgViewDto | undefined | null } = {};
13
14
 
@@ -81,6 +82,23 @@ export class OrgApi extends EntityApi {
81
82
  return data;
82
83
  }
83
84
 
85
+ /**
86
+ * Send action message
87
+ * @param rq Request data
88
+ * @param payload Payload
89
+ * @returns Result
90
+ */
91
+ sendActionMessage(rq: SendActionMessageRQ, payload?: IApiPayload<void>) {
92
+ const appId =
93
+ 'serviceId' in this.app.settings ? this.app.settings.serviceId : 0;
94
+ payload ??= { showLoading: false };
95
+ return this.api.post(
96
+ 'System/SendActionMessage',
97
+ { ...rq, appId },
98
+ payload
99
+ );
100
+ }
101
+
84
102
  /**
85
103
  * Switch organization
86
104
  * @param id Organization id
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Send action message request data
3
+ * 发送操作信息请求数据
4
+ */
5
+ export type SendActionMessageRQ = {
6
+ /**
7
+ * Kind
8
+ * 类型
9
+ */
10
+ kind: string;
11
+
12
+ /**
13
+ * Title
14
+ * 标题
15
+ */
16
+ title: string;
17
+
18
+ /**
19
+ * Related id
20
+ * 相关编号
21
+ */
22
+ relatedId?: number;
23
+
24
+ /**
25
+ * More data
26
+ * 更多数据
27
+ */
28
+ data?: Record<string, unknown>;
29
+ };
package/src/index.ts CHANGED
@@ -64,6 +64,7 @@ export * from './erp/rq/QueryRQ';
64
64
  export * from './erp/rq/RefreshTokenRQ';
65
65
  export * from './erp/rq/RegionsRQ';
66
66
  export * from './erp/rq/ResetPasswordRQ';
67
+ export * from './erp/rq/SendActionMessageRQ';
67
68
  export * from './erp/rq/TiplistRQ';
68
69
  export * from './erp/rq/UpdateStatusRQ';
69
70