@etsoo/appscript 1.5.43 → 1.5.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 +2 -1
- package/lib/cjs/app/CoreApp.js +7 -2
- package/lib/cjs/app/IApp.d.ts +2 -6
- package/lib/cjs/erp/AuthApi.d.ts +4 -0
- package/lib/cjs/erp/AuthApi.js +5 -1
- package/lib/mjs/app/CoreApp.d.ts +2 -1
- package/lib/mjs/app/CoreApp.js +7 -2
- package/lib/mjs/app/IApp.d.ts +2 -6
- package/lib/mjs/erp/AuthApi.d.ts +4 -0
- package/lib/mjs/erp/AuthApi.js +5 -1
- package/package.json +1 -1
- package/src/app/CoreApp.ts +10 -2
- package/src/app/IApp.ts +5 -7
- package/src/erp/AuthApi.ts +6 -1
package/lib/cjs/app/CoreApp.d.ts
CHANGED
|
@@ -581,8 +581,9 @@ export declare abstract class CoreApp<U extends IUser, S extends IAppSettings, N
|
|
|
581
581
|
/**
|
|
582
582
|
* Refresh token
|
|
583
583
|
* @param props Props
|
|
584
|
+
* @param callback Callback
|
|
584
585
|
*/
|
|
585
|
-
refreshToken(props?: RefreshTokenProps): Promise<void>;
|
|
586
|
+
refreshToken(props?: RefreshTokenProps, callback?: (result?: boolean | string) => boolean | void): Promise<void>;
|
|
586
587
|
/**
|
|
587
588
|
* Setup callback
|
|
588
589
|
*/
|
package/lib/cjs/app/CoreApp.js
CHANGED
|
@@ -165,7 +165,11 @@ class CoreApp {
|
|
|
165
165
|
const refresh = async (api, token) => {
|
|
166
166
|
if (this.lastCalled) {
|
|
167
167
|
// Call refreshToken to update access token
|
|
168
|
-
|
|
168
|
+
// No popups show
|
|
169
|
+
await this.refreshToken({ showLoading: false }, (result) => {
|
|
170
|
+
console.log(`CoreApp.${this.name}.ApiRefreshToken`, result);
|
|
171
|
+
return false;
|
|
172
|
+
});
|
|
169
173
|
}
|
|
170
174
|
else {
|
|
171
175
|
// Popup countdown for user action
|
|
@@ -1376,8 +1380,9 @@ class CoreApp {
|
|
|
1376
1380
|
/**
|
|
1377
1381
|
* Refresh token
|
|
1378
1382
|
* @param props Props
|
|
1383
|
+
* @param callback Callback
|
|
1379
1384
|
*/
|
|
1380
|
-
async refreshToken(props) { }
|
|
1385
|
+
async refreshToken(props, callback) { }
|
|
1381
1386
|
/**
|
|
1382
1387
|
* Setup callback
|
|
1383
1388
|
*/
|
package/lib/cjs/app/IApp.d.ts
CHANGED
|
@@ -65,11 +65,6 @@ export interface RefreshTokenProps {
|
|
|
65
65
|
* API name
|
|
66
66
|
*/
|
|
67
67
|
api?: string;
|
|
68
|
-
/**
|
|
69
|
-
* Callback
|
|
70
|
-
* @param result Result
|
|
71
|
-
*/
|
|
72
|
-
callback?: (result: boolean) => void;
|
|
73
68
|
/**
|
|
74
69
|
* Show loading bar or not
|
|
75
70
|
*/
|
|
@@ -522,8 +517,9 @@ export interface IApp {
|
|
|
522
517
|
/**
|
|
523
518
|
* Refresh token
|
|
524
519
|
* @param props Props
|
|
520
|
+
* @param callback Callback
|
|
525
521
|
*/
|
|
526
|
-
refreshToken(props?: RefreshTokenProps): Promise<void>;
|
|
522
|
+
refreshToken(props?: RefreshTokenProps, callback?: (result?: boolean | string) => boolean | void): Promise<void>;
|
|
527
523
|
/**
|
|
528
524
|
* Setup Api error handler
|
|
529
525
|
* @param api Api
|
package/lib/cjs/erp/AuthApi.d.ts
CHANGED
|
@@ -14,6 +14,10 @@ import { RefreshTokenProps, RefreshTokenResult } from '../app/IApp';
|
|
|
14
14
|
* Authentication API
|
|
15
15
|
*/
|
|
16
16
|
export declare class AuthApi extends BaseApi {
|
|
17
|
+
/**
|
|
18
|
+
* Header token field name
|
|
19
|
+
*/
|
|
20
|
+
static HeaderTokenField: string;
|
|
17
21
|
/**
|
|
18
22
|
* API refresh token
|
|
19
23
|
* @param rq Request data
|
package/lib/cjs/erp/AuthApi.js
CHANGED
|
@@ -72,7 +72,7 @@ class AuthApi extends BaseApi_1.BaseApi {
|
|
|
72
72
|
*/
|
|
73
73
|
async refreshToken(token, props) {
|
|
74
74
|
// Destruct
|
|
75
|
-
const { api = 'Auth/RefreshToken', showLoading = false, tokenField =
|
|
75
|
+
const { api = 'Auth/RefreshToken', showLoading = false, tokenField = AuthApi.HeaderTokenField } = props ?? {};
|
|
76
76
|
// Reqest data
|
|
77
77
|
const rq = {
|
|
78
78
|
deviceId: this.app.deviceId
|
|
@@ -117,3 +117,7 @@ class AuthApi extends BaseApi_1.BaseApi {
|
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
exports.AuthApi = AuthApi;
|
|
120
|
+
/**
|
|
121
|
+
* Header token field name
|
|
122
|
+
*/
|
|
123
|
+
AuthApi.HeaderTokenField = 'Etsoo-Refresh-Token';
|
package/lib/mjs/app/CoreApp.d.ts
CHANGED
|
@@ -581,8 +581,9 @@ export declare abstract class CoreApp<U extends IUser, S extends IAppSettings, N
|
|
|
581
581
|
/**
|
|
582
582
|
* Refresh token
|
|
583
583
|
* @param props Props
|
|
584
|
+
* @param callback Callback
|
|
584
585
|
*/
|
|
585
|
-
refreshToken(props?: RefreshTokenProps): Promise<void>;
|
|
586
|
+
refreshToken(props?: RefreshTokenProps, callback?: (result?: boolean | string) => boolean | void): Promise<void>;
|
|
586
587
|
/**
|
|
587
588
|
* Setup callback
|
|
588
589
|
*/
|
package/lib/mjs/app/CoreApp.js
CHANGED
|
@@ -162,7 +162,11 @@ export class CoreApp {
|
|
|
162
162
|
const refresh = async (api, token) => {
|
|
163
163
|
if (this.lastCalled) {
|
|
164
164
|
// Call refreshToken to update access token
|
|
165
|
-
|
|
165
|
+
// No popups show
|
|
166
|
+
await this.refreshToken({ showLoading: false }, (result) => {
|
|
167
|
+
console.log(`CoreApp.${this.name}.ApiRefreshToken`, result);
|
|
168
|
+
return false;
|
|
169
|
+
});
|
|
166
170
|
}
|
|
167
171
|
else {
|
|
168
172
|
// Popup countdown for user action
|
|
@@ -1373,8 +1377,9 @@ export class CoreApp {
|
|
|
1373
1377
|
/**
|
|
1374
1378
|
* Refresh token
|
|
1375
1379
|
* @param props Props
|
|
1380
|
+
* @param callback Callback
|
|
1376
1381
|
*/
|
|
1377
|
-
async refreshToken(props) { }
|
|
1382
|
+
async refreshToken(props, callback) { }
|
|
1378
1383
|
/**
|
|
1379
1384
|
* Setup callback
|
|
1380
1385
|
*/
|
package/lib/mjs/app/IApp.d.ts
CHANGED
|
@@ -65,11 +65,6 @@ export interface RefreshTokenProps {
|
|
|
65
65
|
* API name
|
|
66
66
|
*/
|
|
67
67
|
api?: string;
|
|
68
|
-
/**
|
|
69
|
-
* Callback
|
|
70
|
-
* @param result Result
|
|
71
|
-
*/
|
|
72
|
-
callback?: (result: boolean) => void;
|
|
73
68
|
/**
|
|
74
69
|
* Show loading bar or not
|
|
75
70
|
*/
|
|
@@ -522,8 +517,9 @@ export interface IApp {
|
|
|
522
517
|
/**
|
|
523
518
|
* Refresh token
|
|
524
519
|
* @param props Props
|
|
520
|
+
* @param callback Callback
|
|
525
521
|
*/
|
|
526
|
-
refreshToken(props?: RefreshTokenProps): Promise<void>;
|
|
522
|
+
refreshToken(props?: RefreshTokenProps, callback?: (result?: boolean | string) => boolean | void): Promise<void>;
|
|
527
523
|
/**
|
|
528
524
|
* Setup Api error handler
|
|
529
525
|
* @param api Api
|
package/lib/mjs/erp/AuthApi.d.ts
CHANGED
|
@@ -14,6 +14,10 @@ import { RefreshTokenProps, RefreshTokenResult } from '../app/IApp';
|
|
|
14
14
|
* Authentication API
|
|
15
15
|
*/
|
|
16
16
|
export declare class AuthApi extends BaseApi {
|
|
17
|
+
/**
|
|
18
|
+
* Header token field name
|
|
19
|
+
*/
|
|
20
|
+
static HeaderTokenField: string;
|
|
17
21
|
/**
|
|
18
22
|
* API refresh token
|
|
19
23
|
* @param rq Request data
|
package/lib/mjs/erp/AuthApi.js
CHANGED
|
@@ -69,7 +69,7 @@ export class AuthApi extends BaseApi {
|
|
|
69
69
|
*/
|
|
70
70
|
async refreshToken(token, props) {
|
|
71
71
|
// Destruct
|
|
72
|
-
const { api = 'Auth/RefreshToken', showLoading = false, tokenField =
|
|
72
|
+
const { api = 'Auth/RefreshToken', showLoading = false, tokenField = AuthApi.HeaderTokenField } = props ?? {};
|
|
73
73
|
// Reqest data
|
|
74
74
|
const rq = {
|
|
75
75
|
deviceId: this.app.deviceId
|
|
@@ -113,3 +113,7 @@ export class AuthApi extends BaseApi {
|
|
|
113
113
|
return this.api.put('Auth/Signout', rq, payload);
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* Header token field name
|
|
118
|
+
*/
|
|
119
|
+
AuthApi.HeaderTokenField = 'Etsoo-Refresh-Token';
|
package/package.json
CHANGED
package/src/app/CoreApp.ts
CHANGED
|
@@ -332,7 +332,11 @@ export abstract class CoreApp<
|
|
|
332
332
|
const refresh: ApiRefreshTokenFunction = async (api, token) => {
|
|
333
333
|
if (this.lastCalled) {
|
|
334
334
|
// Call refreshToken to update access token
|
|
335
|
-
|
|
335
|
+
// No popups show
|
|
336
|
+
await this.refreshToken({ showLoading: false }, (result) => {
|
|
337
|
+
console.log(`CoreApp.${this.name}.ApiRefreshToken`, result);
|
|
338
|
+
return false;
|
|
339
|
+
});
|
|
336
340
|
} else {
|
|
337
341
|
// Popup countdown for user action
|
|
338
342
|
this.freshCountdownUI();
|
|
@@ -1908,8 +1912,12 @@ export abstract class CoreApp<
|
|
|
1908
1912
|
/**
|
|
1909
1913
|
* Refresh token
|
|
1910
1914
|
* @param props Props
|
|
1915
|
+
* @param callback Callback
|
|
1911
1916
|
*/
|
|
1912
|
-
async refreshToken(
|
|
1917
|
+
async refreshToken(
|
|
1918
|
+
props?: RefreshTokenProps,
|
|
1919
|
+
callback?: (result?: boolean | string) => boolean | void
|
|
1920
|
+
) {}
|
|
1913
1921
|
|
|
1914
1922
|
/**
|
|
1915
1923
|
* Setup callback
|
package/src/app/IApp.ts
CHANGED
|
@@ -92,12 +92,6 @@ export interface RefreshTokenProps {
|
|
|
92
92
|
*/
|
|
93
93
|
api?: string;
|
|
94
94
|
|
|
95
|
-
/**
|
|
96
|
-
* Callback
|
|
97
|
-
* @param result Result
|
|
98
|
-
*/
|
|
99
|
-
callback?: (result: boolean) => void;
|
|
100
|
-
|
|
101
95
|
/**
|
|
102
96
|
* Show loading bar or not
|
|
103
97
|
*/
|
|
@@ -703,8 +697,12 @@ export interface IApp {
|
|
|
703
697
|
/**
|
|
704
698
|
* Refresh token
|
|
705
699
|
* @param props Props
|
|
700
|
+
* @param callback Callback
|
|
706
701
|
*/
|
|
707
|
-
refreshToken(
|
|
702
|
+
refreshToken(
|
|
703
|
+
props?: RefreshTokenProps,
|
|
704
|
+
callback?: (result?: boolean | string) => boolean | void
|
|
705
|
+
): Promise<void>;
|
|
708
706
|
|
|
709
707
|
/**
|
|
710
708
|
* Setup Api error handler
|
package/src/erp/AuthApi.ts
CHANGED
|
@@ -17,6 +17,11 @@ import { RefreshTokenRQ } from './rq/RefreshTokenRQ';
|
|
|
17
17
|
* Authentication API
|
|
18
18
|
*/
|
|
19
19
|
export class AuthApi extends BaseApi {
|
|
20
|
+
/**
|
|
21
|
+
* Header token field name
|
|
22
|
+
*/
|
|
23
|
+
static HeaderTokenField = 'Etsoo-Refresh-Token';
|
|
24
|
+
|
|
20
25
|
/**
|
|
21
26
|
* API refresh token
|
|
22
27
|
* @param rq Request data
|
|
@@ -98,7 +103,7 @@ export class AuthApi extends BaseApi {
|
|
|
98
103
|
const {
|
|
99
104
|
api = 'Auth/RefreshToken',
|
|
100
105
|
showLoading = false,
|
|
101
|
-
tokenField =
|
|
106
|
+
tokenField = AuthApi.HeaderTokenField
|
|
102
107
|
} = props ?? {};
|
|
103
108
|
|
|
104
109
|
// Reqest data
|