@etsoo/appscript 1.2.40 → 1.2.44
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/lib/cjs/app/CoreApp.d.ts +10 -0
- package/lib/cjs/app/CoreApp.js +8 -1
- package/lib/cjs/bridges/IBridgeHost.d.ts +2 -1
- package/lib/cjs/i18n/zh-CN.json +1 -1
- package/lib/cjs/i18n/zh-HK.json +1 -1
- package/lib/cjs/result/ActionResult.d.ts +2 -2
- package/lib/cjs/result/IActionResult.d.ts +5 -8
- package/lib/cjs/result/InitCallResult.d.ts +2 -2
- package/lib/mjs/app/CoreApp.d.ts +10 -0
- package/lib/mjs/app/CoreApp.js +8 -1
- package/lib/mjs/bridges/IBridgeHost.d.ts +2 -1
- package/lib/mjs/i18n/zh-CN.json +1 -1
- package/lib/mjs/i18n/zh-HK.json +1 -1
- package/lib/mjs/result/ActionResult.d.ts +2 -2
- package/lib/mjs/result/IActionResult.d.ts +5 -8
- package/lib/mjs/result/InitCallResult.d.ts +2 -2
- package/package.json +1 -1
- package/src/app/CoreApp.ts +15 -1
- package/src/bridges/IBridgeHost.ts +2 -1
- package/src/i18n/zh-CN.json +1 -1
- package/src/i18n/zh-HK.json +1 -1
- package/src/result/ActionResult.ts +2 -2
- package/src/result/IActionResult.ts +6 -9
- package/src/result/InitCallResult.ts +2 -2
package/lib/cjs/app/CoreApp.d.ts
CHANGED
|
@@ -312,6 +312,11 @@ export interface ICoreApp<S extends IAppSettings, N, C extends NotificationCallP
|
|
|
312
312
|
* Persist settings to source when application exit
|
|
313
313
|
*/
|
|
314
314
|
persist(): void;
|
|
315
|
+
/**
|
|
316
|
+
* Redirect to the Url
|
|
317
|
+
* @param url Url
|
|
318
|
+
*/
|
|
319
|
+
redirectTo(url: string): void;
|
|
315
320
|
/**
|
|
316
321
|
* Switch organization
|
|
317
322
|
* @param id Organization id
|
|
@@ -684,6 +689,11 @@ export declare abstract class CoreApp<S extends IAppSettings, N, C extends Notif
|
|
|
684
689
|
* Callback where exit a page
|
|
685
690
|
*/
|
|
686
691
|
pageExit(): void;
|
|
692
|
+
/**
|
|
693
|
+
* Redirect to the Url
|
|
694
|
+
* @param url Url
|
|
695
|
+
*/
|
|
696
|
+
redirectTo(url: string): void;
|
|
687
697
|
/**
|
|
688
698
|
* Refresh countdown
|
|
689
699
|
* @param seconds Seconds
|
package/lib/cjs/app/CoreApp.js
CHANGED
|
@@ -802,6 +802,13 @@ class CoreApp {
|
|
|
802
802
|
var _a;
|
|
803
803
|
(_a = this.lastWarning) === null || _a === void 0 ? void 0 : _a.dismiss();
|
|
804
804
|
}
|
|
805
|
+
/**
|
|
806
|
+
* Redirect to the Url
|
|
807
|
+
* @param url Url
|
|
808
|
+
*/
|
|
809
|
+
redirectTo(url) {
|
|
810
|
+
window.location.href = url;
|
|
811
|
+
}
|
|
805
812
|
/**
|
|
806
813
|
* Refresh countdown
|
|
807
814
|
* @param seconds Seconds
|
|
@@ -900,7 +907,7 @@ class CoreApp {
|
|
|
900
907
|
*/
|
|
901
908
|
toLoginPage(tryLogin) {
|
|
902
909
|
const url = this.transformUrl('/' + (tryLogin ? '' : '?tryLogin=false'));
|
|
903
|
-
|
|
910
|
+
this.redirectTo(url);
|
|
904
911
|
}
|
|
905
912
|
/**
|
|
906
913
|
* Transform URL
|
package/lib/cjs/i18n/zh-CN.json
CHANGED
package/lib/cjs/i18n/zh-HK.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IActionResult
|
|
1
|
+
import { IActionResult } from './IActionResult';
|
|
2
2
|
/**
|
|
3
3
|
* Action result
|
|
4
4
|
*/
|
|
@@ -7,5 +7,5 @@ export declare class ActionResult {
|
|
|
7
7
|
* Create a result from error
|
|
8
8
|
* @returns Action result interface
|
|
9
9
|
*/
|
|
10
|
-
static create<D extends
|
|
10
|
+
static create<D extends {} = {}>(error: Error): IActionResult<D>;
|
|
11
11
|
}
|
|
@@ -1,11 +1,4 @@
|
|
|
1
1
|
import { DataTypes } from '@etsoo/shared';
|
|
2
|
-
/**
|
|
3
|
-
* Result data
|
|
4
|
-
* Indexable type
|
|
5
|
-
*/
|
|
6
|
-
export interface IResultData {
|
|
7
|
-
readonly [key: string]: unknown;
|
|
8
|
-
}
|
|
9
2
|
/**
|
|
10
3
|
* Result errors
|
|
11
4
|
* Indexable type
|
|
@@ -16,7 +9,7 @@ export interface IResultErrors {
|
|
|
16
9
|
/**
|
|
17
10
|
* Operation result interface
|
|
18
11
|
*/
|
|
19
|
-
export interface IActionResult<D extends
|
|
12
|
+
export interface IActionResult<D extends {} = {}> {
|
|
20
13
|
/**
|
|
21
14
|
* Status code
|
|
22
15
|
*/
|
|
@@ -60,3 +53,7 @@ export interface IActionResult<D extends IResultData = IResultData> {
|
|
|
60
53
|
export declare type IdActionResult<T extends DataTypes.IdType = number> = IActionResult<{
|
|
61
54
|
id: T;
|
|
62
55
|
}>;
|
|
56
|
+
/**
|
|
57
|
+
* Action result with dynamic data
|
|
58
|
+
*/
|
|
59
|
+
export declare type DynamicActionResult = IActionResult<Record<string, any>>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { IActionResult
|
|
1
|
+
import { IActionResult } from './IActionResult';
|
|
2
2
|
/**
|
|
3
3
|
* Init call result data
|
|
4
4
|
*/
|
|
5
|
-
export interface InitCallResultData
|
|
5
|
+
export interface InitCallResultData {
|
|
6
6
|
/**
|
|
7
7
|
* Device id
|
|
8
8
|
*/
|
package/lib/mjs/app/CoreApp.d.ts
CHANGED
|
@@ -312,6 +312,11 @@ export interface ICoreApp<S extends IAppSettings, N, C extends NotificationCallP
|
|
|
312
312
|
* Persist settings to source when application exit
|
|
313
313
|
*/
|
|
314
314
|
persist(): void;
|
|
315
|
+
/**
|
|
316
|
+
* Redirect to the Url
|
|
317
|
+
* @param url Url
|
|
318
|
+
*/
|
|
319
|
+
redirectTo(url: string): void;
|
|
315
320
|
/**
|
|
316
321
|
* Switch organization
|
|
317
322
|
* @param id Organization id
|
|
@@ -684,6 +689,11 @@ export declare abstract class CoreApp<S extends IAppSettings, N, C extends Notif
|
|
|
684
689
|
* Callback where exit a page
|
|
685
690
|
*/
|
|
686
691
|
pageExit(): void;
|
|
692
|
+
/**
|
|
693
|
+
* Redirect to the Url
|
|
694
|
+
* @param url Url
|
|
695
|
+
*/
|
|
696
|
+
redirectTo(url: string): void;
|
|
687
697
|
/**
|
|
688
698
|
* Refresh countdown
|
|
689
699
|
* @param seconds Seconds
|
package/lib/mjs/app/CoreApp.js
CHANGED
|
@@ -799,6 +799,13 @@ export class CoreApp {
|
|
|
799
799
|
var _a;
|
|
800
800
|
(_a = this.lastWarning) === null || _a === void 0 ? void 0 : _a.dismiss();
|
|
801
801
|
}
|
|
802
|
+
/**
|
|
803
|
+
* Redirect to the Url
|
|
804
|
+
* @param url Url
|
|
805
|
+
*/
|
|
806
|
+
redirectTo(url) {
|
|
807
|
+
window.location.href = url;
|
|
808
|
+
}
|
|
802
809
|
/**
|
|
803
810
|
* Refresh countdown
|
|
804
811
|
* @param seconds Seconds
|
|
@@ -897,7 +904,7 @@ export class CoreApp {
|
|
|
897
904
|
*/
|
|
898
905
|
toLoginPage(tryLogin) {
|
|
899
906
|
const url = this.transformUrl('/' + (tryLogin ? '' : '?tryLogin=false'));
|
|
900
|
-
|
|
907
|
+
this.redirectTo(url);
|
|
901
908
|
}
|
|
902
909
|
/**
|
|
903
910
|
* Transform URL
|
package/lib/mjs/i18n/zh-CN.json
CHANGED
package/lib/mjs/i18n/zh-HK.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IActionResult
|
|
1
|
+
import { IActionResult } from './IActionResult';
|
|
2
2
|
/**
|
|
3
3
|
* Action result
|
|
4
4
|
*/
|
|
@@ -7,5 +7,5 @@ export declare class ActionResult {
|
|
|
7
7
|
* Create a result from error
|
|
8
8
|
* @returns Action result interface
|
|
9
9
|
*/
|
|
10
|
-
static create<D extends
|
|
10
|
+
static create<D extends {} = {}>(error: Error): IActionResult<D>;
|
|
11
11
|
}
|
|
@@ -1,11 +1,4 @@
|
|
|
1
1
|
import { DataTypes } from '@etsoo/shared';
|
|
2
|
-
/**
|
|
3
|
-
* Result data
|
|
4
|
-
* Indexable type
|
|
5
|
-
*/
|
|
6
|
-
export interface IResultData {
|
|
7
|
-
readonly [key: string]: unknown;
|
|
8
|
-
}
|
|
9
2
|
/**
|
|
10
3
|
* Result errors
|
|
11
4
|
* Indexable type
|
|
@@ -16,7 +9,7 @@ export interface IResultErrors {
|
|
|
16
9
|
/**
|
|
17
10
|
* Operation result interface
|
|
18
11
|
*/
|
|
19
|
-
export interface IActionResult<D extends
|
|
12
|
+
export interface IActionResult<D extends {} = {}> {
|
|
20
13
|
/**
|
|
21
14
|
* Status code
|
|
22
15
|
*/
|
|
@@ -60,3 +53,7 @@ export interface IActionResult<D extends IResultData = IResultData> {
|
|
|
60
53
|
export declare type IdActionResult<T extends DataTypes.IdType = number> = IActionResult<{
|
|
61
54
|
id: T;
|
|
62
55
|
}>;
|
|
56
|
+
/**
|
|
57
|
+
* Action result with dynamic data
|
|
58
|
+
*/
|
|
59
|
+
export declare type DynamicActionResult = IActionResult<Record<string, any>>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { IActionResult
|
|
1
|
+
import { IActionResult } from './IActionResult';
|
|
2
2
|
/**
|
|
3
3
|
* Init call result data
|
|
4
4
|
*/
|
|
5
|
-
export interface InitCallResultData
|
|
5
|
+
export interface InitCallResultData {
|
|
6
6
|
/**
|
|
7
7
|
* Device id
|
|
8
8
|
*/
|
package/package.json
CHANGED
package/src/app/CoreApp.ts
CHANGED
|
@@ -428,6 +428,12 @@ export interface ICoreApp<
|
|
|
428
428
|
*/
|
|
429
429
|
persist(): void;
|
|
430
430
|
|
|
431
|
+
/**
|
|
432
|
+
* Redirect to the Url
|
|
433
|
+
* @param url Url
|
|
434
|
+
*/
|
|
435
|
+
redirectTo(url: string): void;
|
|
436
|
+
|
|
431
437
|
/**
|
|
432
438
|
* Switch organization
|
|
433
439
|
* @param id Organization id
|
|
@@ -1496,6 +1502,14 @@ export abstract class CoreApp<
|
|
|
1496
1502
|
this.lastWarning?.dismiss();
|
|
1497
1503
|
}
|
|
1498
1504
|
|
|
1505
|
+
/**
|
|
1506
|
+
* Redirect to the Url
|
|
1507
|
+
* @param url Url
|
|
1508
|
+
*/
|
|
1509
|
+
redirectTo(url: string): void {
|
|
1510
|
+
window.location.href = url;
|
|
1511
|
+
}
|
|
1512
|
+
|
|
1499
1513
|
/**
|
|
1500
1514
|
* Refresh countdown
|
|
1501
1515
|
* @param seconds Seconds
|
|
@@ -1618,7 +1632,7 @@ export abstract class CoreApp<
|
|
|
1618
1632
|
const url = this.transformUrl(
|
|
1619
1633
|
'/' + (tryLogin ? '' : '?tryLogin=false')
|
|
1620
1634
|
);
|
|
1621
|
-
|
|
1635
|
+
this.redirectTo(url);
|
|
1622
1636
|
}
|
|
1623
1637
|
|
|
1624
1638
|
/**
|
package/src/i18n/zh-CN.json
CHANGED
package/src/i18n/zh-HK.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ApiError } from '@etsoo/restclient';
|
|
2
|
-
import { IActionResult
|
|
2
|
+
import { IActionResult } from './IActionResult';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Action result
|
|
@@ -9,7 +9,7 @@ export class ActionResult {
|
|
|
9
9
|
* Create a result from error
|
|
10
10
|
* @returns Action result interface
|
|
11
11
|
*/
|
|
12
|
-
static create<D extends
|
|
12
|
+
static create<D extends {} = {}>(error: Error) {
|
|
13
13
|
// If the error is ApiError, hold the status
|
|
14
14
|
const status = error instanceof ApiError ? error.status : undefined;
|
|
15
15
|
|
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
import { DataTypes } from '@etsoo/shared';
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* Result data
|
|
5
|
-
* Indexable type
|
|
6
|
-
*/
|
|
7
|
-
export interface IResultData {
|
|
8
|
-
readonly [key: string]: unknown;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
3
|
/**
|
|
12
4
|
* Result errors
|
|
13
5
|
* Indexable type
|
|
@@ -19,7 +11,7 @@ export interface IResultErrors {
|
|
|
19
11
|
/**
|
|
20
12
|
* Operation result interface
|
|
21
13
|
*/
|
|
22
|
-
export interface IActionResult<D extends
|
|
14
|
+
export interface IActionResult<D extends {} = {}> {
|
|
23
15
|
/**
|
|
24
16
|
* Status code
|
|
25
17
|
*/
|
|
@@ -73,3 +65,8 @@ export type IdActionResult<T extends DataTypes.IdType = number> =
|
|
|
73
65
|
IActionResult<{
|
|
74
66
|
id: T;
|
|
75
67
|
}>;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Action result with dynamic data
|
|
71
|
+
*/
|
|
72
|
+
export type DynamicActionResult = IActionResult<Record<string, any>>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { IActionResult
|
|
1
|
+
import { IActionResult } from './IActionResult';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Init call result data
|
|
5
5
|
*/
|
|
6
|
-
export interface InitCallResultData
|
|
6
|
+
export interface InitCallResultData {
|
|
7
7
|
/**
|
|
8
8
|
* Device id
|
|
9
9
|
*/
|