@apollo/client 3.8.4 → 3.8.6
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/apollo-client.cjs +168 -149
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/cache/cache.cjs +46 -11
- package/cache/cache.cjs.map +1 -1
- package/cache/cache.cjs.native.js +46 -11
- package/cache/core/types/common.d.ts +2 -2
- package/cache/core/types/common.d.ts.map +1 -1
- package/cache/core/types/common.js.map +1 -1
- package/cache/inmemory/entityStore.d.ts.map +1 -1
- package/cache/inmemory/entityStore.js +35 -0
- package/cache/inmemory/entityStore.js.map +1 -1
- package/cache/inmemory/key-extractor.js +1 -1
- package/cache/inmemory/policies.js +4 -4
- package/cache/inmemory/readFromStore.js +2 -2
- package/cache/inmemory/writeToStore.js +4 -4
- package/core/ApolloClient.js +3 -3
- package/core/LocalState.js +2 -2
- package/core/ObservableQuery.d.ts.map +1 -1
- package/core/ObservableQuery.js +10 -11
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryInfo.d.ts +0 -2
- package/core/QueryInfo.d.ts.map +1 -1
- package/core/QueryInfo.js +0 -2
- package/core/QueryInfo.js.map +1 -1
- package/core/QueryManager.js +11 -11
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs +27 -30
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +27 -30
- package/dev/dev.cjs +124 -100
- package/dev/dev.cjs.map +1 -1
- package/dev/dev.cjs.native.js +124 -100
- package/dev/loadErrorMessageHandler.js +2 -2
- package/dev/loadErrorMessageHandler.js.map +1 -1
- package/invariantErrorCodes.js +95 -80
- 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/package.json +22 -22
- package/react/cache/QueryReference.d.ts.map +1 -1
- package/react/cache/QueryReference.js +7 -2
- package/react/cache/QueryReference.js.map +1 -1
- package/react/cache/index.d.ts +0 -4
- package/react/cache/index.d.ts.map +1 -1
- package/react/cache/index.js +0 -14
- package/react/cache/index.js.map +1 -1
- package/react/context/ApolloConsumer.js +1 -1
- package/react/context/ApolloContext.js +1 -1
- package/react/context/ApolloProvider.js +1 -1
- package/react/context/context.cjs +3 -3
- package/react/context/context.cjs.map +1 -1
- package/react/context/context.cjs.native.js +3 -3
- package/react/hoc/hoc-utils.js +1 -1
- package/react/hoc/hoc.cjs +2 -2
- package/react/hoc/hoc.cjs.map +1 -1
- package/react/hoc/hoc.cjs.native.js +2 -2
- package/react/hoc/withApollo.js +1 -1
- package/react/hooks/hooks.cjs +15 -10
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +15 -10
- package/react/hooks/useApolloClient.js +1 -1
- package/react/hooks/useQuery.js +1 -1
- package/react/hooks/useReadQuery.js +1 -1
- package/react/hooks/useSubscription.js +2 -2
- package/react/hooks/useSuspenseQuery.js +2 -2
- package/react/hooks/useSyncExternalStore.js +1 -1
- package/react/index.d.ts +0 -1
- package/react/index.d.ts.map +1 -1
- package/react/index.js +0 -1
- package/react/index.js.map +1 -1
- package/react/parser/index.js +5 -5
- package/react/parser/parser.cjs +5 -5
- package/react/parser/parser.cjs.map +1 -1
- package/react/parser/parser.cjs.native.js +5 -5
- package/react/react.cjs +1 -218
- package/react/react.cjs.map +1 -1
- package/react/react.cjs.native.js +1 -218
- package/react/types/types.d.ts +0 -3
- package/react/types/types.d.ts.map +1 -1
- package/react/types/types.js.map +1 -1
- package/testing/core/core.cjs +1 -1
- package/testing/core/core.cjs.map +1 -1
- package/testing/core/core.cjs.native.js +1 -1
- package/testing/core/mocking/mockLink.js +1 -1
- package/testing/internal/ObservableStream.d.ts +26 -0
- package/testing/internal/ObservableStream.d.ts.map +1 -0
- package/testing/internal/ObservableStream.js +101 -0
- package/testing/internal/ObservableStream.js.map +1 -0
- package/testing/internal/index.d.ts +1 -0
- package/testing/internal/index.d.ts.map +1 -1
- package/testing/internal/index.js +1 -0
- package/testing/internal/index.js.map +1 -1
- package/testing/react/MockedProvider.d.ts +1 -0
- package/testing/react/MockedProvider.d.ts.map +1 -1
- package/testing/react/MockedProvider.js +2 -1
- package/testing/react/MockedProvider.js.map +1 -1
- package/testing/testing.cjs +2 -1
- package/testing/testing.cjs.map +1 -1
- package/testing/testing.cjs.native.js +2 -1
- package/utilities/globals/globals.cjs +29 -19
- package/utilities/globals/globals.cjs.map +1 -1
- package/utilities/globals/globals.cjs.native.js +29 -19
- package/utilities/globals/invariantWrappers.d.ts.map +1 -1
- package/utilities/globals/invariantWrappers.js +28 -18
- package/utilities/globals/invariantWrappers.js.map +1 -1
- package/utilities/graphql/DocumentTransform.js +1 -1
- package/utilities/graphql/directives.js +4 -4
- package/utilities/graphql/fragments.js +3 -3
- package/utilities/graphql/getFromAST.js +8 -8
- package/utilities/graphql/storeUtils.d.ts +5 -0
- package/utilities/graphql/storeUtils.d.ts.map +1 -1
- package/utilities/graphql/storeUtils.js +1 -1
- package/utilities/graphql/storeUtils.js.map +1 -1
- package/utilities/graphql/transform.js +2 -2
- package/utilities/index.d.ts +1 -1
- package/utilities/index.d.ts.map +1 -1
- package/utilities/index.js.map +1 -1
- package/utilities/observables/asyncMap.d.ts.map +1 -1
- package/utilities/observables/asyncMap.js +17 -34
- package/utilities/observables/asyncMap.js.map +1 -1
- package/utilities/utilities.cjs +36 -53
- package/utilities/utilities.cjs.map +1 -1
- package/utilities/utilities.cjs.native.js +36 -53
- 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.8.
|
|
34
|
+
var version = "3.8.6";
|
|
35
35
|
|
|
36
36
|
function maybe(thunk) {
|
|
37
37
|
try {
|
|
@@ -71,11 +71,14 @@ function wrap(fn) {
|
|
|
71
71
|
args[_i - 1] = arguments[_i];
|
|
72
72
|
}
|
|
73
73
|
if (typeof message === "number") {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
74
|
+
var arg0 = message;
|
|
75
|
+
message = getHandledErrorMsg(arg0);
|
|
76
|
+
if (!message) {
|
|
77
|
+
message = getFallbackErrorMsg(arg0, args);
|
|
78
|
+
args = [];
|
|
79
|
+
}
|
|
78
80
|
}
|
|
81
|
+
fn.apply(void 0, [message].concat(args));
|
|
79
82
|
};
|
|
80
83
|
}
|
|
81
84
|
var invariant = Object.assign(function invariant(condition, message) {
|
|
@@ -84,7 +87,7 @@ var invariant = Object.assign(function invariant(condition, message) {
|
|
|
84
87
|
args[_i - 2] = arguments[_i];
|
|
85
88
|
}
|
|
86
89
|
if (!condition) {
|
|
87
|
-
tsInvariant.invariant(condition,
|
|
90
|
+
tsInvariant.invariant(condition, getHandledErrorMsg(message, args) || getFallbackErrorMsg(message, args));
|
|
88
91
|
}
|
|
89
92
|
}, {
|
|
90
93
|
debug: wrap(tsInvariant.invariant.debug),
|
|
@@ -97,23 +100,31 @@ function newInvariantError(message) {
|
|
|
97
100
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
98
101
|
optionalParams[_i - 1] = arguments[_i];
|
|
99
102
|
}
|
|
100
|
-
return new tsInvariant.InvariantError(
|
|
103
|
+
return new tsInvariant.InvariantError(getHandledErrorMsg(message, optionalParams) ||
|
|
104
|
+
getFallbackErrorMsg(message, optionalParams));
|
|
101
105
|
}
|
|
102
106
|
var ApolloErrorMessageHandler = Symbol.for("ApolloErrorMessageHandler_" + version);
|
|
103
|
-
function
|
|
107
|
+
function stringify$1(arg) {
|
|
108
|
+
return typeof arg == "string"
|
|
109
|
+
? arg
|
|
110
|
+
: stringifyForDisplay(arg, 2).slice(0, 1000);
|
|
111
|
+
}
|
|
112
|
+
function getHandledErrorMsg(message, messageArgs) {
|
|
104
113
|
if (messageArgs === void 0) { messageArgs = []; }
|
|
105
114
|
if (!message)
|
|
106
115
|
return;
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
116
|
+
return (global$1[ApolloErrorMessageHandler] &&
|
|
117
|
+
global$1[ApolloErrorMessageHandler](message, messageArgs.map(stringify$1)));
|
|
118
|
+
}
|
|
119
|
+
function getFallbackErrorMsg(message, messageArgs) {
|
|
120
|
+
if (messageArgs === void 0) { messageArgs = []; }
|
|
121
|
+
if (!message)
|
|
122
|
+
return;
|
|
123
|
+
return "An error occurred! For more details, see the full error text at https://go.apollo.dev/c/err#".concat(encodeURIComponent(JSON.stringify({
|
|
124
|
+
version: version,
|
|
125
|
+
message: message,
|
|
126
|
+
args: messageArgs.map(stringify$1),
|
|
127
|
+
})));
|
|
117
128
|
}
|
|
118
129
|
|
|
119
130
|
function shouldInclude(_a, variables) {
|
|
@@ -127,7 +138,7 @@ function shouldInclude(_a, variables) {
|
|
|
127
138
|
if (ifArgument.value.kind === "Variable") {
|
|
128
139
|
evaledValue =
|
|
129
140
|
variables && variables[ifArgument.value.name.value];
|
|
130
|
-
invariant(evaledValue !== void 0,
|
|
141
|
+
invariant(evaledValue !== void 0, 66, directive.name.value);
|
|
131
142
|
}
|
|
132
143
|
else {
|
|
133
144
|
evaledValue = ifArgument.value.value;
|
|
@@ -162,12 +173,12 @@ function getInclusionDirectives(directives) {
|
|
|
162
173
|
return;
|
|
163
174
|
var directiveArguments = directive.arguments;
|
|
164
175
|
var directiveName = directive.name.value;
|
|
165
|
-
invariant(directiveArguments && directiveArguments.length === 1,
|
|
176
|
+
invariant(directiveArguments && directiveArguments.length === 1, 67, directiveName);
|
|
166
177
|
var ifArgument = directiveArguments[0];
|
|
167
|
-
invariant(ifArgument.name && ifArgument.name.value === "if",
|
|
178
|
+
invariant(ifArgument.name && ifArgument.name.value === "if", 68, directiveName);
|
|
168
179
|
var ifValue = ifArgument.value;
|
|
169
180
|
invariant(ifValue &&
|
|
170
|
-
(ifValue.kind === "Variable" || ifValue.kind === "BooleanValue"),
|
|
181
|
+
(ifValue.kind === "Variable" || ifValue.kind === "BooleanValue"), 69, directiveName);
|
|
171
182
|
result.push({ directive: directive, ifArgument: ifArgument });
|
|
172
183
|
});
|
|
173
184
|
}
|
|
@@ -193,7 +204,7 @@ function getFragmentQueryDocument(document, fragmentName) {
|
|
|
193
204
|
document.definitions.forEach(function (definition) {
|
|
194
205
|
if (definition.kind === "OperationDefinition") {
|
|
195
206
|
throw newInvariantError(
|
|
196
|
-
|
|
207
|
+
70,
|
|
197
208
|
definition.operation,
|
|
198
209
|
definition.name ? " named '".concat(definition.name.value, "'") : ""
|
|
199
210
|
);
|
|
@@ -203,7 +214,7 @@ function getFragmentQueryDocument(document, fragmentName) {
|
|
|
203
214
|
}
|
|
204
215
|
});
|
|
205
216
|
if (typeof actualFragmentName === "undefined") {
|
|
206
|
-
invariant(fragments.length === 1,
|
|
217
|
+
invariant(fragments.length === 1, 71, fragments.length);
|
|
207
218
|
actualFragmentName = fragments[0].name.value;
|
|
208
219
|
}
|
|
209
220
|
var query = tslib.__assign(tslib.__assign({}, document), { definitions: tslib.__spreadArray([
|
|
@@ -244,7 +255,7 @@ function getFragmentFromSelection(selection, fragmentMap) {
|
|
|
244
255
|
return fragmentMap(fragmentName);
|
|
245
256
|
}
|
|
246
257
|
var fragment = fragmentMap && fragmentMap[fragmentName];
|
|
247
|
-
invariant(fragment,
|
|
258
|
+
invariant(fragment, 72, fragmentName);
|
|
248
259
|
return fragment || null;
|
|
249
260
|
}
|
|
250
261
|
default:
|
|
@@ -322,7 +333,7 @@ function valueToObjectRepresentation(argObj, name, value, variables) {
|
|
|
322
333
|
argObj[name.value] = null;
|
|
323
334
|
}
|
|
324
335
|
else {
|
|
325
|
-
throw newInvariantError(
|
|
336
|
+
throw newInvariantError(81, name.value, value.kind);
|
|
326
337
|
}
|
|
327
338
|
}
|
|
328
339
|
function storeKeyNameFromField(field, variables) {
|
|
@@ -469,16 +480,16 @@ function isInlineFragment(selection) {
|
|
|
469
480
|
}
|
|
470
481
|
|
|
471
482
|
function checkDocument(doc) {
|
|
472
|
-
invariant(doc && doc.kind === "Document",
|
|
483
|
+
invariant(doc && doc.kind === "Document", 73);
|
|
473
484
|
var operations = doc.definitions
|
|
474
485
|
.filter(function (d) { return d.kind !== "FragmentDefinition"; })
|
|
475
486
|
.map(function (definition) {
|
|
476
487
|
if (definition.kind !== "OperationDefinition") {
|
|
477
|
-
throw newInvariantError(
|
|
488
|
+
throw newInvariantError(74, definition.kind);
|
|
478
489
|
}
|
|
479
490
|
return definition;
|
|
480
491
|
});
|
|
481
|
-
invariant(operations.length <= 1,
|
|
492
|
+
invariant(operations.length <= 1, 75, operations.length);
|
|
482
493
|
return doc;
|
|
483
494
|
}
|
|
484
495
|
function getOperationDefinition(doc) {
|
|
@@ -501,14 +512,14 @@ function getFragmentDefinitions(doc) {
|
|
|
501
512
|
}
|
|
502
513
|
function getQueryDefinition(doc) {
|
|
503
514
|
var queryDef = getOperationDefinition(doc);
|
|
504
|
-
invariant(queryDef && queryDef.operation === "query",
|
|
515
|
+
invariant(queryDef && queryDef.operation === "query", 76);
|
|
505
516
|
return queryDef;
|
|
506
517
|
}
|
|
507
518
|
function getFragmentDefinition(doc) {
|
|
508
|
-
invariant(doc.kind === "Document",
|
|
509
|
-
invariant(doc.definitions.length <= 1,
|
|
519
|
+
invariant(doc.kind === "Document", 77);
|
|
520
|
+
invariant(doc.definitions.length <= 1, 78);
|
|
510
521
|
var fragmentDef = doc.definitions[0];
|
|
511
|
-
invariant(fragmentDef.kind === "FragmentDefinition",
|
|
522
|
+
invariant(fragmentDef.kind === "FragmentDefinition", 79);
|
|
512
523
|
return fragmentDef;
|
|
513
524
|
}
|
|
514
525
|
function getMainDefinition(queryDoc) {
|
|
@@ -531,7 +542,7 @@ function getMainDefinition(queryDoc) {
|
|
|
531
542
|
if (fragmentDefinition) {
|
|
532
543
|
return fragmentDefinition;
|
|
533
544
|
}
|
|
534
|
-
throw newInvariantError(
|
|
545
|
+
throw newInvariantError(80);
|
|
535
546
|
}
|
|
536
547
|
function getDefaultValues(definition) {
|
|
537
548
|
var defaultValues = Object.create(null);
|
|
@@ -603,7 +614,7 @@ var DocumentTransform = (function () {
|
|
|
603
614
|
return;
|
|
604
615
|
var cacheKeys = this.getCacheKey(document);
|
|
605
616
|
if (cacheKeys) {
|
|
606
|
-
invariant(Array.isArray(cacheKeys),
|
|
617
|
+
invariant(Array.isArray(cacheKeys), 65);
|
|
607
618
|
return this.stableCacheKeys.lookupArray(cacheKeys);
|
|
608
619
|
}
|
|
609
620
|
};
|
|
@@ -699,7 +710,7 @@ function removeDirectivesFromDocument(directives, doc) {
|
|
|
699
710
|
return getInUseByFragmentName(ancestor.name.value);
|
|
700
711
|
}
|
|
701
712
|
}
|
|
702
|
-
globalThis.__DEV__ !== false && invariant.error(
|
|
713
|
+
globalThis.__DEV__ !== false && invariant.error(82);
|
|
703
714
|
return null;
|
|
704
715
|
};
|
|
705
716
|
var operationCount = 0;
|
|
@@ -1092,48 +1103,31 @@ function iterateObserversSafely(observers, method, argument) {
|
|
|
1092
1103
|
|
|
1093
1104
|
function asyncMap(observable, mapFn, catchFn) {
|
|
1094
1105
|
return new zenObservableTs.Observable(function (observer) {
|
|
1095
|
-
var next = observer.next, error = observer.error, complete = observer.complete;
|
|
1096
|
-
var activeCallbackCount = 0;
|
|
1097
|
-
var completed = false;
|
|
1098
1106
|
var promiseQueue = {
|
|
1099
1107
|
then: function (callback) {
|
|
1100
1108
|
return new Promise(function (resolve) { return resolve(callback()); });
|
|
1101
1109
|
},
|
|
1102
1110
|
};
|
|
1103
|
-
function makeCallback(examiner,
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
--activeCallbackCount;
|
|
1118
|
-
throw error;
|
|
1119
|
-
})
|
|
1120
|
-
.catch(function (caught) {
|
|
1121
|
-
error && error.call(observer, caught);
|
|
1122
|
-
});
|
|
1123
|
-
};
|
|
1124
|
-
}
|
|
1125
|
-
else {
|
|
1126
|
-
return function (arg) { return delegate && delegate.call(observer, arg); };
|
|
1127
|
-
}
|
|
1111
|
+
function makeCallback(examiner, key) {
|
|
1112
|
+
return function (arg) {
|
|
1113
|
+
if (examiner) {
|
|
1114
|
+
var both = function () {
|
|
1115
|
+
return observer.closed
|
|
1116
|
+
? 0
|
|
1117
|
+
: examiner(arg);
|
|
1118
|
+
};
|
|
1119
|
+
promiseQueue = promiseQueue.then(both, both).then(function (result) { return observer.next(result); }, function (error) { return observer.error(error); });
|
|
1120
|
+
}
|
|
1121
|
+
else {
|
|
1122
|
+
observer[key](arg);
|
|
1123
|
+
}
|
|
1124
|
+
};
|
|
1128
1125
|
}
|
|
1129
1126
|
var handler = {
|
|
1130
|
-
next: makeCallback(mapFn, next),
|
|
1131
|
-
error: makeCallback(catchFn, error),
|
|
1127
|
+
next: makeCallback(mapFn, "next"),
|
|
1128
|
+
error: makeCallback(catchFn, "error"),
|
|
1132
1129
|
complete: function () {
|
|
1133
|
-
|
|
1134
|
-
if (!activeCallbackCount) {
|
|
1135
|
-
complete && complete.call(observer);
|
|
1136
|
-
}
|
|
1130
|
+
promiseQueue.then(function () { return observer.complete(); });
|
|
1137
1131
|
},
|
|
1138
1132
|
};
|
|
1139
1133
|
var sub = observable.subscribe(handler);
|
|
@@ -1369,7 +1363,7 @@ function toPromise(observable) {
|
|
|
1369
1363
|
observable.subscribe({
|
|
1370
1364
|
next: function (data) {
|
|
1371
1365
|
if (completed) {
|
|
1372
|
-
globalThis.__DEV__ !== false && invariant.warn(
|
|
1366
|
+
globalThis.__DEV__ !== false && invariant.warn(42);
|
|
1373
1367
|
}
|
|
1374
1368
|
else {
|
|
1375
1369
|
completed = true;
|
|
@@ -1412,7 +1406,7 @@ function validateOperation(operation) {
|
|
|
1412
1406
|
for (var _i = 0, _a = Object.keys(operation); _i < _a.length; _i++) {
|
|
1413
1407
|
var key = _a[_i];
|
|
1414
1408
|
if (OPERATION_FIELDS.indexOf(key) < 0) {
|
|
1415
|
-
throw newInvariantError(
|
|
1409
|
+
throw newInvariantError(43, key);
|
|
1416
1410
|
}
|
|
1417
1411
|
}
|
|
1418
1412
|
return operation;
|
|
@@ -1519,7 +1513,7 @@ var ApolloLink = (function () {
|
|
|
1519
1513
|
ApolloLink.concat = function (first, second) {
|
|
1520
1514
|
var firstLink = toLink(first);
|
|
1521
1515
|
if (isTerminating(firstLink)) {
|
|
1522
|
-
globalThis.__DEV__ !== false && invariant.warn(
|
|
1516
|
+
globalThis.__DEV__ !== false && invariant.warn(35, firstLink);
|
|
1523
1517
|
return firstLink;
|
|
1524
1518
|
}
|
|
1525
1519
|
var nextLink = toLink(second);
|
|
@@ -1543,7 +1537,7 @@ var ApolloLink = (function () {
|
|
|
1543
1537
|
return ApolloLink.concat(this, next);
|
|
1544
1538
|
};
|
|
1545
1539
|
ApolloLink.prototype.request = function (operation, forward) {
|
|
1546
|
-
throw newInvariantError(
|
|
1540
|
+
throw newInvariantError(36);
|
|
1547
1541
|
};
|
|
1548
1542
|
ApolloLink.prototype.onError = function (error, observer) {
|
|
1549
1543
|
if (observer && observer.error) {
|
|
@@ -1920,7 +1914,7 @@ var serializeFetchParameter = function (p, label) {
|
|
|
1920
1914
|
serialized = JSON.stringify(p);
|
|
1921
1915
|
}
|
|
1922
1916
|
catch (e) {
|
|
1923
|
-
var parseError = newInvariantError(
|
|
1917
|
+
var parseError = newInvariantError(39, label, e.message);
|
|
1924
1918
|
parseError.parseError = e;
|
|
1925
1919
|
throw parseError;
|
|
1926
1920
|
}
|
|
@@ -2006,7 +2000,7 @@ function removeDuplicateHeaders(headers, preserveHeaderCase) {
|
|
|
2006
2000
|
|
|
2007
2001
|
var checkFetcher = function (fetcher) {
|
|
2008
2002
|
if (!fetcher && typeof fetch === "undefined") {
|
|
2009
|
-
throw newInvariantError(
|
|
2003
|
+
throw newInvariantError(37);
|
|
2010
2004
|
}
|
|
2011
2005
|
};
|
|
2012
2006
|
|
|
@@ -2139,7 +2133,7 @@ var createHttpLink = function (linkOptions) {
|
|
|
2139
2133
|
options.headers = options.headers || {};
|
|
2140
2134
|
var acceptHeader = "multipart/mixed;";
|
|
2141
2135
|
if (isSubscription && hasDefer) {
|
|
2142
|
-
globalThis.__DEV__ !== false && invariant.warn(
|
|
2136
|
+
globalThis.__DEV__ !== false && invariant.warn(38);
|
|
2143
2137
|
}
|
|
2144
2138
|
if (isSubscription) {
|
|
2145
2139
|
acceptHeader +=
|
|
@@ -2566,6 +2560,41 @@ var EntityStore = (function () {
|
|
|
2566
2560
|
changedFields_1[storeFieldName] = newValue;
|
|
2567
2561
|
needToMerge_1 = true;
|
|
2568
2562
|
fieldValue = newValue;
|
|
2563
|
+
if (globalThis.__DEV__ !== false) {
|
|
2564
|
+
var checkReference = function (ref) {
|
|
2565
|
+
if (_this.lookup(ref.__ref) === undefined) {
|
|
2566
|
+
globalThis.__DEV__ !== false && invariant.warn(2, ref);
|
|
2567
|
+
return true;
|
|
2568
|
+
}
|
|
2569
|
+
};
|
|
2570
|
+
if (isReference(newValue)) {
|
|
2571
|
+
checkReference(newValue);
|
|
2572
|
+
}
|
|
2573
|
+
else if (Array.isArray(newValue)) {
|
|
2574
|
+
var seenReference = false;
|
|
2575
|
+
var someNonReference = void 0;
|
|
2576
|
+
for (var _i = 0, newValue_1 = newValue; _i < newValue_1.length; _i++) {
|
|
2577
|
+
var value = newValue_1[_i];
|
|
2578
|
+
if (isReference(value)) {
|
|
2579
|
+
seenReference = true;
|
|
2580
|
+
if (checkReference(value))
|
|
2581
|
+
break;
|
|
2582
|
+
}
|
|
2583
|
+
else {
|
|
2584
|
+
if (typeof value === "object" && !!value) {
|
|
2585
|
+
var id = _this.policies.identify(value)[0];
|
|
2586
|
+
if (id) {
|
|
2587
|
+
someNonReference = value;
|
|
2588
|
+
}
|
|
2589
|
+
}
|
|
2590
|
+
}
|
|
2591
|
+
if (seenReference && someNonReference !== undefined) {
|
|
2592
|
+
globalThis.__DEV__ !== false && invariant.warn(3, someNonReference);
|
|
2593
|
+
break;
|
|
2594
|
+
}
|
|
2595
|
+
}
|
|
2596
|
+
}
|
|
2597
|
+
}
|
|
2569
2598
|
}
|
|
2570
2599
|
}
|
|
2571
2600
|
}
|
|
@@ -3157,7 +3186,7 @@ var StoreReader = (function () {
|
|
|
3157
3186
|
else {
|
|
3158
3187
|
var fragment = getFragmentFromSelection(selection, context.lookupFragment);
|
|
3159
3188
|
if (!fragment && selection.kind === graphql.Kind.FRAGMENT_SPREAD) {
|
|
3160
|
-
throw newInvariantError(
|
|
3189
|
+
throw newInvariantError(9, selection.name.value);
|
|
3161
3190
|
}
|
|
3162
3191
|
if (fragment && policies.fragmentMatches(fragment, typename)) {
|
|
3163
3192
|
fragment.selectionSet.selections.forEach(workSet.add, workSet);
|
|
@@ -3241,7 +3270,7 @@ function assertSelectionSetForIdValue(store, field, fieldValue) {
|
|
|
3241
3270
|
if (isNonNullObject(value)) {
|
|
3242
3271
|
invariant(
|
|
3243
3272
|
!isReference(value),
|
|
3244
|
-
|
|
3273
|
+
10,
|
|
3245
3274
|
getTypenameFromStoreObject(store, value),
|
|
3246
3275
|
field.name.value
|
|
3247
3276
|
);
|
|
@@ -3333,7 +3362,7 @@ function keyFieldsFnFromSpecifier(specifier) {
|
|
|
3333
3362
|
hasOwn.call(object, schemaKeyPath[0])) {
|
|
3334
3363
|
extracted = extractKeyPath(object, schemaKeyPath, extractKey);
|
|
3335
3364
|
}
|
|
3336
|
-
invariant(extracted !== void 0,
|
|
3365
|
+
invariant(extracted !== void 0, 4, schemaKeyPath.join("."), object);
|
|
3337
3366
|
return extracted;
|
|
3338
3367
|
}));
|
|
3339
3368
|
return "".concat(context.typename, ":").concat(JSON.stringify(keyObject));
|
|
@@ -3588,7 +3617,7 @@ var Policies = (function () {
|
|
|
3588
3617
|
var rootId = "ROOT_" + which.toUpperCase();
|
|
3589
3618
|
var old = this.rootTypenamesById[rootId];
|
|
3590
3619
|
if (typename !== old) {
|
|
3591
|
-
invariant(!old || old === which,
|
|
3620
|
+
invariant(!old || old === which, 5, which);
|
|
3592
3621
|
if (old)
|
|
3593
3622
|
delete this.rootIdsByTypename[old];
|
|
3594
3623
|
this.rootIdsByTypename[typename] = rootId;
|
|
@@ -3685,7 +3714,7 @@ var Policies = (function () {
|
|
|
3685
3714
|
if (supertypeSet.has(supertype)) {
|
|
3686
3715
|
if (!typenameSupertypeSet.has(supertype)) {
|
|
3687
3716
|
if (checkingFuzzySubtypes) {
|
|
3688
|
-
globalThis.__DEV__ !== false && invariant.warn(
|
|
3717
|
+
globalThis.__DEV__ !== false && invariant.warn(6, typename, supertype);
|
|
3689
3718
|
}
|
|
3690
3719
|
typenameSupertypeSet.add(supertype);
|
|
3691
3720
|
}
|
|
@@ -3847,7 +3876,7 @@ function normalizeReadFieldOptions(readFieldArgs, objectOrReference, variables)
|
|
|
3847
3876
|
}
|
|
3848
3877
|
}
|
|
3849
3878
|
if (globalThis.__DEV__ !== false && options.from === void 0) {
|
|
3850
|
-
globalThis.__DEV__ !== false && invariant.warn(
|
|
3879
|
+
globalThis.__DEV__ !== false && invariant.warn(7, stringifyForDisplay(Array.from(readFieldArgs)));
|
|
3851
3880
|
}
|
|
3852
3881
|
if (void 0 === options.variables) {
|
|
3853
3882
|
options.variables = variables;
|
|
@@ -3857,7 +3886,7 @@ function normalizeReadFieldOptions(readFieldArgs, objectOrReference, variables)
|
|
|
3857
3886
|
function makeMergeObjectsFunction(store) {
|
|
3858
3887
|
return function mergeObjects(existing, incoming) {
|
|
3859
3888
|
if (isArray(existing) || isArray(incoming)) {
|
|
3860
|
-
throw newInvariantError(
|
|
3889
|
+
throw newInvariantError(8);
|
|
3861
3890
|
}
|
|
3862
3891
|
if (isNonNullObject(existing) && isNonNullObject(incoming)) {
|
|
3863
3892
|
var eType = store.getFieldValue(existing, "__typename");
|
|
@@ -3917,7 +3946,7 @@ var StoreWriter = (function () {
|
|
|
3917
3946
|
context: context,
|
|
3918
3947
|
});
|
|
3919
3948
|
if (!isReference(ref)) {
|
|
3920
|
-
throw newInvariantError(
|
|
3949
|
+
throw newInvariantError(11, result);
|
|
3921
3950
|
}
|
|
3922
3951
|
context.incomingById.forEach(function (_a, dataId) {
|
|
3923
3952
|
var storeObject = _a.storeObject, mergeTree = _a.mergeTree, fieldNodeSet = _a.fieldNodeSet;
|
|
@@ -4022,7 +4051,7 @@ var StoreWriter = (function () {
|
|
|
4022
4051
|
!context.deferred &&
|
|
4023
4052
|
!addTypenameToDocument.added(field) &&
|
|
4024
4053
|
!policies.getReadFunction(typename, field.name.value)) {
|
|
4025
|
-
globalThis.__DEV__ !== false && invariant.error(
|
|
4054
|
+
globalThis.__DEV__ !== false && invariant.error(12, resultKeyNameFromField(field), result);
|
|
4026
4055
|
}
|
|
4027
4056
|
});
|
|
4028
4057
|
try {
|
|
@@ -4127,7 +4156,7 @@ var StoreWriter = (function () {
|
|
|
4127
4156
|
else {
|
|
4128
4157
|
var fragment = getFragmentFromSelection(selection, context.lookupFragment);
|
|
4129
4158
|
if (!fragment && selection.kind === graphql.Kind.FRAGMENT_SPREAD) {
|
|
4130
|
-
throw newInvariantError(
|
|
4159
|
+
throw newInvariantError(13, selection.name.value);
|
|
4131
4160
|
}
|
|
4132
4161
|
if (fragment &&
|
|
4133
4162
|
policies.fragmentMatches(fragment, typename, result, context.variables)) {
|
|
@@ -4269,7 +4298,7 @@ function warnAboutDataLoss(existingRef, incomingObj, storeFieldName, store) {
|
|
|
4269
4298
|
}
|
|
4270
4299
|
});
|
|
4271
4300
|
}
|
|
4272
|
-
globalThis.__DEV__ !== false && invariant.warn(
|
|
4301
|
+
globalThis.__DEV__ !== false && invariant.warn(14, fieldName, parentType, childTypenames.length
|
|
4273
4302
|
? "either ensure all objects of type " +
|
|
4274
4303
|
childTypenames.join(" and ") +
|
|
4275
4304
|
" have an ID or a custom merge function, or "
|
|
@@ -4830,7 +4859,7 @@ var ObservableQuery = (function (_super) {
|
|
|
4830
4859
|
var vars = queryDef.variableDefinitions;
|
|
4831
4860
|
if (!vars || !vars.some(function (v) { return v.variable.name.value === "variables"; })) {
|
|
4832
4861
|
globalThis.__DEV__ !== false && invariant.warn(
|
|
4833
|
-
|
|
4862
|
+
20,
|
|
4834
4863
|
variables,
|
|
4835
4864
|
((_a = queryDef.name) === null || _a === void 0 ? void 0 : _a.value) || queryDef
|
|
4836
4865
|
);
|
|
@@ -4928,7 +4957,7 @@ var ObservableQuery = (function (_super) {
|
|
|
4928
4957
|
options.onError(err);
|
|
4929
4958
|
return;
|
|
4930
4959
|
}
|
|
4931
|
-
globalThis.__DEV__ !== false && invariant.error(
|
|
4960
|
+
globalThis.__DEV__ !== false && invariant.error(21, err);
|
|
4932
4961
|
},
|
|
4933
4962
|
});
|
|
4934
4963
|
this.subscriptions.add(subscription);
|
|
@@ -5007,9 +5036,9 @@ var ObservableQuery = (function (_super) {
|
|
|
5007
5036
|
}
|
|
5008
5037
|
return options.fetchPolicy;
|
|
5009
5038
|
};
|
|
5010
|
-
ObservableQuery.prototype.fetch = function (options, newNetworkStatus) {
|
|
5039
|
+
ObservableQuery.prototype.fetch = function (options, newNetworkStatus, query) {
|
|
5011
5040
|
this.queryManager.setObservableQuery(this);
|
|
5012
|
-
return this.queryManager["fetchConcastWithInfo"](this.queryId, options, newNetworkStatus);
|
|
5041
|
+
return this.queryManager["fetchConcastWithInfo"](this.queryId, options, newNetworkStatus, query);
|
|
5013
5042
|
};
|
|
5014
5043
|
ObservableQuery.prototype.updatePolling = function () {
|
|
5015
5044
|
var _this = this;
|
|
@@ -5027,7 +5056,7 @@ var ObservableQuery = (function (_super) {
|
|
|
5027
5056
|
if (pollingInfo && pollingInfo.interval === pollInterval) {
|
|
5028
5057
|
return;
|
|
5029
5058
|
}
|
|
5030
|
-
invariant(pollInterval,
|
|
5059
|
+
invariant(pollInterval, 22);
|
|
5031
5060
|
var info = pollingInfo || (this.pollingInfo = {});
|
|
5032
5061
|
info.interval = pollInterval;
|
|
5033
5062
|
var maybeFetch = function () {
|
|
@@ -5091,15 +5120,14 @@ var ObservableQuery = (function (_super) {
|
|
|
5091
5120
|
}
|
|
5092
5121
|
}
|
|
5093
5122
|
}
|
|
5094
|
-
|
|
5095
|
-
this.waitForOwnResult && (this.waitForOwnResult = skipCacheDataFor(fetchOptions.fetchPolicy));
|
|
5123
|
+
this.waitForOwnResult && (this.waitForOwnResult = skipCacheDataFor(options.fetchPolicy));
|
|
5096
5124
|
var finishWaitingForOwnResult = function () {
|
|
5097
5125
|
if (_this.concast === concast) {
|
|
5098
5126
|
_this.waitForOwnResult = false;
|
|
5099
5127
|
}
|
|
5100
5128
|
};
|
|
5101
|
-
var variables =
|
|
5102
|
-
var _a = this.fetch(
|
|
5129
|
+
var variables = options.variables && tslib.__assign({}, options.variables);
|
|
5130
|
+
var _a = this.fetch(options, newNetworkStatus, query), concast = _a.concast, fromLink = _a.fromLink;
|
|
5103
5131
|
var observer = {
|
|
5104
5132
|
next: function (result) {
|
|
5105
5133
|
finishWaitingForOwnResult();
|
|
@@ -5193,11 +5221,11 @@ function reobserveCacheFirst(obsQuery) {
|
|
|
5193
5221
|
return obsQuery.reobserve();
|
|
5194
5222
|
}
|
|
5195
5223
|
function defaultSubscriptionObserverErrorCallback(error) {
|
|
5196
|
-
globalThis.__DEV__ !== false && invariant.error(
|
|
5224
|
+
globalThis.__DEV__ !== false && invariant.error(23, error.message, error.stack);
|
|
5197
5225
|
}
|
|
5198
5226
|
function logMissingFieldErrors(missing) {
|
|
5199
5227
|
if (globalThis.__DEV__ !== false && missing) {
|
|
5200
|
-
globalThis.__DEV__ !== false && invariant.debug(
|
|
5228
|
+
globalThis.__DEV__ !== false && invariant.debug(24, missing);
|
|
5201
5229
|
}
|
|
5202
5230
|
}
|
|
5203
5231
|
function skipCacheDataFor(fetchPolicy) {
|
|
@@ -5382,7 +5410,7 @@ var LocalState = (function () {
|
|
|
5382
5410
|
}
|
|
5383
5411
|
else {
|
|
5384
5412
|
fragment = fragmentMap[selection.name.value];
|
|
5385
|
-
invariant(fragment,
|
|
5413
|
+
invariant(fragment, 18, selection.name.value);
|
|
5386
5414
|
}
|
|
5387
5415
|
if (fragment && fragment.typeCondition) {
|
|
5388
5416
|
typeCondition = fragment.typeCondition.name.value;
|
|
@@ -5495,7 +5523,7 @@ var LocalState = (function () {
|
|
|
5495
5523
|
},
|
|
5496
5524
|
FragmentSpread: function (spread, _, __, ___, ancestors) {
|
|
5497
5525
|
var fragment = fragmentMap[spread.name.value];
|
|
5498
|
-
invariant(fragment,
|
|
5526
|
+
invariant(fragment, 19, spread.name.value);
|
|
5499
5527
|
var fragmentSelections = collectByDefinition(fragment);
|
|
5500
5528
|
if (fragmentSelections.size > 0) {
|
|
5501
5529
|
ancestors.forEach(function (node) {
|
|
@@ -5541,7 +5569,6 @@ var QueryInfo = (function () {
|
|
|
5541
5569
|
this.listeners = new Set();
|
|
5542
5570
|
this.document = null;
|
|
5543
5571
|
this.lastRequestId = 1;
|
|
5544
|
-
this.subscriptions = new Set();
|
|
5545
5572
|
this.stopped = false;
|
|
5546
5573
|
this.dirty = false;
|
|
5547
5574
|
this.observableQuery = null;
|
|
@@ -5676,7 +5703,6 @@ var QueryInfo = (function () {
|
|
|
5676
5703
|
this.reset();
|
|
5677
5704
|
this.cancel();
|
|
5678
5705
|
this.cancel = QueryInfo.prototype.cancel;
|
|
5679
|
-
this.subscriptions.forEach(function (sub) { return sub.unsubscribe(); });
|
|
5680
5706
|
var oq = this.observableQuery;
|
|
5681
5707
|
if (oq)
|
|
5682
5708
|
oq.stopPolling();
|
|
@@ -5827,7 +5853,7 @@ var QueryManager = (function () {
|
|
|
5827
5853
|
this.queries.forEach(function (_info, queryId) {
|
|
5828
5854
|
_this.stopQueryNoBroadcast(queryId);
|
|
5829
5855
|
});
|
|
5830
|
-
this.cancelPendingFetches(newInvariantError(
|
|
5856
|
+
this.cancelPendingFetches(newInvariantError(25));
|
|
5831
5857
|
};
|
|
5832
5858
|
QueryManager.prototype.cancelPendingFetches = function (error) {
|
|
5833
5859
|
this.fetchCancelFns.forEach(function (cancel) { return cancel(error); });
|
|
@@ -5841,8 +5867,8 @@ var QueryManager = (function () {
|
|
|
5841
5867
|
return tslib.__generator(this, function (_h) {
|
|
5842
5868
|
switch (_h.label) {
|
|
5843
5869
|
case 0:
|
|
5844
|
-
invariant(mutation,
|
|
5845
|
-
invariant(fetchPolicy === "network-only" || fetchPolicy === "no-cache",
|
|
5870
|
+
invariant(mutation, 26);
|
|
5871
|
+
invariant(fetchPolicy === "network-only" || fetchPolicy === "no-cache", 27);
|
|
5846
5872
|
mutationId = this.generateMutationId();
|
|
5847
5873
|
mutation = this.cache.transformForLink(this.transform(mutation));
|
|
5848
5874
|
hasClientExports = this.getDocumentInfo(mutation).hasClientExports;
|
|
@@ -6163,10 +6189,10 @@ var QueryManager = (function () {
|
|
|
6163
6189
|
QueryManager.prototype.query = function (options, queryId) {
|
|
6164
6190
|
var _this = this;
|
|
6165
6191
|
if (queryId === void 0) { queryId = this.generateQueryId(); }
|
|
6166
|
-
invariant(options.query,
|
|
6167
|
-
invariant(options.query.kind === "Document",
|
|
6168
|
-
invariant(!options.returnPartialData,
|
|
6169
|
-
invariant(!options.pollInterval,
|
|
6192
|
+
invariant(options.query, 28);
|
|
6193
|
+
invariant(options.query.kind === "Document", 29);
|
|
6194
|
+
invariant(!options.returnPartialData, 30);
|
|
6195
|
+
invariant(!options.pollInterval, 31);
|
|
6170
6196
|
return this.fetchQuery(queryId, tslib.__assign(tslib.__assign({}, options), { query: this.transform(options.query) })).finally(function () { return _this.stopQuery(queryId); });
|
|
6171
6197
|
};
|
|
6172
6198
|
QueryManager.prototype.generateQueryId = function () {
|
|
@@ -6191,7 +6217,7 @@ var QueryManager = (function () {
|
|
|
6191
6217
|
if (options === void 0) { options = {
|
|
6192
6218
|
discardWatches: true,
|
|
6193
6219
|
}; }
|
|
6194
|
-
this.cancelPendingFetches(newInvariantError(
|
|
6220
|
+
this.cancelPendingFetches(newInvariantError(32));
|
|
6195
6221
|
this.queries.forEach(function (queryInfo) {
|
|
6196
6222
|
if (queryInfo.observableQuery) {
|
|
6197
6223
|
queryInfo.networkStatus = exports.NetworkStatus.loading;
|
|
@@ -6267,7 +6293,7 @@ var QueryManager = (function () {
|
|
|
6267
6293
|
if (globalThis.__DEV__ !== false && queryNamesAndDocs.size) {
|
|
6268
6294
|
queryNamesAndDocs.forEach(function (included, nameOrDoc) {
|
|
6269
6295
|
if (!included) {
|
|
6270
|
-
globalThis.__DEV__ !== false && invariant.warn(typeof nameOrDoc === "string" ?
|
|
6296
|
+
globalThis.__DEV__ !== false && invariant.warn(typeof nameOrDoc === "string" ? 33 : 34, nameOrDoc);
|
|
6271
6297
|
}
|
|
6272
6298
|
});
|
|
6273
6299
|
}
|
|
@@ -6455,10 +6481,10 @@ var QueryManager = (function () {
|
|
|
6455
6481
|
throw error;
|
|
6456
6482
|
});
|
|
6457
6483
|
};
|
|
6458
|
-
QueryManager.prototype.fetchConcastWithInfo = function (queryId, options, networkStatus) {
|
|
6484
|
+
QueryManager.prototype.fetchConcastWithInfo = function (queryId, options, networkStatus, query) {
|
|
6459
6485
|
var _this = this;
|
|
6460
6486
|
if (networkStatus === void 0) { networkStatus = exports.NetworkStatus.loading; }
|
|
6461
|
-
|
|
6487
|
+
if (query === void 0) { query = options.query; }
|
|
6462
6488
|
var variables = this.getVariables(query, options.variables);
|
|
6463
6489
|
var queryInfo = this.getQuery(queryId);
|
|
6464
6490
|
var defaults = this.defaultOptions.watchQuery;
|
|
@@ -6704,7 +6730,7 @@ var ApolloClient = (function () {
|
|
|
6704
6730
|
this.resetStoreCallbacks = [];
|
|
6705
6731
|
this.clearStoreCallbacks = [];
|
|
6706
6732
|
if (!options.cache) {
|
|
6707
|
-
throw newInvariantError(
|
|
6733
|
+
throw newInvariantError(15);
|
|
6708
6734
|
}
|
|
6709
6735
|
var uri = options.uri, credentials = options.credentials, headers = options.headers, cache = options.cache, documentTransform = options.documentTransform, _a = options.ssrMode, ssrMode = _a === void 0 ? false : _a, _b = options.ssrForceFetchDelay, ssrForceFetchDelay = _b === void 0 ? 0 : _b, _c = options.connectToDevTools, connectToDevTools = _c === void 0 ? typeof window === "object" &&
|
|
6710
6736
|
!window.__APOLLO_CLIENT__ &&
|
|
@@ -6829,7 +6855,7 @@ var ApolloClient = (function () {
|
|
|
6829
6855
|
if (this.defaultOptions.query) {
|
|
6830
6856
|
options = mergeOptions(this.defaultOptions.query, options);
|
|
6831
6857
|
}
|
|
6832
|
-
invariant(options.fetchPolicy !== "cache-and-network",
|
|
6858
|
+
invariant(options.fetchPolicy !== "cache-and-network", 16);
|
|
6833
6859
|
if (this.disableNetworkFetches && options.fetchPolicy === "network-only") {
|
|
6834
6860
|
options = tslib.__assign(tslib.__assign({}, options), { fetchPolicy: "cache-first" });
|
|
6835
6861
|
}
|
|
@@ -6922,7 +6948,7 @@ var ApolloClient = (function () {
|
|
|
6922
6948
|
result.queries = queries;
|
|
6923
6949
|
result.results = results;
|
|
6924
6950
|
result.catch(function (error) {
|
|
6925
|
-
globalThis.__DEV__ !== false && invariant.debug(
|
|
6951
|
+
globalThis.__DEV__ !== false && invariant.debug(17, error);
|
|
6926
6952
|
});
|
|
6927
6953
|
return result;
|
|
6928
6954
|
};
|
|
@@ -6958,7 +6984,7 @@ var contextKey = canUseSymbol
|
|
|
6958
6984
|
? Symbol.for("__APOLLO_CONTEXT__")
|
|
6959
6985
|
: "__APOLLO_CONTEXT__";
|
|
6960
6986
|
function getApolloContext() {
|
|
6961
|
-
invariant("createContext" in React__namespace,
|
|
6987
|
+
invariant("createContext" in React__namespace, 45);
|
|
6962
6988
|
var context = React__namespace.createContext[contextKey];
|
|
6963
6989
|
if (!context) {
|
|
6964
6990
|
Object.defineProperty(React__namespace.createContext, contextKey, {
|
|
@@ -6976,7 +7002,7 @@ var resetApolloContext = getApolloContext;
|
|
|
6976
7002
|
var ApolloConsumer = function (props) {
|
|
6977
7003
|
var ApolloContext = getApolloContext();
|
|
6978
7004
|
return (React__namespace.createElement(ApolloContext.Consumer, null, function (context) {
|
|
6979
|
-
invariant(context && context.client,
|
|
7005
|
+
invariant(context && context.client, 44);
|
|
6980
7006
|
return props.children(context.client);
|
|
6981
7007
|
}));
|
|
6982
7008
|
};
|
|
@@ -6988,14 +7014,14 @@ var ApolloProvider = function (_a) {
|
|
|
6988
7014
|
var context = React__namespace.useMemo(function () {
|
|
6989
7015
|
return tslib.__assign(tslib.__assign({}, parentContext), { client: client || parentContext.client });
|
|
6990
7016
|
}, [parentContext, client]);
|
|
6991
|
-
invariant(context.client,
|
|
7017
|
+
invariant(context.client, 46);
|
|
6992
7018
|
return (React__namespace.createElement(ApolloContext.Provider, { value: context }, children));
|
|
6993
7019
|
};
|
|
6994
7020
|
|
|
6995
7021
|
function useApolloClient(override) {
|
|
6996
7022
|
var context = React__namespace.useContext(getApolloContext());
|
|
6997
7023
|
var client = override || context.client;
|
|
6998
|
-
invariant(!!client,
|
|
7024
|
+
invariant(!!client, 49);
|
|
6999
7025
|
return client;
|
|
7000
7026
|
}
|
|
7001
7027
|
|
|
@@ -7009,7 +7035,7 @@ var useSyncExternalStore = realHook$1 ||
|
|
|
7009
7035
|
!didWarnUncachedGetSnapshot &&
|
|
7010
7036
|
value !== getSnapshot()) {
|
|
7011
7037
|
didWarnUncachedGetSnapshot = true;
|
|
7012
|
-
globalThis.__DEV__ !== false && invariant.error(
|
|
7038
|
+
globalThis.__DEV__ !== false && invariant.error(58);
|
|
7013
7039
|
}
|
|
7014
7040
|
var _a = React__namespace.useState({
|
|
7015
7041
|
inst: { value: value, getSnapshot: getSnapshot },
|
|
@@ -7074,7 +7100,7 @@ function parser(document) {
|
|
|
7074
7100
|
if (cached)
|
|
7075
7101
|
return cached;
|
|
7076
7102
|
var variables, type, name;
|
|
7077
|
-
invariant(!!document && !!document.kind,
|
|
7103
|
+
invariant(!!document && !!document.kind, 59, document);
|
|
7078
7104
|
var fragments = [];
|
|
7079
7105
|
var queries = [];
|
|
7080
7106
|
var mutations = [];
|
|
@@ -7102,10 +7128,10 @@ function parser(document) {
|
|
|
7102
7128
|
invariant(!fragments.length ||
|
|
7103
7129
|
queries.length ||
|
|
7104
7130
|
mutations.length ||
|
|
7105
|
-
subscriptions.length,
|
|
7131
|
+
subscriptions.length, 60);
|
|
7106
7132
|
invariant(
|
|
7107
7133
|
queries.length + mutations.length + subscriptions.length <= 1,
|
|
7108
|
-
|
|
7134
|
+
61,
|
|
7109
7135
|
document,
|
|
7110
7136
|
queries.length,
|
|
7111
7137
|
subscriptions.length,
|
|
@@ -7119,7 +7145,7 @@ function parser(document) {
|
|
|
7119
7145
|
: mutations.length
|
|
7120
7146
|
? mutations
|
|
7121
7147
|
: subscriptions;
|
|
7122
|
-
invariant(definitions.length === 1,
|
|
7148
|
+
invariant(definitions.length === 1, 62, document, definitions.length);
|
|
7123
7149
|
var definition = definitions[0];
|
|
7124
7150
|
variables = definition.variableDefinitions || [];
|
|
7125
7151
|
if (definition.name && definition.name.kind === "Name") {
|
|
@@ -7138,7 +7164,7 @@ function verifyDocumentType(document, type) {
|
|
|
7138
7164
|
var usedOperationName = operationName(operation.type);
|
|
7139
7165
|
invariant(
|
|
7140
7166
|
operation.type === type,
|
|
7141
|
-
|
|
7167
|
+
63,
|
|
7142
7168
|
requiredOperationName,
|
|
7143
7169
|
requiredOperationName,
|
|
7144
7170
|
usedOperationName
|
|
@@ -7188,7 +7214,7 @@ var InternalState = (function () {
|
|
|
7188
7214
|
}
|
|
7189
7215
|
}
|
|
7190
7216
|
InternalState.prototype.forceUpdateState = function () {
|
|
7191
|
-
globalThis.__DEV__ !== false && invariant.warn(
|
|
7217
|
+
globalThis.__DEV__ !== false && invariant.warn(50);
|
|
7192
7218
|
};
|
|
7193
7219
|
InternalState.prototype.executeQuery = function (options) {
|
|
7194
7220
|
var _this = this;
|
|
@@ -7609,10 +7635,10 @@ function useSubscription(subscription, options) {
|
|
|
7609
7635
|
if (!hasIssuedDeprecationWarningRef.current) {
|
|
7610
7636
|
hasIssuedDeprecationWarningRef.current = true;
|
|
7611
7637
|
if (options === null || options === void 0 ? void 0 : options.onSubscriptionData) {
|
|
7612
|
-
globalThis.__DEV__ !== false && invariant.warn(options.onData ?
|
|
7638
|
+
globalThis.__DEV__ !== false && invariant.warn(options.onData ? 52 : 53);
|
|
7613
7639
|
}
|
|
7614
7640
|
if (options === null || options === void 0 ? void 0 : options.onSubscriptionComplete) {
|
|
7615
|
-
globalThis.__DEV__ !== false && invariant.warn(options.onComplete ?
|
|
7641
|
+
globalThis.__DEV__ !== false && invariant.warn(options.onComplete ? 54 : 55);
|
|
7616
7642
|
}
|
|
7617
7643
|
}
|
|
7618
7644
|
var _b = React__namespace.useState(function () {
|
|
@@ -7829,7 +7855,6 @@ var OBSERVED_CHANGED_OPTIONS = [
|
|
|
7829
7855
|
var InternalQueryReference = (function () {
|
|
7830
7856
|
function InternalQueryReference(observable, options) {
|
|
7831
7857
|
var _this = this;
|
|
7832
|
-
var _a;
|
|
7833
7858
|
this.listeners = new Set();
|
|
7834
7859
|
this.status = "loading";
|
|
7835
7860
|
this.references = 0;
|
|
@@ -7863,7 +7888,13 @@ var InternalQueryReference = (function () {
|
|
|
7863
7888
|
next: this.handleNext,
|
|
7864
7889
|
error: this.handleError,
|
|
7865
7890
|
});
|
|
7866
|
-
|
|
7891
|
+
var startDisposeTimer = function () {
|
|
7892
|
+
var _a;
|
|
7893
|
+
if (!_this.references) {
|
|
7894
|
+
_this.autoDisposeTimeoutId = setTimeout(_this.dispose, (_a = options.autoDisposeTimeoutMs) !== null && _a !== void 0 ? _a : 30000);
|
|
7895
|
+
}
|
|
7896
|
+
};
|
|
7897
|
+
this.promise.then(startDisposeTimer, startDisposeTimer);
|
|
7867
7898
|
}
|
|
7868
7899
|
Object.defineProperty(InternalQueryReference.prototype, "watchQueryOptions", {
|
|
7869
7900
|
get: function () {
|
|
@@ -7998,7 +8029,7 @@ var InternalQueryReference = (function () {
|
|
|
7998
8029
|
return InternalQueryReference;
|
|
7999
8030
|
}());
|
|
8000
8031
|
|
|
8001
|
-
var SuspenseCache
|
|
8032
|
+
var SuspenseCache = (function () {
|
|
8002
8033
|
function SuspenseCache(options) {
|
|
8003
8034
|
if (options === void 0) { options = Object.create(null); }
|
|
8004
8035
|
this.queryRefs = new trie.Trie(canUseWeakMap);
|
|
@@ -8024,22 +8055,11 @@ var suspenseCacheSymbol = Symbol.for("apollo.suspenseCache");
|
|
|
8024
8055
|
function getSuspenseCache(client) {
|
|
8025
8056
|
var _a;
|
|
8026
8057
|
if (!client[suspenseCacheSymbol]) {
|
|
8027
|
-
client[suspenseCacheSymbol] = new SuspenseCache
|
|
8058
|
+
client[suspenseCacheSymbol] = new SuspenseCache((_a = client.defaultOptions.react) === null || _a === void 0 ? void 0 : _a.suspense);
|
|
8028
8059
|
}
|
|
8029
8060
|
return client[suspenseCacheSymbol];
|
|
8030
8061
|
}
|
|
8031
8062
|
|
|
8032
|
-
var SuspenseCache = (function (_super) {
|
|
8033
|
-
tslib.__extends(SuspenseCache, _super);
|
|
8034
|
-
function SuspenseCache() {
|
|
8035
|
-
_super.call(this) || this;
|
|
8036
|
-
throw new Error("It is no longer necessary to create a `SuspenseCache` instance and pass it into the `ApolloProvider`.\n" +
|
|
8037
|
-
"Please remove this code from your application. \n\n" +
|
|
8038
|
-
"This export will be removed with the final 3.8 release.");
|
|
8039
|
-
}
|
|
8040
|
-
return SuspenseCache;
|
|
8041
|
-
}(SuspenseCache$1));
|
|
8042
|
-
|
|
8043
8063
|
var skipToken = Symbol.for("apollo.skipToken");
|
|
8044
8064
|
|
|
8045
8065
|
function useSuspenseQuery(query, options) {
|
|
@@ -8129,11 +8149,11 @@ function validateFetchPolicy(fetchPolicy) {
|
|
|
8129
8149
|
"no-cache",
|
|
8130
8150
|
"cache-and-network",
|
|
8131
8151
|
];
|
|
8132
|
-
invariant(supportedFetchPolicies.includes(fetchPolicy),
|
|
8152
|
+
invariant(supportedFetchPolicies.includes(fetchPolicy), 56, fetchPolicy);
|
|
8133
8153
|
}
|
|
8134
8154
|
function validatePartialDataReturn(fetchPolicy, returnPartialData) {
|
|
8135
8155
|
if (fetchPolicy === "no-cache" && returnPartialData) {
|
|
8136
|
-
globalThis.__DEV__ !== false && invariant.warn(
|
|
8156
|
+
globalThis.__DEV__ !== false && invariant.warn(57);
|
|
8137
8157
|
}
|
|
8138
8158
|
}
|
|
8139
8159
|
function toApolloError(result) {
|
|
@@ -8208,7 +8228,7 @@ function useBackgroundQuery(query, options) {
|
|
|
8208
8228
|
|
|
8209
8229
|
function useReadQuery(queryRef) {
|
|
8210
8230
|
var internalQueryRef = unwrapQueryRef(queryRef);
|
|
8211
|
-
invariant(internalQueryRef.promiseCache,
|
|
8231
|
+
invariant(internalQueryRef.promiseCache, 51);
|
|
8212
8232
|
var promiseCache = internalQueryRef.promiseCache, key = internalQueryRef.key;
|
|
8213
8233
|
if (!promiseCache.has(key)) {
|
|
8214
8234
|
promiseCache.set(key, internalQueryRef.promise);
|
|
@@ -8247,7 +8267,6 @@ exports.HttpLink = HttpLink;
|
|
|
8247
8267
|
exports.InMemoryCache = InMemoryCache;
|
|
8248
8268
|
exports.MissingFieldError = MissingFieldError;
|
|
8249
8269
|
exports.ObservableQuery = ObservableQuery;
|
|
8250
|
-
exports.SuspenseCache = SuspenseCache;
|
|
8251
8270
|
exports.checkFetcher = checkFetcher;
|
|
8252
8271
|
exports.concat = concat;
|
|
8253
8272
|
exports.createHttpLink = createHttpLink;
|