@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/esm2022/src/app/core/graphql/graphql.service.mjs +3 -6
- package/esm2022/src/app/core/graphql/graphql.utils.mjs +2 -2
- package/esm2022/src/app/core/services/network.types.mjs +1 -1
- package/fesm2022/sumaris-net.ngx-components.mjs +2 -5
- package/fesm2022/sumaris-net.ngx-components.mjs.map +1 -1
- package/package.json +1 -1
- package/src/app/core/graphql/graphql.service.d.ts +7 -12
- package/src/app/core/graphql/graphql.utils.d.ts +5 -0
- package/src/app/core/services/network.types.d.ts +2 -1
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
2
|
import { Apollo, ExtraSubscriptionOptions, QueryRef } from 'apollo-angular';
|
|
3
|
-
import { ApolloCache, ApolloClient, FetchPolicy,
|
|
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 {
|
|
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 =
|
|
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:
|
|
37
|
-
update?:
|
|
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
|
|
4
|
+
export { ConnectionType };
|