@etsoo/appscript 1.2.76 → 1.2.79

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.
@@ -235,8 +235,9 @@ export interface ICoreApp<U extends IUser, S extends IAppSettings, N, C extends
235
235
  * Format result text
236
236
  * @param result Action result
237
237
  * @param forceToLocal Force to local labels
238
+ * @returns Message
238
239
  */
239
- formatResult(result: IActionResult, forceToLocal?: boolean): void;
240
+ formatResult(result: IActionResult, forceToLocal?: boolean): string;
240
241
  /**
241
242
  * Fresh countdown UI
242
243
  * @param callback Callback
@@ -691,7 +692,7 @@ export declare abstract class CoreApp<U extends IUser, S extends IAppSettings, N
691
692
  * @param result Action result
692
693
  * @param forceToLocal Force to local labels
693
694
  */
694
- formatResult(result: IActionResult, forceToLocal?: boolean): void;
695
+ formatResult(result: IActionResult, forceToLocal?: boolean): string;
695
696
  /**
696
697
  * Get culture resource
697
698
  * @param key key
@@ -421,8 +421,7 @@ class CoreApp {
421
421
  * @param callback Callback
422
422
  */
423
423
  alertResult(result, callback) {
424
- this.formatResult(result);
425
- this.notifier.alert(ActionResultError_1.ActionResultError.format(result), callback);
424
+ this.notifier.alert(this.formatResult(result), callback);
426
425
  }
427
426
  /**
428
427
  * Authorize
@@ -797,6 +796,7 @@ class CoreApp {
797
796
  if (fieldLabel)
798
797
  result.title = result.title.format(fieldLabel);
799
798
  }
799
+ return ActionResultError_1.ActionResultError.format(result);
800
800
  }
801
801
  /**
802
802
  * Get culture resource
@@ -61,4 +61,13 @@ export declare namespace BusinessUtils {
61
61
  * @returns Units
62
62
  */
63
63
  function getRepeatOptions(func: ICultureGet, options?: string[], isJoined?: boolean): IdLabelDto[];
64
+ /**
65
+ * Set id value
66
+ * @param item QueryRQ or TiplistRQ or similiar item
67
+ * @param id Id value
68
+ */
69
+ function setIdValue<T extends {
70
+ id?: number;
71
+ sid?: string;
72
+ }>(item: T, id?: DataTypes.IdType): void;
64
73
  }
@@ -127,4 +127,18 @@ var BusinessUtils;
127
127
  return getUnits(func, options, isJoined);
128
128
  }
129
129
  BusinessUtils.getRepeatOptions = getRepeatOptions;
130
+ /**
131
+ * Set id value
132
+ * @param item QueryRQ or TiplistRQ or similiar item
133
+ * @param id Id value
134
+ */
135
+ function setIdValue(item, id) {
136
+ if (id == null)
137
+ return;
138
+ if (typeof id === 'number')
139
+ item.id = id;
140
+ else
141
+ item.sid = id;
142
+ }
143
+ BusinessUtils.setIdValue = setIdValue;
130
144
  })(BusinessUtils = exports.BusinessUtils || (exports.BusinessUtils = {}));
@@ -48,6 +48,7 @@
48
48
  "expiry": "Expiry",
49
49
  "failed": "Operation failed",
50
50
  "field": "Field",
51
+ "help": "Help",
51
52
  "id": "Number#",
52
53
  "info": "Info",
53
54
  "itemExists": "'{0}' already exists",
@@ -48,6 +48,7 @@
48
48
  "expiry": "到期时间",
49
49
  "failed": "操作失败",
50
50
  "field": "字段",
51
+ "help": "帮助",
51
52
  "id": "编号",
52
53
  "info": "信息",
53
54
  "itemExists": "'{0}'已经存在",
@@ -48,6 +48,7 @@
48
48
  "expiry": "到期時間",
49
49
  "failed": "操作失敗",
50
50
  "field": "字段",
51
+ "help": "幫助",
51
52
  "id": "編號",
52
53
  "info": "信息",
53
54
  "itemExists": "'{0}'已经存在",
@@ -27,6 +27,8 @@ export * from './result/IActionResult';
27
27
  export * from './result/InitCallResult';
28
28
  export * from './rq/LoginIdRQ';
29
29
  export * from './rq/LoginRQ';
30
+ export * from './rq/QueryRQ';
31
+ export * from './rq/TiplistRQ';
30
32
  export * from './state/Culture';
31
33
  export * from './state/State';
32
34
  export * from './state/User';
package/lib/cjs/index.js CHANGED
@@ -55,6 +55,8 @@ __exportStar(require("./result/InitCallResult"), exports);
55
55
  // rq
56
56
  __exportStar(require("./rq/LoginIdRQ"), exports);
57
57
  __exportStar(require("./rq/LoginRQ"), exports);
58
+ __exportStar(require("./rq/QueryRQ"), exports);
59
+ __exportStar(require("./rq/TiplistRQ"), exports);
58
60
  // state
59
61
  __exportStar(require("./state/Culture"), exports);
60
62
  __exportStar(require("./state/State"), exports);
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Query request data
3
+ * com.etsoo.CoreFramework.Models.QueryRQ
4
+ */
5
+ export declare type QueryRQ = {
6
+ /**
7
+ * Number id
8
+ */
9
+ id?: number;
10
+ /**
11
+ * String id
12
+ */
13
+ sid?: number;
14
+ /**
15
+ * Current page
16
+ */
17
+ currentPage: number;
18
+ /**
19
+ * Batch size
20
+ */
21
+ batchSize: number;
22
+ /**
23
+ * Order by field name
24
+ */
25
+ orderBy?: string;
26
+ /**
27
+ * Order by ascending
28
+ */
29
+ orderByAsc?: boolean;
30
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,27 @@
1
+ import { DataTypes } from '@etsoo/shared';
2
+ /**
3
+ * Tiplist request data
4
+ * com.etsoo.CoreFramework.Models.TiplistRQ
5
+ */
6
+ export declare type TiplistRQ = {
7
+ /**
8
+ * number id
9
+ */
10
+ id?: number;
11
+ /**
12
+ * String id
13
+ */
14
+ sid?: string;
15
+ /**
16
+ * Excluded ids
17
+ */
18
+ excludedIds?: DataTypes.IdType[];
19
+ /**
20
+ * Filter keyword
21
+ */
22
+ keyword?: string;
23
+ /**
24
+ * Max items to return
25
+ */
26
+ items?: number;
27
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -235,8 +235,9 @@ export interface ICoreApp<U extends IUser, S extends IAppSettings, N, C extends
235
235
  * Format result text
236
236
  * @param result Action result
237
237
  * @param forceToLocal Force to local labels
238
+ * @returns Message
238
239
  */
239
- formatResult(result: IActionResult, forceToLocal?: boolean): void;
240
+ formatResult(result: IActionResult, forceToLocal?: boolean): string;
240
241
  /**
241
242
  * Fresh countdown UI
242
243
  * @param callback Callback
@@ -691,7 +692,7 @@ export declare abstract class CoreApp<U extends IUser, S extends IAppSettings, N
691
692
  * @param result Action result
692
693
  * @param forceToLocal Force to local labels
693
694
  */
694
- formatResult(result: IActionResult, forceToLocal?: boolean): void;
695
+ formatResult(result: IActionResult, forceToLocal?: boolean): string;
695
696
  /**
696
697
  * Get culture resource
697
698
  * @param key key
@@ -418,8 +418,7 @@ export class CoreApp {
418
418
  * @param callback Callback
419
419
  */
420
420
  alertResult(result, callback) {
421
- this.formatResult(result);
422
- this.notifier.alert(ActionResultError.format(result), callback);
421
+ this.notifier.alert(this.formatResult(result), callback);
423
422
  }
424
423
  /**
425
424
  * Authorize
@@ -794,6 +793,7 @@ export class CoreApp {
794
793
  if (fieldLabel)
795
794
  result.title = result.title.format(fieldLabel);
796
795
  }
796
+ return ActionResultError.format(result);
797
797
  }
798
798
  /**
799
799
  * Get culture resource
@@ -61,4 +61,13 @@ export declare namespace BusinessUtils {
61
61
  * @returns Units
62
62
  */
63
63
  function getRepeatOptions(func: ICultureGet, options?: string[], isJoined?: boolean): IdLabelDto[];
64
+ /**
65
+ * Set id value
66
+ * @param item QueryRQ or TiplistRQ or similiar item
67
+ * @param id Id value
68
+ */
69
+ function setIdValue<T extends {
70
+ id?: number;
71
+ sid?: string;
72
+ }>(item: T, id?: DataTypes.IdType): void;
64
73
  }
@@ -124,4 +124,18 @@ export var BusinessUtils;
124
124
  return getUnits(func, options, isJoined);
125
125
  }
126
126
  BusinessUtils.getRepeatOptions = getRepeatOptions;
127
+ /**
128
+ * Set id value
129
+ * @param item QueryRQ or TiplistRQ or similiar item
130
+ * @param id Id value
131
+ */
132
+ function setIdValue(item, id) {
133
+ if (id == null)
134
+ return;
135
+ if (typeof id === 'number')
136
+ item.id = id;
137
+ else
138
+ item.sid = id;
139
+ }
140
+ BusinessUtils.setIdValue = setIdValue;
127
141
  })(BusinessUtils || (BusinessUtils = {}));
@@ -48,6 +48,7 @@
48
48
  "expiry": "Expiry",
49
49
  "failed": "Operation failed",
50
50
  "field": "Field",
51
+ "help": "Help",
51
52
  "id": "Number#",
52
53
  "info": "Info",
53
54
  "itemExists": "'{0}' already exists",
@@ -48,6 +48,7 @@
48
48
  "expiry": "到期时间",
49
49
  "failed": "操作失败",
50
50
  "field": "字段",
51
+ "help": "帮助",
51
52
  "id": "编号",
52
53
  "info": "信息",
53
54
  "itemExists": "'{0}'已经存在",
@@ -48,6 +48,7 @@
48
48
  "expiry": "到期時間",
49
49
  "failed": "操作失敗",
50
50
  "field": "字段",
51
+ "help": "幫助",
51
52
  "id": "編號",
52
53
  "info": "信息",
53
54
  "itemExists": "'{0}'已经存在",
@@ -27,6 +27,8 @@ export * from './result/IActionResult';
27
27
  export * from './result/InitCallResult';
28
28
  export * from './rq/LoginIdRQ';
29
29
  export * from './rq/LoginRQ';
30
+ export * from './rq/QueryRQ';
31
+ export * from './rq/TiplistRQ';
30
32
  export * from './state/Culture';
31
33
  export * from './state/State';
32
34
  export * from './state/User';
package/lib/mjs/index.js CHANGED
@@ -36,6 +36,8 @@ export * from './result/InitCallResult';
36
36
  // rq
37
37
  export * from './rq/LoginIdRQ';
38
38
  export * from './rq/LoginRQ';
39
+ export * from './rq/QueryRQ';
40
+ export * from './rq/TiplistRQ';
39
41
  // state
40
42
  export * from './state/Culture';
41
43
  export * from './state/State';
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Query request data
3
+ * com.etsoo.CoreFramework.Models.QueryRQ
4
+ */
5
+ export declare type QueryRQ = {
6
+ /**
7
+ * Number id
8
+ */
9
+ id?: number;
10
+ /**
11
+ * String id
12
+ */
13
+ sid?: number;
14
+ /**
15
+ * Current page
16
+ */
17
+ currentPage: number;
18
+ /**
19
+ * Batch size
20
+ */
21
+ batchSize: number;
22
+ /**
23
+ * Order by field name
24
+ */
25
+ orderBy?: string;
26
+ /**
27
+ * Order by ascending
28
+ */
29
+ orderByAsc?: boolean;
30
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,27 @@
1
+ import { DataTypes } from '@etsoo/shared';
2
+ /**
3
+ * Tiplist request data
4
+ * com.etsoo.CoreFramework.Models.TiplistRQ
5
+ */
6
+ export declare type TiplistRQ = {
7
+ /**
8
+ * number id
9
+ */
10
+ id?: number;
11
+ /**
12
+ * String id
13
+ */
14
+ sid?: string;
15
+ /**
16
+ * Excluded ids
17
+ */
18
+ excludedIds?: DataTypes.IdType[];
19
+ /**
20
+ * Filter keyword
21
+ */
22
+ keyword?: string;
23
+ /**
24
+ * Max items to return
25
+ */
26
+ items?: number;
27
+ };
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/appscript",
3
- "version": "1.2.76",
3
+ "version": "1.2.79",
4
4
  "description": "Applications shared TypeScript framework",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -52,21 +52,21 @@
52
52
  },
53
53
  "homepage": "https://github.com/ETSOO/AppScript#readme",
54
54
  "dependencies": {
55
- "@etsoo/notificationbase": "^1.1.5",
55
+ "@etsoo/notificationbase": "^1.1.6",
56
56
  "@etsoo/restclient": "^1.0.70",
57
- "@etsoo/shared": "^1.1.45",
57
+ "@etsoo/shared": "^1.1.46",
58
58
  "@types/crypto-js": "^4.1.1",
59
59
  "crypto-js": "^4.1.1"
60
60
  },
61
61
  "devDependencies": {
62
62
  "@babel/cli": "^7.18.10",
63
- "@babel/core": "^7.18.10",
63
+ "@babel/core": "^7.18.13",
64
64
  "@babel/plugin-transform-runtime": "^7.18.10",
65
65
  "@babel/preset-env": "^7.18.10",
66
66
  "@babel/runtime-corejs3": "^7.18.9",
67
67
  "@types/jest": "^28.1.7",
68
- "@typescript-eslint/eslint-plugin": "^5.33.1",
69
- "@typescript-eslint/parser": "^5.33.1",
68
+ "@typescript-eslint/eslint-plugin": "^5.34.0",
69
+ "@typescript-eslint/parser": "^5.34.0",
70
70
  "eslint": "^8.22.0",
71
71
  "eslint-config-airbnb-base": "^15.0.0",
72
72
  "eslint-plugin-import": "^2.26.0",
@@ -347,8 +347,9 @@ export interface ICoreApp<
347
347
  * Format result text
348
348
  * @param result Action result
349
349
  * @param forceToLocal Force to local labels
350
+ * @returns Message
350
351
  */
351
- formatResult(result: IActionResult, forceToLocal?: boolean): void;
352
+ formatResult(result: IActionResult, forceToLocal?: boolean): string;
352
353
 
353
354
  /**
354
355
  * Fresh countdown UI
@@ -1109,8 +1110,7 @@ export abstract class CoreApp<
1109
1110
  * @param callback Callback
1110
1111
  */
1111
1112
  alertResult(result: IActionResult, callback?: NotificationReturn<void>) {
1112
- this.formatResult(result);
1113
- this.notifier.alert(ActionResultError.format(result), callback);
1113
+ this.notifier.alert(this.formatResult(result), callback);
1114
1114
  }
1115
1115
 
1116
1116
  /**
@@ -1566,6 +1566,8 @@ export abstract class CoreApp<
1566
1566
  const fieldLabel = this.get(result.field.formatInitial(false));
1567
1567
  if (fieldLabel) result.title = result.title.format(fieldLabel);
1568
1568
  }
1569
+
1570
+ return ActionResultError.format(result);
1569
1571
  }
1570
1572
 
1571
1573
  /**
@@ -167,4 +167,18 @@ export namespace BusinessUtils {
167
167
 
168
168
  return getUnits(func, options, isJoined);
169
169
  }
170
+
171
+ /**
172
+ * Set id value
173
+ * @param item QueryRQ or TiplistRQ or similiar item
174
+ * @param id Id value
175
+ */
176
+ export function setIdValue<T extends { id?: number; sid?: string }>(
177
+ item: T,
178
+ id?: DataTypes.IdType
179
+ ) {
180
+ if (id == null) return;
181
+ if (typeof id === 'number') item.id = id;
182
+ else item.sid = id;
183
+ }
170
184
  }
@@ -48,6 +48,7 @@
48
48
  "expiry": "Expiry",
49
49
  "failed": "Operation failed",
50
50
  "field": "Field",
51
+ "help": "Help",
51
52
  "id": "Number#",
52
53
  "info": "Info",
53
54
  "itemExists": "'{0}' already exists",
@@ -48,6 +48,7 @@
48
48
  "expiry": "到期时间",
49
49
  "failed": "操作失败",
50
50
  "field": "字段",
51
+ "help": "帮助",
51
52
  "id": "编号",
52
53
  "info": "信息",
53
54
  "itemExists": "'{0}'已经存在",
@@ -48,6 +48,7 @@
48
48
  "expiry": "到期時間",
49
49
  "failed": "操作失敗",
50
50
  "field": "字段",
51
+ "help": "幫助",
51
52
  "id": "編號",
52
53
  "info": "信息",
53
54
  "itemExists": "'{0}'已经存在",
package/src/index.ts CHANGED
@@ -46,6 +46,8 @@ export * from './result/InitCallResult';
46
46
  // rq
47
47
  export * from './rq/LoginIdRQ';
48
48
  export * from './rq/LoginRQ';
49
+ export * from './rq/QueryRQ';
50
+ export * from './rq/TiplistRQ';
49
51
 
50
52
  // state
51
53
  export * from './state/Culture';
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Query request data
3
+ * com.etsoo.CoreFramework.Models.QueryRQ
4
+ */
5
+ export type QueryRQ = {
6
+ /**
7
+ * Number id
8
+ */
9
+ id?: number;
10
+
11
+ /**
12
+ * String id
13
+ */
14
+ sid?: number;
15
+
16
+ /**
17
+ * Current page
18
+ */
19
+ currentPage: number;
20
+
21
+ /**
22
+ * Batch size
23
+ */
24
+ batchSize: number;
25
+
26
+ /**
27
+ * Order by field name
28
+ */
29
+ orderBy?: string;
30
+
31
+ /**
32
+ * Order by ascending
33
+ */
34
+ orderByAsc?: boolean;
35
+ };
@@ -0,0 +1,32 @@
1
+ import { DataTypes } from '@etsoo/shared';
2
+
3
+ /**
4
+ * Tiplist request data
5
+ * com.etsoo.CoreFramework.Models.TiplistRQ
6
+ */
7
+ export type TiplistRQ = {
8
+ /**
9
+ * number id
10
+ */
11
+ id?: number;
12
+
13
+ /**
14
+ * String id
15
+ */
16
+ sid?: string;
17
+
18
+ /**
19
+ * Excluded ids
20
+ */
21
+ excludedIds?: DataTypes.IdType[];
22
+
23
+ /**
24
+ * Filter keyword
25
+ */
26
+ keyword?: string;
27
+
28
+ /**
29
+ * Max items to return
30
+ */
31
+ items?: number;
32
+ };