@apollo/client 4.1.4 → 4.2.0-alpha.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/CHANGELOG.md +6 -0
- package/__cjs/core/ApolloClient.cjs +0 -9
- package/__cjs/core/ApolloClient.cjs.map +1 -1
- package/__cjs/core/ApolloClient.d.cts +81 -3
- package/__cjs/react/internal/cache/QueryReference.d.cts +8 -2
- package/__cjs/utilities/internal/toQueryResult.d.cts +5 -2
- package/__cjs/version.cjs +1 -1
- package/__cjs/version.cjs.map +1 -1
- package/core/ApolloClient.d.ts +81 -3
- package/core/ApolloClient.js +0 -9
- package/core/ApolloClient.js.map +1 -1
- package/package.json +1 -1
- package/react/internal/cache/QueryReference.d.ts +8 -2
- package/utilities/internal/toQueryResult.d.ts +5 -2
- package/version.js +1 -1
- package/version.js.map +1 -1
|
@@ -267,7 +267,25 @@ export declare namespace ApolloClient {
|
|
|
267
267
|
*/
|
|
268
268
|
fetchPolicy?: FetchPolicy;
|
|
269
269
|
} & VariablesOption<NoInfer<TVariables>>;
|
|
270
|
-
|
|
270
|
+
type QueryResult<TData = unknown, TErrorPolicy extends ErrorPolicy | undefined = undefined> = TErrorPolicy extends "none" ? {
|
|
271
|
+
/**
|
|
272
|
+
* An object containing the result of your GraphQL query after it completes.
|
|
273
|
+
*
|
|
274
|
+
* This value might be `undefined` if a query results in one or more errors (depending on the query's `errorPolicy`).
|
|
275
|
+
*
|
|
276
|
+
* @docGroup 1. Operation data
|
|
277
|
+
*/
|
|
278
|
+
data: TData;
|
|
279
|
+
/**
|
|
280
|
+
* A single ErrorLike object describing the error that occurred during the latest
|
|
281
|
+
* query execution.
|
|
282
|
+
*
|
|
283
|
+
* For more information, see [Handling operation errors](https://www.apollographql.com/docs/react/data/error-handling/).
|
|
284
|
+
*
|
|
285
|
+
* @docGroup 1. Operation data
|
|
286
|
+
*/
|
|
287
|
+
error?: never;
|
|
288
|
+
} : TErrorPolicy extends "all" ? {
|
|
271
289
|
/**
|
|
272
290
|
* An object containing the result of your GraphQL query after it completes.
|
|
273
291
|
*
|
|
@@ -285,7 +303,43 @@ export declare namespace ApolloClient {
|
|
|
285
303
|
* @docGroup 1. Operation data
|
|
286
304
|
*/
|
|
287
305
|
error?: ErrorLike;
|
|
288
|
-
}
|
|
306
|
+
} : TErrorPolicy extends "ignore" ? {
|
|
307
|
+
/**
|
|
308
|
+
* An object containing the result of your GraphQL query after it completes.
|
|
309
|
+
*
|
|
310
|
+
* This value might be `undefined` if a query results in one or more errors (depending on the query's `errorPolicy`).
|
|
311
|
+
*
|
|
312
|
+
* @docGroup 1. Operation data
|
|
313
|
+
*/
|
|
314
|
+
data: TData | undefined;
|
|
315
|
+
/**
|
|
316
|
+
* A single ErrorLike object describing the error that occurred during the latest
|
|
317
|
+
* query execution.
|
|
318
|
+
*
|
|
319
|
+
* For more information, see [Handling operation errors](https://www.apollographql.com/docs/react/data/error-handling/).
|
|
320
|
+
*
|
|
321
|
+
* @docGroup 1. Operation data
|
|
322
|
+
*/
|
|
323
|
+
error?: never;
|
|
324
|
+
} : {
|
|
325
|
+
/**
|
|
326
|
+
* An object containing the result of your GraphQL query after it completes.
|
|
327
|
+
*
|
|
328
|
+
* This value might be `undefined` if a query results in one or more errors (depending on the query's `errorPolicy`).
|
|
329
|
+
*
|
|
330
|
+
* @docGroup 1. Operation data
|
|
331
|
+
*/
|
|
332
|
+
data: TData | undefined;
|
|
333
|
+
/**
|
|
334
|
+
* A single ErrorLike object describing the error that occurred during the latest
|
|
335
|
+
* query execution.
|
|
336
|
+
*
|
|
337
|
+
* For more information, see [Handling operation errors](https://www.apollographql.com/docs/react/data/error-handling/).
|
|
338
|
+
*
|
|
339
|
+
* @docGroup 1. Operation data
|
|
340
|
+
*/
|
|
341
|
+
error?: ErrorLike;
|
|
342
|
+
};
|
|
289
343
|
/**
|
|
290
344
|
* Options object for the `client.refetchQueries` method.
|
|
291
345
|
*/
|
|
@@ -811,7 +865,31 @@ export declare class ApolloClient {
|
|
|
811
865
|
* describe how this query should be treated e.g. whether it should hit the
|
|
812
866
|
* server at all or just resolve from the cache, etc.
|
|
813
867
|
*/
|
|
814
|
-
query<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: ApolloClient.QueryOptions<TData, TVariables>
|
|
868
|
+
query<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: ApolloClient.QueryOptions<TData, TVariables> & {
|
|
869
|
+
errorPolicy: "all";
|
|
870
|
+
}): Promise<ApolloClient.QueryResult<MaybeMasked<TData>, "all">>;
|
|
871
|
+
/**
|
|
872
|
+
* This resolves a single query according to the options specified and
|
|
873
|
+
* returns a `Promise` which is either resolved with the resulting data
|
|
874
|
+
* or rejected with an error.
|
|
875
|
+
*
|
|
876
|
+
* @param options - An object of type `QueryOptions` that allows us to
|
|
877
|
+
* describe how this query should be treated e.g. whether it should hit the
|
|
878
|
+
* server at all or just resolve from the cache, etc.
|
|
879
|
+
*/
|
|
880
|
+
query<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: ApolloClient.QueryOptions<TData, TVariables> & {
|
|
881
|
+
errorPolicy: "ignore";
|
|
882
|
+
}): Promise<ApolloClient.QueryResult<MaybeMasked<TData>, "ignore">>;
|
|
883
|
+
/**
|
|
884
|
+
* This resolves a single query according to the options specified and
|
|
885
|
+
* returns a `Promise` which is either resolved with the resulting data
|
|
886
|
+
* or rejected with an error.
|
|
887
|
+
*
|
|
888
|
+
* @param options - An object of type `QueryOptions` that allows us to
|
|
889
|
+
* describe how this query should be treated e.g. whether it should hit the
|
|
890
|
+
* server at all or just resolve from the cache, etc.
|
|
891
|
+
*/
|
|
892
|
+
query<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: ApolloClient.QueryOptions<TData, TVariables>): Promise<ApolloClient.QueryResult<MaybeMasked<TData>, "none">>;
|
|
815
893
|
/**
|
|
816
894
|
* This resolves a single mutation according to the options specified and returns a
|
|
817
895
|
* Promise which is either resolved with the resulting data or rejected with an
|
|
@@ -96,8 +96,14 @@ export declare class InternalQueryReference<TData = unknown, TStates extends Dat
|
|
|
96
96
|
didChangeOptions(watchQueryOptions: ObservedOptions): boolean;
|
|
97
97
|
applyOptions(watchQueryOptions: ObservedOptions): QueryRefPromise<TData, TStates>;
|
|
98
98
|
listen(listener: Listener<TData, TStates>): () => void;
|
|
99
|
-
refetch(variables: OperationVariables | undefined): Promise<
|
|
100
|
-
|
|
99
|
+
refetch(variables: OperationVariables | undefined): Promise<{
|
|
100
|
+
data: TData | undefined;
|
|
101
|
+
error?: import("@apollo/client").ErrorLike;
|
|
102
|
+
}>;
|
|
103
|
+
fetchMore(options: ObservableQuery.FetchMoreOptions<TData, any, any, any>): Promise<{
|
|
104
|
+
data: TData | undefined;
|
|
105
|
+
error?: import("@apollo/client").ErrorLike;
|
|
106
|
+
}>;
|
|
101
107
|
private dispose;
|
|
102
108
|
private onDispose;
|
|
103
109
|
private handleNext;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ObservableQuery } from "@apollo/client";
|
|
2
2
|
/**
|
|
3
3
|
* @internal
|
|
4
4
|
*
|
|
5
5
|
* @deprecated This is an internal API and should not be used directly. This can be removed or changed at any time.
|
|
6
6
|
*/
|
|
7
|
-
export declare function toQueryResult<TData = unknown>(value: ObservableQuery.Result<TData>):
|
|
7
|
+
export declare function toQueryResult<TData = unknown>(value: ObservableQuery.Result<TData>): {
|
|
8
|
+
data: TData | undefined;
|
|
9
|
+
error?: import("@apollo/client").ErrorLike;
|
|
10
|
+
};
|
|
8
11
|
//# sourceMappingURL=toQueryResult.d.cts.map
|
package/__cjs/version.cjs
CHANGED
package/__cjs/version.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.cjs","sources":["../../src/version.ts"],"sourcesContent":["export const version = \"local\" as string;\nexport const build = \"source\" as \"source\" | \"esm\" | \"cjs\";\n"],"names":[],"mappings":";;;AAAa,CAAb,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAa,CAAb,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,
|
|
1
|
+
{"version":3,"file":"version.cjs","sources":["../../src/version.ts"],"sourcesContent":["export const version = \"local\" as string;\nexport const build = \"source\" as \"source\" | \"esm\" | \"cjs\";\n"],"names":[],"mappings":";;;AAAa,CAAb,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAa,CAAb,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,iBAAwC;AAC3B,CAAb,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAa,CAAb,CAAA,CAAA,CAAA,EAAA,OAAyD;"}
|
package/core/ApolloClient.d.ts
CHANGED
|
@@ -267,7 +267,25 @@ export declare namespace ApolloClient {
|
|
|
267
267
|
*/
|
|
268
268
|
fetchPolicy?: FetchPolicy;
|
|
269
269
|
} & VariablesOption<NoInfer<TVariables>>;
|
|
270
|
-
|
|
270
|
+
type QueryResult<TData = unknown, TErrorPolicy extends ErrorPolicy | undefined = undefined> = TErrorPolicy extends "none" ? {
|
|
271
|
+
/**
|
|
272
|
+
* An object containing the result of your GraphQL query after it completes.
|
|
273
|
+
*
|
|
274
|
+
* This value might be `undefined` if a query results in one or more errors (depending on the query's `errorPolicy`).
|
|
275
|
+
*
|
|
276
|
+
* @docGroup 1. Operation data
|
|
277
|
+
*/
|
|
278
|
+
data: TData;
|
|
279
|
+
/**
|
|
280
|
+
* A single ErrorLike object describing the error that occurred during the latest
|
|
281
|
+
* query execution.
|
|
282
|
+
*
|
|
283
|
+
* For more information, see [Handling operation errors](https://www.apollographql.com/docs/react/data/error-handling/).
|
|
284
|
+
*
|
|
285
|
+
* @docGroup 1. Operation data
|
|
286
|
+
*/
|
|
287
|
+
error?: never;
|
|
288
|
+
} : TErrorPolicy extends "all" ? {
|
|
271
289
|
/**
|
|
272
290
|
* An object containing the result of your GraphQL query after it completes.
|
|
273
291
|
*
|
|
@@ -285,7 +303,43 @@ export declare namespace ApolloClient {
|
|
|
285
303
|
* @docGroup 1. Operation data
|
|
286
304
|
*/
|
|
287
305
|
error?: ErrorLike;
|
|
288
|
-
}
|
|
306
|
+
} : TErrorPolicy extends "ignore" ? {
|
|
307
|
+
/**
|
|
308
|
+
* An object containing the result of your GraphQL query after it completes.
|
|
309
|
+
*
|
|
310
|
+
* This value might be `undefined` if a query results in one or more errors (depending on the query's `errorPolicy`).
|
|
311
|
+
*
|
|
312
|
+
* @docGroup 1. Operation data
|
|
313
|
+
*/
|
|
314
|
+
data: TData | undefined;
|
|
315
|
+
/**
|
|
316
|
+
* A single ErrorLike object describing the error that occurred during the latest
|
|
317
|
+
* query execution.
|
|
318
|
+
*
|
|
319
|
+
* For more information, see [Handling operation errors](https://www.apollographql.com/docs/react/data/error-handling/).
|
|
320
|
+
*
|
|
321
|
+
* @docGroup 1. Operation data
|
|
322
|
+
*/
|
|
323
|
+
error?: never;
|
|
324
|
+
} : {
|
|
325
|
+
/**
|
|
326
|
+
* An object containing the result of your GraphQL query after it completes.
|
|
327
|
+
*
|
|
328
|
+
* This value might be `undefined` if a query results in one or more errors (depending on the query's `errorPolicy`).
|
|
329
|
+
*
|
|
330
|
+
* @docGroup 1. Operation data
|
|
331
|
+
*/
|
|
332
|
+
data: TData | undefined;
|
|
333
|
+
/**
|
|
334
|
+
* A single ErrorLike object describing the error that occurred during the latest
|
|
335
|
+
* query execution.
|
|
336
|
+
*
|
|
337
|
+
* For more information, see [Handling operation errors](https://www.apollographql.com/docs/react/data/error-handling/).
|
|
338
|
+
*
|
|
339
|
+
* @docGroup 1. Operation data
|
|
340
|
+
*/
|
|
341
|
+
error?: ErrorLike;
|
|
342
|
+
};
|
|
289
343
|
/**
|
|
290
344
|
* Options object for the `client.refetchQueries` method.
|
|
291
345
|
*/
|
|
@@ -811,7 +865,31 @@ export declare class ApolloClient {
|
|
|
811
865
|
* describe how this query should be treated e.g. whether it should hit the
|
|
812
866
|
* server at all or just resolve from the cache, etc.
|
|
813
867
|
*/
|
|
814
|
-
query<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: ApolloClient.QueryOptions<TData, TVariables>
|
|
868
|
+
query<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: ApolloClient.QueryOptions<TData, TVariables> & {
|
|
869
|
+
errorPolicy: "all";
|
|
870
|
+
}): Promise<ApolloClient.QueryResult<MaybeMasked<TData>, "all">>;
|
|
871
|
+
/**
|
|
872
|
+
* This resolves a single query according to the options specified and
|
|
873
|
+
* returns a `Promise` which is either resolved with the resulting data
|
|
874
|
+
* or rejected with an error.
|
|
875
|
+
*
|
|
876
|
+
* @param options - An object of type `QueryOptions` that allows us to
|
|
877
|
+
* describe how this query should be treated e.g. whether it should hit the
|
|
878
|
+
* server at all or just resolve from the cache, etc.
|
|
879
|
+
*/
|
|
880
|
+
query<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: ApolloClient.QueryOptions<TData, TVariables> & {
|
|
881
|
+
errorPolicy: "ignore";
|
|
882
|
+
}): Promise<ApolloClient.QueryResult<MaybeMasked<TData>, "ignore">>;
|
|
883
|
+
/**
|
|
884
|
+
* This resolves a single query according to the options specified and
|
|
885
|
+
* returns a `Promise` which is either resolved with the resulting data
|
|
886
|
+
* or rejected with an error.
|
|
887
|
+
*
|
|
888
|
+
* @param options - An object of type `QueryOptions` that allows us to
|
|
889
|
+
* describe how this query should be treated e.g. whether it should hit the
|
|
890
|
+
* server at all or just resolve from the cache, etc.
|
|
891
|
+
*/
|
|
892
|
+
query<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: ApolloClient.QueryOptions<TData, TVariables>): Promise<ApolloClient.QueryResult<MaybeMasked<TData>, "none">>;
|
|
815
893
|
/**
|
|
816
894
|
* This resolves a single mutation according to the options specified and returns a
|
|
817
895
|
* Promise which is either resolved with the resulting data or rejected with an
|
package/core/ApolloClient.js
CHANGED
|
@@ -218,15 +218,6 @@ export class ApolloClient {
|
|
|
218
218
|
}
|
|
219
219
|
return this.queryManager.watchQuery(options);
|
|
220
220
|
}
|
|
221
|
-
/**
|
|
222
|
-
* This resolves a single query according to the options specified and
|
|
223
|
-
* returns a `Promise` which is either resolved with the resulting data
|
|
224
|
-
* or rejected with an error.
|
|
225
|
-
*
|
|
226
|
-
* @param options - An object of type `QueryOptions` that allows us to
|
|
227
|
-
* describe how this query should be treated e.g. whether it should hit the
|
|
228
|
-
* server at all or just resolve from the cache, etc.
|
|
229
|
-
*/
|
|
230
221
|
query(options) {
|
|
231
222
|
if (this.defaultOptions.query) {
|
|
232
223
|
options = mergeOptions(this.defaultOptions.query, options);
|