@sumaris-net/ngx-components 18.20.1 → 18.21.1
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/doc/changelog.md +3 -0
- package/esm2022/src/app/admin/users/person.service.mjs +2 -1
- package/esm2022/src/app/admin/users/users.mjs +3 -3
- package/esm2022/src/app/core/graphql/graphql.service.mjs +3 -1
- package/esm2022/src/app/core/services/base-entity-service.class.mjs +30 -16
- package/esm2022/src/app/core/services/base-graphql-service.class.mjs +14 -20
- package/esm2022/src/app/shared/services/entity-service.class.mjs +1 -1
- package/fesm2022/sumaris-net.ngx-components.mjs +46 -35
- package/fesm2022/sumaris-net.ngx-components.mjs.map +1 -1
- package/package.json +1 -1
- package/src/app/core/services/base-entity-service.class.d.ts +20 -13
- package/src/app/shared/services/entity-service.class.d.ts +23 -22
- package/src/assets/manifest.json +1 -1
package/package.json
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
|
-
import { InternalRefetchQueriesInclude,
|
|
2
|
+
import { InternalRefetchQueriesInclude, WatchQueryFetchPolicy } from '@apollo/client/core';
|
|
3
3
|
import { SortDirection } from '@angular/material/sort';
|
|
4
4
|
import { BaseGraphqlService } from './base-graphql-service.class';
|
|
5
|
-
import { EntitiesServiceLoadOptions, EntitiesServiceWatchOptions, EntityServiceListenChangesOptions, EntityServiceSaveOptions, IEntitiesService, IEntityService, LoadResult } from '../../shared/services/entity-service.class';
|
|
5
|
+
import { EntitiesServiceDeleteOptions, EntitiesServiceLoadOptions, EntitiesServiceWatchOptions, EntityServiceListenChangesOptions, EntityServiceSaveOptions, IEntitiesService, IEntityService, LoadResult } from '../../shared/services/entity-service.class';
|
|
6
6
|
import { GraphqlService } from '../graphql/graphql.service';
|
|
7
7
|
import { PlatformService } from './platform.service';
|
|
8
8
|
import { Entity, EntityAsObjectOptions } from './model/entity.model';
|
|
9
9
|
import { FetchResult } from '@apollo/client/link/core';
|
|
10
10
|
import { EntityFilter } from './model/filter.model';
|
|
11
11
|
import { DocumentNode } from 'graphql';
|
|
12
|
+
import type { Unmasked } from '@apollo/client/masking';
|
|
12
13
|
import * as i0 from "@angular/core";
|
|
13
|
-
export type MutableWatchQueriesUpdatePolicy = 'update-cache' | 'refetch-queries';
|
|
14
|
+
export type MutableWatchQueriesUpdatePolicy = 'update-cache' | 'refetch-queries' | 'none';
|
|
14
15
|
/**
|
|
15
16
|
* @deprecated Use EntityServiceSaveOptions
|
|
16
17
|
*/
|
|
@@ -48,8 +49,15 @@ export interface BaseEntityServiceOptions<T extends Entity<any, ID>, ID = number
|
|
|
48
49
|
defaultSortBy?: keyof T;
|
|
49
50
|
defaultSortDirection?: SortDirection;
|
|
50
51
|
watchQueriesUpdatePolicy?: MutableWatchQueriesUpdatePolicy;
|
|
52
|
+
watchQueriesDeletePolicy?: MutableWatchQueriesUpdatePolicy;
|
|
51
53
|
}
|
|
52
|
-
export
|
|
54
|
+
export interface EntityServiceRefetchQueriesOptions<T = any> {
|
|
55
|
+
refetchQueries?: ((result: FetchResult<Unmasked<{
|
|
56
|
+
data: T[];
|
|
57
|
+
}>>) => InternalRefetchQueriesInclude) | InternalRefetchQueriesInclude;
|
|
58
|
+
policy?: MutableWatchQueriesUpdatePolicy;
|
|
59
|
+
}
|
|
60
|
+
export declare abstract class BaseEntityService<T extends Entity<T, ID>, F extends EntityFilter<F, T, ID>, ID = number, WO extends EntitiesServiceWatchOptions = EntitiesServiceWatchOptions<T>, LO extends EntitiesServiceLoadOptions = EntitiesServiceLoadOptions<T>, DO extends EntitiesServiceDeleteOptions = EntitiesServiceDeleteOptions<T>, Q extends BaseEntityGraphqlQueries = BaseEntityGraphqlQueries, M extends BaseEntityGraphqlMutations = BaseEntityGraphqlMutations, S extends BaseEntityGraphqlSubscriptions = BaseEntityGraphqlSubscriptions> extends BaseGraphqlService<T, F, ID> implements IEntitiesService<T, F, WO>, IEntityService<T, ID, LO> {
|
|
53
61
|
protected graphql: GraphqlService;
|
|
54
62
|
protected platform: PlatformService;
|
|
55
63
|
protected dataType: new () => T;
|
|
@@ -64,6 +72,7 @@ export declare abstract class BaseEntityService<T extends Entity<T, ID>, F exten
|
|
|
64
72
|
protected readonly defaultSortBy: keyof T;
|
|
65
73
|
protected readonly defaultSortDirection: SortDirection;
|
|
66
74
|
protected readonly watchQueriesUpdatePolicy: MutableWatchQueriesUpdatePolicy;
|
|
75
|
+
protected readonly watchQueriesDeletePolicy: MutableWatchQueriesUpdatePolicy;
|
|
67
76
|
get defaultFetchPolicy(): WatchQueryFetchPolicy;
|
|
68
77
|
protected constructor(graphql: GraphqlService, platform: PlatformService, dataType: new () => T, filterType: new () => F, options: BaseEntityServiceOptions<T, ID, Q, M, S>);
|
|
69
78
|
watch(id: number, opts?: WO): Observable<T>;
|
|
@@ -85,13 +94,11 @@ export declare abstract class BaseEntityService<T extends Entity<T, ID>, F exten
|
|
|
85
94
|
/**
|
|
86
95
|
* Delete referential entities
|
|
87
96
|
*/
|
|
88
|
-
deleteAll(entities: T[], opts?:
|
|
89
|
-
update: MutationUpdaterFn<any>;
|
|
90
|
-
}> | any): Promise<any>;
|
|
97
|
+
deleteAll(entities: T[], opts?: DO | any): Promise<any>;
|
|
91
98
|
/**
|
|
92
99
|
* Delete a referential entity
|
|
93
100
|
*/
|
|
94
|
-
delete(entity: T, opts?:
|
|
101
|
+
delete(entity: T, opts?: DO | any): Promise<any>;
|
|
95
102
|
listenChanges(id: ID, opts?: EntityServiceListenChangesOptions<T>): Observable<T>;
|
|
96
103
|
copyIdAndUpdateDate(source: T, target: T): void;
|
|
97
104
|
fromObject(source: any, opts?: {
|
|
@@ -117,11 +124,11 @@ export declare abstract class BaseEntityService<T extends Entity<T, ID>, F exten
|
|
|
117
124
|
[key: string]: any;
|
|
118
125
|
}): T[];
|
|
119
126
|
protected asObject(source: T, opts?: EntityAsObjectOptions): any;
|
|
120
|
-
protected getRefetchQueriesForMutation(opts?:
|
|
121
|
-
data:
|
|
122
|
-
}
|
|
127
|
+
protected getRefetchQueriesForMutation(opts?: EntityServiceRefetchQueriesOptions<T>): ((result: FetchResult<Unmasked<{
|
|
128
|
+
data: T[];
|
|
129
|
+
}>>) => InternalRefetchQueriesInclude) | InternalRefetchQueriesInclude;
|
|
123
130
|
protected getLoadQueries(): DocumentNode[];
|
|
124
131
|
protected getLoadQueryNames(): string[];
|
|
125
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<BaseEntityService<any, any, any, any, any, any, any, any>, never>;
|
|
126
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<BaseEntityService<any, any, any, any, any, any, any, any>, never, never, {}, {}, never, never, false, never>;
|
|
132
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BaseEntityService<any, any, any, any, any, any, any, any, any>, never>;
|
|
133
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<BaseEntityService<any, any, any, any, any, any, any, any, any>, never, never, {}, {}, never, never, false, never>;
|
|
127
134
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
|
-
import { ApolloCache, FetchPolicy,
|
|
2
|
+
import { ApolloCache, FetchPolicy, MutationUpdaterFn, MutationUpdaterFunction, WatchQueryFetchPolicy } from '@apollo/client/core';
|
|
3
3
|
import { SortDirection } from '@angular/material/sort';
|
|
4
4
|
import { EmptyObject } from '../../core/graphql/graphql.utils';
|
|
5
|
-
import {
|
|
5
|
+
import { MutationBaseOptions } from '@apollo/client/core/watchQueryOptions';
|
|
6
6
|
export declare interface Page {
|
|
7
7
|
offset: number;
|
|
8
8
|
size: number;
|
|
@@ -25,37 +25,34 @@ export type SuggestFn<T, F> = (value: any, filter?: F, sortBy?: string | keyof T
|
|
|
25
25
|
export declare interface SuggestService<T, F> {
|
|
26
26
|
suggest: SuggestFn<T, F>;
|
|
27
27
|
}
|
|
28
|
-
export declare interface EntityServiceLoadOptions<
|
|
28
|
+
export declare interface EntityServiceLoadOptions<T = any, V = any> {
|
|
29
29
|
fetchPolicy?: FetchPolicy;
|
|
30
30
|
trash?: boolean;
|
|
31
|
-
toEntity?: boolean | ((source: any, opts?: any) =>
|
|
31
|
+
toEntity?: boolean | ((source: any, opts?: any) => T);
|
|
32
32
|
query?: any;
|
|
33
|
-
variables?:
|
|
34
|
-
[key: string]: any;
|
|
35
|
-
}
|
|
36
|
-
export declare interface EntityServiceDeleteOptions<E = any> {
|
|
33
|
+
variables?: V;
|
|
37
34
|
[key: string]: any;
|
|
38
35
|
}
|
|
39
|
-
export declare interface EntityServiceWatchOptions<T = any> {
|
|
36
|
+
export declare interface EntityServiceWatchOptions<T = any, V = any> {
|
|
37
|
+
query?: any;
|
|
38
|
+
variables?: V;
|
|
40
39
|
fetchPolicy?: WatchQueryFetchPolicy;
|
|
41
40
|
trash?: boolean;
|
|
42
41
|
toEntity?: boolean | ((source: any, opts?: any) => T);
|
|
43
|
-
query?: any;
|
|
44
|
-
variables?: any;
|
|
45
42
|
[key: string]: any;
|
|
46
43
|
}
|
|
47
|
-
export declare interface EntityServiceListenChangesOptions<T = any> {
|
|
44
|
+
export declare interface EntityServiceListenChangesOptions<T = any, V = any> {
|
|
45
|
+
query?: any;
|
|
46
|
+
variables?: V;
|
|
48
47
|
interval?: number;
|
|
49
48
|
fetchPolicy?: FetchPolicy;
|
|
50
|
-
toEntity?: boolean | ((source: any) => T);
|
|
51
|
-
query?: any;
|
|
52
|
-
variables?: any;
|
|
49
|
+
toEntity?: boolean | ((source: any, opts?: any) => T);
|
|
53
50
|
[key: string]: any;
|
|
54
51
|
}
|
|
55
52
|
export interface EntityServiceSaveOptions<T = any, V = any> {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
53
|
+
query?: any;
|
|
54
|
+
variables?: V;
|
|
55
|
+
refetchQueries?: MutationBaseOptions<T>['refetchQueries'];
|
|
59
56
|
awaitRefetchQueries?: boolean;
|
|
60
57
|
update?: MutationUpdaterFn<{
|
|
61
58
|
data: any;
|
|
@@ -64,6 +61,10 @@ export interface EntityServiceSaveOptions<T = any, V = any> {
|
|
|
64
61
|
}, V, any, ApolloCache<{
|
|
65
62
|
data: any;
|
|
66
63
|
}>>;
|
|
64
|
+
[key: string]: any;
|
|
65
|
+
}
|
|
66
|
+
export declare interface EntityServiceDeleteOptions<T = any, V = any> extends Omit<EntityServiceSaveOptions<T, V>, 'query'> {
|
|
67
|
+
mutation?: any;
|
|
67
68
|
}
|
|
68
69
|
export declare interface IEntityService<T, ID = any, LO = EntityServiceLoadOptions<T>, SO = EntityServiceSaveOptions<T>, DO = EntityServiceDeleteOptions<T>> {
|
|
69
70
|
load(id: ID, opts?: LO): Promise<T>;
|
|
@@ -72,15 +73,15 @@ export declare interface IEntityService<T, ID = any, LO = EntityServiceLoadOptio
|
|
|
72
73
|
delete(data: T, opts?: DO): Promise<any>;
|
|
73
74
|
listenChanges(id: ID, opts?: any): Observable<T | undefined>;
|
|
74
75
|
}
|
|
75
|
-
export declare interface EntitiesServiceLoadOptions<T = any> extends EntityServiceLoadOptions<T> {
|
|
76
|
+
export declare interface EntitiesServiceLoadOptions<T = any, V = any> extends EntityServiceLoadOptions<T, V> {
|
|
76
77
|
withTotal?: boolean;
|
|
77
78
|
}
|
|
78
|
-
export declare interface EntitiesServiceWatchOptions<T = any> extends EntityServiceWatchOptions<T> {
|
|
79
|
+
export declare interface EntitiesServiceWatchOptions<T = any, V = any> extends EntityServiceWatchOptions<T, V> {
|
|
79
80
|
withTotal?: boolean;
|
|
80
81
|
}
|
|
81
|
-
export declare interface EntitiesServiceSaveOptions<T = any> extends EntityServiceSaveOptions<T> {
|
|
82
|
+
export declare interface EntitiesServiceSaveOptions<T = any, V = any> extends EntityServiceSaveOptions<T, V> {
|
|
82
83
|
}
|
|
83
|
-
export declare interface EntitiesServiceDeleteOptions<T = any> extends EntityServiceDeleteOptions<T> {
|
|
84
|
+
export declare interface EntitiesServiceDeleteOptions<T = any, V = any> extends EntityServiceDeleteOptions<T, V> {
|
|
84
85
|
}
|
|
85
86
|
export declare interface IEntitiesService<T, F, O extends EntitiesServiceWatchOptions = EntitiesServiceWatchOptions<T>, SO extends EntitiesServiceSaveOptions = EntitiesServiceSaveOptions<T>, DO extends EntitiesServiceDeleteOptions = EntitiesServiceDeleteOptions<T>> {
|
|
86
87
|
readonly defaultFetchPolicy?: WatchQueryFetchPolicy;
|
package/src/assets/manifest.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "ngx-sumaris-components",
|
|
3
3
|
"short_name": "ngx-sumaris-components",
|
|
4
4
|
"manifest_version": 1,
|
|
5
|
-
"version": "18.
|
|
5
|
+
"version": "18.21.1",
|
|
6
6
|
"default_locale": "fr",
|
|
7
7
|
"description": "Angular components for building beautiful and responsive Apps",
|
|
8
8
|
"icons": [{
|