@sumaris-net/ngx-components 0.28.5 → 1.0.3
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/bundles/sumaris-net.ngx-components.umd.js +301 -312
- package/bundles/sumaris-net.ngx-components.umd.js.map +1 -1
- package/bundles/sumaris-net.ngx-components.umd.min.js +2 -2
- package/bundles/sumaris-net.ngx-components.umd.min.js.map +1 -1
- package/doc/changelog.md +5 -0
- package/esm2015/src/app/core/graphql/graphql.service.js +5 -8
- package/esm2015/src/app/core/services/account.service.js +177 -188
- package/esm2015/src/app/core/services/base-entity-service.class.js +9 -7
- package/esm2015/src/app/core/services/base-graphql-service.class.js +7 -2
- package/esm2015/src/app/core/services/config.service.js +9 -54
- package/esm2015/src/app/core/services/model/account.model.js +1 -1
- package/esm2015/src/app/core/services/model/settings.model.js +29 -2
- package/esm2015/src/app/core/services/network.service.js +5 -7
- package/esm2015/src/app/core/services/storage/entities-storage.service.js +3 -6
- package/esm2015/src/app/shared/functions.js +15 -9
- package/esm2015/src/app/shared/services/startable-service.class.js +13 -2
- package/fesm2015/sumaris-net.ngx-components.js +255 -270
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
- package/src/app/core/graphql/graphql.service.d.ts +0 -1
- package/src/app/core/services/account.service.d.ts +8 -21
- package/src/app/core/services/base-entity-service.class.d.ts +1 -0
- package/src/app/core/services/base-graphql-service.class.d.ts +3 -2
- package/src/app/core/services/config.service.d.ts +2 -9
- package/src/app/core/services/model/settings.model.d.ts +2 -0
- package/src/app/core/services/network.service.d.ts +2 -2
- package/src/app/core/services/storage/entities-storage.service.d.ts +0 -1
- package/src/app/shared/services/startable-service.class.d.ts +3 -1
- package/sumaris-net.ngx-components.metadata.json +1 -1
package/package.json
CHANGED
|
@@ -45,7 +45,6 @@ export declare class GraphqlService extends StartableService<ApolloClient<any>>
|
|
|
45
45
|
private cryptoService;
|
|
46
46
|
protected environment: any;
|
|
47
47
|
private typePolicies;
|
|
48
|
-
private _subscription;
|
|
49
48
|
private readonly _networkStatusChanged$;
|
|
50
49
|
private httpParams;
|
|
51
50
|
private wsParams;
|
|
@@ -2,7 +2,7 @@ import { CryptoService, KeyPair } from './crypto.service';
|
|
|
2
2
|
import { Department } from './model/department.model';
|
|
3
3
|
import { Account } from './model/account.model';
|
|
4
4
|
import { Person, UserProfileLabel } from './model/person.model';
|
|
5
|
-
import { UsageMode } from './model/settings.model';
|
|
5
|
+
import { LocalSettings, UsageMode } from './model/settings.model';
|
|
6
6
|
import { Observable, Subject, Subscription } from 'rxjs';
|
|
7
7
|
import { FetchPolicy } from '@apollo/client/core';
|
|
8
8
|
import { Storage } from '@ionic/storage';
|
|
@@ -13,14 +13,12 @@ import { FormFieldDefinition } from '../../shared/form/field.model';
|
|
|
13
13
|
import { AuthTokenType, NetworkService } from './network.service';
|
|
14
14
|
import { FileService } from '../../shared/file/file.service';
|
|
15
15
|
import { Referential } from './model/referential.model';
|
|
16
|
-
|
|
17
|
-
export declare interface AccountHolder {
|
|
16
|
+
export declare interface AccountDetails {
|
|
18
17
|
loaded: boolean;
|
|
19
18
|
keypair: KeyPair;
|
|
20
19
|
authToken: string;
|
|
21
20
|
authBasic?: string;
|
|
22
21
|
pubkey: string;
|
|
23
|
-
account: Account;
|
|
24
22
|
person: Person;
|
|
25
23
|
department: Department;
|
|
26
24
|
mainProfile: String;
|
|
@@ -37,7 +35,7 @@ export declare interface IsEmailExistsVariables {
|
|
|
37
35
|
email: string;
|
|
38
36
|
hash: string;
|
|
39
37
|
}
|
|
40
|
-
export declare class AccountService extends BaseGraphqlService
|
|
38
|
+
export declare class AccountService extends BaseGraphqlService<Account, any, number, Account> {
|
|
41
39
|
private cryptoService;
|
|
42
40
|
protected network: NetworkService;
|
|
43
41
|
protected graphql: GraphqlService;
|
|
@@ -50,9 +48,7 @@ export declare class AccountService extends BaseGraphqlService implements IStart
|
|
|
50
48
|
onChange: Subject<Account>;
|
|
51
49
|
onAuthTokenChange: Subject<string>;
|
|
52
50
|
onAuthBasicChange: Subject<string>;
|
|
53
|
-
private
|
|
54
|
-
private _startPromise;
|
|
55
|
-
private _started;
|
|
51
|
+
private _cache;
|
|
56
52
|
private _$additionalFields;
|
|
57
53
|
private _tokenType$;
|
|
58
54
|
get account(): Account;
|
|
@@ -61,11 +57,8 @@ export declare class AccountService extends BaseGraphqlService implements IStart
|
|
|
61
57
|
get tokenType(): AuthTokenType;
|
|
62
58
|
set tokenType(value: AuthTokenType);
|
|
63
59
|
constructor(cryptoService: CryptoService, network: NetworkService, graphql: GraphqlService, settings: LocalSettingsService, storage: Storage, file: FileService, environment: any);
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
stop(): Promise<void>;
|
|
67
|
-
restart(): Promise<Account>;
|
|
68
|
-
ready(): Promise<Account>;
|
|
60
|
+
ngOnStart(): Promise<Account>;
|
|
61
|
+
protected ngOnStop(): Promise<void>;
|
|
69
62
|
isLogin(): boolean;
|
|
70
63
|
isAuth(): boolean;
|
|
71
64
|
hasMinProfile(userProfile: UserProfileLabel): boolean;
|
|
@@ -117,14 +110,6 @@ export declare class AccountService extends BaseGraphqlService implements IStart
|
|
|
117
110
|
sendConfirmationEmail(email: string, locale?: string): Promise<boolean>;
|
|
118
111
|
confirmEmail(email: String, code: String): Promise<boolean>;
|
|
119
112
|
listenChanges(): Subscription;
|
|
120
|
-
/**
|
|
121
|
-
* @deprecated
|
|
122
|
-
*/
|
|
123
|
-
getPageSettings(pageId: string, propertyName?: string): string[];
|
|
124
|
-
/**
|
|
125
|
-
* @deprecated
|
|
126
|
-
*/
|
|
127
|
-
savePageSetting(pageId: string, value: any, propertyName?: string): Promise<void>;
|
|
128
113
|
get additionalFields(): FormFieldDefinition[];
|
|
129
114
|
get $additionalFields(): Observable<FormFieldDefinition[]>;
|
|
130
115
|
getAdditionalField(key: string): FormFieldDefinition | undefined;
|
|
@@ -134,11 +119,13 @@ export declare class AccountService extends BaseGraphqlService implements IStart
|
|
|
134
119
|
offline?: boolean;
|
|
135
120
|
fetchPolicy?: FetchPolicy;
|
|
136
121
|
}): Promise<Account>;
|
|
122
|
+
protected listenSettings(): Promise<void>;
|
|
137
123
|
protected restoreLocally(): Promise<Account | undefined>;
|
|
138
124
|
/**
|
|
139
125
|
* Save account into the local storage
|
|
140
126
|
*/
|
|
141
127
|
protected saveLocally(): Promise<void>;
|
|
128
|
+
saveLocalSettingsRemotely(source: LocalSettings): Promise<void>;
|
|
142
129
|
/**
|
|
143
130
|
* Create or update an user account
|
|
144
131
|
*
|
|
@@ -102,6 +102,7 @@ export declare abstract class BaseEntityService<T extends Entity<T, ID>, F exten
|
|
|
102
102
|
copyIdAndUpdateDate(source: T, target: T): void;
|
|
103
103
|
fromObject(source: any): T;
|
|
104
104
|
asFilter(source: any): F;
|
|
105
|
+
protected ngOnStart(): Promise<void>;
|
|
105
106
|
protected fillDefaultProperties(source: T): void;
|
|
106
107
|
protected asObject(entity: T, opts?: EntityAsObjectOptions): any;
|
|
107
108
|
protected getRefetchQueriesForMutation(opts?: EntitySaveOptions): ((result: FetchResult<{
|
|
@@ -7,6 +7,7 @@ import { ApolloCache, InternalRefetchQueriesInclude } from '@apollo/client/core'
|
|
|
7
7
|
import { QueryRef } from 'apollo-angular';
|
|
8
8
|
import { PureQueryOptions } from '@apollo/client/core/types';
|
|
9
9
|
import { DocumentNode } from 'graphql';
|
|
10
|
+
import { StartableService } from '../../shared/services/startable-service.class';
|
|
10
11
|
export interface QueryVariables<F = any> extends Partial<Page> {
|
|
11
12
|
filter?: F;
|
|
12
13
|
[key: string]: any;
|
|
@@ -48,9 +49,8 @@ export interface FindMutableWatchQueriesOptions {
|
|
|
48
49
|
export declare class BaseGraphqlServiceOptions {
|
|
49
50
|
production?: boolean;
|
|
50
51
|
}
|
|
51
|
-
export declare abstract class BaseGraphqlService<T = any, F = any, ID = any> {
|
|
52
|
+
export declare abstract class BaseGraphqlService<T = any, F = any, ID = any, S = void> extends StartableService<S> {
|
|
52
53
|
protected graphql: GraphqlService;
|
|
53
|
-
protected _debug: boolean;
|
|
54
54
|
protected _logPrefix: string;
|
|
55
55
|
protected _mutableWatchQueries: MutableWatchQueryDescription<any>[];
|
|
56
56
|
protected _mutableWatchQueriesMaxCount: number;
|
|
@@ -69,4 +69,5 @@ export declare abstract class BaseGraphqlService<T = any, F = any, ID = any> {
|
|
|
69
69
|
protected findMutableWatchQueries(opts: FindMutableWatchQueriesOptions): MutableWatchQueryDescription<any>[];
|
|
70
70
|
protected registerNewMutableWatchQuery(mutableQuery: MutableWatchQueryDescription<any>): void;
|
|
71
71
|
protected findRefetchQueries(opts: FindMutableWatchQueriesOptions): InternalRefetchQueriesInclude;
|
|
72
|
+
protected ngOnStart(): Promise<S>;
|
|
72
73
|
}
|
|
@@ -16,7 +16,7 @@ export declare const Fragments: {
|
|
|
16
16
|
config: import("graphql/language/ast").DocumentNode;
|
|
17
17
|
};
|
|
18
18
|
export declare const APP_CONFIG_OPTIONS: InjectionToken<FormFieldDefinitionMap>;
|
|
19
|
-
export declare class ConfigService extends BaseGraphqlService<Configuration, any, number> implements IEntityService<Configuration>, IStartableService<Configuration> {
|
|
19
|
+
export declare class ConfigService extends BaseGraphqlService<Configuration, any, number, Configuration> implements IEntityService<Configuration>, IStartableService<Configuration> {
|
|
20
20
|
protected platform: Platform;
|
|
21
21
|
protected graphql: GraphqlService;
|
|
22
22
|
protected storage: Storage;
|
|
@@ -25,18 +25,11 @@ export declare class ConfigService extends BaseGraphqlService<Configuration, any
|
|
|
25
25
|
protected toastController: ToastController;
|
|
26
26
|
protected translate: TranslateService;
|
|
27
27
|
protected environment: any;
|
|
28
|
-
private _started;
|
|
29
|
-
private _startPromise;
|
|
30
|
-
private _subscription;
|
|
31
28
|
private _optionDefs;
|
|
32
29
|
private $data;
|
|
33
|
-
get started(): boolean;
|
|
34
30
|
get config(): Observable<Configuration>;
|
|
35
31
|
constructor(platform: Platform, graphql: GraphqlService, storage: Storage, network: NetworkService, file: FileService, toastController: ToastController, translate: TranslateService, environment: any, defaultOptionsMap: FormFieldDefinitionMap);
|
|
36
|
-
|
|
37
|
-
stop(): Promise<void>;
|
|
38
|
-
restart(): Promise<Configuration>;
|
|
39
|
-
ready(): Promise<Configuration>;
|
|
32
|
+
protected ngOnStart(): Promise<Configuration>;
|
|
40
33
|
loadDefault(opts?: EntityServiceLoadOptions): Promise<Configuration>;
|
|
41
34
|
load(id: number, opts?: EntityServiceLoadOptions & {
|
|
42
35
|
query?: any;
|
|
@@ -28,6 +28,7 @@ export declare interface LocalSettings {
|
|
|
28
28
|
pageHistoryMaxSize: number;
|
|
29
29
|
}
|
|
30
30
|
export declare class UserSettings extends Entity<UserSettings> {
|
|
31
|
+
static SETTINGS_PROPERTIES: string[];
|
|
31
32
|
static fromObject: (source: any, opts?: any) => UserSettings;
|
|
32
33
|
locale: string;
|
|
33
34
|
latLongFormat: LatLongPattern;
|
|
@@ -36,4 +37,5 @@ export declare class UserSettings extends Entity<UserSettings> {
|
|
|
36
37
|
constructor();
|
|
37
38
|
asObject(opts?: EntityAsObjectOptions): any;
|
|
38
39
|
fromObject(source: any, opts?: any): void;
|
|
40
|
+
merge<S = LocalSettings>(source: S, includesProperties: (keyof S)[]): boolean;
|
|
39
41
|
}
|
|
@@ -36,7 +36,6 @@ export declare class NetworkService extends StartableService<Peer> {
|
|
|
36
36
|
onNetworkStatusChanges: BehaviorSubject<ConnectionType>;
|
|
37
37
|
onResetNetworkCache: EventEmitter<any>;
|
|
38
38
|
private readonly _mobile;
|
|
39
|
-
private _subscription;
|
|
40
39
|
private _timerSubscription;
|
|
41
40
|
private readonly _timerRefreshPeriod;
|
|
42
41
|
private readonly _timerRefreshCondition;
|
|
@@ -75,7 +74,8 @@ export declare class NetworkService extends StartableService<Peer> {
|
|
|
75
74
|
/**
|
|
76
75
|
* Check if the peer is alive
|
|
77
76
|
*
|
|
78
|
-
* @param
|
|
77
|
+
* @param peer
|
|
78
|
+
* @param opts
|
|
79
79
|
*/
|
|
80
80
|
checkPeerAlive(peer?: string | Peer, opts?: {
|
|
81
81
|
checkCompatible?: boolean;
|
|
@@ -23,7 +23,6 @@ export declare class EntitiesStorage extends StartableService<EntityStorageMap>
|
|
|
23
23
|
static TRASH_PREFIX: string;
|
|
24
24
|
static REMOTE_PREFIX: string;
|
|
25
25
|
private readonly _typePolicies;
|
|
26
|
-
private _subscription;
|
|
27
26
|
private readonly _saveTimerPeriod;
|
|
28
27
|
private _$save;
|
|
29
28
|
private _dirty;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Subject } from 'rxjs';
|
|
1
|
+
import { Subject, Subscription } from 'rxjs';
|
|
2
2
|
export interface IStartableService<T = any> {
|
|
3
3
|
started: boolean;
|
|
4
4
|
start(): Promise<T>;
|
|
@@ -13,6 +13,7 @@ export declare abstract class StartableService<T = any> implements IStartableSer
|
|
|
13
13
|
private _started;
|
|
14
14
|
private _startPromise;
|
|
15
15
|
private _startPrerequisite;
|
|
16
|
+
private _subscription;
|
|
16
17
|
protected constructor(prerequisiteService: {
|
|
17
18
|
ready: () => Promise<any>;
|
|
18
19
|
});
|
|
@@ -22,6 +23,7 @@ export declare abstract class StartableService<T = any> implements IStartableSer
|
|
|
22
23
|
get started(): boolean;
|
|
23
24
|
get starting(): boolean;
|
|
24
25
|
ready(): Promise<T>;
|
|
26
|
+
protected registerSubscription(sub: Subscription): Subscription;
|
|
25
27
|
protected ngOnStop(): Promise<void>;
|
|
26
28
|
protected abstract ngOnStart(): Promise<T>;
|
|
27
29
|
}
|