@apollo/client 3.10.8 → 3.11.0-rc.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/.changeset/angry-ravens-mate.md +5 -0
- package/.changeset/angry-seals-jog.md +5 -0
- package/.changeset/chilly-dots-shake.md +5 -0
- package/.changeset/clever-bikes-admire.md +5 -0
- package/.changeset/flat-onions-guess.md +5 -0
- package/.changeset/fluffy-badgers-rush.md +5 -0
- package/.changeset/little-suits-return.md +5 -0
- package/.changeset/nasty-olives-act.md +5 -0
- package/.changeset/pink-ants-remember.md +16 -0
- package/.changeset/pre.json +24 -0
- package/.changeset/slimy-balloons-cheat.md +5 -0
- package/.changeset/slimy-berries-yawn.md +14 -0
- package/.changeset/tasty-chairs-dress.md +5 -0
- package/.changeset/thin-lies-begin.md +5 -0
- package/.changeset/unlucky-birds-press.md +5 -0
- package/.changeset/weak-ads-develop.md +5 -0
- package/CHANGELOG.md +60 -4
- package/apollo-client.cjs +501 -410
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/core/ApolloClient.d.ts +24 -2
- package/core/ApolloClient.js +9 -8
- package/core/ApolloClient.js.map +1 -1
- package/core/ObservableQuery.js +5 -1
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryInfo.d.ts +2 -2
- package/core/QueryInfo.js.map +1 -1
- package/core/QueryManager.d.ts +1 -1
- package/core/QueryManager.js +5 -4
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs +18 -11
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +18 -11
- package/core/types.d.ts +2 -2
- package/core/types.js.map +1 -1
- package/core/watchQueryOptions.d.ts +4 -0
- package/core/watchQueryOptions.js.map +1 -1
- package/dev/dev.cjs +40 -34
- package/dev/dev.cjs.map +1 -1
- package/dev/dev.cjs.native.js +40 -34
- package/errors/errors.cjs +4 -0
- package/errors/errors.cjs.map +1 -1
- package/errors/errors.cjs.native.js +4 -0
- package/errors/index.d.ts +18 -3
- package/errors/index.js +7 -2
- package/errors/index.js.map +1 -1
- package/invariantErrorCodes.js +41 -34
- package/link/core/types.d.ts +6 -4
- package/link/core/types.js.map +1 -1
- package/link/error/index.d.ts +4 -4
- package/link/error/index.js.map +1 -1
- package/link/persisted-queries/index.d.ts +3 -3
- package/link/persisted-queries/index.js.map +1 -1
- package/link/subscriptions/index.js +1 -0
- package/link/subscriptions/index.js.map +1 -1
- package/link/subscriptions/subscriptions.cjs.map +1 -1
- package/package.json +29 -29
- package/react/hooks/hooks.cjs +445 -368
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +445 -368
- package/react/hooks/internal/wrapHook.d.ts +2 -0
- package/react/hooks/internal/wrapHook.js.map +1 -1
- package/react/hooks/useBackgroundQuery.d.ts +15 -1
- package/react/hooks/useBackgroundQuery.js +5 -1
- package/react/hooks/useBackgroundQuery.js.map +1 -1
- package/react/hooks/useLazyQuery.js +54 -12
- package/react/hooks/useLazyQuery.js.map +1 -1
- package/react/hooks/useLoadableQuery.d.ts +7 -1
- package/react/hooks/useLoadableQuery.js +5 -1
- package/react/hooks/useLoadableQuery.js.map +1 -1
- package/react/hooks/useQuery.d.ts +34 -47
- package/react/hooks/useQuery.js +387 -388
- package/react/hooks/useQuery.js.map +1 -1
- package/react/hooks/useQueryRefHandlers.d.ts +7 -1
- package/react/hooks/useQueryRefHandlers.js +5 -1
- package/react/hooks/useQueryRefHandlers.js.map +1 -1
- package/react/hooks/useSubscription.d.ts +13 -10
- package/react/hooks/useSubscription.js +130 -98
- package/react/hooks/useSubscription.js.map +1 -1
- package/react/hooks/useSuspenseQuery.js +3 -3
- package/react/hooks/useSuspenseQuery.js.map +1 -1
- package/react/hooks/useSyncExternalStore.js +1 -1
- package/react/internal/cache/QueryReference.js +1 -1
- package/react/internal/internal.cjs +2 -2
- package/react/internal/internal.cjs.map +1 -1
- package/react/internal/internal.cjs.native.js +2 -2
- package/react/parser/index.js +5 -5
- package/react/parser/parser.cjs +5 -5
- package/react/parser/parser.cjs.map +1 -1
- package/react/parser/parser.cjs.native.js +5 -5
- package/react/query-preloader/createQueryPreloader.js +5 -1
- package/react/query-preloader/createQueryPreloader.js.map +1 -1
- package/react/react.cjs +12 -1
- package/react/react.cjs.map +1 -1
- package/react/react.cjs.native.js +12 -1
- package/react/types/types.d.ts +19 -0
- package/react/types/types.documentation.d.ts +10 -0
- package/react/types/types.documentation.js.map +1 -1
- package/react/types/types.js.map +1 -1
- package/testing/core/core.cjs +6 -5
- package/testing/core/core.cjs.map +1 -1
- package/testing/core/core.cjs.native.js +6 -5
- package/testing/core/mocking/mockLink.js +8 -7
- package/testing/core/mocking/mockLink.js.map +1 -1
- package/testing/experimental/createSchemaFetch.d.ts +2 -0
- package/testing/experimental/createSchemaFetch.js +12 -1
- package/testing/experimental/createSchemaFetch.js.map +1 -1
- package/testing/experimental/createTestSchema.d.ts +2 -0
- package/testing/experimental/createTestSchema.js +2 -0
- package/testing/experimental/createTestSchema.js.map +1 -1
- package/testing/experimental/experimental.cjs +5 -1
- package/testing/experimental/experimental.cjs.map +1 -1
- package/testing/experimental/experimental.cjs.native.js +5 -1
- package/testing/internal/disposables/enableFakeTimers.d.ts +7 -0
- package/testing/internal/disposables/enableFakeTimers.js +16 -0
- package/testing/internal/disposables/enableFakeTimers.js.map +1 -0
- package/testing/internal/disposables/index.d.ts +1 -0
- package/testing/internal/disposables/index.js +1 -0
- package/testing/internal/disposables/index.js.map +1 -1
- package/utilities/common/errorHandling.d.ts +1 -1
- package/utilities/globals/globals.cjs +1 -1
- package/utilities/globals/globals.cjs.map +1 -1
- package/utilities/globals/globals.cjs.native.js +1 -1
- package/utilities/graphql/DocumentTransform.js +1 -1
- package/utilities/graphql/directives.js +4 -4
- package/utilities/graphql/fragments.js +3 -3
- package/utilities/graphql/getFromAST.js +8 -8
- package/utilities/graphql/storeUtils.js +1 -1
- package/utilities/graphql/transform.js +2 -2
- package/utilities/utilities.cjs +19 -19
- package/utilities/utilities.cjs.map +1 -1
- package/utilities/utilities.cjs.native.js +19 -19
- package/version.js +1 -1
package/core/core.cjs.native.js
CHANGED
|
@@ -20,7 +20,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
20
20
|
|
|
21
21
|
var equal__default = /*#__PURE__*/_interopDefaultLegacy(equal);
|
|
22
22
|
|
|
23
|
-
var version = "3.
|
|
23
|
+
var version = "3.11.0-rc.0";
|
|
24
24
|
|
|
25
25
|
function isNonNullObject(obj) {
|
|
26
26
|
return obj !== null && typeof obj === "object";
|
|
@@ -230,6 +230,7 @@ var ObservableQuery = (function (_super) {
|
|
|
230
230
|
_this.queryManager = queryManager;
|
|
231
231
|
_this.waitForOwnResult = skipCacheDataFor(options.fetchPolicy);
|
|
232
232
|
_this.isTornDown = false;
|
|
233
|
+
_this.subscribeToMore = _this.subscribeToMore.bind(_this);
|
|
233
234
|
var _b = queryManager.defaultOptions.watchQuery, _c = _b === void 0 ? {} : _b, _d = _c.fetchPolicy, defaultFetchPolicy = _d === void 0 ? "cache-first" : _d;
|
|
234
235
|
var _e = options.fetchPolicy, fetchPolicy = _e === void 0 ? defaultFetchPolicy : _e,
|
|
235
236
|
_f = options.initialFetchPolicy,
|
|
@@ -633,7 +634,8 @@ var ObservableQuery = (function (_super) {
|
|
|
633
634
|
newOptions.variables &&
|
|
634
635
|
!equal.equal(newOptions.variables, oldVariables) &&
|
|
635
636
|
options.fetchPolicy !== "standby" &&
|
|
636
|
-
options.fetchPolicy === oldFetchPolicy
|
|
637
|
+
(options.fetchPolicy === oldFetchPolicy ||
|
|
638
|
+
typeof options.nextFetchPolicy === "function")) {
|
|
637
639
|
this.applyNextFetchPolicy("variables-changed", options);
|
|
638
640
|
if (newNetworkStatus === void 0) {
|
|
639
641
|
newNetworkStatus = exports.NetworkStatus.setVariables;
|
|
@@ -1441,7 +1443,7 @@ var QueryManager = (function () {
|
|
|
1441
1443
|
this.broadcastQueries();
|
|
1442
1444
|
self = this;
|
|
1443
1445
|
return [2 , new Promise(function (resolve, reject) {
|
|
1444
|
-
return utilities.asyncMap(self.getObservableFromLink(mutation, tslib.__assign(tslib.__assign({}, context), { optimisticResponse: isOptimistic ? optimisticResponse : void 0 }), variables, false), function (result) {
|
|
1446
|
+
return utilities.asyncMap(self.getObservableFromLink(mutation, tslib.__assign(tslib.__assign({}, context), { optimisticResponse: isOptimistic ? optimisticResponse : void 0 }), variables, {}, false), function (result) {
|
|
1445
1447
|
if (utilities.graphQLResultHasError(result) && errorPolicy === "none") {
|
|
1446
1448
|
throw new errors.ApolloError({
|
|
1447
1449
|
graphQLErrors: utilities.getGraphQLErrorsFromResult(result),
|
|
@@ -1861,11 +1863,11 @@ var QueryManager = (function () {
|
|
|
1861
1863
|
};
|
|
1862
1864
|
QueryManager.prototype.startGraphQLSubscription = function (_a) {
|
|
1863
1865
|
var _this = this;
|
|
1864
|
-
var query = _a.query, fetchPolicy = _a.fetchPolicy, _b = _a.errorPolicy, errorPolicy = _b === void 0 ? "none" : _b, variables = _a.variables, _c = _a.context, context = _c === void 0 ? {} : _c;
|
|
1866
|
+
var query = _a.query, fetchPolicy = _a.fetchPolicy, _b = _a.errorPolicy, errorPolicy = _b === void 0 ? "none" : _b, variables = _a.variables, _c = _a.context, context = _c === void 0 ? {} : _c, _d = _a.extensions, extensions = _d === void 0 ? {} : _d;
|
|
1865
1867
|
query = this.transform(query);
|
|
1866
1868
|
variables = this.getVariables(query, variables);
|
|
1867
1869
|
var makeObservable = function (variables) {
|
|
1868
|
-
return _this.getObservableFromLink(query, context, variables).map(function (result) {
|
|
1870
|
+
return _this.getObservableFromLink(query, context, variables, extensions).map(function (result) {
|
|
1869
1871
|
if (fetchPolicy !== "no-cache") {
|
|
1870
1872
|
if (shouldWriteResult(result, errorPolicy)) {
|
|
1871
1873
|
_this.cache.write({
|
|
@@ -1932,7 +1934,7 @@ var QueryManager = (function () {
|
|
|
1932
1934
|
QueryManager.prototype.getLocalState = function () {
|
|
1933
1935
|
return this.localState;
|
|
1934
1936
|
};
|
|
1935
|
-
QueryManager.prototype.getObservableFromLink = function (query, context, variables,
|
|
1937
|
+
QueryManager.prototype.getObservableFromLink = function (query, context, variables, extensions,
|
|
1936
1938
|
deduplication) {
|
|
1937
1939
|
var _this = this;
|
|
1938
1940
|
var _a;
|
|
@@ -1946,6 +1948,7 @@ var QueryManager = (function () {
|
|
|
1946
1948
|
variables: variables,
|
|
1947
1949
|
operationName: utilities.getOperationName(serverQuery) || void 0,
|
|
1948
1950
|
context: this.prepareContext(tslib.__assign(tslib.__assign({}, context), { forceFetch: !deduplication })),
|
|
1951
|
+
extensions: extensions,
|
|
1949
1952
|
};
|
|
1950
1953
|
context = operation.context;
|
|
1951
1954
|
if (deduplication) {
|
|
@@ -2343,10 +2346,7 @@ var ApolloClient = (function () {
|
|
|
2343
2346
|
throw globals.newInvariantError(15);
|
|
2344
2347
|
}
|
|
2345
2348
|
var uri = options.uri, credentials = options.credentials, headers = options.headers, cache = options.cache, documentTransform = options.documentTransform, _a = options.ssrMode, ssrMode = _a === void 0 ? false : _a, _b = options.ssrForceFetchDelay, ssrForceFetchDelay = _b === void 0 ? 0 : _b,
|
|
2346
|
-
|
|
2347
|
-
connectToDevTools = _c === void 0 ? typeof window === "object" &&
|
|
2348
|
-
!window.__APOLLO_CLIENT__ &&
|
|
2349
|
-
globalThis.__DEV__ !== false : _c, _d = options.queryDeduplication, queryDeduplication = _d === void 0 ? true : _d, defaultOptions = options.defaultOptions, defaultContext = options.defaultContext, _e = options.assumeImmutableResults, assumeImmutableResults = _e === void 0 ? cache.assumeImmutableResults : _e, resolvers = options.resolvers, typeDefs = options.typeDefs, fragmentMatcher = options.fragmentMatcher, clientAwarenessName = options.name, clientAwarenessVersion = options.version;
|
|
2349
|
+
connectToDevTools = options.connectToDevTools, _c = options.queryDeduplication, queryDeduplication = _c === void 0 ? true : _c, defaultOptions = options.defaultOptions, defaultContext = options.defaultContext, _d = options.assumeImmutableResults, assumeImmutableResults = _d === void 0 ? cache.assumeImmutableResults : _d, resolvers = options.resolvers, typeDefs = options.typeDefs, fragmentMatcher = options.fragmentMatcher, clientAwarenessName = options.name, clientAwarenessVersion = options.version, devtools = options.devtools;
|
|
2350
2350
|
var link = options.link;
|
|
2351
2351
|
if (!link) {
|
|
2352
2352
|
link =
|
|
@@ -2358,6 +2358,13 @@ var ApolloClient = (function () {
|
|
|
2358
2358
|
this.queryDeduplication = queryDeduplication;
|
|
2359
2359
|
this.defaultOptions = defaultOptions || Object.create(null);
|
|
2360
2360
|
this.typeDefs = typeDefs;
|
|
2361
|
+
this.devtoolsConfig = tslib.__assign(tslib.__assign({}, devtools), { enabled: (devtools === null || devtools === void 0 ? void 0 : devtools.enabled) || connectToDevTools });
|
|
2362
|
+
if (this.devtoolsConfig.enabled === undefined) {
|
|
2363
|
+
this.devtoolsConfig.enabled =
|
|
2364
|
+
typeof window === "object" &&
|
|
2365
|
+
window.__APOLLO_CLIENT__ &&
|
|
2366
|
+
globalThis.__DEV__ !== false;
|
|
2367
|
+
}
|
|
2361
2368
|
if (ssrForceFetchDelay) {
|
|
2362
2369
|
setTimeout(function () { return (_this.disableNetworkFetches = false); }, ssrForceFetchDelay);
|
|
2363
2370
|
}
|
|
@@ -2403,7 +2410,7 @@ var ApolloClient = (function () {
|
|
|
2403
2410
|
}
|
|
2404
2411
|
: void 0,
|
|
2405
2412
|
});
|
|
2406
|
-
if (
|
|
2413
|
+
if (this.devtoolsConfig.enabled)
|
|
2407
2414
|
this.connectToDevTools();
|
|
2408
2415
|
}
|
|
2409
2416
|
ApolloClient.prototype.connectToDevTools = function () {
|
package/core/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DocumentNode,
|
|
1
|
+
import type { DocumentNode, GraphQLFormattedError } from "graphql";
|
|
2
2
|
import type { ApolloCache } from "../cache/index.js";
|
|
3
3
|
import type { FetchResult } from "../link/core/index.js";
|
|
4
4
|
import type { ApolloError } from "../errors/index.js";
|
|
@@ -47,7 +47,7 @@ export interface ApolloQueryResult<T> {
|
|
|
47
47
|
* A list of any errors that occurred during server-side execution of a GraphQL operation.
|
|
48
48
|
* See https://www.apollographql.com/docs/react/data/error-handling/ for more information.
|
|
49
49
|
*/
|
|
50
|
-
errors?: ReadonlyArray<
|
|
50
|
+
errors?: ReadonlyArray<GraphQLFormattedError>;
|
|
51
51
|
/**
|
|
52
52
|
* The single Error object that is passed to onError and useQuery hooks, and is often thrown during manual `client.query` calls.
|
|
53
53
|
* This will contain both a NetworkError field and any GraphQLErrors.
|
package/core/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { DocumentNode,
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { DocumentNode, GraphQLFormattedError } from \"graphql\";\n\nimport type { ApolloCache } from \"../cache/index.js\";\nimport type { FetchResult } from \"../link/core/index.js\";\nimport type { ApolloError } from \"../errors/index.js\";\nimport type { QueryInfo } from \"./QueryInfo.js\";\nimport type { NetworkStatus } from \"./networkStatus.js\";\nimport type { Resolver } from \"./LocalState.js\";\nimport type { ObservableQuery } from \"./ObservableQuery.js\";\nimport type { QueryOptions } from \"./watchQueryOptions.js\";\nimport type { Cache } from \"../cache/index.js\";\nimport type { IsStrictlyAny } from \"../utilities/index.js\";\n\nexport type { TypedDocumentNode } from \"@graphql-typed-document-node/core\";\n\nexport type MethodKeys<T> = {\n [P in keyof T]: T[P] extends Function ? P : never;\n}[keyof T];\n\nexport interface DefaultContext extends Record<string, any> {}\n\nexport type QueryListener = (queryInfo: QueryInfo) => void;\n\nexport type OnQueryUpdated<TResult> = (\n observableQuery: ObservableQuery<any>,\n diff: Cache.DiffResult<any>,\n lastDiff: Cache.DiffResult<any> | undefined\n) => boolean | TResult;\n\nexport type RefetchQueryDescriptor = string | DocumentNode;\nexport type InternalRefetchQueryDescriptor =\n | RefetchQueryDescriptor\n | QueryOptions;\n\ntype RefetchQueriesIncludeShorthand = \"all\" | \"active\";\n\nexport type RefetchQueriesInclude =\n | RefetchQueryDescriptor[]\n | RefetchQueriesIncludeShorthand;\n\nexport type InternalRefetchQueriesInclude =\n | InternalRefetchQueryDescriptor[]\n | RefetchQueriesIncludeShorthand;\n\n// Used by ApolloClient[\"refetchQueries\"]\n// TODO Improve documentation comments for this public type.\nexport interface RefetchQueriesOptions<\n TCache extends ApolloCache<any>,\n TResult,\n> {\n updateCache?: (cache: TCache) => void;\n // The client.refetchQueries method discourages passing QueryOptions, by\n // restricting the public type of options.include to exclude QueryOptions as\n // an available array element type (see InternalRefetchQueriesInclude for a\n // version of RefetchQueriesInclude that allows legacy QueryOptions objects).\n include?: RefetchQueriesInclude;\n optimistic?: boolean;\n // If no onQueryUpdated function is provided, any queries affected by the\n // updateCache function or included in the options.include array will be\n // refetched by default. Passing null instead of undefined disables this\n // default refetching behavior for affected queries, though included queries\n // will still be refetched.\n onQueryUpdated?: OnQueryUpdated<TResult> | null;\n}\n\n// The client.refetchQueries method returns a thenable (PromiseLike) object\n// whose result is an array of Promise.resolve'd TResult values, where TResult\n// is whatever type the (optional) onQueryUpdated function returns. When no\n// onQueryUpdated function is given, TResult defaults to ApolloQueryResult<any>\n// (thanks to default type parameters for client.refetchQueries).\nexport type RefetchQueriesPromiseResults<TResult> =\n // If onQueryUpdated returns any, all bets are off, so the results array must\n // be a generic any[] array, which is much less confusing than the union type\n // we get if we don't check for any. I hoped `any extends TResult` would do\n // the trick here, instead of IsStrictlyAny, but you can see for yourself what\n // fails in the refetchQueries tests if you try making that simplification.\n IsStrictlyAny<TResult> extends true ? any[]\n : // If the onQueryUpdated function passed to client.refetchQueries returns true\n // or false, that means either to refetch the query (true) or to skip the\n // query (false). Since refetching produces an ApolloQueryResult<any>, and\n // skipping produces nothing, the fully-resolved array of all results produced\n // will be an ApolloQueryResult<any>[], when TResult extends boolean.\n TResult extends boolean ? ApolloQueryResult<any>[]\n : // If onQueryUpdated returns a PromiseLike<U>, that thenable will be passed as\n // an array element to Promise.all, so we infer/unwrap the array type U here.\n TResult extends PromiseLike<infer U> ? U[]\n : // All other onQueryUpdated results end up in the final Promise.all array as\n // themselves, with their original TResult type. Note that TResult will\n // default to ApolloQueryResult<any> if no onQueryUpdated function is passed\n // to client.refetchQueries.\n TResult[];\n\n// The result of client.refetchQueries is thenable/awaitable, if you just want\n// an array of fully resolved results, but you can also access the raw results\n// immediately by examining the additional { queries, results } properties of\n// the RefetchQueriesResult<TResult> object.\nexport interface RefetchQueriesResult<TResult>\n extends Promise<RefetchQueriesPromiseResults<TResult>> {\n // An array of ObservableQuery objects corresponding 1:1 to TResult values\n // in the results arrays (both the TResult[] array below, and the results\n // array resolved by the Promise above).\n queries: ObservableQuery<any>[];\n // These are the raw TResult values returned by any onQueryUpdated functions\n // that were invoked by client.refetchQueries.\n results: InternalRefetchQueriesResult<TResult>[];\n}\n\n// Used by QueryManager[\"refetchQueries\"]\nexport interface InternalRefetchQueriesOptions<\n TCache extends ApolloCache<any>,\n TResult,\n> extends Omit<RefetchQueriesOptions<TCache, TResult>, \"include\"> {\n // Just like the refetchQueries option for a mutation, an array of strings,\n // DocumentNode objects, and/or QueryOptions objects, or one of the shorthand\n // strings \"all\" or \"active\", to select every (active) query.\n include?: InternalRefetchQueriesInclude;\n // This part of the API is a (useful) implementation detail, but need not be\n // exposed in the public client.refetchQueries API (above).\n removeOptimistic?: string;\n}\n\nexport type InternalRefetchQueriesResult<TResult> =\n // If onQueryUpdated returns a boolean, that's equivalent to refetching the\n // query when the boolean is true and skipping the query when false, so the\n // internal type of refetched results is Promise<ApolloQueryResult<any>>.\n TResult extends boolean ? Promise<ApolloQueryResult<any>>\n : // Otherwise, onQueryUpdated returns whatever it returns. If onQueryUpdated is\n // not provided, TResult defaults to Promise<ApolloQueryResult<any>> (see the\n // generic type parameters of client.refetchQueries).\n TResult;\n\nexport type InternalRefetchQueriesMap<TResult> = Map<\n ObservableQuery<any>,\n InternalRefetchQueriesResult<TResult>\n>;\n\n// TODO Remove this unnecessary type in Apollo Client 4.\nexport type { QueryOptions as PureQueryOptions };\n\nexport type OperationVariables = Record<string, any>;\n\nexport interface ApolloQueryResult<T> {\n data: T;\n /**\n * A list of any errors that occurred during server-side execution of a GraphQL operation.\n * See https://www.apollographql.com/docs/react/data/error-handling/ for more information.\n */\n errors?: ReadonlyArray<GraphQLFormattedError>;\n /**\n * The single Error object that is passed to onError and useQuery hooks, and is often thrown during manual `client.query` calls.\n * This will contain both a NetworkError field and any GraphQLErrors.\n * See https://www.apollographql.com/docs/react/data/error-handling/ for more information.\n */\n error?: ApolloError;\n loading: boolean;\n networkStatus: NetworkStatus;\n // If result.data was read from the cache with missing fields,\n // result.partial will be true. Otherwise, result.partial will be falsy\n // (usually because the property is absent from the result object).\n partial?: boolean;\n}\n\n// This is part of the public API, people write these functions in `updateQueries`.\nexport type MutationQueryReducer<T> = (\n previousResult: Record<string, any>,\n options: {\n mutationResult: FetchResult<T>;\n queryName: string | undefined;\n queryVariables: Record<string, any>;\n }\n) => Record<string, any>;\n\nexport type MutationQueryReducersMap<T = { [key: string]: any }> = {\n [queryName: string]: MutationQueryReducer<T>;\n};\n\n/**\n * @deprecated Use `MutationUpdaterFunction` instead.\n */\nexport type MutationUpdaterFn<T = { [key: string]: any }> = (\n // The MutationUpdaterFn type is broken because it mistakenly uses the same\n // type parameter T for both the cache and the mutationResult. Do not use this\n // type unless you absolutely need it for backwards compatibility.\n cache: ApolloCache<T>,\n mutationResult: FetchResult<T>\n) => void;\n\nexport type MutationUpdaterFunction<\n TData,\n TVariables,\n TContext,\n TCache extends ApolloCache<any>,\n> = (\n cache: TCache,\n result: Omit<FetchResult<TData>, \"context\">,\n options: {\n context?: TContext;\n variables?: TVariables;\n }\n) => void;\nexport interface Resolvers {\n [key: string]: {\n [field: string]: Resolver;\n };\n}\n"]}
|
|
@@ -326,6 +326,10 @@ export interface SubscriptionOptions<TVariables = OperationVariables, TData = an
|
|
|
326
326
|
* Shared context between your component and your network interface (Apollo Link).
|
|
327
327
|
*/
|
|
328
328
|
context?: DefaultContext;
|
|
329
|
+
/**
|
|
330
|
+
* Shared context between your component and your network interface (Apollo Link).
|
|
331
|
+
*/
|
|
332
|
+
extensions?: Record<string, any>;
|
|
329
333
|
}
|
|
330
334
|
export interface MutationBaseOptions<TData = any, TVariables = OperationVariables, TContext = DefaultContext, TCache extends ApolloCache<any> = ApolloCache<any>> {
|
|
331
335
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"watchQueryOptions.js","sourceRoot":"","sources":["../../src/core/watchQueryOptions.ts"],"names":[],"mappings":"","sourcesContent":["import type { DocumentNode } from \"graphql\";\nimport type { TypedDocumentNode } from \"@graphql-typed-document-node/core\";\n\nimport type { FetchResult } from \"../link/core/index.js\";\nimport type {\n DefaultContext,\n MutationQueryReducersMap,\n OperationVariables,\n MutationUpdaterFunction,\n OnQueryUpdated,\n InternalRefetchQueriesInclude,\n} from \"./types.js\";\nimport type { ApolloCache } from \"../cache/index.js\";\nimport type { ObservableQuery } from \"./ObservableQuery.js\";\nimport type { IgnoreModifier } from \"../cache/core/types/common.js\";\n\n/**\n * fetchPolicy determines where the client may return a result from. The options are:\n * - cache-first (default): return result from cache. Only fetch from network if cached result is not available.\n * - cache-and-network: return result from cache first (if it exists), then return network result once it's available.\n * - cache-only: return result from cache if available, fail otherwise.\n * - no-cache: return result from network, fail if network call doesn't succeed, don't save to cache\n * - network-only: return result from network, fail if network call doesn't succeed, save to cache\n * - standby: only for queries that aren't actively watched, but should be available for refetch and updateQueries.\n */\nexport type FetchPolicy =\n | \"cache-first\"\n | \"network-only\"\n | \"cache-only\"\n | \"no-cache\"\n | \"standby\";\n\nexport type WatchQueryFetchPolicy = FetchPolicy | \"cache-and-network\";\n\nexport type MutationFetchPolicy = Extract<\n FetchPolicy,\n | \"network-only\" // default behavior (mutation results written to cache)\n | \"no-cache\" // alternate behavior (results not written to cache)\n>;\n\nexport type RefetchWritePolicy = \"merge\" | \"overwrite\";\n\n/**\n * errorPolicy determines the level of events for errors in the execution result. The options are:\n * - none (default): any errors from the request are treated like runtime errors and the observable is stopped\n * - ignore: errors from the request do not stop the observable, but also don't call `next`\n * - all: errors are treated like data and will notify observables\n */\nexport type ErrorPolicy = \"none\" | \"ignore\" | \"all\";\n\n/**\n * Query options.\n */\nexport interface QueryOptions<TVariables = OperationVariables, TData = any> {\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#query:member} */\n query: DocumentNode | TypedDocumentNode<TData, TVariables>;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#variables:member} */\n variables?: TVariables;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#errorPolicy:member} */\n errorPolicy?: ErrorPolicy;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#context:member} */\n context?: DefaultContext;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#fetchPolicy:member} */\n fetchPolicy?: FetchPolicy;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#pollInterval:member} */\n pollInterval?: number;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#notifyOnNetworkStatusChange:member} */\n notifyOnNetworkStatusChange?: boolean;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#returnPartialData:member} */\n returnPartialData?: boolean;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#partialRefetch:member} */\n partialRefetch?: boolean;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#canonizeResults:member} */\n canonizeResults?: boolean;\n}\n\n/**\n * Watched query options.\n */\nexport interface WatchQueryOptions<\n TVariables extends OperationVariables = OperationVariables,\n TData = any,\n> extends SharedWatchQueryOptions<TVariables, TData> {\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#query:member} */\n query: DocumentNode | TypedDocumentNode<TData, TVariables>;\n}\n\nexport interface SharedWatchQueryOptions<\n TVariables extends OperationVariables,\n TData,\n> {\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#fetchPolicy:member} */\n fetchPolicy?: WatchQueryFetchPolicy;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#nextFetchPolicy:member} */\n nextFetchPolicy?:\n | WatchQueryFetchPolicy\n | ((\n this: WatchQueryOptions<TVariables, TData>,\n currentFetchPolicy: WatchQueryFetchPolicy,\n context: NextFetchPolicyContext<TData, TVariables>\n ) => WatchQueryFetchPolicy);\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#initialFetchPolicy:member} */\n initialFetchPolicy?: WatchQueryFetchPolicy;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#refetchWritePolicy:member} */\n refetchWritePolicy?: RefetchWritePolicy;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#variables:member} */\n variables?: TVariables;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#errorPolicy:member} */\n errorPolicy?: ErrorPolicy;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#context:member} */\n context?: DefaultContext;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#pollInterval:member} */\n pollInterval?: number;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#notifyOnNetworkStatusChange:member} */\n notifyOnNetworkStatusChange?: boolean;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#returnPartialData:member} */\n returnPartialData?: boolean;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#partialRefetch:member} */\n partialRefetch?: boolean;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#canonizeResults:member} */\n canonizeResults?: boolean;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#skipPollAttempt:member} */\n skipPollAttempt?: () => boolean;\n}\n\nexport interface NextFetchPolicyContext<\n TData,\n TVariables extends OperationVariables,\n> {\n reason: \"after-fetch\" | \"variables-changed\";\n observable: ObservableQuery<TData, TVariables>;\n options: WatchQueryOptions<TVariables, TData>;\n initialFetchPolicy: WatchQueryFetchPolicy;\n}\n\nexport interface FetchMoreQueryOptions<TVariables, TData = any> {\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#query:member} */\n query?: DocumentNode | TypedDocumentNode<TData, TVariables>;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#variables:member} */\n variables?: Partial<TVariables>;\n context?: DefaultContext;\n}\n\nexport type UpdateQueryFn<\n TData = any,\n TSubscriptionVariables = OperationVariables,\n TSubscriptionData = TData,\n> = (\n previousQueryResult: TData,\n options: {\n subscriptionData: { data: TSubscriptionData };\n variables?: TSubscriptionVariables;\n }\n) => TData;\n\nexport type SubscribeToMoreOptions<\n TData = any,\n TSubscriptionVariables = OperationVariables,\n TSubscriptionData = TData,\n> = {\n document:\n | DocumentNode\n | TypedDocumentNode<TSubscriptionData, TSubscriptionVariables>;\n variables?: TSubscriptionVariables;\n updateQuery?: UpdateQueryFn<TData, TSubscriptionVariables, TSubscriptionData>;\n onError?: (error: Error) => void;\n context?: DefaultContext;\n};\n\nexport interface SubscriptionOptions<\n TVariables = OperationVariables,\n TData = any,\n> {\n /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#query:member} */\n query: DocumentNode | TypedDocumentNode<TData, TVariables>;\n\n /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#variables:member} */\n variables?: TVariables;\n\n /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#fetchPolicy:member} */\n fetchPolicy?: FetchPolicy;\n\n /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#errorPolicy:member} */\n errorPolicy?: ErrorPolicy;\n\n /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#context:member} */\n context?: DefaultContext;\n}\n\nexport interface MutationBaseOptions<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>,\n> {\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#optimisticResponse:member} */\n optimisticResponse?:\n | TData\n | ((vars: TVariables, { IGNORE }: { IGNORE: IgnoreModifier }) => TData);\n\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#updateQueries:member} */\n updateQueries?: MutationQueryReducersMap<TData>;\n\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#refetchQueries:member} */\n refetchQueries?:\n | ((result: FetchResult<TData>) => InternalRefetchQueriesInclude)\n | InternalRefetchQueriesInclude;\n\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#awaitRefetchQueries:member} */\n awaitRefetchQueries?: boolean;\n\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#update:member} */\n update?: MutationUpdaterFunction<TData, TVariables, TContext, TCache>;\n\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#onQueryUpdated:member} */\n onQueryUpdated?: OnQueryUpdated<any>;\n\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#errorPolicy:member} */\n errorPolicy?: ErrorPolicy;\n\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#variables:member} */\n variables?: TVariables;\n\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#context:member} */\n context?: TContext;\n}\n\nexport interface MutationOptions<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>,\n> extends MutationSharedOptions<TData, TVariables, TContext, TCache> {\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#mutation:member} */\n mutation: DocumentNode | TypedDocumentNode<TData, TVariables>;\n}\nexport interface MutationSharedOptions<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>,\n> extends MutationBaseOptions<TData, TVariables, TContext, TCache> {\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#fetchPolicy:member} */\n fetchPolicy?: MutationFetchPolicy;\n\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#keepRootFields:member} */\n keepRootFields?: boolean;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"watchQueryOptions.js","sourceRoot":"","sources":["../../src/core/watchQueryOptions.ts"],"names":[],"mappings":"","sourcesContent":["import type { DocumentNode } from \"graphql\";\nimport type { TypedDocumentNode } from \"@graphql-typed-document-node/core\";\n\nimport type { FetchResult } from \"../link/core/index.js\";\nimport type {\n DefaultContext,\n MutationQueryReducersMap,\n OperationVariables,\n MutationUpdaterFunction,\n OnQueryUpdated,\n InternalRefetchQueriesInclude,\n} from \"./types.js\";\nimport type { ApolloCache } from \"../cache/index.js\";\nimport type { ObservableQuery } from \"./ObservableQuery.js\";\nimport type { IgnoreModifier } from \"../cache/core/types/common.js\";\n\n/**\n * fetchPolicy determines where the client may return a result from. The options are:\n * - cache-first (default): return result from cache. Only fetch from network if cached result is not available.\n * - cache-and-network: return result from cache first (if it exists), then return network result once it's available.\n * - cache-only: return result from cache if available, fail otherwise.\n * - no-cache: return result from network, fail if network call doesn't succeed, don't save to cache\n * - network-only: return result from network, fail if network call doesn't succeed, save to cache\n * - standby: only for queries that aren't actively watched, but should be available for refetch and updateQueries.\n */\nexport type FetchPolicy =\n | \"cache-first\"\n | \"network-only\"\n | \"cache-only\"\n | \"no-cache\"\n | \"standby\";\n\nexport type WatchQueryFetchPolicy = FetchPolicy | \"cache-and-network\";\n\nexport type MutationFetchPolicy = Extract<\n FetchPolicy,\n | \"network-only\" // default behavior (mutation results written to cache)\n | \"no-cache\" // alternate behavior (results not written to cache)\n>;\n\nexport type RefetchWritePolicy = \"merge\" | \"overwrite\";\n\n/**\n * errorPolicy determines the level of events for errors in the execution result. The options are:\n * - none (default): any errors from the request are treated like runtime errors and the observable is stopped\n * - ignore: errors from the request do not stop the observable, but also don't call `next`\n * - all: errors are treated like data and will notify observables\n */\nexport type ErrorPolicy = \"none\" | \"ignore\" | \"all\";\n\n/**\n * Query options.\n */\nexport interface QueryOptions<TVariables = OperationVariables, TData = any> {\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#query:member} */\n query: DocumentNode | TypedDocumentNode<TData, TVariables>;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#variables:member} */\n variables?: TVariables;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#errorPolicy:member} */\n errorPolicy?: ErrorPolicy;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#context:member} */\n context?: DefaultContext;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#fetchPolicy:member} */\n fetchPolicy?: FetchPolicy;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#pollInterval:member} */\n pollInterval?: number;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#notifyOnNetworkStatusChange:member} */\n notifyOnNetworkStatusChange?: boolean;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#returnPartialData:member} */\n returnPartialData?: boolean;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#partialRefetch:member} */\n partialRefetch?: boolean;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#canonizeResults:member} */\n canonizeResults?: boolean;\n}\n\n/**\n * Watched query options.\n */\nexport interface WatchQueryOptions<\n TVariables extends OperationVariables = OperationVariables,\n TData = any,\n> extends SharedWatchQueryOptions<TVariables, TData> {\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#query:member} */\n query: DocumentNode | TypedDocumentNode<TData, TVariables>;\n}\n\nexport interface SharedWatchQueryOptions<\n TVariables extends OperationVariables,\n TData,\n> {\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#fetchPolicy:member} */\n fetchPolicy?: WatchQueryFetchPolicy;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#nextFetchPolicy:member} */\n nextFetchPolicy?:\n | WatchQueryFetchPolicy\n | ((\n this: WatchQueryOptions<TVariables, TData>,\n currentFetchPolicy: WatchQueryFetchPolicy,\n context: NextFetchPolicyContext<TData, TVariables>\n ) => WatchQueryFetchPolicy);\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#initialFetchPolicy:member} */\n initialFetchPolicy?: WatchQueryFetchPolicy;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#refetchWritePolicy:member} */\n refetchWritePolicy?: RefetchWritePolicy;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#variables:member} */\n variables?: TVariables;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#errorPolicy:member} */\n errorPolicy?: ErrorPolicy;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#context:member} */\n context?: DefaultContext;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#pollInterval:member} */\n pollInterval?: number;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#notifyOnNetworkStatusChange:member} */\n notifyOnNetworkStatusChange?: boolean;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#returnPartialData:member} */\n returnPartialData?: boolean;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#partialRefetch:member} */\n partialRefetch?: boolean;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#canonizeResults:member} */\n canonizeResults?: boolean;\n\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#skipPollAttempt:member} */\n skipPollAttempt?: () => boolean;\n}\n\nexport interface NextFetchPolicyContext<\n TData,\n TVariables extends OperationVariables,\n> {\n reason: \"after-fetch\" | \"variables-changed\";\n observable: ObservableQuery<TData, TVariables>;\n options: WatchQueryOptions<TVariables, TData>;\n initialFetchPolicy: WatchQueryFetchPolicy;\n}\n\nexport interface FetchMoreQueryOptions<TVariables, TData = any> {\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#query:member} */\n query?: DocumentNode | TypedDocumentNode<TData, TVariables>;\n /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#variables:member} */\n variables?: Partial<TVariables>;\n context?: DefaultContext;\n}\n\nexport type UpdateQueryFn<\n TData = any,\n TSubscriptionVariables = OperationVariables,\n TSubscriptionData = TData,\n> = (\n previousQueryResult: TData,\n options: {\n subscriptionData: { data: TSubscriptionData };\n variables?: TSubscriptionVariables;\n }\n) => TData;\n\nexport type SubscribeToMoreOptions<\n TData = any,\n TSubscriptionVariables = OperationVariables,\n TSubscriptionData = TData,\n> = {\n document:\n | DocumentNode\n | TypedDocumentNode<TSubscriptionData, TSubscriptionVariables>;\n variables?: TSubscriptionVariables;\n updateQuery?: UpdateQueryFn<TData, TSubscriptionVariables, TSubscriptionData>;\n onError?: (error: Error) => void;\n context?: DefaultContext;\n};\n\nexport interface SubscriptionOptions<\n TVariables = OperationVariables,\n TData = any,\n> {\n /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#query:member} */\n query: DocumentNode | TypedDocumentNode<TData, TVariables>;\n\n /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#variables:member} */\n variables?: TVariables;\n\n /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#fetchPolicy:member} */\n fetchPolicy?: FetchPolicy;\n\n /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#errorPolicy:member} */\n errorPolicy?: ErrorPolicy;\n\n /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#context:member} */\n context?: DefaultContext;\n\n /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#extensions:member} */\n extensions?: Record<string, any>;\n}\n\nexport interface MutationBaseOptions<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>,\n> {\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#optimisticResponse:member} */\n optimisticResponse?:\n | TData\n | ((vars: TVariables, { IGNORE }: { IGNORE: IgnoreModifier }) => TData);\n\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#updateQueries:member} */\n updateQueries?: MutationQueryReducersMap<TData>;\n\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#refetchQueries:member} */\n refetchQueries?:\n | ((result: FetchResult<TData>) => InternalRefetchQueriesInclude)\n | InternalRefetchQueriesInclude;\n\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#awaitRefetchQueries:member} */\n awaitRefetchQueries?: boolean;\n\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#update:member} */\n update?: MutationUpdaterFunction<TData, TVariables, TContext, TCache>;\n\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#onQueryUpdated:member} */\n onQueryUpdated?: OnQueryUpdated<any>;\n\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#errorPolicy:member} */\n errorPolicy?: ErrorPolicy;\n\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#variables:member} */\n variables?: TVariables;\n\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#context:member} */\n context?: TContext;\n}\n\nexport interface MutationOptions<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>,\n> extends MutationSharedOptions<TData, TVariables, TContext, TCache> {\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#mutation:member} */\n mutation: DocumentNode | TypedDocumentNode<TData, TVariables>;\n}\nexport interface MutationSharedOptions<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>,\n> extends MutationBaseOptions<TData, TVariables, TContext, TCache> {\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#fetchPolicy:member} */\n fetchPolicy?: MutationFetchPolicy;\n\n /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#keepRootFields:member} */\n keepRootFields?: boolean;\n}\n"]}
|
package/dev/dev.cjs
CHANGED
|
@@ -183,30 +183,40 @@ const errorCodes =
|
|
|
183
183
|
condition: "!calledDuringRender()",
|
|
184
184
|
message: "useLoadableQuery: 'loadQuery' should not be called during render. To start a query during render, use the 'useBackgroundQuery' hook."
|
|
185
185
|
},
|
|
186
|
+
51: {
|
|
187
|
+
file: "@apollo/client/react/hooks/useLoadableQuery.js",
|
|
188
|
+
condition: "internalQueryRef",
|
|
189
|
+
message: "The query has not been loaded. Please load the query."
|
|
190
|
+
},
|
|
186
191
|
56: {
|
|
192
|
+
file: "@apollo/client/react/hooks/useSubscription.js",
|
|
193
|
+
condition: "!optionsRef.current.skip",
|
|
194
|
+
message: "A subscription that is skipped cannot be restarted."
|
|
195
|
+
},
|
|
196
|
+
57: {
|
|
187
197
|
file: "@apollo/client/react/hooks/useSuspenseQuery.js",
|
|
188
198
|
condition: "supportedFetchPolicies.includes(fetchPolicy)",
|
|
189
199
|
message: "The fetch policy `%s` is not supported with suspense."
|
|
190
200
|
},
|
|
191
|
-
|
|
201
|
+
60: {
|
|
192
202
|
file: "@apollo/client/react/internal/cache/QueryReference.js",
|
|
193
203
|
condition: "!queryRef || QUERY_REFERENCE_SYMBOL in queryRef",
|
|
194
204
|
message: "Expected a QueryRef object, but got something else instead."
|
|
195
205
|
},
|
|
196
|
-
|
|
206
|
+
61: {
|
|
197
207
|
file: "@apollo/client/react/parser/index.js",
|
|
198
208
|
condition: "!!document && !!document.kind",
|
|
199
209
|
message: "Argument of %s passed to parser was not a valid GraphQL " +
|
|
200
210
|
"DocumentNode. You may need to use 'graphql-tag' or another method " +
|
|
201
211
|
"to convert your operation into a document"
|
|
202
212
|
},
|
|
203
|
-
|
|
213
|
+
62: {
|
|
204
214
|
file: "@apollo/client/react/parser/index.js",
|
|
205
215
|
condition: "!fragments.length ||\n queries.length ||\n mutations.length ||\n subscriptions.length",
|
|
206
216
|
message: "Passing only a fragment to 'graphql' is not yet supported. " +
|
|
207
217
|
"You must include a query, subscription or mutation as well"
|
|
208
218
|
},
|
|
209
|
-
|
|
219
|
+
63: {
|
|
210
220
|
file: "@apollo/client/react/parser/index.js",
|
|
211
221
|
condition: "queries.length + mutations.length + subscriptions.length <= 1",
|
|
212
222
|
message: "react-apollo only supports a query, subscription, or a mutation per HOC. " +
|
|
@@ -214,107 +224,107 @@ const errorCodes =
|
|
|
214
224
|
"subscriptions and %s mutations. " +
|
|
215
225
|
"You can use 'compose' to join multiple operation types to a component"
|
|
216
226
|
},
|
|
217
|
-
|
|
227
|
+
64: {
|
|
218
228
|
file: "@apollo/client/react/parser/index.js",
|
|
219
229
|
condition: "definitions.length === 1",
|
|
220
230
|
message: "react-apollo only supports one definition per HOC. %s had " +
|
|
221
231
|
"%s definitions. " +
|
|
222
232
|
"You can use 'compose' to join multiple operation types to a component"
|
|
223
233
|
},
|
|
224
|
-
|
|
234
|
+
65: {
|
|
225
235
|
file: "@apollo/client/react/parser/index.js",
|
|
226
236
|
condition: "operation.type === type",
|
|
227
237
|
message: "Running a %s requires a graphql " + "%s, but a %s was used instead."
|
|
228
238
|
},
|
|
229
|
-
|
|
239
|
+
66: {
|
|
230
240
|
file: "@apollo/client/testing/core/mocking/mockLink.js",
|
|
231
241
|
condition: "queryWithoutClientOnlyDirectives",
|
|
232
242
|
message: "query is required"
|
|
233
243
|
},
|
|
234
|
-
|
|
244
|
+
67: {
|
|
235
245
|
file: "@apollo/client/testing/core/mocking/mockLink.js",
|
|
236
246
|
condition: "mockedResponse.maxUsageCount > 0",
|
|
237
247
|
message: "Mock response maxUsageCount must be greater than 0, %s given"
|
|
238
248
|
},
|
|
239
|
-
|
|
249
|
+
68: {
|
|
240
250
|
file: "@apollo/client/utilities/graphql/DocumentTransform.js",
|
|
241
251
|
condition: "Array.isArray(cacheKeys)",
|
|
242
252
|
message: "`getCacheKey` must return an array or undefined"
|
|
243
253
|
},
|
|
244
|
-
|
|
254
|
+
69: {
|
|
245
255
|
file: "@apollo/client/utilities/graphql/directives.js",
|
|
246
256
|
condition: "evaledValue !== void 0",
|
|
247
257
|
message: "Invalid variable referenced in @%s directive."
|
|
248
258
|
},
|
|
249
|
-
|
|
259
|
+
70: {
|
|
250
260
|
file: "@apollo/client/utilities/graphql/directives.js",
|
|
251
261
|
condition: "directiveArguments && directiveArguments.length === 1",
|
|
252
262
|
message: "Incorrect number of arguments for the @%s directive."
|
|
253
263
|
},
|
|
254
|
-
|
|
264
|
+
71: {
|
|
255
265
|
file: "@apollo/client/utilities/graphql/directives.js",
|
|
256
266
|
condition: "ifArgument.name && ifArgument.name.value === \"if\"",
|
|
257
267
|
message: "Invalid argument for the @%s directive."
|
|
258
268
|
},
|
|
259
|
-
|
|
269
|
+
72: {
|
|
260
270
|
file: "@apollo/client/utilities/graphql/directives.js",
|
|
261
271
|
condition: "ifValue &&\n (ifValue.kind === \"Variable\" || ifValue.kind === \"BooleanValue\")",
|
|
262
272
|
message: "Argument for the @%s directive must be a variable or a boolean value."
|
|
263
273
|
},
|
|
264
|
-
|
|
274
|
+
73: {
|
|
265
275
|
file: "@apollo/client/utilities/graphql/fragments.js",
|
|
266
276
|
message: "Found a %s operation%s. " +
|
|
267
277
|
"No operations are allowed when using a fragment as a query. Only fragments are allowed."
|
|
268
278
|
},
|
|
269
|
-
|
|
279
|
+
74: {
|
|
270
280
|
file: "@apollo/client/utilities/graphql/fragments.js",
|
|
271
281
|
condition: "fragments.length === 1",
|
|
272
282
|
message: "Found %s fragments. `fragmentName` must be provided when there is not exactly 1 fragment."
|
|
273
283
|
},
|
|
274
|
-
|
|
284
|
+
75: {
|
|
275
285
|
file: "@apollo/client/utilities/graphql/fragments.js",
|
|
276
286
|
condition: "fragment",
|
|
277
287
|
message: "No fragment named %s"
|
|
278
288
|
},
|
|
279
|
-
|
|
289
|
+
76: {
|
|
280
290
|
file: "@apollo/client/utilities/graphql/getFromAST.js",
|
|
281
291
|
condition: "doc && doc.kind === \"Document\"",
|
|
282
292
|
message: "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql"
|
|
283
293
|
},
|
|
284
|
-
|
|
294
|
+
77: {
|
|
285
295
|
file: "@apollo/client/utilities/graphql/getFromAST.js",
|
|
286
296
|
message: "Schema type definitions not allowed in queries. Found: \"%s\""
|
|
287
297
|
},
|
|
288
|
-
|
|
298
|
+
78: {
|
|
289
299
|
file: "@apollo/client/utilities/graphql/getFromAST.js",
|
|
290
300
|
condition: "operations.length <= 1",
|
|
291
301
|
message: "Ambiguous GraphQL document: contains %s operations"
|
|
292
302
|
},
|
|
293
|
-
|
|
303
|
+
79: {
|
|
294
304
|
file: "@apollo/client/utilities/graphql/getFromAST.js",
|
|
295
305
|
condition: "queryDef && queryDef.operation === \"query\"",
|
|
296
306
|
message: "Must contain a query definition."
|
|
297
307
|
},
|
|
298
|
-
|
|
308
|
+
80: {
|
|
299
309
|
file: "@apollo/client/utilities/graphql/getFromAST.js",
|
|
300
310
|
condition: "doc.kind === \"Document\"",
|
|
301
311
|
message: "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql"
|
|
302
312
|
},
|
|
303
|
-
|
|
313
|
+
81: {
|
|
304
314
|
file: "@apollo/client/utilities/graphql/getFromAST.js",
|
|
305
315
|
condition: "doc.definitions.length <= 1",
|
|
306
316
|
message: "Fragment must have exactly one definition."
|
|
307
317
|
},
|
|
308
|
-
|
|
318
|
+
82: {
|
|
309
319
|
file: "@apollo/client/utilities/graphql/getFromAST.js",
|
|
310
320
|
condition: "fragmentDef.kind === \"FragmentDefinition\"",
|
|
311
321
|
message: "Must be a fragment definition."
|
|
312
322
|
},
|
|
313
|
-
|
|
323
|
+
83: {
|
|
314
324
|
file: "@apollo/client/utilities/graphql/getFromAST.js",
|
|
315
325
|
message: "Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment."
|
|
316
326
|
},
|
|
317
|
-
|
|
327
|
+
84: {
|
|
318
328
|
file: "@apollo/client/utilities/graphql/storeUtils.js",
|
|
319
329
|
message: "The inline argument \"%s\" of kind \"%s\"" +
|
|
320
330
|
"is not supported. Use variables instead of inline arguments to " +
|
|
@@ -380,10 +390,6 @@ const devWarn = {
|
|
|
380
390
|
file: "@apollo/client/link/utils/toPromise.js",
|
|
381
391
|
message: "Promise Wrapper does not support multiple results from Observable"
|
|
382
392
|
},
|
|
383
|
-
51: {
|
|
384
|
-
file: "@apollo/client/react/hooks/useQuery.js",
|
|
385
|
-
message: "Calling default no-op implementation of InternalState#forceUpdate"
|
|
386
|
-
},
|
|
387
393
|
52: {
|
|
388
394
|
file: "@apollo/client/react/hooks/useSubscription.js",
|
|
389
395
|
message: "'useSubscription' supports only the 'onSubscriptionData' or 'onData' option, but not both. Only the 'onData' option will be used."
|
|
@@ -400,11 +406,11 @@ const devWarn = {
|
|
|
400
406
|
file: "@apollo/client/react/hooks/useSubscription.js",
|
|
401
407
|
message: "'onSubscriptionComplete' is deprecated and will be removed in a future major version. Please use the 'onComplete' option instead."
|
|
402
408
|
},
|
|
403
|
-
|
|
409
|
+
58: {
|
|
404
410
|
file: "@apollo/client/react/hooks/useSuspenseQuery.js",
|
|
405
411
|
message: "Using `returnPartialData` with a `no-cache` fetch policy has no effect. To read partial data from the cache, consider using an alternate fetch policy."
|
|
406
412
|
},
|
|
407
|
-
|
|
413
|
+
86: {
|
|
408
414
|
file: "@apollo/client/utilities/graphql/transform.js",
|
|
409
415
|
message: "Removing an @connection directive even though it does not have a key. " +
|
|
410
416
|
"You may want to use the key parameter to specify a store key."
|
|
@@ -423,17 +429,17 @@ const devError = {
|
|
|
423
429
|
file: "@apollo/client/core/ObservableQuery.js",
|
|
424
430
|
message: "Unhandled error"
|
|
425
431
|
},
|
|
426
|
-
|
|
432
|
+
59: {
|
|
427
433
|
file: "@apollo/client/react/hooks/useSyncExternalStore.js",
|
|
428
434
|
message: "The result of getSnapshot should be cached to avoid an infinite loop"
|
|
429
435
|
},
|
|
430
|
-
|
|
436
|
+
85: {
|
|
431
437
|
file: "@apollo/client/utilities/graphql/transform.js",
|
|
432
438
|
message: "Could not find operation or fragment"
|
|
433
439
|
}
|
|
434
440
|
};
|
|
435
441
|
|
|
436
|
-
var version = "3.
|
|
442
|
+
var version = "3.11.0-rc.0";
|
|
437
443
|
|
|
438
444
|
function maybe(thunk) {
|
|
439
445
|
try {
|