@apollo/client 3.13.8 → 3.14.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/.changeset/chilled-cameras-scream.md +5 -0
- package/.changeset/great-suns-cover.md +5 -0
- package/.changeset/perfect-donuts-roll.md +5 -0
- package/.changeset/popular-waves-drop.md +5 -0
- package/.changeset/pre.json +16 -0
- package/.changeset/shy-dragons-tease.md +5 -0
- package/.changeset/smooth-countries-cough.md +5 -0
- package/.changeset/spotty-walls-repair.md +5 -0
- package/CHANGELOG.md +20 -0
- package/README.md +80 -31
- package/apollo-client.cjs +354 -132
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/cache/cache.cjs +78 -21
- package/cache/cache.cjs.map +1 -1
- package/cache/cache.cjs.native.js +78 -21
- package/cache/core/cache.js +27 -4
- package/cache/core/cache.js.map +1 -1
- package/cache/core/types/Cache.d.ts +4 -4
- package/cache/core/types/Cache.js.map +1 -1
- package/cache/core/types/DataProxy.d.ts +2 -2
- package/cache/inmemory/inMemoryCache.js +15 -4
- package/cache/inmemory/inMemoryCache.js.map +1 -1
- package/cache/inmemory/policies.js +18 -13
- package/cache/inmemory/policies.js.map +1 -1
- package/cache/inmemory/readFromStore.d.ts +7 -0
- package/cache/inmemory/readFromStore.js.map +1 -1
- package/cache/inmemory/types.d.ts +14 -3
- package/cache/inmemory/types.js.map +1 -1
- package/core/ApolloClient.d.ts +191 -2
- package/core/ApolloClient.js +93 -7
- package/core/ApolloClient.js.map +1 -1
- package/core/LocalState.js +2 -2
- package/core/ObservableQuery.js +10 -6
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryInfo.js +8 -2
- package/core/QueryInfo.js.map +1 -1
- package/core/QueryManager.js +15 -12
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs +93 -30
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +93 -30
- package/core/watchQueryOptions.d.ts +2 -2
- package/dev/dev.cjs +144 -84
- package/dev/dev.cjs.map +1 -1
- package/dev/dev.cjs.native.js +144 -84
- package/invariantErrorCodes.js +158 -83
- package/link/core/ApolloLink.js +2 -2
- package/link/core/core.cjs +2 -2
- package/link/core/core.cjs.map +1 -1
- package/link/core/core.cjs.native.js +2 -2
- package/link/http/checkFetcher.js +1 -1
- package/link/http/createHttpLink.js +1 -1
- package/link/http/http.cjs +3 -3
- package/link/http/http.cjs.map +1 -1
- package/link/http/http.cjs.native.js +3 -3
- package/link/http/serializeFetchParameter.js +1 -1
- package/link/persisted-queries/index.js +2 -2
- package/link/persisted-queries/persisted-queries.cjs +2 -2
- package/link/persisted-queries/persisted-queries.cjs.map +1 -1
- package/link/persisted-queries/persisted-queries.cjs.native.js +2 -2
- package/link/utils/toPromise.js +1 -1
- package/link/utils/utils.cjs +2 -2
- package/link/utils/utils.cjs.map +1 -1
- package/link/utils/utils.cjs.native.js +2 -2
- package/link/utils/validateOperation.js +1 -1
- package/masking/maskDefinition.js +2 -2
- package/masking/maskFragment.js +2 -2
- package/masking/maskOperation.js +1 -1
- package/masking/masking.cjs +6 -6
- package/masking/masking.cjs.map +1 -1
- package/masking/masking.cjs.native.js +6 -6
- package/masking/utils.js +1 -1
- package/package.json +1 -1
- package/react/components/Mutation.js +5 -0
- package/react/components/Mutation.js.map +1 -1
- package/react/components/Query.js +5 -0
- package/react/components/Query.js.map +1 -1
- package/react/components/Subscription.js +5 -0
- package/react/components/Subscription.js.map +1 -1
- package/react/components/components.cjs +34 -0
- package/react/components/components.cjs.map +1 -1
- package/react/components/components.cjs.native.js +34 -0
- package/react/context/ApolloConsumer.js +1 -1
- package/react/context/ApolloContext.js +7 -2
- package/react/context/ApolloContext.js.map +1 -1
- package/react/context/ApolloProvider.js +1 -1
- package/react/context/context.cjs +9 -4
- package/react/context/context.cjs.map +1 -1
- package/react/context/context.cjs.native.js +9 -4
- package/react/hoc/graphql.js +17 -4
- package/react/hoc/graphql.js.map +1 -1
- package/react/hoc/hoc-utils.js +1 -1
- package/react/hoc/hoc.cjs +55 -9
- package/react/hoc/hoc.cjs.map +1 -1
- package/react/hoc/hoc.cjs.native.js +55 -9
- package/react/hoc/mutation-hoc.js +8 -1
- package/react/hoc/mutation-hoc.js.map +1 -1
- package/react/hoc/query-hoc.js +8 -1
- package/react/hoc/query-hoc.js.map +1 -1
- package/react/hoc/subscription-hoc.js +8 -1
- package/react/hoc/subscription-hoc.js.map +1 -1
- package/react/hoc/withApollo.js +1 -1
- package/react/hooks/hooks.cjs +264 -31
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +264 -31
- package/react/hooks/internal/index.d.ts +2 -0
- package/react/hooks/internal/index.js +2 -0
- package/react/hooks/internal/index.js.map +1 -1
- package/react/hooks/internal/useWarnRemoved.d.ts +2 -0
- package/react/hooks/internal/useWarnRemoved.js +14 -0
- package/react/hooks/internal/useWarnRemoved.js.map +1 -0
- package/react/hooks/internal/useWarnRemovedOption.d.ts +2 -0
- package/react/hooks/internal/useWarnRemovedOption.js +14 -0
- package/react/hooks/internal/useWarnRemovedOption.js.map +1 -0
- package/react/hooks/useApolloClient.js +1 -1
- package/react/hooks/useBackgroundQuery.js +11 -3
- package/react/hooks/useBackgroundQuery.js.map +1 -1
- package/react/hooks/useFragment.js +30 -21
- package/react/hooks/useFragment.js.map +1 -1
- package/react/hooks/useLazyQuery.js +65 -0
- package/react/hooks/useLazyQuery.js.map +1 -1
- package/react/hooks/useLoadableQuery.js +12 -5
- package/react/hooks/useLoadableQuery.js.map +1 -1
- package/react/hooks/useMutation.js +5 -1
- package/react/hooks/useMutation.js.map +1 -1
- package/react/hooks/useQuery.d.ts +2 -2
- package/react/hooks/useQuery.js +25 -7
- package/react/hooks/useQuery.js.map +1 -1
- package/react/hooks/useSubscription.js +3 -3
- package/react/hooks/useSubscription.js.map +1 -1
- package/react/hooks/useSuspenseQuery.js +12 -6
- package/react/hooks/useSuspenseQuery.js.map +1 -1
- package/react/hooks/useSyncExternalStore.js +1 -1
- package/react/internal/cache/QueryReference.d.ts +16 -0
- package/react/internal/cache/QueryReference.js +1 -1
- package/react/internal/cache/QueryReference.js.map +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.d.ts +7 -0
- package/react/parser/index.js +17 -7
- package/react/parser/index.js.map +1 -1
- package/react/parser/parser.cjs +28 -7
- package/react/parser/parser.cjs.map +1 -1
- package/react/parser/parser.cjs.native.js +28 -7
- package/react/query-preloader/createQueryPreloader.d.ts +2 -1
- package/react/query-preloader/createQueryPreloader.js +14 -5
- package/react/query-preloader/createQueryPreloader.js.map +1 -1
- package/react/react.cjs +40 -6
- package/react/react.cjs.map +1 -1
- package/react/react.cjs.native.js +40 -6
- package/react/types/types.d.ts +303 -9
- package/react/types/types.documentation.d.ts +2 -3
- package/react/types/types.documentation.js.map +1 -1
- package/react/types/types.js.map +1 -1
- package/testing/core/core.cjs +2 -2
- package/testing/core/core.cjs.map +1 -1
- package/testing/core/core.cjs.native.js +2 -2
- package/testing/core/mocking/mockLink.js +2 -2
- package/testing/react/MockedProvider.d.ts +27 -1
- package/testing/react/MockedProvider.js +16 -10
- package/testing/react/MockedProvider.js.map +1 -1
- package/testing/testing.cjs +42 -11
- package/testing/testing.cjs.map +1 -1
- package/testing/testing.cjs.native.js +42 -11
- package/utilities/deprecation/index.d.ts +11 -0
- package/utilities/deprecation/index.js +28 -0
- package/utilities/deprecation/index.js.map +1 -0
- 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 +7 -7
- 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 +22 -22
- package/utilities/utilities.cjs.map +1 -1
- package/utilities/utilities.cjs.native.js +22 -22
- package/version.js +1 -1
|
@@ -22,7 +22,7 @@ function shouldInclude(_a, variables) {
|
|
|
22
22
|
if (ifArgument.value.kind === "Variable") {
|
|
23
23
|
evaledValue =
|
|
24
24
|
variables && variables[ifArgument.value.name.value];
|
|
25
|
-
globals.invariant(evaledValue !== void 0,
|
|
25
|
+
globals.invariant(evaledValue !== void 0, 93, directive.name.value);
|
|
26
26
|
}
|
|
27
27
|
else {
|
|
28
28
|
evaledValue = ifArgument.value.value;
|
|
@@ -72,12 +72,12 @@ function getInclusionDirectives(directives) {
|
|
|
72
72
|
return;
|
|
73
73
|
var directiveArguments = directive.arguments;
|
|
74
74
|
var directiveName = directive.name.value;
|
|
75
|
-
globals.invariant(directiveArguments && directiveArguments.length === 1,
|
|
75
|
+
globals.invariant(directiveArguments && directiveArguments.length === 1, 94, directiveName);
|
|
76
76
|
var ifArgument = directiveArguments[0];
|
|
77
|
-
globals.invariant(ifArgument.name && ifArgument.name.value === "if",
|
|
77
|
+
globals.invariant(ifArgument.name && ifArgument.name.value === "if", 95, directiveName);
|
|
78
78
|
var ifValue = ifArgument.value;
|
|
79
79
|
globals.invariant(ifValue &&
|
|
80
|
-
(ifValue.kind === "Variable" || ifValue.kind === "BooleanValue"),
|
|
80
|
+
(ifValue.kind === "Variable" || ifValue.kind === "BooleanValue"), 96, directiveName);
|
|
81
81
|
result.push({ directive: directive, ifArgument: ifArgument });
|
|
82
82
|
});
|
|
83
83
|
}
|
|
@@ -99,13 +99,13 @@ function getFragmentMaskMode(fragment) {
|
|
|
99
99
|
if (globalThis.__DEV__ !== false) {
|
|
100
100
|
if (modeArg) {
|
|
101
101
|
if (modeArg.value.kind === graphql.Kind.VARIABLE) {
|
|
102
|
-
globalThis.__DEV__ !== false && globals.invariant.warn(
|
|
102
|
+
globalThis.__DEV__ !== false && globals.invariant.warn(97);
|
|
103
103
|
}
|
|
104
104
|
else if (modeArg.value.kind !== graphql.Kind.STRING) {
|
|
105
|
-
globalThis.__DEV__ !== false && globals.invariant.warn(
|
|
105
|
+
globalThis.__DEV__ !== false && globals.invariant.warn(98);
|
|
106
106
|
}
|
|
107
107
|
else if (modeArg.value.value !== "migrate") {
|
|
108
|
-
globalThis.__DEV__ !== false && globals.invariant.warn(
|
|
108
|
+
globalThis.__DEV__ !== false && globals.invariant.warn(99, modeArg.value.value);
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
}
|
|
@@ -144,7 +144,7 @@ function getFragmentQueryDocument(document, fragmentName) {
|
|
|
144
144
|
document.definitions.forEach(function (definition) {
|
|
145
145
|
if (definition.kind === "OperationDefinition") {
|
|
146
146
|
throw globals.newInvariantError(
|
|
147
|
-
|
|
147
|
+
100,
|
|
148
148
|
definition.operation,
|
|
149
149
|
definition.name ? " named '".concat(definition.name.value, "'") : ""
|
|
150
150
|
);
|
|
@@ -154,7 +154,7 @@ function getFragmentQueryDocument(document, fragmentName) {
|
|
|
154
154
|
}
|
|
155
155
|
});
|
|
156
156
|
if (typeof actualFragmentName === "undefined") {
|
|
157
|
-
globals.invariant(fragments.length === 1,
|
|
157
|
+
globals.invariant(fragments.length === 1, 101, fragments.length);
|
|
158
158
|
actualFragmentName = fragments[0].name.value;
|
|
159
159
|
}
|
|
160
160
|
var query = tslib.__assign(tslib.__assign({}, document), { definitions: tslib.__spreadArray([
|
|
@@ -195,7 +195,7 @@ function getFragmentFromSelection(selection, fragmentMap) {
|
|
|
195
195
|
return fragmentMap(fragmentName);
|
|
196
196
|
}
|
|
197
197
|
var fragment = fragmentMap && fragmentMap[fragmentName];
|
|
198
|
-
globals.invariant(fragment,
|
|
198
|
+
globals.invariant(fragment, 102, fragmentName);
|
|
199
199
|
return fragment || null;
|
|
200
200
|
}
|
|
201
201
|
default:
|
|
@@ -368,7 +368,7 @@ function valueToObjectRepresentation(argObj, name, value, variables) {
|
|
|
368
368
|
argObj[name.value] = null;
|
|
369
369
|
}
|
|
370
370
|
else {
|
|
371
|
-
throw globals.newInvariantError(
|
|
371
|
+
throw globals.newInvariantError(111, name.value, value.kind);
|
|
372
372
|
}
|
|
373
373
|
}
|
|
374
374
|
function storeKeyNameFromField(field, variables) {
|
|
@@ -502,16 +502,16 @@ function isInlineFragment(selection) {
|
|
|
502
502
|
}
|
|
503
503
|
|
|
504
504
|
function checkDocument(doc) {
|
|
505
|
-
globals.invariant(doc && doc.kind === "Document",
|
|
505
|
+
globals.invariant(doc && doc.kind === "Document", 103);
|
|
506
506
|
var operations = doc.definitions
|
|
507
507
|
.filter(function (d) { return d.kind !== "FragmentDefinition"; })
|
|
508
508
|
.map(function (definition) {
|
|
509
509
|
if (definition.kind !== "OperationDefinition") {
|
|
510
|
-
throw globals.newInvariantError(
|
|
510
|
+
throw globals.newInvariantError(104, definition.kind);
|
|
511
511
|
}
|
|
512
512
|
return definition;
|
|
513
513
|
});
|
|
514
|
-
globals.invariant(operations.length <= 1,
|
|
514
|
+
globals.invariant(operations.length <= 1, 105, operations.length);
|
|
515
515
|
return doc;
|
|
516
516
|
}
|
|
517
517
|
function getOperationDefinition(doc) {
|
|
@@ -534,14 +534,14 @@ function getFragmentDefinitions(doc) {
|
|
|
534
534
|
}
|
|
535
535
|
function getQueryDefinition(doc) {
|
|
536
536
|
var queryDef = getOperationDefinition(doc);
|
|
537
|
-
globals.invariant(queryDef && queryDef.operation === "query",
|
|
537
|
+
globals.invariant(queryDef && queryDef.operation === "query", 106);
|
|
538
538
|
return queryDef;
|
|
539
539
|
}
|
|
540
540
|
function getFragmentDefinition(doc) {
|
|
541
|
-
globals.invariant(doc.kind === "Document",
|
|
542
|
-
globals.invariant(doc.definitions.length <= 1,
|
|
541
|
+
globals.invariant(doc.kind === "Document", 107);
|
|
542
|
+
globals.invariant(doc.definitions.length <= 1, 108);
|
|
543
543
|
var fragmentDef = doc.definitions[0];
|
|
544
|
-
globals.invariant(fragmentDef.kind === "FragmentDefinition",
|
|
544
|
+
globals.invariant(fragmentDef.kind === "FragmentDefinition", 109);
|
|
545
545
|
return fragmentDef;
|
|
546
546
|
}
|
|
547
547
|
function getMainDefinition(queryDoc) {
|
|
@@ -564,7 +564,7 @@ function getMainDefinition(queryDoc) {
|
|
|
564
564
|
if (fragmentDefinition) {
|
|
565
565
|
return fragmentDefinition;
|
|
566
566
|
}
|
|
567
|
-
throw globals.newInvariantError(
|
|
567
|
+
throw globals.newInvariantError(110);
|
|
568
568
|
}
|
|
569
569
|
function getDefaultValues(definition) {
|
|
570
570
|
var defaultValues = Object.create(null);
|
|
@@ -615,7 +615,7 @@ var DocumentTransform = (function () {
|
|
|
615
615
|
makeCacheKey: function (document) {
|
|
616
616
|
var cacheKeys = _this.getCacheKey(document);
|
|
617
617
|
if (cacheKeys) {
|
|
618
|
-
globals.invariant(Array.isArray(cacheKeys),
|
|
618
|
+
globals.invariant(Array.isArray(cacheKeys), 92);
|
|
619
619
|
return stableCacheKeys_1.lookupArray(cacheKeys);
|
|
620
620
|
}
|
|
621
621
|
},
|
|
@@ -745,7 +745,7 @@ function removeDirectivesFromDocument(directives, doc) {
|
|
|
745
745
|
return getInUseByFragmentName(ancestor.name.value);
|
|
746
746
|
}
|
|
747
747
|
}
|
|
748
|
-
globalThis.__DEV__ !== false && globals.invariant.error(
|
|
748
|
+
globalThis.__DEV__ !== false && globals.invariant.error(112);
|
|
749
749
|
return null;
|
|
750
750
|
};
|
|
751
751
|
var operationCount = 0;
|
|
@@ -935,7 +935,7 @@ var connectionRemoveConfig = {
|
|
|
935
935
|
if (willRemove) {
|
|
936
936
|
if (!directive.arguments ||
|
|
937
937
|
!directive.arguments.some(function (arg) { return arg.name.value === "key"; })) {
|
|
938
|
-
globalThis.__DEV__ !== false && globals.invariant.warn(
|
|
938
|
+
globalThis.__DEV__ !== false && globals.invariant.warn(113);
|
|
939
939
|
}
|
|
940
940
|
}
|
|
941
941
|
return willRemove;
|
package/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export var version = "3.
|
|
1
|
+
export var version = "3.14.0-alpha.0";
|
|
2
2
|
//# sourceMappingURL=version.js.map
|