@etsoo/appscript 1.2.70 → 1.2.71
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/__tests__/app/CoreApp.ts
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
} from '@etsoo/notificationbase';
|
|
9
9
|
import { ApiAuthorizationScheme, createClient } from '@etsoo/restclient';
|
|
10
10
|
import { DataTypes, DomUtils, Utils, WindowStorage } from '@etsoo/shared';
|
|
11
|
-
import { BusinessUtils } from '../../src';
|
|
11
|
+
import { BusinessUtils, IUser } from '../../src';
|
|
12
12
|
import { AddressUtils } from '../../src/address/AddressUtils';
|
|
13
13
|
import { IAppSettings } from '../../src/app/AppSettings';
|
|
14
14
|
import { CoreApp } from '../../src/app/CoreApp';
|
|
@@ -49,7 +49,12 @@ class NotificationContainerTest extends NotificationContainer<
|
|
|
49
49
|
var container = new NotificationContainerTest((update) => {});
|
|
50
50
|
|
|
51
51
|
// Arrange
|
|
52
|
-
class CoreAppTest extends CoreApp<
|
|
52
|
+
class CoreAppTest extends CoreApp<
|
|
53
|
+
IUser,
|
|
54
|
+
IAppSettings,
|
|
55
|
+
{},
|
|
56
|
+
NotificationCallProps
|
|
57
|
+
> {
|
|
53
58
|
/**
|
|
54
59
|
* Constructor
|
|
55
60
|
* @param settings Settings
|
package/lib/cjs/app/CoreApp.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { IdLabelDto } from '../dto/IdLabelDto';
|
|
|
7
7
|
import { InitCallDto } from '../dto/InitCallDto';
|
|
8
8
|
import { IActionResult } from '../result/IActionResult';
|
|
9
9
|
import { InitCallResult, InitCallResultData } from '../result/InitCallResult';
|
|
10
|
-
import {
|
|
10
|
+
import { IUser } from '../state/User';
|
|
11
11
|
import { IAppSettings } from './AppSettings';
|
|
12
12
|
import { UserRole } from './UserRole';
|
|
13
13
|
/**
|
|
@@ -56,7 +56,7 @@ export declare type IAppFields = {
|
|
|
56
56
|
/**
|
|
57
57
|
* Core application interface
|
|
58
58
|
*/
|
|
59
|
-
export interface ICoreApp<S extends IAppSettings, N, C extends NotificationCallProps> {
|
|
59
|
+
export interface ICoreApp<U extends IUser, S extends IAppSettings, N, C extends NotificationCallProps> {
|
|
60
60
|
/**
|
|
61
61
|
* Settings
|
|
62
62
|
*/
|
|
@@ -112,7 +112,7 @@ export interface ICoreApp<S extends IAppSettings, N, C extends NotificationCallP
|
|
|
112
112
|
/**
|
|
113
113
|
* User data
|
|
114
114
|
*/
|
|
115
|
-
userData?:
|
|
115
|
+
userData?: U;
|
|
116
116
|
/**
|
|
117
117
|
* Search input element
|
|
118
118
|
*/
|
|
@@ -379,7 +379,7 @@ export interface ICoreApp<S extends IAppSettings, N, C extends NotificationCallP
|
|
|
379
379
|
* @param refreshToken Refresh token
|
|
380
380
|
* @param keep Keep login or not
|
|
381
381
|
*/
|
|
382
|
-
userLogin(user:
|
|
382
|
+
userLogin(user: U, refreshToken: string, keep?: boolean): void;
|
|
383
383
|
/**
|
|
384
384
|
* User logout
|
|
385
385
|
* @param clearToken Clear refresh token or not
|
|
@@ -399,7 +399,7 @@ export interface ICoreApp<S extends IAppSettings, N, C extends NotificationCallP
|
|
|
399
399
|
/**
|
|
400
400
|
* Core application
|
|
401
401
|
*/
|
|
402
|
-
export declare abstract class CoreApp<S extends IAppSettings, N, C extends NotificationCallProps> implements ICoreApp<S, N, C> {
|
|
402
|
+
export declare abstract class CoreApp<U extends IUser, S extends IAppSettings, N, C extends NotificationCallProps> implements ICoreApp<U, S, N, C> {
|
|
403
403
|
/**
|
|
404
404
|
* Settings
|
|
405
405
|
*/
|
|
@@ -458,8 +458,8 @@ export declare abstract class CoreApp<S extends IAppSettings, N, C extends Notif
|
|
|
458
458
|
/**
|
|
459
459
|
* User data
|
|
460
460
|
*/
|
|
461
|
-
get userData():
|
|
462
|
-
protected set userData(value:
|
|
461
|
+
get userData(): U | undefined;
|
|
462
|
+
protected set userData(value: U | undefined);
|
|
463
463
|
private ipDetectCallbacks?;
|
|
464
464
|
/**
|
|
465
465
|
* Search input element
|
|
@@ -822,7 +822,7 @@ export declare abstract class CoreApp<S extends IAppSettings, N, C extends Notif
|
|
|
822
822
|
* @param refreshToken Refresh token
|
|
823
823
|
* @param keep Keep login or not
|
|
824
824
|
*/
|
|
825
|
-
userLogin(user:
|
|
825
|
+
userLogin(user: U, refreshToken: string, keep?: boolean): void;
|
|
826
826
|
/**
|
|
827
827
|
* User logout
|
|
828
828
|
* @param clearToken Clear refresh token or not
|
package/lib/mjs/app/CoreApp.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { IdLabelDto } from '../dto/IdLabelDto';
|
|
|
7
7
|
import { InitCallDto } from '../dto/InitCallDto';
|
|
8
8
|
import { IActionResult } from '../result/IActionResult';
|
|
9
9
|
import { InitCallResult, InitCallResultData } from '../result/InitCallResult';
|
|
10
|
-
import {
|
|
10
|
+
import { IUser } from '../state/User';
|
|
11
11
|
import { IAppSettings } from './AppSettings';
|
|
12
12
|
import { UserRole } from './UserRole';
|
|
13
13
|
/**
|
|
@@ -56,7 +56,7 @@ export declare type IAppFields = {
|
|
|
56
56
|
/**
|
|
57
57
|
* Core application interface
|
|
58
58
|
*/
|
|
59
|
-
export interface ICoreApp<S extends IAppSettings, N, C extends NotificationCallProps> {
|
|
59
|
+
export interface ICoreApp<U extends IUser, S extends IAppSettings, N, C extends NotificationCallProps> {
|
|
60
60
|
/**
|
|
61
61
|
* Settings
|
|
62
62
|
*/
|
|
@@ -112,7 +112,7 @@ export interface ICoreApp<S extends IAppSettings, N, C extends NotificationCallP
|
|
|
112
112
|
/**
|
|
113
113
|
* User data
|
|
114
114
|
*/
|
|
115
|
-
userData?:
|
|
115
|
+
userData?: U;
|
|
116
116
|
/**
|
|
117
117
|
* Search input element
|
|
118
118
|
*/
|
|
@@ -379,7 +379,7 @@ export interface ICoreApp<S extends IAppSettings, N, C extends NotificationCallP
|
|
|
379
379
|
* @param refreshToken Refresh token
|
|
380
380
|
* @param keep Keep login or not
|
|
381
381
|
*/
|
|
382
|
-
userLogin(user:
|
|
382
|
+
userLogin(user: U, refreshToken: string, keep?: boolean): void;
|
|
383
383
|
/**
|
|
384
384
|
* User logout
|
|
385
385
|
* @param clearToken Clear refresh token or not
|
|
@@ -399,7 +399,7 @@ export interface ICoreApp<S extends IAppSettings, N, C extends NotificationCallP
|
|
|
399
399
|
/**
|
|
400
400
|
* Core application
|
|
401
401
|
*/
|
|
402
|
-
export declare abstract class CoreApp<S extends IAppSettings, N, C extends NotificationCallProps> implements ICoreApp<S, N, C> {
|
|
402
|
+
export declare abstract class CoreApp<U extends IUser, S extends IAppSettings, N, C extends NotificationCallProps> implements ICoreApp<U, S, N, C> {
|
|
403
403
|
/**
|
|
404
404
|
* Settings
|
|
405
405
|
*/
|
|
@@ -458,8 +458,8 @@ export declare abstract class CoreApp<S extends IAppSettings, N, C extends Notif
|
|
|
458
458
|
/**
|
|
459
459
|
* User data
|
|
460
460
|
*/
|
|
461
|
-
get userData():
|
|
462
|
-
protected set userData(value:
|
|
461
|
+
get userData(): U | undefined;
|
|
462
|
+
protected set userData(value: U | undefined);
|
|
463
463
|
private ipDetectCallbacks?;
|
|
464
464
|
/**
|
|
465
465
|
* Search input element
|
|
@@ -822,7 +822,7 @@ export declare abstract class CoreApp<S extends IAppSettings, N, C extends Notif
|
|
|
822
822
|
* @param refreshToken Refresh token
|
|
823
823
|
* @param keep Keep login or not
|
|
824
824
|
*/
|
|
825
|
-
userLogin(user:
|
|
825
|
+
userLogin(user: U, refreshToken: string, keep?: boolean): void;
|
|
826
826
|
/**
|
|
827
827
|
* User logout
|
|
828
828
|
* @param clearToken Clear refresh token or not
|
package/package.json
CHANGED
package/src/app/CoreApp.ts
CHANGED
|
@@ -37,7 +37,7 @@ import { InitCallDto } from '../dto/InitCallDto';
|
|
|
37
37
|
import { ActionResultError } from '../result/ActionResultError';
|
|
38
38
|
import { IActionResult } from '../result/IActionResult';
|
|
39
39
|
import { InitCallResult, InitCallResultData } from '../result/InitCallResult';
|
|
40
|
-
import { IUserData } from '../state/User';
|
|
40
|
+
import { IUser, IUserData } from '../state/User';
|
|
41
41
|
import { IAppSettings } from './AppSettings';
|
|
42
42
|
import { UserRole } from './UserRole';
|
|
43
43
|
|
|
@@ -104,6 +104,7 @@ export type IAppFields = { [key in typeof appFields[number]]: string };
|
|
|
104
104
|
* Core application interface
|
|
105
105
|
*/
|
|
106
106
|
export interface ICoreApp<
|
|
107
|
+
U extends IUser,
|
|
107
108
|
S extends IAppSettings,
|
|
108
109
|
N,
|
|
109
110
|
C extends NotificationCallProps
|
|
@@ -176,7 +177,7 @@ export interface ICoreApp<
|
|
|
176
177
|
/**
|
|
177
178
|
* User data
|
|
178
179
|
*/
|
|
179
|
-
userData?:
|
|
180
|
+
userData?: U;
|
|
180
181
|
|
|
181
182
|
/**
|
|
182
183
|
* Search input element
|
|
@@ -518,7 +519,7 @@ export interface ICoreApp<
|
|
|
518
519
|
* @param refreshToken Refresh token
|
|
519
520
|
* @param keep Keep login or not
|
|
520
521
|
*/
|
|
521
|
-
userLogin(user:
|
|
522
|
+
userLogin(user: U, refreshToken: string, keep?: boolean): void;
|
|
522
523
|
|
|
523
524
|
/**
|
|
524
525
|
* User logout
|
|
@@ -543,10 +544,11 @@ export interface ICoreApp<
|
|
|
543
544
|
* Core application
|
|
544
545
|
*/
|
|
545
546
|
export abstract class CoreApp<
|
|
547
|
+
U extends IUser,
|
|
546
548
|
S extends IAppSettings,
|
|
547
549
|
N,
|
|
548
550
|
C extends NotificationCallProps
|
|
549
|
-
> implements ICoreApp<S, N, C>
|
|
551
|
+
> implements ICoreApp<U, S, N, C>
|
|
550
552
|
{
|
|
551
553
|
/**
|
|
552
554
|
* Settings
|
|
@@ -628,14 +630,14 @@ export abstract class CoreApp<
|
|
|
628
630
|
this._ipData = value;
|
|
629
631
|
}
|
|
630
632
|
|
|
631
|
-
private _userData?:
|
|
633
|
+
private _userData?: U;
|
|
632
634
|
/**
|
|
633
635
|
* User data
|
|
634
636
|
*/
|
|
635
637
|
get userData() {
|
|
636
638
|
return this._userData;
|
|
637
639
|
}
|
|
638
|
-
protected set userData(value:
|
|
640
|
+
protected set userData(value: U | undefined) {
|
|
639
641
|
this._userData = value;
|
|
640
642
|
}
|
|
641
643
|
|
|
@@ -1870,7 +1872,7 @@ export abstract class CoreApp<
|
|
|
1870
1872
|
* @param refreshToken Refresh token
|
|
1871
1873
|
* @param keep Keep login or not
|
|
1872
1874
|
*/
|
|
1873
|
-
userLogin(user:
|
|
1875
|
+
userLogin(user: U, refreshToken: string, keep?: boolean) {
|
|
1874
1876
|
this.userData = user;
|
|
1875
1877
|
|
|
1876
1878
|
// Cache the encrypted serverside device id
|