@apollo/client 4.3.0-alpha.7 → 4.3.0-alpha.9
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 +18 -0
- package/__cjs/cache/core/cache.cjs +25 -1
- package/__cjs/cache/core/cache.cjs.map +1 -1
- package/__cjs/cache/core/cache.d.cts +19 -1
- package/__cjs/cache/inmemory/entityStore.cjs +3 -3
- package/__cjs/cache/inmemory/inMemoryCache.cjs +10 -0
- package/__cjs/cache/inmemory/inMemoryCache.cjs.map +1 -1
- package/__cjs/cache/inmemory/inMemoryCache.d.cts +5 -1
- package/__cjs/cache/inmemory/key-extractor.cjs +1 -1
- package/__cjs/cache/inmemory/policies.cjs +5 -5
- package/__cjs/cache/inmemory/readFromStore.cjs +3 -3
- package/__cjs/cache/inmemory/writeToStore.cjs +4 -4
- package/__cjs/core/ApolloClient.cjs +14 -14
- package/__cjs/core/ObservableQuery.cjs +8 -8
- package/__cjs/core/QueryInfo.cjs +1 -1
- package/__cjs/core/QueryManager.cjs +23 -13
- package/__cjs/core/QueryManager.cjs.map +1 -1
- package/__cjs/core/RefetchEventManager.cjs +3 -3
- package/__cjs/incremental/GraphQLCodegenIncremental.cjs +3 -0
- package/__cjs/incremental/GraphQLCodegenIncremental.cjs.map +1 -0
- package/__cjs/incremental/GraphQLCodegenIncremental.d.cts +55 -0
- package/__cjs/incremental/handlers/graphql17Alpha9.cjs +1 -1
- package/__cjs/incremental/handlers/notImplemented.cjs +1 -1
- package/__cjs/incremental/index.cjs.map +1 -1
- package/__cjs/incremental/index.d.cts +1 -0
- package/__cjs/incremental/internal/types.cjs +3 -0
- package/__cjs/incremental/internal/types.cjs.map +1 -0
- package/__cjs/incremental/internal/types.d.cts +17 -0
- package/__cjs/invariantErrorCodes.cjs +122 -116
- package/__cjs/link/core/ApolloLink.cjs +3 -3
- package/__cjs/link/http/checkFetcher.cjs +1 -1
- package/__cjs/link/http/parseAndCheckHttpResponse.cjs +2 -2
- package/__cjs/link/http/parseAndCheckHttpResponse.cjs.map +1 -1
- package/__cjs/link/persisted-queries/index.cjs +2 -2
- package/__cjs/link/ws/index.cjs +1 -1
- package/__cjs/local-state/LocalState.cjs +11 -11
- package/__cjs/masking/internal/types.d.cts +1 -2
- package/__cjs/masking/maskDefinition.cjs +2 -2
- package/__cjs/masking/maskFragment.cjs +2 -2
- package/__cjs/masking/maskOperation.cjs +1 -1
- package/__cjs/masking/utils.cjs +3 -3
- package/__cjs/react/context/ApolloContext.cjs +1 -1
- package/__cjs/react/context/ApolloProvider.cjs +1 -1
- package/__cjs/react/hooks/internal/validateSuspenseHookOptions.cjs +2 -2
- package/__cjs/react/hooks/useApolloClient.cjs +1 -1
- package/__cjs/react/hooks/useLazyQuery.cjs +2 -2
- package/__cjs/react/hooks/useLoadableQuery.cjs +2 -2
- package/__cjs/react/hooks/useSubscription.cjs +1 -1
- package/__cjs/react/hooks/useSyncExternalStore.cjs +1 -1
- package/__cjs/react/internal/cache/QueryReference.cjs +1 -1
- package/__cjs/react/ssr/prerenderStatic.cjs +2 -2
- package/__cjs/testing/core/mocking/mockLink.cjs +4 -4
- package/__cjs/utilities/graphql/DocumentTransform.cjs +1 -1
- package/__cjs/utilities/internal/capitalize.cjs +12 -0
- package/__cjs/utilities/internal/capitalize.cjs.map +1 -0
- package/__cjs/utilities/internal/capitalize.d.cts +7 -0
- package/__cjs/utilities/internal/coerceScalarFieldsToParsed.cjs +69 -0
- package/__cjs/utilities/internal/coerceScalarFieldsToParsed.cjs.map +1 -0
- package/__cjs/utilities/internal/coerceScalarFieldsToParsed.d.cts +9 -0
- package/__cjs/utilities/internal/getFragmentDefinition.cjs +3 -3
- package/__cjs/utilities/internal/getFragmentFromSelection.cjs +1 -1
- package/__cjs/utilities/internal/getFragmentFromSelection.cjs.map +1 -1
- package/__cjs/utilities/internal/getFragmentQueryDocument.cjs +2 -2
- package/__cjs/utilities/internal/getMainDefinition.cjs +1 -1
- package/__cjs/utilities/internal/getQueryDefinition.cjs +1 -1
- package/__cjs/utilities/internal/index.cjs +6 -2
- package/__cjs/utilities/internal/index.cjs.map +1 -1
- package/__cjs/utilities/internal/index.d.cts +4 -0
- package/__cjs/utilities/internal/removeDirectivesFromDocument.cjs +1 -1
- package/__cjs/utilities/internal/shouldInclude.cjs +4 -4
- package/__cjs/utilities/internal/types/Exact.cjs +3 -0
- package/__cjs/utilities/internal/types/Exact.cjs.map +1 -0
- package/__cjs/utilities/internal/types/Exact.d.cts +2 -0
- package/__cjs/utilities/internal/types/IsNeverish.cjs +3 -0
- package/__cjs/utilities/internal/types/IsNeverish.cjs.map +1 -0
- package/__cjs/utilities/internal/types/IsNeverish.d.cts +4 -0
- package/__cjs/utilities/internal/valueToObjectRepresentation.cjs +1 -1
- package/__cjs/version.cjs +1 -1
- package/cache/core/cache.d.ts +19 -1
- package/cache/core/cache.js +26 -2
- package/cache/core/cache.js.map +1 -1
- package/cache/inmemory/entityStore.js +3 -3
- package/cache/inmemory/inMemoryCache.d.ts +5 -1
- package/cache/inmemory/inMemoryCache.js +10 -0
- package/cache/inmemory/inMemoryCache.js.map +1 -1
- package/cache/inmemory/key-extractor.js +1 -1
- package/cache/inmemory/policies.js +5 -5
- package/cache/inmemory/readFromStore.js +3 -3
- package/cache/inmemory/writeToStore.js +4 -4
- package/core/ApolloClient.js +14 -14
- package/core/ObservableQuery.js +8 -8
- package/core/QueryInfo.js +1 -1
- package/core/QueryManager.js +24 -14
- package/core/QueryManager.js.map +1 -1
- package/core/RefetchEventManager.js +3 -3
- package/incremental/GraphQLCodegenIncremental.d.ts +55 -0
- package/incremental/GraphQLCodegenIncremental.js +2 -0
- package/incremental/GraphQLCodegenIncremental.js.map +1 -0
- package/incremental/handlers/graphql17Alpha9.js +1 -1
- package/incremental/handlers/notImplemented.js +1 -1
- package/incremental/index.d.ts +1 -0
- package/incremental/index.js.map +1 -1
- package/incremental/internal/types.d.ts +17 -0
- package/incremental/internal/types.js +2 -0
- package/incremental/internal/types.js.map +1 -0
- package/invariantErrorCodes.js +122 -116
- package/link/core/ApolloLink.js +3 -3
- package/link/http/checkFetcher.js +1 -1
- package/link/http/parseAndCheckHttpResponse.js +2 -2
- package/link/http/parseAndCheckHttpResponse.js.map +1 -1
- package/link/persisted-queries/index.js +2 -2
- package/link/ws/index.js +1 -1
- package/local-state/LocalState.js +11 -11
- package/masking/internal/types.d.ts +1 -2
- package/masking/internal/types.js.map +1 -1
- package/masking/maskDefinition.js +2 -2
- package/masking/maskFragment.js +2 -2
- package/masking/maskOperation.js +1 -1
- package/masking/utils.js +3 -3
- package/package.json +1 -1
- package/react/context/ApolloContext.js +1 -1
- package/react/context/ApolloProvider.js +1 -1
- package/react/hooks/internal/validateSuspenseHookOptions.js +2 -2
- package/react/hooks/useApolloClient.js +1 -1
- package/react/hooks/useLazyQuery.js +2 -2
- package/react/hooks/useLoadableQuery.js +2 -2
- package/react/hooks/useSubscription.js +1 -1
- package/react/hooks/useSyncExternalStore.js +1 -1
- package/react/hooks-compiled/internal/validateSuspenseHookOptions.js +2 -2
- package/react/hooks-compiled/useApolloClient.js +1 -1
- package/react/hooks-compiled/useLazyQuery.js +2 -2
- package/react/hooks-compiled/useLoadableQuery.js +2 -2
- package/react/hooks-compiled/useSubscription.js +1 -1
- package/react/hooks-compiled/useSyncExternalStore.js +1 -1
- package/react/internal/cache/QueryReference.js +1 -1
- package/react/ssr/prerenderStatic.js +2 -2
- package/testing/core/mocking/mockLink.js +4 -4
- package/utilities/graphql/DocumentTransform.js +1 -1
- package/utilities/internal/capitalize.d.ts +7 -0
- package/utilities/internal/capitalize.js +9 -0
- package/utilities/internal/capitalize.js.map +1 -0
- package/utilities/internal/coerceScalarFieldsToParsed.d.ts +9 -0
- package/utilities/internal/coerceScalarFieldsToParsed.js +66 -0
- package/utilities/internal/coerceScalarFieldsToParsed.js.map +1 -0
- package/utilities/internal/getFragmentDefinition.js +3 -3
- package/utilities/internal/getFragmentFromSelection.js +1 -1
- package/utilities/internal/getFragmentFromSelection.js.map +1 -1
- package/utilities/internal/getFragmentQueryDocument.js +2 -2
- package/utilities/internal/getMainDefinition.js +1 -1
- package/utilities/internal/getQueryDefinition.js +1 -1
- package/utilities/internal/index.d.ts +4 -0
- package/utilities/internal/index.js +2 -0
- package/utilities/internal/index.js.map +1 -1
- package/utilities/internal/removeDirectivesFromDocument.js +1 -1
- package/utilities/internal/shouldInclude.js +4 -4
- package/utilities/internal/types/Exact.d.ts +2 -0
- package/utilities/internal/types/Exact.js +2 -0
- package/utilities/internal/types/Exact.js.map +1 -0
- package/utilities/internal/types/IsNeverish.d.ts +4 -0
- package/utilities/internal/types/IsNeverish.js +2 -0
- package/utilities/internal/types/IsNeverish.js.map +1 -0
- package/utilities/internal/valueToObjectRepresentation.js +1 -1
- package/version.js +1 -1
|
@@ -242,7 +242,7 @@ export class Policies {
|
|
|
242
242
|
const rootId = "ROOT_" + which.toUpperCase();
|
|
243
243
|
const old = this.rootTypenamesById[rootId];
|
|
244
244
|
if (typename !== old) {
|
|
245
|
-
invariant(!old || old === which,
|
|
245
|
+
invariant(!old || old === which, 111, which);
|
|
246
246
|
// First, delete any old __typename associated with this rootId from
|
|
247
247
|
// rootIdsByTypename.
|
|
248
248
|
if (old)
|
|
@@ -385,7 +385,7 @@ export class Policies {
|
|
|
385
385
|
if (supertypeSet.has(supertype)) {
|
|
386
386
|
if (!typenameSupertypeSet.has(supertype)) {
|
|
387
387
|
if (checkingFuzzySubtypes) {
|
|
388
|
-
__DEV__ && invariant.warn(
|
|
388
|
+
__DEV__ && invariant.warn(112, typename, supertype);
|
|
389
389
|
}
|
|
390
390
|
// Record positive results for faster future lookup.
|
|
391
391
|
// Unfortunately, we cannot safely cache negative results,
|
|
@@ -641,7 +641,7 @@ export function normalizeReadFieldOptions(readFieldArgs, objectOrReference, vari
|
|
|
641
641
|
}
|
|
642
642
|
}
|
|
643
643
|
if (__DEV__ && options.from === void 0) {
|
|
644
|
-
__DEV__ && invariant.warn(
|
|
644
|
+
__DEV__ && invariant.warn(113, stringifyForDisplay(Array.from(readFieldArgs)));
|
|
645
645
|
}
|
|
646
646
|
if (void 0 === options.variables) {
|
|
647
647
|
options.variables = variables;
|
|
@@ -651,7 +651,7 @@ export function normalizeReadFieldOptions(readFieldArgs, objectOrReference, vari
|
|
|
651
651
|
function makeMergeObjectsFunction(store) {
|
|
652
652
|
return function mergeObjects(existing, incoming) {
|
|
653
653
|
if (isArray(existing) || isArray(incoming)) {
|
|
654
|
-
throw newInvariantError(
|
|
654
|
+
throw newInvariantError(114);
|
|
655
655
|
}
|
|
656
656
|
// These dynamic checks are necessary because the parameters of a
|
|
657
657
|
// custom merge function can easily have the any type, so the type
|
|
@@ -688,6 +688,6 @@ function makeMergeObjectsFunction(store) {
|
|
|
688
688
|
};
|
|
689
689
|
}
|
|
690
690
|
function warnAboutScalarConfig(typename, fieldName, scalar, kind) {
|
|
691
|
-
__DEV__ && invariant.warn(
|
|
691
|
+
__DEV__ && invariant.warn(115, `${typename}.${fieldName}`, scalar, kind);
|
|
692
692
|
}
|
|
693
693
|
//# sourceMappingURL=policies.js.map
|
|
@@ -282,7 +282,7 @@ export class StoreReader {
|
|
|
282
282
|
if (typename) {
|
|
283
283
|
const policy = policies["getFieldPolicy"](typename, fieldName);
|
|
284
284
|
if (policy?.scalar) {
|
|
285
|
-
__DEV__ && invariant.warn(
|
|
285
|
+
__DEV__ && invariant.warn(116, `${typename}.${fieldName}`, policy.scalar);
|
|
286
286
|
}
|
|
287
287
|
}
|
|
288
288
|
}
|
|
@@ -319,7 +319,7 @@ export class StoreReader {
|
|
|
319
319
|
else {
|
|
320
320
|
const fragment = getFragmentFromSelection(selection, context.lookupFragment);
|
|
321
321
|
if (!fragment && selection.kind === Kind.FRAGMENT_SPREAD) {
|
|
322
|
-
throw newInvariantError(
|
|
322
|
+
throw newInvariantError(117, selection.name.value);
|
|
323
323
|
}
|
|
324
324
|
if (fragment && policies.fragmentMatches(fragment, typename)) {
|
|
325
325
|
const isDeferBoundary = isDeferredFragment(selection, context.variables);
|
|
@@ -616,7 +616,7 @@ function assertSelectionSetForIdValue(store, field, fieldValue) {
|
|
|
616
616
|
if (isNonNullObject(value)) {
|
|
617
617
|
invariant(
|
|
618
618
|
!isReference(value),
|
|
619
|
-
|
|
619
|
+
118,
|
|
620
620
|
getTypenameFromStoreObject(store, value),
|
|
621
621
|
field.name.value
|
|
622
622
|
);
|
|
@@ -68,7 +68,7 @@ export class StoreWriter {
|
|
|
68
68
|
path: [],
|
|
69
69
|
});
|
|
70
70
|
if (!isReference(ref)) {
|
|
71
|
-
throw newInvariantError(
|
|
71
|
+
throw newInvariantError(119, result);
|
|
72
72
|
}
|
|
73
73
|
// So far, the store has not been modified, so now it's time to process
|
|
74
74
|
// context.incomingById and merge those incoming fields into context.store.
|
|
@@ -230,7 +230,7 @@ export class StoreWriter {
|
|
|
230
230
|
// provide a default value, so its absence from the written data should
|
|
231
231
|
// not be cause for alarm.
|
|
232
232
|
!policies.getReadFunction(typename, field.name.value)) {
|
|
233
|
-
invariant.error(
|
|
233
|
+
invariant.error(120, resultKeyNameFromField(field), result);
|
|
234
234
|
}
|
|
235
235
|
});
|
|
236
236
|
// Identify the result object, even if dataId was already provided,
|
|
@@ -378,7 +378,7 @@ export class StoreWriter {
|
|
|
378
378
|
else {
|
|
379
379
|
const fragment = getFragmentFromSelection(selection, context.lookupFragment);
|
|
380
380
|
if (!fragment && selection.kind === Kind.FRAGMENT_SPREAD) {
|
|
381
|
-
throw newInvariantError(
|
|
381
|
+
throw newInvariantError(121, selection.name.value);
|
|
382
382
|
}
|
|
383
383
|
if (fragment &&
|
|
384
384
|
policies.fragmentMatches(fragment, typename, result, context.variables)) {
|
|
@@ -550,7 +550,7 @@ function warnAboutDataLoss(existingRef, incomingObj, storeFieldName, store) {
|
|
|
550
550
|
}
|
|
551
551
|
});
|
|
552
552
|
}
|
|
553
|
-
__DEV__ && invariant.warn(
|
|
553
|
+
__DEV__ && invariant.warn(122, fieldName, parentType, childTypenames.length ?
|
|
554
554
|
"either ensure all objects of type " +
|
|
555
555
|
childTypenames.join(" and ") +
|
|
556
556
|
" have an ID or a custom merge function, or "
|
package/core/ApolloClient.js
CHANGED
|
@@ -71,8 +71,8 @@ export class ApolloClient {
|
|
|
71
71
|
*/
|
|
72
72
|
constructor(options) {
|
|
73
73
|
if (__DEV__) {
|
|
74
|
-
invariant(options.cache,
|
|
75
|
-
invariant(options.link,
|
|
74
|
+
invariant(options.cache, 69);
|
|
75
|
+
invariant(options.link, 70);
|
|
76
76
|
}
|
|
77
77
|
const { cache, documentTransform, ssrMode = false, ssrForceFetchDelay = 0, queryDeduplication = true, defaultOptions, defaultContext, assumeImmutableResults = cache.assumeImmutableResults, localState, devtools, dataMasking, link, incrementalHandler = new NotImplementedHandler(), experiments = [], refetchEventManager, } = options;
|
|
78
78
|
this.link = link;
|
|
@@ -260,12 +260,12 @@ export class ApolloClient {
|
|
|
260
260
|
if (refetchOn) {
|
|
261
261
|
const operationName = getOperationName(query, "(anonymous)");
|
|
262
262
|
if (!refetchEventManager) {
|
|
263
|
-
__DEV__ && invariant.warn(
|
|
263
|
+
__DEV__ && invariant.warn(71, operationName);
|
|
264
264
|
}
|
|
265
265
|
else if (typeof refetchOn === "object") {
|
|
266
266
|
Object.keys(refetchOn).forEach((source) => {
|
|
267
267
|
if (!refetchEventManager.hasSource(source)) {
|
|
268
|
-
__DEV__ && invariant.warn(
|
|
268
|
+
__DEV__ && invariant.warn(72, source, operationName);
|
|
269
269
|
}
|
|
270
270
|
});
|
|
271
271
|
}
|
|
@@ -287,13 +287,13 @@ export class ApolloClient {
|
|
|
287
287
|
options = mergeOptions(this.defaultOptions.query, options);
|
|
288
288
|
}
|
|
289
289
|
if (__DEV__) {
|
|
290
|
-
invariant(options.fetchPolicy !== "cache-and-network",
|
|
291
|
-
invariant(options.fetchPolicy !== "standby",
|
|
292
|
-
invariant(options.query,
|
|
293
|
-
invariant(options.query.kind === "Document",
|
|
294
|
-
invariant(!options.returnPartialData,
|
|
295
|
-
invariant(!options.pollInterval,
|
|
296
|
-
invariant(!options.notifyOnNetworkStatusChange,
|
|
290
|
+
invariant(options.fetchPolicy !== "cache-and-network", 73);
|
|
291
|
+
invariant(options.fetchPolicy !== "standby", 74);
|
|
292
|
+
invariant(options.query, 75);
|
|
293
|
+
invariant(options.query.kind === "Document", 76);
|
|
294
|
+
invariant(!options.returnPartialData, 77);
|
|
295
|
+
invariant(!options.pollInterval, 78);
|
|
296
|
+
invariant(!options.notifyOnNetworkStatusChange, 79);
|
|
297
297
|
}
|
|
298
298
|
return this.queryManager.query(options);
|
|
299
299
|
};
|
|
@@ -311,9 +311,9 @@ export class ApolloClient {
|
|
|
311
311
|
errorPolicy: "none",
|
|
312
312
|
}, this.defaultOptions.mutate), options);
|
|
313
313
|
if (__DEV__) {
|
|
314
|
-
invariant(optionsWithDefaults.mutation,
|
|
314
|
+
invariant(optionsWithDefaults.mutation, 80);
|
|
315
315
|
invariant(optionsWithDefaults.fetchPolicy === "network-only" ||
|
|
316
|
-
optionsWithDefaults.fetchPolicy === "no-cache",
|
|
316
|
+
optionsWithDefaults.fetchPolicy === "no-cache", 81);
|
|
317
317
|
}
|
|
318
318
|
checkDocument(optionsWithDefaults.mutation, OperationTypeNode.MUTATION);
|
|
319
319
|
return this.queryManager.mutate(optionsWithDefaults);
|
|
@@ -519,7 +519,7 @@ export class ApolloClient {
|
|
|
519
519
|
// result.queries and result.results instead, you shouldn't have to worry
|
|
520
520
|
// about preventing uncaught rejections for the Promise.all result.
|
|
521
521
|
result.catch((error) => {
|
|
522
|
-
__DEV__ && invariant.debug(
|
|
522
|
+
__DEV__ && invariant.debug(82, error);
|
|
523
523
|
});
|
|
524
524
|
return result;
|
|
525
525
|
}
|
package/core/ObservableQuery.js
CHANGED
|
@@ -102,7 +102,7 @@ export class ObservableQuery {
|
|
|
102
102
|
// Make sure we don't store "standby" as the initialFetchPolicy.
|
|
103
103
|
initialFetchPolicy = fetchPolicy === "standby" ? defaultFetchPolicy : (fetchPolicy), } = options;
|
|
104
104
|
if (options[variablesUnknownSymbol]) {
|
|
105
|
-
invariant(fetchPolicy === "standby",
|
|
105
|
+
invariant(fetchPolicy === "standby", 83);
|
|
106
106
|
this.variablesUnknown = true;
|
|
107
107
|
}
|
|
108
108
|
this.lastQuery = transformedQuery;
|
|
@@ -411,7 +411,7 @@ export class ObservableQuery {
|
|
|
411
411
|
const queryDef = getQueryDefinition(this.query);
|
|
412
412
|
const vars = queryDef.variableDefinitions;
|
|
413
413
|
if (!vars || !vars.some((v) => v.variable.name.value === "variables")) {
|
|
414
|
-
__DEV__ && invariant.warn(
|
|
414
|
+
__DEV__ && invariant.warn(84, variables, queryDef.name?.value || queryDef);
|
|
415
415
|
}
|
|
416
416
|
}
|
|
417
417
|
if (variables && !equal(this.variables, variables)) {
|
|
@@ -426,7 +426,7 @@ export class ObservableQuery {
|
|
|
426
426
|
fetchMore({ query, variables, context, errorPolicy, updateQuery, }) {
|
|
427
427
|
invariant(
|
|
428
428
|
this.options.fetchPolicy !== "cache-only",
|
|
429
|
-
|
|
429
|
+
85,
|
|
430
430
|
getOperationName(this.query, "(anonymous)")
|
|
431
431
|
);
|
|
432
432
|
const combinedOptions = {
|
|
@@ -460,7 +460,7 @@ export class ObservableQuery {
|
|
|
460
460
|
let wasUpdated = false;
|
|
461
461
|
const isCached = this.options.fetchPolicy !== "no-cache";
|
|
462
462
|
if (!isCached) {
|
|
463
|
-
invariant(updateQuery,
|
|
463
|
+
invariant(updateQuery, 86);
|
|
464
464
|
}
|
|
465
465
|
const { finalize, pushNotification } = this.pushOperation(NetworkStatus.fetchMore);
|
|
466
466
|
pushNotification({
|
|
@@ -634,7 +634,7 @@ export class ObservableQuery {
|
|
|
634
634
|
onError(error);
|
|
635
635
|
}
|
|
636
636
|
else {
|
|
637
|
-
invariant.error(
|
|
637
|
+
invariant.error(87, error);
|
|
638
638
|
}
|
|
639
639
|
return;
|
|
640
640
|
}
|
|
@@ -885,7 +885,7 @@ export class ObservableQuery {
|
|
|
885
885
|
if (!this.didWarnCacheOnlyPolling &&
|
|
886
886
|
pollInterval &&
|
|
887
887
|
fetchPolicy === "cache-only") {
|
|
888
|
-
__DEV__ && invariant.warn(
|
|
888
|
+
__DEV__ && invariant.warn(88, getOperationName(this.query, "(anonymous)"));
|
|
889
889
|
this.didWarnCacheOnlyPolling = true;
|
|
890
890
|
}
|
|
891
891
|
}
|
|
@@ -1511,7 +1511,7 @@ export class ObservableQuery {
|
|
|
1511
1511
|
}
|
|
1512
1512
|
export function logMissingFieldErrors(missing) {
|
|
1513
1513
|
if (__DEV__ && missing) {
|
|
1514
|
-
__DEV__ && invariant.debug(
|
|
1514
|
+
__DEV__ && invariant.debug(89, missing);
|
|
1515
1515
|
}
|
|
1516
1516
|
}
|
|
1517
1517
|
function isEqualQuery(a, b) {
|
|
@@ -1555,6 +1555,6 @@ function getTrackingOperatorPromise(defaultValue) {
|
|
|
1555
1555
|
return { promise, operator };
|
|
1556
1556
|
}
|
|
1557
1557
|
function warnOnFeud(query, diff) {
|
|
1558
|
-
__DEV__ && invariant.warn(
|
|
1558
|
+
__DEV__ && invariant.warn(90, getOperationName(query, "(anonymous)"), diff.missing?.missing);
|
|
1559
1559
|
}
|
|
1560
1560
|
//# sourceMappingURL=ObservableQuery.js.map
|
package/core/QueryInfo.js
CHANGED
package/core/QueryManager.js
CHANGED
|
@@ -9,7 +9,7 @@ import { execute } from "@apollo/client/link";
|
|
|
9
9
|
import { maskFragment, maskOperation } from "@apollo/client/masking";
|
|
10
10
|
import { cacheSizes, DocumentTransform, isNetworkRequestInFlight, print, } from "@apollo/client/utilities";
|
|
11
11
|
import { __DEV__ } from "@apollo/client/utilities/environment";
|
|
12
|
-
import { AutoCleanedWeakCache, checkDocument, extensionsSymbol, filterMap, getDefaultValues, getOperationDefinition, getOperationName, graphQLResultHasError, hasDirectives, hasForcedResolvers, isDocumentNode, isNonNullObject, makeUniqueId, mergeOptions, removeDirectivesFromDocument, streamInfoSymbol, toQueryResult, } from "@apollo/client/utilities/internal";
|
|
12
|
+
import { AutoCleanedWeakCache, checkDocument, coerceScalarFieldsToParsed, extensionsSymbol, filterMap, getDefaultValues, getOperationDefinition, getOperationName, graphQLResultHasError, hasDirectives, hasForcedResolvers, isDocumentNode, isNonNullObject, makeUniqueId, mergeOptions, removeDirectivesFromDocument, streamInfoSymbol, toQueryResult, } from "@apollo/client/utilities/internal";
|
|
13
13
|
import { invariant, newInvariantError, } from "@apollo/client/utilities/invariant";
|
|
14
14
|
import { dataStateErrorCache } from "./dataStateErrorCache.js";
|
|
15
15
|
import { NetworkStatus } from "./networkStatus.js";
|
|
@@ -99,7 +99,7 @@ export class QueryManager {
|
|
|
99
99
|
*/
|
|
100
100
|
stop() {
|
|
101
101
|
this.obsQueries.forEach((oq) => oq.stop());
|
|
102
|
-
this.cancelPendingFetches(newInvariantError(
|
|
102
|
+
this.cancelPendingFetches(newInvariantError(92));
|
|
103
103
|
}
|
|
104
104
|
cancelPendingFetches(error) {
|
|
105
105
|
this.fetchCancelFns.forEach((cancel) => cancel(error));
|
|
@@ -112,7 +112,7 @@ export class QueryManager {
|
|
|
112
112
|
variables = this.getVariables(mutation, variables);
|
|
113
113
|
if (hasClientExports) {
|
|
114
114
|
if (__DEV__) {
|
|
115
|
-
invariant(this.localState,
|
|
115
|
+
invariant(this.localState, 93, getOperationName(mutation, "(anonymous)"));
|
|
116
116
|
}
|
|
117
117
|
variables = await this.localState.getExportedVariables({
|
|
118
118
|
client: this.client,
|
|
@@ -345,7 +345,7 @@ export class QueryManager {
|
|
|
345
345
|
// depend on values that previously existed in the data portion of the
|
|
346
346
|
// store. So, we cancel the promises and observers that we have issued
|
|
347
347
|
// so far and not yet resolved (in the case of queries).
|
|
348
|
-
this.cancelPendingFetches(newInvariantError(
|
|
348
|
+
this.cancelPendingFetches(newInvariantError(94));
|
|
349
349
|
this.obsQueries.forEach((observableQuery) => {
|
|
350
350
|
// Set loading to true so listeners don't trigger unless they want
|
|
351
351
|
// results with partial data.
|
|
@@ -415,10 +415,10 @@ export class QueryManager {
|
|
|
415
415
|
if (!included) {
|
|
416
416
|
const queryName = queryNames.get(nameOrQueryString);
|
|
417
417
|
if (queryName) {
|
|
418
|
-
__DEV__ && invariant.warn(
|
|
418
|
+
__DEV__ && invariant.warn(95, queryName);
|
|
419
419
|
}
|
|
420
420
|
else {
|
|
421
|
-
__DEV__ && invariant.warn(
|
|
421
|
+
__DEV__ && invariant.warn(96);
|
|
422
422
|
}
|
|
423
423
|
}
|
|
424
424
|
});
|
|
@@ -447,7 +447,7 @@ export class QueryManager {
|
|
|
447
447
|
if (__DEV__) {
|
|
448
448
|
invariant(
|
|
449
449
|
!this.getDocumentInfo(query).hasClientExports || this.localState,
|
|
450
|
-
|
|
450
|
+
97,
|
|
451
451
|
getOperationName(query, "(anonymous)")
|
|
452
452
|
);
|
|
453
453
|
}
|
|
@@ -592,14 +592,14 @@ export class QueryManager {
|
|
|
592
592
|
if (__DEV__) {
|
|
593
593
|
invariant(
|
|
594
594
|
this.localState,
|
|
595
|
-
|
|
595
|
+
98,
|
|
596
596
|
operation[0].toUpperCase() + operation.slice(1),
|
|
597
597
|
operationName ?? "(anonymous)"
|
|
598
598
|
);
|
|
599
599
|
}
|
|
600
600
|
invariant(
|
|
601
601
|
!hasIncrementalDirective,
|
|
602
|
-
|
|
602
|
+
99,
|
|
603
603
|
operation[0].toUpperCase() + operation.slice(1),
|
|
604
604
|
operationName ?? "(anonymous)"
|
|
605
605
|
);
|
|
@@ -767,7 +767,7 @@ export class QueryManager {
|
|
|
767
767
|
// we deprecated and removed LocalState.
|
|
768
768
|
if (this.getDocumentInfo(normalized.query).hasClientExports) {
|
|
769
769
|
if (__DEV__) {
|
|
770
|
-
invariant(this.localState,
|
|
770
|
+
invariant(this.localState, 100, getOperationName(normalized.query, "(anonymous)"));
|
|
771
771
|
}
|
|
772
772
|
observable = from(this.localState.getExportedVariables({
|
|
773
773
|
client: this.client,
|
|
@@ -940,7 +940,7 @@ export class QueryManager {
|
|
|
940
940
|
!isFullyUnmaskedOperation(document) &&
|
|
941
941
|
!this.noCacheWarningsByCause.has(cause)) {
|
|
942
942
|
this.noCacheWarningsByCause.add(cause);
|
|
943
|
-
__DEV__ && invariant.warn(
|
|
943
|
+
__DEV__ && invariant.warn(101, getOperationName(document, `Unnamed ${operationType ?? "operation"}`));
|
|
944
944
|
}
|
|
945
945
|
}
|
|
946
946
|
return (this.dataMasking ?
|
|
@@ -1003,7 +1003,7 @@ export class QueryManager {
|
|
|
1003
1003
|
(diff.complete || returnPartialData) &&
|
|
1004
1004
|
this.getDocumentInfo(query).hasForcedResolvers) {
|
|
1005
1005
|
if (__DEV__) {
|
|
1006
|
-
invariant(this.localState,
|
|
1006
|
+
invariant(this.localState, 102, getOperationName(query, "(anonymous)"));
|
|
1007
1007
|
}
|
|
1008
1008
|
onCacheHit();
|
|
1009
1009
|
return from(this.localState.execute({
|
|
@@ -1101,7 +1101,17 @@ export class QueryManager {
|
|
|
1101
1101
|
}),
|
|
1102
1102
|
};
|
|
1103
1103
|
case "no-cache":
|
|
1104
|
-
return {
|
|
1104
|
+
return {
|
|
1105
|
+
fromLink: true,
|
|
1106
|
+
observable: resultsFromLink().pipe(map((notification) => {
|
|
1107
|
+
if (notification.kind === "N" &&
|
|
1108
|
+
notification.value.data != null &&
|
|
1109
|
+
this.cache.configuresScalars()) {
|
|
1110
|
+
notification.value.data = coerceScalarFieldsToParsed(notification.value.data, query, this.cache);
|
|
1111
|
+
}
|
|
1112
|
+
return notification;
|
|
1113
|
+
})),
|
|
1114
|
+
};
|
|
1105
1115
|
case "standby":
|
|
1106
1116
|
return { fromLink: false, observable: EMPTY };
|
|
1107
1117
|
}
|
|
@@ -1114,7 +1124,7 @@ function validateDidEmitValue() {
|
|
|
1114
1124
|
didEmitValue = true;
|
|
1115
1125
|
},
|
|
1116
1126
|
complete() {
|
|
1117
|
-
invariant(didEmitValue,
|
|
1127
|
+
invariant(didEmitValue, 103);
|
|
1118
1128
|
},
|
|
1119
1129
|
});
|
|
1120
1130
|
}
|