@apollo/client 3.14.0-alpha.0 → 3.14.0-alpha.1
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/breezy-lions-rule.md +5 -0
- package/.changeset/great-jobs-fetch.md +5 -0
- package/.changeset/pre.json +4 -1
- package/.changeset/tidy-bulldogs-exercise.md +5 -0
- package/CHANGELOG.md +10 -0
- package/apollo-client.cjs +187 -119
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/cache/cache.cjs +7 -2
- package/cache/cache.cjs.map +1 -1
- package/cache/cache.cjs.native.js +7 -2
- package/cache/inmemory/inMemoryCache.d.ts +8 -0
- package/cache/inmemory/inMemoryCache.js +3 -0
- package/cache/inmemory/inMemoryCache.js.map +1 -1
- package/core/ApolloClient.d.ts +9 -9
- package/core/ApolloClient.js +6 -1
- package/core/ApolloClient.js.map +1 -1
- package/core/LocalState.js +2 -2
- package/core/ObservableQuery.d.ts +51 -6
- package/core/ObservableQuery.js +89 -13
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryInfo.js +6 -3
- package/core/QueryInfo.js.map +1 -1
- package/core/QueryManager.js +14 -12
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs +85 -33
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +85 -33
- package/core/types.d.ts +177 -3
- package/core/types.js.map +1 -1
- package/core/watchQueryOptions.d.ts +10 -2
- package/core/watchQueryOptions.js.map +1 -1
- package/dev/dev.cjs +149 -97
- package/dev/dev.cjs.map +1 -1
- package/dev/dev.cjs.native.js +149 -97
- package/errors/errors.cjs.map +1 -1
- package/errors/index.d.ts +19 -0
- package/errors/index.js +19 -0
- package/errors/index.js.map +1 -1
- package/invariantErrorCodes.js +161 -96
- package/link/batch-http/batch-http.cjs +9 -0
- package/link/batch-http/batch-http.cjs.map +1 -1
- package/link/batch-http/batch-http.cjs.native.js +9 -0
- package/link/batch-http/batchHttpLink.js +9 -0
- package/link/batch-http/batchHttpLink.js.map +1 -1
- package/link/core/ApolloLink.d.ts +8 -0
- package/link/core/ApolloLink.js +19 -2
- package/link/core/ApolloLink.js.map +1 -1
- package/link/core/core.cjs +24 -2
- package/link/core/core.cjs.map +1 -1
- package/link/core/core.cjs.native.js +24 -2
- package/link/core/types.d.ts +20 -0
- package/link/core/types.js.map +1 -1
- package/link/error/index.d.ts +48 -0
- package/link/error/index.js.map +1 -1
- package/link/http/checkFetcher.js +1 -1
- package/link/http/createHttpLink.js +4 -1
- package/link/http/createHttpLink.js.map +1 -1
- package/link/http/http.cjs +6 -3
- package/link/http/http.cjs.map +1 -1
- package/link/http/http.cjs.native.js +6 -3
- package/link/http/serializeFetchParameter.js +1 -1
- package/link/persisted-queries/index.d.ts +38 -0
- package/link/persisted-queries/index.js +2 -2
- package/link/persisted-queries/index.js.map +1 -1
- 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/fromError.d.ts +16 -0
- package/link/utils/fromError.js +16 -0
- package/link/utils/fromError.js.map +1 -1
- package/link/utils/fromPromise.d.ts +16 -0
- package/link/utils/fromPromise.js +16 -0
- package/link/utils/fromPromise.js.map +1 -1
- package/link/utils/throwServerError.d.ts +30 -0
- package/link/utils/throwServerError.js +17 -0
- package/link/utils/throwServerError.js.map +1 -1
- package/link/utils/toPromise.d.ts +16 -0
- package/link/utils/toPromise.js +17 -1
- package/link/utils/toPromise.js.map +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/masking/utils.js.map +1 -1
- package/package.json +1 -1
- package/react/components/Mutation.js +1 -1
- package/react/components/Query.js +1 -1
- package/react/components/Subscription.js +1 -1
- package/react/components/components.cjs +6 -4
- package/react/components/components.cjs.map +1 -1
- package/react/components/components.cjs.native.js +6 -4
- package/react/context/ApolloConsumer.js +1 -1
- package/react/context/ApolloContext.js +2 -2
- package/react/context/ApolloProvider.js +1 -1
- package/react/context/context.cjs +4 -4
- package/react/context/context.cjs.map +1 -1
- package/react/context/context.cjs.native.js +4 -4
- package/react/hoc/graphql.js +1 -1
- package/react/hoc/hoc-utils.js +1 -1
- package/react/hoc/hoc.cjs +9 -7
- package/react/hoc/hoc.cjs.map +1 -1
- package/react/hoc/hoc.cjs.native.js +9 -7
- package/react/hoc/mutation-hoc.js +1 -1
- package/react/hoc/query-hoc.js +1 -1
- package/react/hoc/subscription-hoc.js +1 -1
- package/react/hoc/withApollo.js +1 -1
- package/react/hooks/hooks.cjs +18 -16
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +18 -16
- package/react/hooks/internal/useWarnRemoved.d.ts +2 -1
- package/react/hooks/internal/useWarnRemoved.js.map +1 -1
- package/react/hooks/internal/useWarnRemovedOption.js +1 -1
- package/react/hooks/useApolloClient.js +1 -1
- package/react/hooks/useLazyQuery.js +2 -2
- package/react/hooks/useLoadableQuery.js +2 -2
- package/react/hooks/useQuery.js +1 -1
- package/react/hooks/useSubscription.js +3 -3
- package/react/hooks/useSuspenseQuery.js +2 -2
- package/react/hooks/useSyncExternalStore.js +1 -1
- package/react/internal/cache/QueryReference.d.ts +1 -0
- package/react/internal/cache/QueryReference.js +5 -2
- package/react/internal/cache/QueryReference.js.map +1 -1
- package/react/internal/internal.cjs +16 -3
- package/react/internal/internal.cjs.map +1 -1
- package/react/internal/internal.cjs.native.js +16 -3
- package/react/parser/index.js +6 -6
- package/react/parser/parser.cjs +9 -7
- package/react/parser/parser.cjs.map +1 -1
- package/react/parser/parser.cjs.native.js +9 -7
- package/react/react.cjs +4 -2
- package/react/react.cjs.map +1 -1
- package/react/react.cjs.native.js +4 -2
- package/react/types/types.d.ts +40 -0
- package/react/types/types.documentation.d.ts +1 -1
- package/react/types/types.documentation.js.map +1 -1
- package/react/types/types.js.map +1 -1
- package/testing/core/core.cjs +17 -3
- package/testing/core/core.cjs.map +1 -1
- package/testing/core/core.cjs.native.js +17 -3
- package/testing/core/itAsync.d.ts +5 -0
- package/testing/core/itAsync.js +5 -0
- package/testing/core/itAsync.js.map +1 -1
- package/testing/core/mocking/mockClient.d.ts +4 -0
- package/testing/core/mocking/mockClient.js +4 -0
- package/testing/core/mocking/mockClient.js.map +1 -1
- package/testing/core/mocking/mockLink.d.ts +10 -0
- package/testing/core/mocking/mockLink.js +23 -4
- package/testing/core/mocking/mockLink.js.map +1 -1
- package/testing/core/mocking/mockSubscriptionLink.d.ts +4 -0
- package/testing/core/mocking/mockSubscriptionLink.js +4 -0
- package/testing/core/mocking/mockSubscriptionLink.js.map +1 -1
- package/testing/core/subscribeAndCount.d.ts +4 -0
- package/testing/core/subscribeAndCount.js +4 -0
- package/testing/core/subscribeAndCount.js.map +1 -1
- package/testing/experimental/createSchemaFetch.d.ts +1 -1
- package/testing/experimental/createSchemaFetch.js +1 -1
- package/testing/experimental/createSchemaFetch.js.map +1 -1
- package/testing/experimental/createTestSchema.d.ts +1 -1
- package/testing/experimental/createTestSchema.js +1 -1
- package/testing/experimental/createTestSchema.js.map +1 -1
- package/testing/experimental/experimental.cjs.map +1 -1
- package/testing/testing.cjs +4 -2
- package/testing/testing.cjs.map +1 -1
- package/testing/testing.cjs.native.js +4 -2
- package/utilities/deprecation/index.d.ts +83 -3
- package/utilities/deprecation/index.js +15 -3
- package/utilities/deprecation/index.js.map +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 +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/observables/asyncMap.d.ts +13 -0
- package/utilities/observables/asyncMap.js +13 -0
- package/utilities/observables/asyncMap.js.map +1 -1
- package/utilities/observables/iteration.d.ts +4 -0
- package/utilities/observables/iteration.js +4 -0
- package/utilities/observables/iteration.js.map +1 -1
- package/utilities/subscriptions/urql/index.d.ts +5 -0
- package/utilities/subscriptions/urql/index.js +5 -0
- package/utilities/subscriptions/urql/index.js.map +1 -1
- package/utilities/subscriptions/urql/urql.cjs.map +1 -1
- 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
package/apollo-client.cjs
CHANGED
|
@@ -31,7 +31,7 @@ function _interopNamespace(e) {
|
|
|
31
31
|
var equal__default = /*#__PURE__*/_interopDefaultLegacy(equal);
|
|
32
32
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
33
33
|
|
|
34
|
-
var version = "3.14.0-alpha.
|
|
34
|
+
var version = "3.14.0-alpha.1";
|
|
35
35
|
|
|
36
36
|
function maybe(thunk) {
|
|
37
37
|
try {
|
|
@@ -40,7 +40,7 @@ function maybe(thunk) {
|
|
|
40
40
|
catch (_a) { }
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
var
|
|
43
|
+
var untypedGlobal = (maybe(function () { return globalThis; }) ||
|
|
44
44
|
maybe(function () { return window; }) ||
|
|
45
45
|
maybe(function () { return self; }) ||
|
|
46
46
|
maybe(function () { return global; }) ||
|
|
@@ -120,8 +120,8 @@ function getHandledErrorMsg(message, messageArgs) {
|
|
|
120
120
|
if (messageArgs === void 0) { messageArgs = []; }
|
|
121
121
|
if (!message)
|
|
122
122
|
return;
|
|
123
|
-
return (
|
|
124
|
-
|
|
123
|
+
return (untypedGlobal[ApolloErrorMessageHandler] &&
|
|
124
|
+
untypedGlobal[ApolloErrorMessageHandler](message, messageArgs.map(stringify)));
|
|
125
125
|
}
|
|
126
126
|
function getFallbackErrorMsg(message, messageArgs) {
|
|
127
127
|
if (messageArgs === void 0) { messageArgs = []; }
|
|
@@ -145,7 +145,7 @@ function shouldInclude(_a, variables) {
|
|
|
145
145
|
if (ifArgument.value.kind === "Variable") {
|
|
146
146
|
evaledValue =
|
|
147
147
|
variables && variables[ifArgument.value.name.value];
|
|
148
|
-
invariant(evaledValue !== void 0,
|
|
148
|
+
invariant(evaledValue !== void 0, 106, directive.name.value);
|
|
149
149
|
}
|
|
150
150
|
else {
|
|
151
151
|
evaledValue = ifArgument.value.value;
|
|
@@ -180,12 +180,12 @@ function getInclusionDirectives(directives) {
|
|
|
180
180
|
return;
|
|
181
181
|
var directiveArguments = directive.arguments;
|
|
182
182
|
var directiveName = directive.name.value;
|
|
183
|
-
invariant(directiveArguments && directiveArguments.length === 1,
|
|
183
|
+
invariant(directiveArguments && directiveArguments.length === 1, 107, directiveName);
|
|
184
184
|
var ifArgument = directiveArguments[0];
|
|
185
|
-
invariant(ifArgument.name && ifArgument.name.value === "if",
|
|
185
|
+
invariant(ifArgument.name && ifArgument.name.value === "if", 108, directiveName);
|
|
186
186
|
var ifValue = ifArgument.value;
|
|
187
187
|
invariant(ifValue &&
|
|
188
|
-
(ifValue.kind === "Variable" || ifValue.kind === "BooleanValue"),
|
|
188
|
+
(ifValue.kind === "Variable" || ifValue.kind === "BooleanValue"), 109, directiveName);
|
|
189
189
|
result.push({ directive: directive, ifArgument: ifArgument });
|
|
190
190
|
});
|
|
191
191
|
}
|
|
@@ -207,13 +207,13 @@ function getFragmentMaskMode(fragment) {
|
|
|
207
207
|
if (globalThis.__DEV__ !== false) {
|
|
208
208
|
if (modeArg) {
|
|
209
209
|
if (modeArg.value.kind === graphql.Kind.VARIABLE) {
|
|
210
|
-
globalThis.__DEV__ !== false && invariant.warn(
|
|
210
|
+
globalThis.__DEV__ !== false && invariant.warn(110);
|
|
211
211
|
}
|
|
212
212
|
else if (modeArg.value.kind !== graphql.Kind.STRING) {
|
|
213
|
-
globalThis.__DEV__ !== false && invariant.warn(
|
|
213
|
+
globalThis.__DEV__ !== false && invariant.warn(111);
|
|
214
214
|
}
|
|
215
215
|
else if (modeArg.value.value !== "migrate") {
|
|
216
|
-
globalThis.__DEV__ !== false && invariant.warn(
|
|
216
|
+
globalThis.__DEV__ !== false && invariant.warn(112, modeArg.value.value);
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
219
|
}
|
|
@@ -246,7 +246,7 @@ function getFragmentQueryDocument(document, fragmentName) {
|
|
|
246
246
|
document.definitions.forEach(function (definition) {
|
|
247
247
|
if (definition.kind === "OperationDefinition") {
|
|
248
248
|
throw newInvariantError(
|
|
249
|
-
|
|
249
|
+
113,
|
|
250
250
|
definition.operation,
|
|
251
251
|
definition.name ? " named '".concat(definition.name.value, "'") : ""
|
|
252
252
|
);
|
|
@@ -256,7 +256,7 @@ function getFragmentQueryDocument(document, fragmentName) {
|
|
|
256
256
|
}
|
|
257
257
|
});
|
|
258
258
|
if (typeof actualFragmentName === "undefined") {
|
|
259
|
-
invariant(fragments.length === 1,
|
|
259
|
+
invariant(fragments.length === 1, 114, fragments.length);
|
|
260
260
|
actualFragmentName = fragments[0].name.value;
|
|
261
261
|
}
|
|
262
262
|
var query = tslib.__assign(tslib.__assign({}, document), { definitions: tslib.__spreadArray([
|
|
@@ -297,7 +297,7 @@ function getFragmentFromSelection(selection, fragmentMap) {
|
|
|
297
297
|
return fragmentMap(fragmentName);
|
|
298
298
|
}
|
|
299
299
|
var fragment = fragmentMap && fragmentMap[fragmentName];
|
|
300
|
-
invariant(fragment,
|
|
300
|
+
invariant(fragment, 115, fragmentName);
|
|
301
301
|
return fragment || null;
|
|
302
302
|
}
|
|
303
303
|
default:
|
|
@@ -352,7 +352,7 @@ var AutoCleanedStrongCache = function (max, dispose) {
|
|
|
352
352
|
};
|
|
353
353
|
|
|
354
354
|
var cacheSizeSymbol = Symbol.for("apollo.cacheSize");
|
|
355
|
-
var cacheSizes = tslib.__assign({},
|
|
355
|
+
var cacheSizes = tslib.__assign({}, untypedGlobal[cacheSizeSymbol]);
|
|
356
356
|
|
|
357
357
|
var globalCaches = {};
|
|
358
358
|
function registerGlobalCache(name, getSize) {
|
|
@@ -562,7 +562,7 @@ function valueToObjectRepresentation(argObj, name, value, variables) {
|
|
|
562
562
|
argObj[name.value] = null;
|
|
563
563
|
}
|
|
564
564
|
else {
|
|
565
|
-
throw newInvariantError(
|
|
565
|
+
throw newInvariantError(124, name.value, value.kind);
|
|
566
566
|
}
|
|
567
567
|
}
|
|
568
568
|
function storeKeyNameFromField(field, variables) {
|
|
@@ -696,16 +696,16 @@ function isInlineFragment(selection) {
|
|
|
696
696
|
}
|
|
697
697
|
|
|
698
698
|
function checkDocument(doc) {
|
|
699
|
-
invariant(doc && doc.kind === "Document",
|
|
699
|
+
invariant(doc && doc.kind === "Document", 116);
|
|
700
700
|
var operations = doc.definitions
|
|
701
701
|
.filter(function (d) { return d.kind !== "FragmentDefinition"; })
|
|
702
702
|
.map(function (definition) {
|
|
703
703
|
if (definition.kind !== "OperationDefinition") {
|
|
704
|
-
throw newInvariantError(
|
|
704
|
+
throw newInvariantError(117, definition.kind);
|
|
705
705
|
}
|
|
706
706
|
return definition;
|
|
707
707
|
});
|
|
708
|
-
invariant(operations.length <= 1,
|
|
708
|
+
invariant(operations.length <= 1, 118, operations.length);
|
|
709
709
|
return doc;
|
|
710
710
|
}
|
|
711
711
|
function getOperationDefinition(doc) {
|
|
@@ -728,14 +728,14 @@ function getFragmentDefinitions(doc) {
|
|
|
728
728
|
}
|
|
729
729
|
function getQueryDefinition(doc) {
|
|
730
730
|
var queryDef = getOperationDefinition(doc);
|
|
731
|
-
invariant(queryDef && queryDef.operation === "query",
|
|
731
|
+
invariant(queryDef && queryDef.operation === "query", 119);
|
|
732
732
|
return queryDef;
|
|
733
733
|
}
|
|
734
734
|
function getFragmentDefinition(doc) {
|
|
735
|
-
invariant(doc.kind === "Document",
|
|
736
|
-
invariant(doc.definitions.length <= 1,
|
|
735
|
+
invariant(doc.kind === "Document", 120);
|
|
736
|
+
invariant(doc.definitions.length <= 1, 121);
|
|
737
737
|
var fragmentDef = doc.definitions[0];
|
|
738
|
-
invariant(fragmentDef.kind === "FragmentDefinition",
|
|
738
|
+
invariant(fragmentDef.kind === "FragmentDefinition", 122);
|
|
739
739
|
return fragmentDef;
|
|
740
740
|
}
|
|
741
741
|
function getMainDefinition(queryDoc) {
|
|
@@ -758,7 +758,7 @@ function getMainDefinition(queryDoc) {
|
|
|
758
758
|
if (fragmentDefinition) {
|
|
759
759
|
return fragmentDefinition;
|
|
760
760
|
}
|
|
761
|
-
throw newInvariantError(
|
|
761
|
+
throw newInvariantError(123);
|
|
762
762
|
}
|
|
763
763
|
function getDefaultValues(definition) {
|
|
764
764
|
var defaultValues = Object.create(null);
|
|
@@ -809,7 +809,7 @@ var DocumentTransform = (function () {
|
|
|
809
809
|
makeCacheKey: function (document) {
|
|
810
810
|
var cacheKeys = _this.getCacheKey(document);
|
|
811
811
|
if (cacheKeys) {
|
|
812
|
-
invariant(Array.isArray(cacheKeys),
|
|
812
|
+
invariant(Array.isArray(cacheKeys), 105);
|
|
813
813
|
return stableCacheKeys_1.lookupArray(cacheKeys);
|
|
814
814
|
}
|
|
815
815
|
},
|
|
@@ -939,7 +939,7 @@ function removeDirectivesFromDocument(directives, doc) {
|
|
|
939
939
|
return getInUseByFragmentName(ancestor.name.value);
|
|
940
940
|
}
|
|
941
941
|
}
|
|
942
|
-
globalThis.__DEV__ !== false && invariant.error(
|
|
942
|
+
globalThis.__DEV__ !== false && invariant.error(125);
|
|
943
943
|
return null;
|
|
944
944
|
};
|
|
945
945
|
var operationCount = 0;
|
|
@@ -1615,7 +1615,7 @@ function toPromise(observable) {
|
|
|
1615
1615
|
observable.subscribe({
|
|
1616
1616
|
next: function (data) {
|
|
1617
1617
|
if (completed) {
|
|
1618
|
-
globalThis.__DEV__ !== false && invariant.warn(
|
|
1618
|
+
globalThis.__DEV__ !== false && invariant.warn(57);
|
|
1619
1619
|
}
|
|
1620
1620
|
else {
|
|
1621
1621
|
completed = true;
|
|
@@ -1658,7 +1658,7 @@ function validateOperation(operation) {
|
|
|
1658
1658
|
for (var _i = 0, _a = Object.keys(operation); _i < _a.length; _i++) {
|
|
1659
1659
|
var key = _a[_i];
|
|
1660
1660
|
if (OPERATION_FIELDS.indexOf(key) < 0) {
|
|
1661
|
-
throw newInvariantError(
|
|
1661
|
+
throw newInvariantError(58, key);
|
|
1662
1662
|
}
|
|
1663
1663
|
}
|
|
1664
1664
|
return operation;
|
|
@@ -1719,6 +1719,33 @@ function filterOperationVariables(variables, query) {
|
|
|
1719
1719
|
return result;
|
|
1720
1720
|
}
|
|
1721
1721
|
|
|
1722
|
+
var muteAllDeprecations = Symbol.for("apollo.deprecations");
|
|
1723
|
+
var global$1 = untypedGlobal;
|
|
1724
|
+
var slot = new optimism.Slot();
|
|
1725
|
+
function isMuted(name) {
|
|
1726
|
+
return global$1[muteAllDeprecations] || (slot.getValue() || []).includes(name);
|
|
1727
|
+
}
|
|
1728
|
+
function muteDeprecations(name) {
|
|
1729
|
+
var args = [];
|
|
1730
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
1731
|
+
args[_i - 1] = arguments[_i];
|
|
1732
|
+
}
|
|
1733
|
+
return slot.withValue.apply(slot, tslib.__spreadArray([Array.isArray(name) ? name : [name]], args, false));
|
|
1734
|
+
}
|
|
1735
|
+
function warnRemovedOption(options, name, callSite, recommendation) {
|
|
1736
|
+
if (recommendation === void 0) { recommendation = "Please remove this option."; }
|
|
1737
|
+
warnDeprecated(name, function () {
|
|
1738
|
+
if (name in options) {
|
|
1739
|
+
globalThis.__DEV__ !== false && invariant.warn(104, callSite, name, recommendation);
|
|
1740
|
+
}
|
|
1741
|
+
});
|
|
1742
|
+
}
|
|
1743
|
+
function warnDeprecated(name, cb) {
|
|
1744
|
+
if (!isMuted(name)) {
|
|
1745
|
+
cb();
|
|
1746
|
+
}
|
|
1747
|
+
}
|
|
1748
|
+
|
|
1722
1749
|
function passthrough(op, forward) {
|
|
1723
1750
|
return (forward ? forward(op) : zenObservableTs.Observable.of());
|
|
1724
1751
|
}
|
|
@@ -1767,7 +1794,7 @@ var ApolloLink = (function () {
|
|
|
1767
1794
|
ApolloLink.concat = function (first, second) {
|
|
1768
1795
|
var firstLink = toLink(first);
|
|
1769
1796
|
if (isTerminating(firstLink)) {
|
|
1770
|
-
globalThis.__DEV__ !== false && invariant.warn(
|
|
1797
|
+
globalThis.__DEV__ !== false && invariant.warn(47, firstLink);
|
|
1771
1798
|
return firstLink;
|
|
1772
1799
|
}
|
|
1773
1800
|
var nextLink = toLink(second);
|
|
@@ -1793,9 +1820,14 @@ var ApolloLink = (function () {
|
|
|
1793
1820
|
return ApolloLink.concat(this, next);
|
|
1794
1821
|
};
|
|
1795
1822
|
ApolloLink.prototype.request = function (operation, forward) {
|
|
1796
|
-
throw newInvariantError(
|
|
1823
|
+
throw newInvariantError(48);
|
|
1797
1824
|
};
|
|
1798
1825
|
ApolloLink.prototype.onError = function (error, observer) {
|
|
1826
|
+
if (globalThis.__DEV__ !== false) {
|
|
1827
|
+
warnDeprecated("onError", function () {
|
|
1828
|
+
globalThis.__DEV__ !== false && invariant.warn(49);
|
|
1829
|
+
});
|
|
1830
|
+
}
|
|
1799
1831
|
if (observer && observer.error) {
|
|
1800
1832
|
observer.error(error);
|
|
1801
1833
|
return false;
|
|
@@ -1803,6 +1835,9 @@ var ApolloLink = (function () {
|
|
|
1803
1835
|
throw error;
|
|
1804
1836
|
};
|
|
1805
1837
|
ApolloLink.prototype.setOnError = function (fn) {
|
|
1838
|
+
if (globalThis.__DEV__ !== false) {
|
|
1839
|
+
globalThis.__DEV__ !== false && invariant.warn(50);
|
|
1840
|
+
}
|
|
1806
1841
|
this.onError = fn;
|
|
1807
1842
|
return this;
|
|
1808
1843
|
};
|
|
@@ -2175,7 +2210,7 @@ var serializeFetchParameter = function (p, label) {
|
|
|
2175
2210
|
serialized = JSON.stringify(p);
|
|
2176
2211
|
}
|
|
2177
2212
|
catch (e) {
|
|
2178
|
-
var parseError = newInvariantError(
|
|
2213
|
+
var parseError = newInvariantError(54, label, e.message);
|
|
2179
2214
|
parseError.parseError = e;
|
|
2180
2215
|
throw parseError;
|
|
2181
2216
|
}
|
|
@@ -2261,7 +2296,7 @@ function removeDuplicateHeaders(headers, preserveHeaderCase) {
|
|
|
2261
2296
|
|
|
2262
2297
|
var checkFetcher = function (fetcher) {
|
|
2263
2298
|
if (!fetcher && typeof fetch === "undefined") {
|
|
2264
|
-
throw newInvariantError(
|
|
2299
|
+
throw newInvariantError(51);
|
|
2265
2300
|
}
|
|
2266
2301
|
};
|
|
2267
2302
|
|
|
@@ -2364,6 +2399,9 @@ var createHttpLink = function (linkOptions) {
|
|
|
2364
2399
|
headers: contextHeaders,
|
|
2365
2400
|
};
|
|
2366
2401
|
if (hasDirectives(["client"], operation.query)) {
|
|
2402
|
+
if (globalThis.__DEV__ !== false) {
|
|
2403
|
+
globalThis.__DEV__ !== false && invariant.warn(52);
|
|
2404
|
+
}
|
|
2367
2405
|
var transformedQuery = removeClientSetsFromDocument(operation.query);
|
|
2368
2406
|
if (!transformedQuery) {
|
|
2369
2407
|
return fromError(new Error("HttpLink: Trying to send a client-only query to the server. To send to the server, ensure a non-client field is added to the query or set the `transformOptions.removeClientFields` option to `true`."));
|
|
@@ -2395,7 +2433,7 @@ var createHttpLink = function (linkOptions) {
|
|
|
2395
2433
|
options.headers = options.headers || {};
|
|
2396
2434
|
var acceptHeader = "multipart/mixed;";
|
|
2397
2435
|
if (isSubscription && hasDefer) {
|
|
2398
|
-
globalThis.__DEV__ !== false && invariant.warn(
|
|
2436
|
+
globalThis.__DEV__ !== false && invariant.warn(53);
|
|
2399
2437
|
}
|
|
2400
2438
|
if (isSubscription) {
|
|
2401
2439
|
acceptHeader +=
|
|
@@ -2536,7 +2574,7 @@ var issuedWarning = false;
|
|
|
2536
2574
|
function warnOnImproperCacheImplementation() {
|
|
2537
2575
|
if (!issuedWarning) {
|
|
2538
2576
|
issuedWarning = true;
|
|
2539
|
-
globalThis.__DEV__ !== false && invariant.warn(
|
|
2577
|
+
globalThis.__DEV__ !== false && invariant.warn(64);
|
|
2540
2578
|
}
|
|
2541
2579
|
}
|
|
2542
2580
|
|
|
@@ -2620,7 +2658,7 @@ function maskSelectionSet(data, selectionSet, context, migration, path) {
|
|
|
2620
2658
|
var fragment = context.fragmentMap[fragmentName] ||
|
|
2621
2659
|
(context.fragmentMap[fragmentName] =
|
|
2622
2660
|
context.cache.lookupFragment(fragmentName));
|
|
2623
|
-
invariant(fragment,
|
|
2661
|
+
invariant(fragment, 59, fragmentName);
|
|
2624
2662
|
var mode = getFragmentMaskMode(selection);
|
|
2625
2663
|
if (mode !== "mask") {
|
|
2626
2664
|
value = maskSelectionSet(data, fragment.selectionSet, context, mode === "migrate", path);
|
|
@@ -2643,7 +2681,7 @@ function getAccessorWarningDescriptor(fieldName, value, path, operationName, ope
|
|
|
2643
2681
|
if (disableWarningsSlot.getValue()) {
|
|
2644
2682
|
return value;
|
|
2645
2683
|
}
|
|
2646
|
-
globalThis.__DEV__ !== false && invariant.warn(
|
|
2684
|
+
globalThis.__DEV__ !== false && invariant.warn(60, operationName ?
|
|
2647
2685
|
"".concat(operationType, " '").concat(operationName, "'")
|
|
2648
2686
|
: "anonymous ".concat(operationType), "".concat(path, ".").concat(fieldName).replace(/^\./, ""));
|
|
2649
2687
|
getValue = function () { return value; };
|
|
@@ -2672,11 +2710,11 @@ function maskFragment(data, document, cache, fragmentName) {
|
|
|
2672
2710
|
return node.kind === graphql.Kind.FRAGMENT_DEFINITION;
|
|
2673
2711
|
});
|
|
2674
2712
|
if (typeof fragmentName === "undefined") {
|
|
2675
|
-
invariant(fragments.length === 1,
|
|
2713
|
+
invariant(fragments.length === 1, 61, fragments.length);
|
|
2676
2714
|
fragmentName = fragments[0].name.value;
|
|
2677
2715
|
}
|
|
2678
2716
|
var fragment = fragments.find(function (fragment) { return fragment.name.value === fragmentName; });
|
|
2679
|
-
invariant(!!fragment,
|
|
2717
|
+
invariant(!!fragment, 62, fragmentName);
|
|
2680
2718
|
if (data == null) {
|
|
2681
2719
|
return data;
|
|
2682
2720
|
}
|
|
@@ -2702,7 +2740,7 @@ function maskOperation(data, document, cache) {
|
|
|
2702
2740
|
return data;
|
|
2703
2741
|
}
|
|
2704
2742
|
var definition = getOperationDefinition(document);
|
|
2705
|
-
invariant(definition,
|
|
2743
|
+
invariant(definition, 63);
|
|
2706
2744
|
if (data == null) {
|
|
2707
2745
|
return data;
|
|
2708
2746
|
}
|
|
@@ -2716,31 +2754,6 @@ function maskOperation(data, document, cache) {
|
|
|
2716
2754
|
});
|
|
2717
2755
|
}
|
|
2718
2756
|
|
|
2719
|
-
var slot = new optimism.Slot();
|
|
2720
|
-
function isMuted(name) {
|
|
2721
|
-
return (slot.getValue() || []).includes(name);
|
|
2722
|
-
}
|
|
2723
|
-
function muteDeprecations(name) {
|
|
2724
|
-
var args = [];
|
|
2725
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
2726
|
-
args[_i - 1] = arguments[_i];
|
|
2727
|
-
}
|
|
2728
|
-
return slot.withValue.apply(slot, tslib.__spreadArray([Array.isArray(name) ? name : [name]], args, false));
|
|
2729
|
-
}
|
|
2730
|
-
function warnRemovedOption(options, name, callSite, recommendation) {
|
|
2731
|
-
if (recommendation === void 0) { recommendation = "Please remove this option."; }
|
|
2732
|
-
warnDeprecated(name, function () {
|
|
2733
|
-
if (name in options) {
|
|
2734
|
-
globalThis.__DEV__ !== false && invariant.warn(91, callSite, name, recommendation);
|
|
2735
|
-
}
|
|
2736
|
-
});
|
|
2737
|
-
}
|
|
2738
|
-
function warnDeprecated(name, cb) {
|
|
2739
|
-
if (!isMuted(name)) {
|
|
2740
|
-
cb();
|
|
2741
|
-
}
|
|
2742
|
-
}
|
|
2743
|
-
|
|
2744
2757
|
var ApolloCache = (function () {
|
|
2745
2758
|
function ApolloCache() {
|
|
2746
2759
|
this.assumeImmutableResults = false;
|
|
@@ -5027,6 +5040,9 @@ var InMemoryCache = (function (_super) {
|
|
|
5027
5040
|
};
|
|
5028
5041
|
};
|
|
5029
5042
|
InMemoryCache.prototype.gc = function (options) {
|
|
5043
|
+
if (globalThis.__DEV__ !== false) {
|
|
5044
|
+
warnRemovedOption(options || {}, "resetResultIdentities", "cache.gc", "First ensure all usages of `canonizeResults` are removed, then remove this option.");
|
|
5045
|
+
}
|
|
5030
5046
|
canonicalStringify.reset();
|
|
5031
5047
|
print.reset();
|
|
5032
5048
|
var ids = this.optimisticData.gc();
|
|
@@ -5295,6 +5311,11 @@ var ObservableQuery = (function (_super) {
|
|
|
5295
5311
|
});
|
|
5296
5312
|
ObservableQuery.prototype.result = function () {
|
|
5297
5313
|
var _this = this;
|
|
5314
|
+
if (globalThis.__DEV__ !== false) {
|
|
5315
|
+
warnDeprecated("observableQuery.result", function () {
|
|
5316
|
+
globalThis.__DEV__ !== false && invariant.warn(23);
|
|
5317
|
+
});
|
|
5318
|
+
}
|
|
5298
5319
|
return new Promise(function (resolve, reject) {
|
|
5299
5320
|
var observer = {
|
|
5300
5321
|
next: function (result) {
|
|
@@ -5316,8 +5337,11 @@ var ObservableQuery = (function (_super) {
|
|
|
5316
5337
|
this.queryInfo.resetDiff();
|
|
5317
5338
|
};
|
|
5318
5339
|
ObservableQuery.prototype.getCurrentFullResult = function (saveAsLastResult) {
|
|
5340
|
+
var _this = this;
|
|
5319
5341
|
if (saveAsLastResult === void 0) { saveAsLastResult = true; }
|
|
5320
|
-
var lastResult =
|
|
5342
|
+
var lastResult = muteDeprecations("getLastResult", function () {
|
|
5343
|
+
return _this.getLastResult(true);
|
|
5344
|
+
});
|
|
5321
5345
|
var networkStatus = this.queryInfo.networkStatus ||
|
|
5322
5346
|
(lastResult && lastResult.networkStatus) ||
|
|
5323
5347
|
exports.NetworkStatus.ready;
|
|
@@ -5392,16 +5416,34 @@ var ObservableQuery = (function (_super) {
|
|
|
5392
5416
|
}
|
|
5393
5417
|
};
|
|
5394
5418
|
ObservableQuery.prototype.getLastResult = function (variablesMustMatch) {
|
|
5419
|
+
if (globalThis.__DEV__ !== false) {
|
|
5420
|
+
warnDeprecated("getLastResult", function () {
|
|
5421
|
+
globalThis.__DEV__ !== false && invariant.warn(24);
|
|
5422
|
+
});
|
|
5423
|
+
}
|
|
5395
5424
|
return this.getLast("result", variablesMustMatch);
|
|
5396
5425
|
};
|
|
5397
5426
|
ObservableQuery.prototype.getLastError = function (variablesMustMatch) {
|
|
5427
|
+
if (globalThis.__DEV__ !== false) {
|
|
5428
|
+
warnDeprecated("getLastError", function () {
|
|
5429
|
+
globalThis.__DEV__ !== false && invariant.warn(25);
|
|
5430
|
+
});
|
|
5431
|
+
}
|
|
5398
5432
|
return this.getLast("error", variablesMustMatch);
|
|
5399
5433
|
};
|
|
5400
5434
|
ObservableQuery.prototype.resetLastResults = function () {
|
|
5435
|
+
if (globalThis.__DEV__ !== false) {
|
|
5436
|
+
warnDeprecated("resetLastResults", function () {
|
|
5437
|
+
globalThis.__DEV__ !== false && invariant.warn(26);
|
|
5438
|
+
});
|
|
5439
|
+
}
|
|
5401
5440
|
delete this.last;
|
|
5402
5441
|
this.isTornDown = false;
|
|
5403
5442
|
};
|
|
5404
5443
|
ObservableQuery.prototype.resetQueryStoreErrors = function () {
|
|
5444
|
+
if (globalThis.__DEV__ !== false) {
|
|
5445
|
+
globalThis.__DEV__ !== false && invariant.warn(27);
|
|
5446
|
+
}
|
|
5405
5447
|
this.queryManager.resetErrors(this.queryId);
|
|
5406
5448
|
};
|
|
5407
5449
|
ObservableQuery.prototype.refetch = function (variables) {
|
|
@@ -5421,7 +5463,7 @@ var ObservableQuery = (function (_super) {
|
|
|
5421
5463
|
var vars = queryDef.variableDefinitions;
|
|
5422
5464
|
if (!vars || !vars.some(function (v) { return v.variable.name.value === "variables"; })) {
|
|
5423
5465
|
globalThis.__DEV__ !== false && invariant.warn(
|
|
5424
|
-
|
|
5466
|
+
28,
|
|
5425
5467
|
variables,
|
|
5426
5468
|
((_a = queryDef.name) === null || _a === void 0 ? void 0 : _a.value) || queryDef
|
|
5427
5469
|
);
|
|
@@ -5453,7 +5495,7 @@ var ObservableQuery = (function (_super) {
|
|
|
5453
5495
|
var updateQuery = fetchMoreOptions === null || fetchMoreOptions === void 0 ? void 0 : fetchMoreOptions.updateQuery;
|
|
5454
5496
|
var isCached = this.options.fetchPolicy !== "no-cache";
|
|
5455
5497
|
if (!isCached) {
|
|
5456
|
-
invariant(updateQuery,
|
|
5498
|
+
invariant(updateQuery, 29);
|
|
5457
5499
|
}
|
|
5458
5500
|
return this.queryManager
|
|
5459
5501
|
.fetchQuery(qid, combinedOptions, exports.NetworkStatus.fetchMore)
|
|
@@ -5530,7 +5572,7 @@ var ObservableQuery = (function (_super) {
|
|
|
5530
5572
|
options.onError(err);
|
|
5531
5573
|
return;
|
|
5532
5574
|
}
|
|
5533
|
-
globalThis.__DEV__ !== false && invariant.error(
|
|
5575
|
+
globalThis.__DEV__ !== false && invariant.error(30, err);
|
|
5534
5576
|
},
|
|
5535
5577
|
});
|
|
5536
5578
|
this.subscriptions.add(subscription);
|
|
@@ -5543,6 +5585,9 @@ var ObservableQuery = (function (_super) {
|
|
|
5543
5585
|
ObservableQuery.prototype.setOptions = function (newOptions) {
|
|
5544
5586
|
if (globalThis.__DEV__ !== false) {
|
|
5545
5587
|
warnRemovedOption(newOptions, "canonizeResults", "setOptions");
|
|
5588
|
+
warnDeprecated("setOptions", function () {
|
|
5589
|
+
globalThis.__DEV__ !== false && invariant.warn(31);
|
|
5590
|
+
});
|
|
5546
5591
|
}
|
|
5547
5592
|
return this.reobserve(newOptions);
|
|
5548
5593
|
};
|
|
@@ -5551,8 +5596,11 @@ var ObservableQuery = (function (_super) {
|
|
|
5551
5596
|
assign(this.options, mergedOptions);
|
|
5552
5597
|
};
|
|
5553
5598
|
ObservableQuery.prototype.setVariables = function (variables) {
|
|
5599
|
+
var _this = this;
|
|
5554
5600
|
if (equal.equal(this.variables, variables)) {
|
|
5555
|
-
return this.observers.size ?
|
|
5601
|
+
return this.observers.size ?
|
|
5602
|
+
muteDeprecations("observableQuery.result", function () { return _this.result(); })
|
|
5603
|
+
: Promise.resolve();
|
|
5556
5604
|
}
|
|
5557
5605
|
this.options.variables = variables;
|
|
5558
5606
|
if (!this.observers.size) {
|
|
@@ -5636,7 +5684,7 @@ var ObservableQuery = (function (_super) {
|
|
|
5636
5684
|
if (pollingInfo && pollingInfo.interval === pollInterval) {
|
|
5637
5685
|
return;
|
|
5638
5686
|
}
|
|
5639
|
-
invariant(pollInterval,
|
|
5687
|
+
invariant(pollInterval, 32);
|
|
5640
5688
|
var info = pollingInfo || (this.pollingInfo = {});
|
|
5641
5689
|
info.interval = pollInterval;
|
|
5642
5690
|
var maybeFetch = function () {
|
|
@@ -5665,8 +5713,11 @@ var ObservableQuery = (function (_super) {
|
|
|
5665
5713
|
poll();
|
|
5666
5714
|
};
|
|
5667
5715
|
ObservableQuery.prototype.updateLastResult = function (newResult, variables) {
|
|
5716
|
+
var _this = this;
|
|
5668
5717
|
if (variables === void 0) { variables = this.variables; }
|
|
5669
|
-
var error =
|
|
5718
|
+
var error = muteDeprecations("getLastError", function () {
|
|
5719
|
+
return _this.getLastError();
|
|
5720
|
+
});
|
|
5670
5721
|
if (error && this.last && !equal.equal(variables, this.last.variables)) {
|
|
5671
5722
|
error = void 0;
|
|
5672
5723
|
}
|
|
@@ -5742,12 +5793,13 @@ var ObservableQuery = (function (_super) {
|
|
|
5742
5793
|
return preventUnhandledRejection(this.reobserveAsConcast(newOptions, newNetworkStatus).promise.then(this.maskResult));
|
|
5743
5794
|
};
|
|
5744
5795
|
ObservableQuery.prototype.resubscribeAfterError = function () {
|
|
5796
|
+
var _this = this;
|
|
5745
5797
|
var args = [];
|
|
5746
5798
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
5747
5799
|
args[_i] = arguments[_i];
|
|
5748
5800
|
}
|
|
5749
5801
|
var last = this.last;
|
|
5750
|
-
|
|
5802
|
+
muteDeprecations("resetLastResults", function () { return _this.resetLastResults(); });
|
|
5751
5803
|
var subscription = this.subscribe.apply(this, args);
|
|
5752
5804
|
this.last = last;
|
|
5753
5805
|
return subscription;
|
|
@@ -5757,7 +5809,10 @@ var ObservableQuery = (function (_super) {
|
|
|
5757
5809
|
this.getCurrentFullResult(false), this.variables);
|
|
5758
5810
|
};
|
|
5759
5811
|
ObservableQuery.prototype.reportResult = function (result, variables) {
|
|
5760
|
-
var
|
|
5812
|
+
var _this = this;
|
|
5813
|
+
var lastError = muteDeprecations("getLastError", function () {
|
|
5814
|
+
return _this.getLastError();
|
|
5815
|
+
});
|
|
5761
5816
|
var isDifferent = this.isDifferentFromLastResult(result, variables);
|
|
5762
5817
|
if (lastError || !result.partial || this.options.returnPartialData) {
|
|
5763
5818
|
this.updateLastResult(result, variables);
|
|
@@ -5767,7 +5822,8 @@ var ObservableQuery = (function (_super) {
|
|
|
5767
5822
|
}
|
|
5768
5823
|
};
|
|
5769
5824
|
ObservableQuery.prototype.reportError = function (error, variables) {
|
|
5770
|
-
var
|
|
5825
|
+
var _this = this;
|
|
5826
|
+
var errorResult = tslib.__assign(tslib.__assign({}, muteDeprecations("getLastResult", function () { return _this.getLastResult(); })), { error: error, errors: error.graphQLErrors, networkStatus: exports.NetworkStatus.error, loading: false });
|
|
5771
5827
|
this.updateLastResult(errorResult, variables);
|
|
5772
5828
|
iterateObserversSafely(this.observers, "error", (this.last.error = error));
|
|
5773
5829
|
};
|
|
@@ -5857,11 +5913,11 @@ var ObservableQuery = (function (_super) {
|
|
|
5857
5913
|
}(zenObservableTs.Observable));
|
|
5858
5914
|
fixObservableSubclass(ObservableQuery);
|
|
5859
5915
|
function defaultSubscriptionObserverErrorCallback(error) {
|
|
5860
|
-
globalThis.__DEV__ !== false && invariant.error(
|
|
5916
|
+
globalThis.__DEV__ !== false && invariant.error(33, error.message, error.stack);
|
|
5861
5917
|
}
|
|
5862
5918
|
function logMissingFieldErrors(missing) {
|
|
5863
5919
|
if (globalThis.__DEV__ !== false && missing) {
|
|
5864
|
-
globalThis.__DEV__ !== false && invariant.debug(
|
|
5920
|
+
globalThis.__DEV__ !== false && invariant.debug(34, missing);
|
|
5865
5921
|
}
|
|
5866
5922
|
}
|
|
5867
5923
|
function skipCacheDataFor(fetchPolicy ) {
|
|
@@ -5964,14 +6020,17 @@ var QueryInfo = (function () {
|
|
|
5964
6020
|
};
|
|
5965
6021
|
};
|
|
5966
6022
|
QueryInfo.prototype.setDiff = function (diff) {
|
|
5967
|
-
var
|
|
6023
|
+
var _this = this;
|
|
6024
|
+
var _a;
|
|
5968
6025
|
var oldDiff = this.lastDiff && this.lastDiff.diff;
|
|
5969
|
-
if (diff &&
|
|
6026
|
+
if (diff &&
|
|
6027
|
+
!diff.complete &&
|
|
6028
|
+
muteDeprecations("getLastError", function () { var _a; return (_a = _this.observableQuery) === null || _a === void 0 ? void 0 : _a.getLastError(); })) {
|
|
5970
6029
|
return;
|
|
5971
6030
|
}
|
|
5972
6031
|
this.updateLastDiff(diff);
|
|
5973
6032
|
if (!equal.equal(oldDiff && oldDiff.result, diff && diff.result)) {
|
|
5974
|
-
(
|
|
6033
|
+
(_a = this.observableQuery) === null || _a === void 0 ? void 0 : _a["scheduleNotify"]();
|
|
5975
6034
|
}
|
|
5976
6035
|
};
|
|
5977
6036
|
QueryInfo.prototype.setObservableQuery = function (oq) {
|
|
@@ -6151,7 +6210,7 @@ var QueryManager = (function () {
|
|
|
6151
6210
|
this.queries.forEach(function (_info, queryId) {
|
|
6152
6211
|
_this.stopQueryNoBroadcast(queryId);
|
|
6153
6212
|
});
|
|
6154
|
-
this.cancelPendingFetches(newInvariantError(
|
|
6213
|
+
this.cancelPendingFetches(newInvariantError(35));
|
|
6155
6214
|
};
|
|
6156
6215
|
QueryManager.prototype.cancelPendingFetches = function (error) {
|
|
6157
6216
|
this.fetchCancelFns.forEach(function (cancel) { return cancel(error); });
|
|
@@ -6165,8 +6224,8 @@ var QueryManager = (function () {
|
|
|
6165
6224
|
return tslib.__generator(this, function (_j) {
|
|
6166
6225
|
switch (_j.label) {
|
|
6167
6226
|
case 0:
|
|
6168
|
-
invariant(mutation,
|
|
6169
|
-
invariant(fetchPolicy === "network-only" || fetchPolicy === "no-cache",
|
|
6227
|
+
invariant(mutation, 36);
|
|
6228
|
+
invariant(fetchPolicy === "network-only" || fetchPolicy === "no-cache", 37);
|
|
6170
6229
|
mutationId = this.generateMutationId();
|
|
6171
6230
|
mutation = this.cache.transformForLink(this.transform(mutation));
|
|
6172
6231
|
hasClientExports = this.getDocumentInfo(mutation).hasClientExports;
|
|
@@ -6496,10 +6555,10 @@ var QueryManager = (function () {
|
|
|
6496
6555
|
QueryManager.prototype.query = function (options, queryId) {
|
|
6497
6556
|
var _this = this;
|
|
6498
6557
|
if (queryId === void 0) { queryId = this.generateQueryId(); }
|
|
6499
|
-
invariant(options.query,
|
|
6500
|
-
invariant(options.query.kind === "Document",
|
|
6501
|
-
invariant(!options.returnPartialData,
|
|
6502
|
-
invariant(!options.pollInterval,
|
|
6558
|
+
invariant(options.query, 38);
|
|
6559
|
+
invariant(options.query.kind === "Document", 39);
|
|
6560
|
+
invariant(!options.returnPartialData, 40);
|
|
6561
|
+
invariant(!options.pollInterval, 41);
|
|
6503
6562
|
var query = this.transform(options.query);
|
|
6504
6563
|
return this.fetchQuery(queryId, tslib.__assign(tslib.__assign({}, options), { query: query }))
|
|
6505
6564
|
.then(function (result) {
|
|
@@ -6534,7 +6593,7 @@ var QueryManager = (function () {
|
|
|
6534
6593
|
if (options === void 0) { options = {
|
|
6535
6594
|
discardWatches: true,
|
|
6536
6595
|
}; }
|
|
6537
|
-
this.cancelPendingFetches(newInvariantError(
|
|
6596
|
+
this.cancelPendingFetches(newInvariantError(42));
|
|
6538
6597
|
this.queries.forEach(function (queryInfo) {
|
|
6539
6598
|
if (queryInfo.observableQuery) {
|
|
6540
6599
|
queryInfo.networkStatus = exports.NetworkStatus.loading;
|
|
@@ -6616,10 +6675,10 @@ var QueryManager = (function () {
|
|
|
6616
6675
|
if (!included) {
|
|
6617
6676
|
var queryName = queryNames.get(nameOrQueryString);
|
|
6618
6677
|
if (queryName) {
|
|
6619
|
-
globalThis.__DEV__ !== false && invariant.warn(
|
|
6678
|
+
globalThis.__DEV__ !== false && invariant.warn(43, queryName);
|
|
6620
6679
|
}
|
|
6621
6680
|
else {
|
|
6622
|
-
globalThis.__DEV__ !== false && invariant.warn(
|
|
6681
|
+
globalThis.__DEV__ !== false && invariant.warn(44);
|
|
6623
6682
|
}
|
|
6624
6683
|
}
|
|
6625
6684
|
});
|
|
@@ -6632,7 +6691,9 @@ var QueryManager = (function () {
|
|
|
6632
6691
|
var observableQueryPromises = [];
|
|
6633
6692
|
this.getObservableQueries(includeStandby ? "all" : "active").forEach(function (observableQuery, queryId) {
|
|
6634
6693
|
var fetchPolicy = observableQuery.options.fetchPolicy;
|
|
6635
|
-
|
|
6694
|
+
muteDeprecations("resetLastResults", function () {
|
|
6695
|
+
return observableQuery.resetLastResults();
|
|
6696
|
+
});
|
|
6636
6697
|
if (includeStandby ||
|
|
6637
6698
|
(fetchPolicy !== "standby" && fetchPolicy !== "cache-only")) {
|
|
6638
6699
|
observableQueryPromises.push(observableQuery.refetch());
|
|
@@ -6945,7 +7006,7 @@ var QueryManager = (function () {
|
|
|
6945
7006
|
!this.noCacheWarningsByQueryId.has(operationId)) {
|
|
6946
7007
|
this.noCacheWarningsByQueryId.add(operationId);
|
|
6947
7008
|
globalThis.__DEV__ !== false && invariant.warn(
|
|
6948
|
-
|
|
7009
|
+
45,
|
|
6949
7010
|
(_c = getOperationName(document)) !== null && _c !== void 0 ? _c : "Unnamed ".concat(operationType !== null && operationType !== void 0 ? operationType : "operation")
|
|
6950
7011
|
);
|
|
6951
7012
|
}
|
|
@@ -7260,7 +7321,7 @@ var LocalState = (function () {
|
|
|
7260
7321
|
}
|
|
7261
7322
|
else {
|
|
7262
7323
|
fragment = fragmentMap[selection.name.value];
|
|
7263
|
-
invariant(fragment,
|
|
7324
|
+
invariant(fragment, 21, selection.name.value);
|
|
7264
7325
|
}
|
|
7265
7326
|
if (fragment && fragment.typeCondition) {
|
|
7266
7327
|
typeCondition = fragment.typeCondition.name.value;
|
|
@@ -7374,7 +7435,7 @@ var LocalState = (function () {
|
|
|
7374
7435
|
},
|
|
7375
7436
|
FragmentSpread: function (spread, _, __, ___, ancestors) {
|
|
7376
7437
|
var fragment = fragmentMap[spread.name.value];
|
|
7377
|
-
invariant(fragment,
|
|
7438
|
+
invariant(fragment, 22, spread.name.value);
|
|
7378
7439
|
var fragmentSelections = collectByDefinition(fragment);
|
|
7379
7440
|
if (fragmentSelections.size > 0) {
|
|
7380
7441
|
ancestors.forEach(function (node) {
|
|
@@ -7555,6 +7616,7 @@ var ApolloClient = (function () {
|
|
|
7555
7616
|
}
|
|
7556
7617
|
if (globalThis.__DEV__ !== false) {
|
|
7557
7618
|
warnRemovedOption(options, "canonizeResults", "client.watchQuery");
|
|
7619
|
+
warnRemovedOption(options, "partialRefetch", "client.watchQuery");
|
|
7558
7620
|
}
|
|
7559
7621
|
return this.queryManager.watchQuery(options);
|
|
7560
7622
|
};
|
|
@@ -7568,6 +7630,10 @@ var ApolloClient = (function () {
|
|
|
7568
7630
|
}
|
|
7569
7631
|
if (globalThis.__DEV__ !== false) {
|
|
7570
7632
|
warnRemovedOption(options, "canonizeResults", "client.query");
|
|
7633
|
+
warnRemovedOption(options, "notifyOnNetworkStatusChange", "client.query", "This option does not affect `client.query` and can be safely removed.");
|
|
7634
|
+
if (options.fetchPolicy === "standby") {
|
|
7635
|
+
globalThis.__DEV__ !== false && invariant.warn(19);
|
|
7636
|
+
}
|
|
7571
7637
|
}
|
|
7572
7638
|
return this.queryManager.query(options);
|
|
7573
7639
|
};
|
|
@@ -7671,7 +7737,7 @@ var ApolloClient = (function () {
|
|
|
7671
7737
|
result.queries = queries;
|
|
7672
7738
|
result.results = results;
|
|
7673
7739
|
result.catch(function (error) {
|
|
7674
|
-
globalThis.__DEV__ !== false && invariant.debug(
|
|
7740
|
+
globalThis.__DEV__ !== false && invariant.debug(20, error);
|
|
7675
7741
|
});
|
|
7676
7742
|
return result;
|
|
7677
7743
|
};
|
|
@@ -7715,7 +7781,7 @@ if (globalThis.__DEV__ !== false) {
|
|
|
7715
7781
|
|
|
7716
7782
|
var contextKey = canUseSymbol ? Symbol.for("__APOLLO_CONTEXT__") : "__APOLLO_CONTEXT__";
|
|
7717
7783
|
function getApolloContext() {
|
|
7718
|
-
invariant("createContext" in React__namespace,
|
|
7784
|
+
invariant("createContext" in React__namespace, 69);
|
|
7719
7785
|
var context = React__namespace.createContext[contextKey];
|
|
7720
7786
|
if (!context) {
|
|
7721
7787
|
Object.defineProperty(React__namespace.createContext, contextKey, {
|
|
@@ -7730,7 +7796,7 @@ function getApolloContext() {
|
|
|
7730
7796
|
}
|
|
7731
7797
|
var resetApolloContext = function () {
|
|
7732
7798
|
if (globalThis.__DEV__ !== false) {
|
|
7733
|
-
globalThis.__DEV__ !== false && invariant.warn(
|
|
7799
|
+
globalThis.__DEV__ !== false && invariant.warn(70);
|
|
7734
7800
|
}
|
|
7735
7801
|
return getApolloContext();
|
|
7736
7802
|
};
|
|
@@ -7738,7 +7804,7 @@ var resetApolloContext = function () {
|
|
|
7738
7804
|
var ApolloConsumer = function (props) {
|
|
7739
7805
|
var ApolloContext = getApolloContext();
|
|
7740
7806
|
return (React__namespace.createElement(ApolloContext.Consumer, null, function (context) {
|
|
7741
|
-
invariant(context && context.client,
|
|
7807
|
+
invariant(context && context.client, 68);
|
|
7742
7808
|
return props.children(context.client);
|
|
7743
7809
|
}));
|
|
7744
7810
|
};
|
|
@@ -7750,14 +7816,14 @@ var ApolloProvider = function (_a) {
|
|
|
7750
7816
|
var context = React__namespace.useMemo(function () {
|
|
7751
7817
|
return tslib.__assign(tslib.__assign({}, parentContext), { client: client || parentContext.client });
|
|
7752
7818
|
}, [parentContext, client]);
|
|
7753
|
-
invariant(context.client,
|
|
7819
|
+
invariant(context.client, 71);
|
|
7754
7820
|
return (React__namespace.createElement(ApolloContext.Provider, { value: context }, children));
|
|
7755
7821
|
};
|
|
7756
7822
|
|
|
7757
7823
|
function useApolloClient(override) {
|
|
7758
7824
|
var context = React__namespace.useContext(getApolloContext());
|
|
7759
7825
|
var client = override || context.client;
|
|
7760
|
-
invariant(!!client,
|
|
7826
|
+
invariant(!!client, 79);
|
|
7761
7827
|
return client;
|
|
7762
7828
|
}
|
|
7763
7829
|
|
|
@@ -7772,7 +7838,7 @@ var useSyncExternalStore = realHook$1 ||
|
|
|
7772
7838
|
!didWarnUncachedGetSnapshot &&
|
|
7773
7839
|
value !== getSnapshot()) {
|
|
7774
7840
|
didWarnUncachedGetSnapshot = true;
|
|
7775
|
-
globalThis.__DEV__ !== false && invariant.error(
|
|
7841
|
+
globalThis.__DEV__ !== false && invariant.error(92);
|
|
7776
7842
|
}
|
|
7777
7843
|
var _a = React__namespace.useState({
|
|
7778
7844
|
inst: { value: value, getSnapshot: getSnapshot },
|
|
@@ -7834,7 +7900,7 @@ function operationName(type) {
|
|
|
7834
7900
|
}
|
|
7835
7901
|
function parser(document) {
|
|
7836
7902
|
warnDeprecated("parser", function () {
|
|
7837
|
-
globalThis.__DEV__ !== false && invariant.warn(
|
|
7903
|
+
globalThis.__DEV__ !== false && invariant.warn(94);
|
|
7838
7904
|
});
|
|
7839
7905
|
if (!cache) {
|
|
7840
7906
|
cache = new AutoCleanedWeakCache(cacheSizes.parser || 1000 );
|
|
@@ -7843,7 +7909,7 @@ function parser(document) {
|
|
|
7843
7909
|
if (cached)
|
|
7844
7910
|
return cached;
|
|
7845
7911
|
var variables, type, name;
|
|
7846
|
-
invariant(!!document && !!document.kind,
|
|
7912
|
+
invariant(!!document && !!document.kind, 95, document);
|
|
7847
7913
|
var fragments = [];
|
|
7848
7914
|
var queries = [];
|
|
7849
7915
|
var mutations = [];
|
|
@@ -7871,10 +7937,10 @@ function parser(document) {
|
|
|
7871
7937
|
invariant(!fragments.length ||
|
|
7872
7938
|
queries.length ||
|
|
7873
7939
|
mutations.length ||
|
|
7874
|
-
subscriptions.length,
|
|
7940
|
+
subscriptions.length, 96);
|
|
7875
7941
|
invariant(
|
|
7876
7942
|
queries.length + mutations.length + subscriptions.length <= 1,
|
|
7877
|
-
|
|
7943
|
+
97,
|
|
7878
7944
|
document,
|
|
7879
7945
|
queries.length,
|
|
7880
7946
|
subscriptions.length,
|
|
@@ -7886,7 +7952,7 @@ function parser(document) {
|
|
|
7886
7952
|
var definitions = queries.length ? queries
|
|
7887
7953
|
: mutations.length ? mutations
|
|
7888
7954
|
: subscriptions;
|
|
7889
|
-
invariant(definitions.length === 1,
|
|
7955
|
+
invariant(definitions.length === 1, 98, document, definitions.length);
|
|
7890
7956
|
var definition = definitions[0];
|
|
7891
7957
|
variables = definition.variableDefinitions || [];
|
|
7892
7958
|
if (definition.name && definition.name.kind === "Name") {
|
|
@@ -7911,7 +7977,7 @@ function verifyDocumentType(document, type) {
|
|
|
7911
7977
|
var usedOperationName = operationName(operation.type);
|
|
7912
7978
|
invariant(
|
|
7913
7979
|
operation.type === type,
|
|
7914
|
-
|
|
7980
|
+
99,
|
|
7915
7981
|
requiredOperationName,
|
|
7916
7982
|
requiredOperationName,
|
|
7917
7983
|
usedOperationName
|
|
@@ -7956,7 +8022,7 @@ function useWarnRemovedOption(options, name, callSite, recommendation) {
|
|
|
7956
8022
|
if (recommendation === void 0) { recommendation = "Please remove this option."; }
|
|
7957
8023
|
var didWarn = React__namespace.useRef(false);
|
|
7958
8024
|
if (name in options && !didWarn.current) {
|
|
7959
|
-
globalThis.__DEV__ !== false && invariant.warn(
|
|
8025
|
+
globalThis.__DEV__ !== false && invariant.warn(78, callSite, name, recommendation);
|
|
7960
8026
|
didWarn.current = true;
|
|
7961
8027
|
}
|
|
7962
8028
|
}
|
|
@@ -8288,7 +8354,7 @@ function bindObservableMethods(observable) {
|
|
|
8288
8354
|
args[_i] = arguments[_i];
|
|
8289
8355
|
}
|
|
8290
8356
|
if (globalThis.__DEV__ !== false) {
|
|
8291
|
-
globalThis.__DEV__ !== false && invariant.warn(
|
|
8357
|
+
globalThis.__DEV__ !== false && invariant.warn(84);
|
|
8292
8358
|
}
|
|
8293
8359
|
return observable.reobserve.apply(observable, args);
|
|
8294
8360
|
},
|
|
@@ -8362,7 +8428,7 @@ function useLazyQuery(query, options) {
|
|
|
8362
8428
|
eagerMethods[key] = function () {
|
|
8363
8429
|
if (globalThis.__DEV__ !== false) {
|
|
8364
8430
|
if (key === "reobserve") {
|
|
8365
|
-
globalThis.__DEV__ !== false && invariant.warn(
|
|
8431
|
+
globalThis.__DEV__ !== false && invariant.warn(80);
|
|
8366
8432
|
}
|
|
8367
8433
|
}
|
|
8368
8434
|
if (!execOptionsRef.current) {
|
|
@@ -8385,7 +8451,7 @@ function useLazyQuery(query, options) {
|
|
|
8385
8451
|
var execute = React__namespace.useCallback(function (executeOptions) {
|
|
8386
8452
|
if (globalThis.__DEV__ !== false) {
|
|
8387
8453
|
if (calledDuringRender()) {
|
|
8388
|
-
globalThis.__DEV__ !== false && invariant.warn(
|
|
8454
|
+
globalThis.__DEV__ !== false && invariant.warn(81);
|
|
8389
8455
|
}
|
|
8390
8456
|
for (var _i = 0, REMOVED_EXECUTE_OPTIONS_1 = REMOVED_EXECUTE_OPTIONS; _i < REMOVED_EXECUTE_OPTIONS_1.length; _i++) {
|
|
8391
8457
|
var name_1 = REMOVED_EXECUTE_OPTIONS_1[_i];
|
|
@@ -8576,10 +8642,10 @@ function useSubscription(subscription, options) {
|
|
|
8576
8642
|
if (!hasIssuedDeprecationWarningRef.current) {
|
|
8577
8643
|
hasIssuedDeprecationWarningRef.current = true;
|
|
8578
8644
|
if (options.onSubscriptionData) {
|
|
8579
|
-
globalThis.__DEV__ !== false && invariant.warn(options.onData ?
|
|
8645
|
+
globalThis.__DEV__ !== false && invariant.warn(options.onData ? 85 : 86);
|
|
8580
8646
|
}
|
|
8581
8647
|
if (options.onSubscriptionComplete) {
|
|
8582
|
-
globalThis.__DEV__ !== false && invariant.warn(options.onComplete ?
|
|
8648
|
+
globalThis.__DEV__ !== false && invariant.warn(options.onComplete ? 87 : 88);
|
|
8583
8649
|
}
|
|
8584
8650
|
}
|
|
8585
8651
|
var skip = options.skip, fetchPolicy = options.fetchPolicy, errorPolicy = options.errorPolicy, shouldResubscribe = options.shouldResubscribe, context = options.context, extensions = options.extensions, ignoreResults = options.ignoreResults;
|
|
@@ -8700,7 +8766,7 @@ function useSubscription(subscription, options) {
|
|
|
8700
8766
|
: fallbackResult;
|
|
8701
8767
|
}, function () { return fallbackResult; });
|
|
8702
8768
|
var restart = React__namespace.useCallback(function () {
|
|
8703
|
-
invariant(!optionsRef.current.skip,
|
|
8769
|
+
invariant(!optionsRef.current.skip, 89);
|
|
8704
8770
|
setObservable(recreateRef.current());
|
|
8705
8771
|
}, [optionsRef, recreateRef]);
|
|
8706
8772
|
return React__namespace.useMemo(function () { return (tslib.__assign(tslib.__assign({}, ret), { restart: restart })); }, [ret, restart]);
|
|
@@ -8830,7 +8896,7 @@ function wrapQueryRef(internalQueryRef) {
|
|
|
8830
8896
|
return ref;
|
|
8831
8897
|
}
|
|
8832
8898
|
function assertWrappedQueryRef(queryRef) {
|
|
8833
|
-
invariant(!queryRef || QUERY_REFERENCE_SYMBOL in queryRef,
|
|
8899
|
+
invariant(!queryRef || QUERY_REFERENCE_SYMBOL in queryRef, 93);
|
|
8834
8900
|
}
|
|
8835
8901
|
function getWrappedPromise(queryRef) {
|
|
8836
8902
|
var internalQueryRef = unwrapQueryRef(queryRef);
|
|
@@ -8899,7 +8965,9 @@ var InternalQueryReference = (function () {
|
|
|
8899
8965
|
observable.silentSetOptions({ fetchPolicy: "standby" });
|
|
8900
8966
|
}
|
|
8901
8967
|
else {
|
|
8902
|
-
|
|
8968
|
+
muteDeprecations("resetLastResults", function () {
|
|
8969
|
+
return observable.resetLastResults();
|
|
8970
|
+
});
|
|
8903
8971
|
observable.silentSetOptions({ fetchPolicy: "cache-first" });
|
|
8904
8972
|
}
|
|
8905
8973
|
this.subscribeToQuery();
|
|
@@ -9331,11 +9399,11 @@ function validateFetchPolicy(fetchPolicy) {
|
|
|
9331
9399
|
"no-cache",
|
|
9332
9400
|
"cache-and-network",
|
|
9333
9401
|
];
|
|
9334
|
-
invariant(supportedFetchPolicies.includes(fetchPolicy),
|
|
9402
|
+
invariant(supportedFetchPolicies.includes(fetchPolicy), 90, fetchPolicy);
|
|
9335
9403
|
}
|
|
9336
9404
|
function validatePartialDataReturn(fetchPolicy, returnPartialData) {
|
|
9337
9405
|
if (fetchPolicy === "no-cache" && returnPartialData) {
|
|
9338
|
-
globalThis.__DEV__ !== false && invariant.warn(
|
|
9406
|
+
globalThis.__DEV__ !== false && invariant.warn(91);
|
|
9339
9407
|
}
|
|
9340
9408
|
}
|
|
9341
9409
|
function toApolloError(result) {
|
|
@@ -9505,7 +9573,7 @@ function useLoadableQuery(query, options) {
|
|
|
9505
9573
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
9506
9574
|
args[_i] = arguments[_i];
|
|
9507
9575
|
}
|
|
9508
|
-
invariant(!calledDuringRender(),
|
|
9576
|
+
invariant(!calledDuringRender(), 82);
|
|
9509
9577
|
var variables = args[0];
|
|
9510
9578
|
var cacheKey = tslib.__spreadArray([
|
|
9511
9579
|
query,
|
|
@@ -9526,7 +9594,7 @@ function useLoadableQuery(query, options) {
|
|
|
9526
9594
|
client,
|
|
9527
9595
|
]);
|
|
9528
9596
|
var subscribeToMore = React__namespace.useCallback(function (options) {
|
|
9529
|
-
invariant(internalQueryRef,
|
|
9597
|
+
invariant(internalQueryRef, 83);
|
|
9530
9598
|
return internalQueryRef.observable.subscribeToMore(
|
|
9531
9599
|
options);
|
|
9532
9600
|
}, [internalQueryRef]);
|