@sumaris-net/ngx-components 18.20.1 → 18.21.0

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sumaris-net/ngx-components",
3
3
  "description": "SUMARiS Angular components",
4
- "version": "18.20.1",
4
+ "version": "18.21.0",
5
5
  "author": "contact@e-is.pro",
6
6
  "license": "AGPL-3.0",
7
7
  "readmeFilename": "README.md",
@@ -9,8 +9,9 @@ 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,6 +49,13 @@ 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;
53
+ }
54
+ export interface EntityServiceRefetchQueriesOptions<T = any> {
55
+ refetchQueries?: ((result: FetchResult<Unmasked<{
56
+ data: T[];
57
+ }>>) => InternalRefetchQueriesInclude) | InternalRefetchQueriesInclude;
58
+ policy?: MutableWatchQueriesUpdatePolicy;
51
59
  }
52
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>, 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;
@@ -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>;
@@ -117,9 +126,9 @@ export declare abstract class BaseEntityService<T extends Entity<T, ID>, F exten
117
126
  [key: string]: any;
118
127
  }): T[];
119
128
  protected asObject(source: T, opts?: EntityAsObjectOptions): any;
120
- protected getRefetchQueriesForMutation(opts?: EntityServiceSaveOptions): ((result: FetchResult<{
121
- data: any;
122
- }>) => InternalRefetchQueriesInclude) | InternalRefetchQueriesInclude;
129
+ protected getRefetchQueriesForMutation(opts?: EntityServiceRefetchQueriesOptions<T>): ((result: FetchResult<Unmasked<{
130
+ data: T[];
131
+ }>>) => InternalRefetchQueriesInclude) | InternalRefetchQueriesInclude;
123
132
  protected getLoadQueries(): DocumentNode[];
124
133
  protected getLoadQueryNames(): string[];
125
134
  static ɵfac: i0.ɵɵFactoryDeclaration<BaseEntityService<any, any, any, any, any, any, any, any>, never>;
@@ -1,8 +1,8 @@
1
1
  import { Observable } from 'rxjs';
2
- import { ApolloCache, FetchPolicy, InternalRefetchQueriesInclude, MutationUpdaterFn, MutationUpdaterFunction, WatchQueryFetchPolicy } from '@apollo/client/core';
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 { FetchResult } from '@apollo/client/link/core';
5
+ import { MutationBaseOptions } from '@apollo/client/core/watchQueryOptions';
6
6
  export declare interface Page {
7
7
  offset: number;
8
8
  size: number;
@@ -53,9 +53,7 @@ export declare interface EntityServiceListenChangesOptions<T = any> {
53
53
  [key: string]: any;
54
54
  }
55
55
  export interface EntityServiceSaveOptions<T = any, V = any> {
56
- refetchQueries?: ((result: FetchResult<{
57
- data: T;
58
- }>) => InternalRefetchQueriesInclude) | InternalRefetchQueriesInclude;
56
+ refetchQueries?: MutationBaseOptions<T>['refetchQueries'];
59
57
  awaitRefetchQueries?: boolean;
60
58
  update?: MutationUpdaterFn<{
61
59
  data: any;
@@ -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.20.1",
5
+ "version": "18.21.0",
6
6
  "default_locale": "fr",
7
7
  "description": "Angular components for building beautiful and responsive Apps",
8
8
  "icons": [{