@sumaris-net/ngx-components 18.5.0-alpha3 → 18.5.0-rc2

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.5.0-alpha3",
4
+ "version": "18.5.0-rc2",
5
5
  "author": "contact@e-is.pro",
6
6
  "license": "AGPL-3.0",
7
7
  "readmeFilename": "README.md",
@@ -1,13 +1,13 @@
1
1
  import { Observable } from 'rxjs';
2
2
  import { Apollo, ExtraSubscriptionOptions, QueryRef } from 'apollo-angular';
3
- import { ApolloCache, ApolloClient, FetchPolicy, MutationUpdaterFn, MutationUpdaterFunction, OperationVariables, TypePolicies, Unmasked, WatchQueryFetchPolicy } from '@apollo/client/core';
3
+ import { ApolloCache, ApolloClient, FetchPolicy, MutationUpdaterFunction, OperationVariables, TypePolicies, Unmasked, WatchQueryFetchPolicy } from '@apollo/client/core';
4
4
  import { ServiceError } from '../services/errors';
5
5
  import { InjectionToken } from '@angular/core';
6
6
  import { NetworkService } from '../services/network.service';
7
- import { EmptyObject } from './graphql.utils';
7
+ import { EmptyObject, TrackableMutationContext } from './graphql.utils';
8
8
  import { Platform } from '@ionic/angular';
9
9
  import { IEntity } from '../services/model/entity.model';
10
- import { type DefaultContext, Resolvers } from '@apollo/client/core/types';
10
+ import { Resolvers } from '@apollo/client/core/types';
11
11
  import { HttpLink } from 'apollo-angular/http';
12
12
  import { ErrorPolicy, MutationBaseOptions } from '@apollo/client/core/watchQueryOptions';
13
13
  import { Cache } from '@apollo/client/cache/core/types/Cache';
@@ -23,18 +23,14 @@ export interface WatchQueryOptions<V> {
23
23
  error?: ServiceError;
24
24
  fetchPolicy?: WatchQueryFetchPolicy;
25
25
  }
26
- export interface MutateQueryOptions<TData, TVariables = OperationVariables, TContext = DefaultContext, TCache extends ApolloCache<any> = ApolloCache<any>> extends MutationBaseOptions<TData, TVariables, TContext, TCache> {
26
+ export interface MutateQueryOptions<TData, TVariables = OperationVariables, TContext = TrackableMutationContext, TCache extends ApolloCache<any> = ApolloCache<any>> extends MutationBaseOptions<TData, TVariables, TContext, TCache> {
27
27
  mutation: any;
28
28
  variables?: TVariables;
29
29
  error?: ServiceError;
30
- context?: {
31
- serializationKey?: string;
32
- tracked?: boolean;
33
- timeout?: number;
34
- };
30
+ context?: TContext;
35
31
  optimisticResponse?: Unmasked<NoInfer<TData>>;
36
- offlineResponse?: TData | ((context: any) => Promise<TData>);
37
- update?: MutationUpdaterFn<TData> | MutationUpdaterFunction<TData, TVariables, TContext, TCache>;
32
+ offlineResponse?: TData | ((context: TContext) => Promise<TData>);
33
+ update?: MutationUpdaterFunction<TData, TVariables, TContext, TCache>;
38
34
  forceOffline?: boolean;
39
35
  }
40
36
  export declare const APP_GRAPHQL_TYPE_POLICIES: InjectionToken<TypePolicies>;
@@ -137,7 +133,6 @@ export declare class GraphqlService extends StartableService<ApolloClient<any>>
137
133
  protected ngOnStart(): Promise<ApolloClient<any>>;
138
134
  protected ngOnStop(): Promise<void>;
139
135
  protected resetClient(client?: ApolloClient<any>): Promise<void>;
140
- private onApolloError;
141
136
  private toApolloError;
142
137
  private createAppErrorByCode;
143
138
  private getI18nErrorMessageByCode;
@@ -21,6 +21,11 @@ export interface TrackedQuery {
21
21
  variablesJSON: string;
22
22
  contextJSON: string;
23
23
  }
24
+ export interface TrackableMutationContext extends Record<string, any> {
25
+ serializationKey?: string;
26
+ tracked?: boolean;
27
+ timeout?: number;
28
+ }
24
29
  export declare const TRACKED_QUERIES_STORAGE_KEY = "apollo-tracker-persist";
25
30
  export declare function createTrackerLink(opts: {
26
31
  storage?: PersistentStorage<string>;
@@ -1,3 +1,4 @@
1
+ import { ConnectionType } from '@capacitor/network';
1
2
  export type AuthTokenType = 'token' | 'basic' | 'basic-and-token';
2
3
  export declare type NetworkEventType = 'start' | 'peerChanged' | 'statusChanged' | 'resetCache' | 'beforeTryOnlineFinish';
3
- export type ConnectionType = 'none' | 'wifi' | 'cellular' | 'unknown';
4
+ export { ConnectionType };