@apollo/client 3.8.5 → 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 +114 -74
- 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.js +5 -5
- package/core/QueryManager.js +9 -9
- package/core/core.cjs +20 -20
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +20 -20
- package/dev/dev.cjs +97 -82
- package/dev/dev.cjs.map +1 -1
- package/dev/dev.cjs.native.js +97 -82
- package/dev/loadErrorMessageHandler.js +1 -1
- 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 +21 -21
- 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/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/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/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/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 +1 -1
- package/utilities/globals/globals.cjs.map +1 -1
- package/utilities/globals/globals.cjs.native.js +1 -1
- package/utilities/graphql/DocumentTransform.js +1 -1
- package/utilities/graphql/directives.js +4 -4
- package/utilities/graphql/fragments.js +3 -3
- package/utilities/graphql/getFromAST.js +8 -8
- package/utilities/graphql/storeUtils.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/utilities.cjs +19 -19
- package/utilities/utilities.cjs.map +1 -1
- package/utilities/utilities.cjs.native.js +19 -19
- package/version.js +1 -1
package/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 {
|
|
@@ -138,7 +138,7 @@ function shouldInclude(_a, variables) {
|
|
|
138
138
|
if (ifArgument.value.kind === "Variable") {
|
|
139
139
|
evaledValue =
|
|
140
140
|
variables && variables[ifArgument.value.name.value];
|
|
141
|
-
invariant(evaledValue !== void 0,
|
|
141
|
+
invariant(evaledValue !== void 0, 66, directive.name.value);
|
|
142
142
|
}
|
|
143
143
|
else {
|
|
144
144
|
evaledValue = ifArgument.value.value;
|
|
@@ -173,12 +173,12 @@ function getInclusionDirectives(directives) {
|
|
|
173
173
|
return;
|
|
174
174
|
var directiveArguments = directive.arguments;
|
|
175
175
|
var directiveName = directive.name.value;
|
|
176
|
-
invariant(directiveArguments && directiveArguments.length === 1,
|
|
176
|
+
invariant(directiveArguments && directiveArguments.length === 1, 67, directiveName);
|
|
177
177
|
var ifArgument = directiveArguments[0];
|
|
178
|
-
invariant(ifArgument.name && ifArgument.name.value === "if",
|
|
178
|
+
invariant(ifArgument.name && ifArgument.name.value === "if", 68, directiveName);
|
|
179
179
|
var ifValue = ifArgument.value;
|
|
180
180
|
invariant(ifValue &&
|
|
181
|
-
(ifValue.kind === "Variable" || ifValue.kind === "BooleanValue"),
|
|
181
|
+
(ifValue.kind === "Variable" || ifValue.kind === "BooleanValue"), 69, directiveName);
|
|
182
182
|
result.push({ directive: directive, ifArgument: ifArgument });
|
|
183
183
|
});
|
|
184
184
|
}
|
|
@@ -204,7 +204,7 @@ function getFragmentQueryDocument(document, fragmentName) {
|
|
|
204
204
|
document.definitions.forEach(function (definition) {
|
|
205
205
|
if (definition.kind === "OperationDefinition") {
|
|
206
206
|
throw newInvariantError(
|
|
207
|
-
|
|
207
|
+
70,
|
|
208
208
|
definition.operation,
|
|
209
209
|
definition.name ? " named '".concat(definition.name.value, "'") : ""
|
|
210
210
|
);
|
|
@@ -214,7 +214,7 @@ function getFragmentQueryDocument(document, fragmentName) {
|
|
|
214
214
|
}
|
|
215
215
|
});
|
|
216
216
|
if (typeof actualFragmentName === "undefined") {
|
|
217
|
-
invariant(fragments.length === 1,
|
|
217
|
+
invariant(fragments.length === 1, 71, fragments.length);
|
|
218
218
|
actualFragmentName = fragments[0].name.value;
|
|
219
219
|
}
|
|
220
220
|
var query = tslib.__assign(tslib.__assign({}, document), { definitions: tslib.__spreadArray([
|
|
@@ -255,7 +255,7 @@ function getFragmentFromSelection(selection, fragmentMap) {
|
|
|
255
255
|
return fragmentMap(fragmentName);
|
|
256
256
|
}
|
|
257
257
|
var fragment = fragmentMap && fragmentMap[fragmentName];
|
|
258
|
-
invariant(fragment,
|
|
258
|
+
invariant(fragment, 72, fragmentName);
|
|
259
259
|
return fragment || null;
|
|
260
260
|
}
|
|
261
261
|
default:
|
|
@@ -333,7 +333,7 @@ function valueToObjectRepresentation(argObj, name, value, variables) {
|
|
|
333
333
|
argObj[name.value] = null;
|
|
334
334
|
}
|
|
335
335
|
else {
|
|
336
|
-
throw newInvariantError(
|
|
336
|
+
throw newInvariantError(81, name.value, value.kind);
|
|
337
337
|
}
|
|
338
338
|
}
|
|
339
339
|
function storeKeyNameFromField(field, variables) {
|
|
@@ -480,16 +480,16 @@ function isInlineFragment(selection) {
|
|
|
480
480
|
}
|
|
481
481
|
|
|
482
482
|
function checkDocument(doc) {
|
|
483
|
-
invariant(doc && doc.kind === "Document",
|
|
483
|
+
invariant(doc && doc.kind === "Document", 73);
|
|
484
484
|
var operations = doc.definitions
|
|
485
485
|
.filter(function (d) { return d.kind !== "FragmentDefinition"; })
|
|
486
486
|
.map(function (definition) {
|
|
487
487
|
if (definition.kind !== "OperationDefinition") {
|
|
488
|
-
throw newInvariantError(
|
|
488
|
+
throw newInvariantError(74, definition.kind);
|
|
489
489
|
}
|
|
490
490
|
return definition;
|
|
491
491
|
});
|
|
492
|
-
invariant(operations.length <= 1,
|
|
492
|
+
invariant(operations.length <= 1, 75, operations.length);
|
|
493
493
|
return doc;
|
|
494
494
|
}
|
|
495
495
|
function getOperationDefinition(doc) {
|
|
@@ -512,14 +512,14 @@ function getFragmentDefinitions(doc) {
|
|
|
512
512
|
}
|
|
513
513
|
function getQueryDefinition(doc) {
|
|
514
514
|
var queryDef = getOperationDefinition(doc);
|
|
515
|
-
invariant(queryDef && queryDef.operation === "query",
|
|
515
|
+
invariant(queryDef && queryDef.operation === "query", 76);
|
|
516
516
|
return queryDef;
|
|
517
517
|
}
|
|
518
518
|
function getFragmentDefinition(doc) {
|
|
519
|
-
invariant(doc.kind === "Document",
|
|
520
|
-
invariant(doc.definitions.length <= 1,
|
|
519
|
+
invariant(doc.kind === "Document", 77);
|
|
520
|
+
invariant(doc.definitions.length <= 1, 78);
|
|
521
521
|
var fragmentDef = doc.definitions[0];
|
|
522
|
-
invariant(fragmentDef.kind === "FragmentDefinition",
|
|
522
|
+
invariant(fragmentDef.kind === "FragmentDefinition", 79);
|
|
523
523
|
return fragmentDef;
|
|
524
524
|
}
|
|
525
525
|
function getMainDefinition(queryDoc) {
|
|
@@ -542,7 +542,7 @@ function getMainDefinition(queryDoc) {
|
|
|
542
542
|
if (fragmentDefinition) {
|
|
543
543
|
return fragmentDefinition;
|
|
544
544
|
}
|
|
545
|
-
throw newInvariantError(
|
|
545
|
+
throw newInvariantError(80);
|
|
546
546
|
}
|
|
547
547
|
function getDefaultValues(definition) {
|
|
548
548
|
var defaultValues = Object.create(null);
|
|
@@ -614,7 +614,7 @@ var DocumentTransform = (function () {
|
|
|
614
614
|
return;
|
|
615
615
|
var cacheKeys = this.getCacheKey(document);
|
|
616
616
|
if (cacheKeys) {
|
|
617
|
-
invariant(Array.isArray(cacheKeys),
|
|
617
|
+
invariant(Array.isArray(cacheKeys), 65);
|
|
618
618
|
return this.stableCacheKeys.lookupArray(cacheKeys);
|
|
619
619
|
}
|
|
620
620
|
};
|
|
@@ -710,7 +710,7 @@ function removeDirectivesFromDocument(directives, doc) {
|
|
|
710
710
|
return getInUseByFragmentName(ancestor.name.value);
|
|
711
711
|
}
|
|
712
712
|
}
|
|
713
|
-
globalThis.__DEV__ !== false && invariant.error(
|
|
713
|
+
globalThis.__DEV__ !== false && invariant.error(82);
|
|
714
714
|
return null;
|
|
715
715
|
};
|
|
716
716
|
var operationCount = 0;
|
|
@@ -1363,7 +1363,7 @@ function toPromise(observable) {
|
|
|
1363
1363
|
observable.subscribe({
|
|
1364
1364
|
next: function (data) {
|
|
1365
1365
|
if (completed) {
|
|
1366
|
-
globalThis.__DEV__ !== false && invariant.warn(
|
|
1366
|
+
globalThis.__DEV__ !== false && invariant.warn(42);
|
|
1367
1367
|
}
|
|
1368
1368
|
else {
|
|
1369
1369
|
completed = true;
|
|
@@ -1406,7 +1406,7 @@ function validateOperation(operation) {
|
|
|
1406
1406
|
for (var _i = 0, _a = Object.keys(operation); _i < _a.length; _i++) {
|
|
1407
1407
|
var key = _a[_i];
|
|
1408
1408
|
if (OPERATION_FIELDS.indexOf(key) < 0) {
|
|
1409
|
-
throw newInvariantError(
|
|
1409
|
+
throw newInvariantError(43, key);
|
|
1410
1410
|
}
|
|
1411
1411
|
}
|
|
1412
1412
|
return operation;
|
|
@@ -1513,7 +1513,7 @@ var ApolloLink = (function () {
|
|
|
1513
1513
|
ApolloLink.concat = function (first, second) {
|
|
1514
1514
|
var firstLink = toLink(first);
|
|
1515
1515
|
if (isTerminating(firstLink)) {
|
|
1516
|
-
globalThis.__DEV__ !== false && invariant.warn(
|
|
1516
|
+
globalThis.__DEV__ !== false && invariant.warn(35, firstLink);
|
|
1517
1517
|
return firstLink;
|
|
1518
1518
|
}
|
|
1519
1519
|
var nextLink = toLink(second);
|
|
@@ -1537,7 +1537,7 @@ var ApolloLink = (function () {
|
|
|
1537
1537
|
return ApolloLink.concat(this, next);
|
|
1538
1538
|
};
|
|
1539
1539
|
ApolloLink.prototype.request = function (operation, forward) {
|
|
1540
|
-
throw newInvariantError(
|
|
1540
|
+
throw newInvariantError(36);
|
|
1541
1541
|
};
|
|
1542
1542
|
ApolloLink.prototype.onError = function (error, observer) {
|
|
1543
1543
|
if (observer && observer.error) {
|
|
@@ -1914,7 +1914,7 @@ var serializeFetchParameter = function (p, label) {
|
|
|
1914
1914
|
serialized = JSON.stringify(p);
|
|
1915
1915
|
}
|
|
1916
1916
|
catch (e) {
|
|
1917
|
-
var parseError = newInvariantError(
|
|
1917
|
+
var parseError = newInvariantError(39, label, e.message);
|
|
1918
1918
|
parseError.parseError = e;
|
|
1919
1919
|
throw parseError;
|
|
1920
1920
|
}
|
|
@@ -2000,7 +2000,7 @@ function removeDuplicateHeaders(headers, preserveHeaderCase) {
|
|
|
2000
2000
|
|
|
2001
2001
|
var checkFetcher = function (fetcher) {
|
|
2002
2002
|
if (!fetcher && typeof fetch === "undefined") {
|
|
2003
|
-
throw newInvariantError(
|
|
2003
|
+
throw newInvariantError(37);
|
|
2004
2004
|
}
|
|
2005
2005
|
};
|
|
2006
2006
|
|
|
@@ -2133,7 +2133,7 @@ var createHttpLink = function (linkOptions) {
|
|
|
2133
2133
|
options.headers = options.headers || {};
|
|
2134
2134
|
var acceptHeader = "multipart/mixed;";
|
|
2135
2135
|
if (isSubscription && hasDefer) {
|
|
2136
|
-
globalThis.__DEV__ !== false && invariant.warn(
|
|
2136
|
+
globalThis.__DEV__ !== false && invariant.warn(38);
|
|
2137
2137
|
}
|
|
2138
2138
|
if (isSubscription) {
|
|
2139
2139
|
acceptHeader +=
|
|
@@ -2560,6 +2560,41 @@ var EntityStore = (function () {
|
|
|
2560
2560
|
changedFields_1[storeFieldName] = newValue;
|
|
2561
2561
|
needToMerge_1 = true;
|
|
2562
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
|
+
}
|
|
2563
2598
|
}
|
|
2564
2599
|
}
|
|
2565
2600
|
}
|
|
@@ -3151,7 +3186,7 @@ var StoreReader = (function () {
|
|
|
3151
3186
|
else {
|
|
3152
3187
|
var fragment = getFragmentFromSelection(selection, context.lookupFragment);
|
|
3153
3188
|
if (!fragment && selection.kind === graphql.Kind.FRAGMENT_SPREAD) {
|
|
3154
|
-
throw newInvariantError(
|
|
3189
|
+
throw newInvariantError(9, selection.name.value);
|
|
3155
3190
|
}
|
|
3156
3191
|
if (fragment && policies.fragmentMatches(fragment, typename)) {
|
|
3157
3192
|
fragment.selectionSet.selections.forEach(workSet.add, workSet);
|
|
@@ -3235,7 +3270,7 @@ function assertSelectionSetForIdValue(store, field, fieldValue) {
|
|
|
3235
3270
|
if (isNonNullObject(value)) {
|
|
3236
3271
|
invariant(
|
|
3237
3272
|
!isReference(value),
|
|
3238
|
-
|
|
3273
|
+
10,
|
|
3239
3274
|
getTypenameFromStoreObject(store, value),
|
|
3240
3275
|
field.name.value
|
|
3241
3276
|
);
|
|
@@ -3327,7 +3362,7 @@ function keyFieldsFnFromSpecifier(specifier) {
|
|
|
3327
3362
|
hasOwn.call(object, schemaKeyPath[0])) {
|
|
3328
3363
|
extracted = extractKeyPath(object, schemaKeyPath, extractKey);
|
|
3329
3364
|
}
|
|
3330
|
-
invariant(extracted !== void 0,
|
|
3365
|
+
invariant(extracted !== void 0, 4, schemaKeyPath.join("."), object);
|
|
3331
3366
|
return extracted;
|
|
3332
3367
|
}));
|
|
3333
3368
|
return "".concat(context.typename, ":").concat(JSON.stringify(keyObject));
|
|
@@ -3582,7 +3617,7 @@ var Policies = (function () {
|
|
|
3582
3617
|
var rootId = "ROOT_" + which.toUpperCase();
|
|
3583
3618
|
var old = this.rootTypenamesById[rootId];
|
|
3584
3619
|
if (typename !== old) {
|
|
3585
|
-
invariant(!old || old === which,
|
|
3620
|
+
invariant(!old || old === which, 5, which);
|
|
3586
3621
|
if (old)
|
|
3587
3622
|
delete this.rootIdsByTypename[old];
|
|
3588
3623
|
this.rootIdsByTypename[typename] = rootId;
|
|
@@ -3679,7 +3714,7 @@ var Policies = (function () {
|
|
|
3679
3714
|
if (supertypeSet.has(supertype)) {
|
|
3680
3715
|
if (!typenameSupertypeSet.has(supertype)) {
|
|
3681
3716
|
if (checkingFuzzySubtypes) {
|
|
3682
|
-
globalThis.__DEV__ !== false && invariant.warn(
|
|
3717
|
+
globalThis.__DEV__ !== false && invariant.warn(6, typename, supertype);
|
|
3683
3718
|
}
|
|
3684
3719
|
typenameSupertypeSet.add(supertype);
|
|
3685
3720
|
}
|
|
@@ -3841,7 +3876,7 @@ function normalizeReadFieldOptions(readFieldArgs, objectOrReference, variables)
|
|
|
3841
3876
|
}
|
|
3842
3877
|
}
|
|
3843
3878
|
if (globalThis.__DEV__ !== false && options.from === void 0) {
|
|
3844
|
-
globalThis.__DEV__ !== false && invariant.warn(
|
|
3879
|
+
globalThis.__DEV__ !== false && invariant.warn(7, stringifyForDisplay(Array.from(readFieldArgs)));
|
|
3845
3880
|
}
|
|
3846
3881
|
if (void 0 === options.variables) {
|
|
3847
3882
|
options.variables = variables;
|
|
@@ -3851,7 +3886,7 @@ function normalizeReadFieldOptions(readFieldArgs, objectOrReference, variables)
|
|
|
3851
3886
|
function makeMergeObjectsFunction(store) {
|
|
3852
3887
|
return function mergeObjects(existing, incoming) {
|
|
3853
3888
|
if (isArray(existing) || isArray(incoming)) {
|
|
3854
|
-
throw newInvariantError(
|
|
3889
|
+
throw newInvariantError(8);
|
|
3855
3890
|
}
|
|
3856
3891
|
if (isNonNullObject(existing) && isNonNullObject(incoming)) {
|
|
3857
3892
|
var eType = store.getFieldValue(existing, "__typename");
|
|
@@ -3911,7 +3946,7 @@ var StoreWriter = (function () {
|
|
|
3911
3946
|
context: context,
|
|
3912
3947
|
});
|
|
3913
3948
|
if (!isReference(ref)) {
|
|
3914
|
-
throw newInvariantError(
|
|
3949
|
+
throw newInvariantError(11, result);
|
|
3915
3950
|
}
|
|
3916
3951
|
context.incomingById.forEach(function (_a, dataId) {
|
|
3917
3952
|
var storeObject = _a.storeObject, mergeTree = _a.mergeTree, fieldNodeSet = _a.fieldNodeSet;
|
|
@@ -4016,7 +4051,7 @@ var StoreWriter = (function () {
|
|
|
4016
4051
|
!context.deferred &&
|
|
4017
4052
|
!addTypenameToDocument.added(field) &&
|
|
4018
4053
|
!policies.getReadFunction(typename, field.name.value)) {
|
|
4019
|
-
globalThis.__DEV__ !== false && invariant.error(
|
|
4054
|
+
globalThis.__DEV__ !== false && invariant.error(12, resultKeyNameFromField(field), result);
|
|
4020
4055
|
}
|
|
4021
4056
|
});
|
|
4022
4057
|
try {
|
|
@@ -4121,7 +4156,7 @@ var StoreWriter = (function () {
|
|
|
4121
4156
|
else {
|
|
4122
4157
|
var fragment = getFragmentFromSelection(selection, context.lookupFragment);
|
|
4123
4158
|
if (!fragment && selection.kind === graphql.Kind.FRAGMENT_SPREAD) {
|
|
4124
|
-
throw newInvariantError(
|
|
4159
|
+
throw newInvariantError(13, selection.name.value);
|
|
4125
4160
|
}
|
|
4126
4161
|
if (fragment &&
|
|
4127
4162
|
policies.fragmentMatches(fragment, typename, result, context.variables)) {
|
|
@@ -4263,7 +4298,7 @@ function warnAboutDataLoss(existingRef, incomingObj, storeFieldName, store) {
|
|
|
4263
4298
|
}
|
|
4264
4299
|
});
|
|
4265
4300
|
}
|
|
4266
|
-
globalThis.__DEV__ !== false && invariant.warn(
|
|
4301
|
+
globalThis.__DEV__ !== false && invariant.warn(14, fieldName, parentType, childTypenames.length
|
|
4267
4302
|
? "either ensure all objects of type " +
|
|
4268
4303
|
childTypenames.join(" and ") +
|
|
4269
4304
|
" have an ID or a custom merge function, or "
|
|
@@ -4824,7 +4859,7 @@ var ObservableQuery = (function (_super) {
|
|
|
4824
4859
|
var vars = queryDef.variableDefinitions;
|
|
4825
4860
|
if (!vars || !vars.some(function (v) { return v.variable.name.value === "variables"; })) {
|
|
4826
4861
|
globalThis.__DEV__ !== false && invariant.warn(
|
|
4827
|
-
|
|
4862
|
+
20,
|
|
4828
4863
|
variables,
|
|
4829
4864
|
((_a = queryDef.name) === null || _a === void 0 ? void 0 : _a.value) || queryDef
|
|
4830
4865
|
);
|
|
@@ -4922,7 +4957,7 @@ var ObservableQuery = (function (_super) {
|
|
|
4922
4957
|
options.onError(err);
|
|
4923
4958
|
return;
|
|
4924
4959
|
}
|
|
4925
|
-
globalThis.__DEV__ !== false && invariant.error(
|
|
4960
|
+
globalThis.__DEV__ !== false && invariant.error(21, err);
|
|
4926
4961
|
},
|
|
4927
4962
|
});
|
|
4928
4963
|
this.subscriptions.add(subscription);
|
|
@@ -5021,7 +5056,7 @@ var ObservableQuery = (function (_super) {
|
|
|
5021
5056
|
if (pollingInfo && pollingInfo.interval === pollInterval) {
|
|
5022
5057
|
return;
|
|
5023
5058
|
}
|
|
5024
|
-
invariant(pollInterval,
|
|
5059
|
+
invariant(pollInterval, 22);
|
|
5025
5060
|
var info = pollingInfo || (this.pollingInfo = {});
|
|
5026
5061
|
info.interval = pollInterval;
|
|
5027
5062
|
var maybeFetch = function () {
|
|
@@ -5186,11 +5221,11 @@ function reobserveCacheFirst(obsQuery) {
|
|
|
5186
5221
|
return obsQuery.reobserve();
|
|
5187
5222
|
}
|
|
5188
5223
|
function defaultSubscriptionObserverErrorCallback(error) {
|
|
5189
|
-
globalThis.__DEV__ !== false && invariant.error(
|
|
5224
|
+
globalThis.__DEV__ !== false && invariant.error(23, error.message, error.stack);
|
|
5190
5225
|
}
|
|
5191
5226
|
function logMissingFieldErrors(missing) {
|
|
5192
5227
|
if (globalThis.__DEV__ !== false && missing) {
|
|
5193
|
-
globalThis.__DEV__ !== false && invariant.debug(
|
|
5228
|
+
globalThis.__DEV__ !== false && invariant.debug(24, missing);
|
|
5194
5229
|
}
|
|
5195
5230
|
}
|
|
5196
5231
|
function skipCacheDataFor(fetchPolicy) {
|
|
@@ -5375,7 +5410,7 @@ var LocalState = (function () {
|
|
|
5375
5410
|
}
|
|
5376
5411
|
else {
|
|
5377
5412
|
fragment = fragmentMap[selection.name.value];
|
|
5378
|
-
invariant(fragment,
|
|
5413
|
+
invariant(fragment, 18, selection.name.value);
|
|
5379
5414
|
}
|
|
5380
5415
|
if (fragment && fragment.typeCondition) {
|
|
5381
5416
|
typeCondition = fragment.typeCondition.name.value;
|
|
@@ -5488,7 +5523,7 @@ var LocalState = (function () {
|
|
|
5488
5523
|
},
|
|
5489
5524
|
FragmentSpread: function (spread, _, __, ___, ancestors) {
|
|
5490
5525
|
var fragment = fragmentMap[spread.name.value];
|
|
5491
|
-
invariant(fragment,
|
|
5526
|
+
invariant(fragment, 19, spread.name.value);
|
|
5492
5527
|
var fragmentSelections = collectByDefinition(fragment);
|
|
5493
5528
|
if (fragmentSelections.size > 0) {
|
|
5494
5529
|
ancestors.forEach(function (node) {
|
|
@@ -5818,7 +5853,7 @@ var QueryManager = (function () {
|
|
|
5818
5853
|
this.queries.forEach(function (_info, queryId) {
|
|
5819
5854
|
_this.stopQueryNoBroadcast(queryId);
|
|
5820
5855
|
});
|
|
5821
|
-
this.cancelPendingFetches(newInvariantError(
|
|
5856
|
+
this.cancelPendingFetches(newInvariantError(25));
|
|
5822
5857
|
};
|
|
5823
5858
|
QueryManager.prototype.cancelPendingFetches = function (error) {
|
|
5824
5859
|
this.fetchCancelFns.forEach(function (cancel) { return cancel(error); });
|
|
@@ -5832,8 +5867,8 @@ var QueryManager = (function () {
|
|
|
5832
5867
|
return tslib.__generator(this, function (_h) {
|
|
5833
5868
|
switch (_h.label) {
|
|
5834
5869
|
case 0:
|
|
5835
|
-
invariant(mutation,
|
|
5836
|
-
invariant(fetchPolicy === "network-only" || fetchPolicy === "no-cache",
|
|
5870
|
+
invariant(mutation, 26);
|
|
5871
|
+
invariant(fetchPolicy === "network-only" || fetchPolicy === "no-cache", 27);
|
|
5837
5872
|
mutationId = this.generateMutationId();
|
|
5838
5873
|
mutation = this.cache.transformForLink(this.transform(mutation));
|
|
5839
5874
|
hasClientExports = this.getDocumentInfo(mutation).hasClientExports;
|
|
@@ -6154,10 +6189,10 @@ var QueryManager = (function () {
|
|
|
6154
6189
|
QueryManager.prototype.query = function (options, queryId) {
|
|
6155
6190
|
var _this = this;
|
|
6156
6191
|
if (queryId === void 0) { queryId = this.generateQueryId(); }
|
|
6157
|
-
invariant(options.query,
|
|
6158
|
-
invariant(options.query.kind === "Document",
|
|
6159
|
-
invariant(!options.returnPartialData,
|
|
6160
|
-
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);
|
|
6161
6196
|
return this.fetchQuery(queryId, tslib.__assign(tslib.__assign({}, options), { query: this.transform(options.query) })).finally(function () { return _this.stopQuery(queryId); });
|
|
6162
6197
|
};
|
|
6163
6198
|
QueryManager.prototype.generateQueryId = function () {
|
|
@@ -6182,7 +6217,7 @@ var QueryManager = (function () {
|
|
|
6182
6217
|
if (options === void 0) { options = {
|
|
6183
6218
|
discardWatches: true,
|
|
6184
6219
|
}; }
|
|
6185
|
-
this.cancelPendingFetches(newInvariantError(
|
|
6220
|
+
this.cancelPendingFetches(newInvariantError(32));
|
|
6186
6221
|
this.queries.forEach(function (queryInfo) {
|
|
6187
6222
|
if (queryInfo.observableQuery) {
|
|
6188
6223
|
queryInfo.networkStatus = exports.NetworkStatus.loading;
|
|
@@ -6258,7 +6293,7 @@ var QueryManager = (function () {
|
|
|
6258
6293
|
if (globalThis.__DEV__ !== false && queryNamesAndDocs.size) {
|
|
6259
6294
|
queryNamesAndDocs.forEach(function (included, nameOrDoc) {
|
|
6260
6295
|
if (!included) {
|
|
6261
|
-
globalThis.__DEV__ !== false && invariant.warn(typeof nameOrDoc === "string" ?
|
|
6296
|
+
globalThis.__DEV__ !== false && invariant.warn(typeof nameOrDoc === "string" ? 33 : 34, nameOrDoc);
|
|
6262
6297
|
}
|
|
6263
6298
|
});
|
|
6264
6299
|
}
|
|
@@ -6695,7 +6730,7 @@ var ApolloClient = (function () {
|
|
|
6695
6730
|
this.resetStoreCallbacks = [];
|
|
6696
6731
|
this.clearStoreCallbacks = [];
|
|
6697
6732
|
if (!options.cache) {
|
|
6698
|
-
throw newInvariantError(
|
|
6733
|
+
throw newInvariantError(15);
|
|
6699
6734
|
}
|
|
6700
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" &&
|
|
6701
6736
|
!window.__APOLLO_CLIENT__ &&
|
|
@@ -6820,7 +6855,7 @@ var ApolloClient = (function () {
|
|
|
6820
6855
|
if (this.defaultOptions.query) {
|
|
6821
6856
|
options = mergeOptions(this.defaultOptions.query, options);
|
|
6822
6857
|
}
|
|
6823
|
-
invariant(options.fetchPolicy !== "cache-and-network",
|
|
6858
|
+
invariant(options.fetchPolicy !== "cache-and-network", 16);
|
|
6824
6859
|
if (this.disableNetworkFetches && options.fetchPolicy === "network-only") {
|
|
6825
6860
|
options = tslib.__assign(tslib.__assign({}, options), { fetchPolicy: "cache-first" });
|
|
6826
6861
|
}
|
|
@@ -6913,7 +6948,7 @@ var ApolloClient = (function () {
|
|
|
6913
6948
|
result.queries = queries;
|
|
6914
6949
|
result.results = results;
|
|
6915
6950
|
result.catch(function (error) {
|
|
6916
|
-
globalThis.__DEV__ !== false && invariant.debug(
|
|
6951
|
+
globalThis.__DEV__ !== false && invariant.debug(17, error);
|
|
6917
6952
|
});
|
|
6918
6953
|
return result;
|
|
6919
6954
|
};
|
|
@@ -6949,7 +6984,7 @@ var contextKey = canUseSymbol
|
|
|
6949
6984
|
? Symbol.for("__APOLLO_CONTEXT__")
|
|
6950
6985
|
: "__APOLLO_CONTEXT__";
|
|
6951
6986
|
function getApolloContext() {
|
|
6952
|
-
invariant("createContext" in React__namespace,
|
|
6987
|
+
invariant("createContext" in React__namespace, 45);
|
|
6953
6988
|
var context = React__namespace.createContext[contextKey];
|
|
6954
6989
|
if (!context) {
|
|
6955
6990
|
Object.defineProperty(React__namespace.createContext, contextKey, {
|
|
@@ -6967,7 +7002,7 @@ var resetApolloContext = getApolloContext;
|
|
|
6967
7002
|
var ApolloConsumer = function (props) {
|
|
6968
7003
|
var ApolloContext = getApolloContext();
|
|
6969
7004
|
return (React__namespace.createElement(ApolloContext.Consumer, null, function (context) {
|
|
6970
|
-
invariant(context && context.client,
|
|
7005
|
+
invariant(context && context.client, 44);
|
|
6971
7006
|
return props.children(context.client);
|
|
6972
7007
|
}));
|
|
6973
7008
|
};
|
|
@@ -6979,14 +7014,14 @@ var ApolloProvider = function (_a) {
|
|
|
6979
7014
|
var context = React__namespace.useMemo(function () {
|
|
6980
7015
|
return tslib.__assign(tslib.__assign({}, parentContext), { client: client || parentContext.client });
|
|
6981
7016
|
}, [parentContext, client]);
|
|
6982
|
-
invariant(context.client,
|
|
7017
|
+
invariant(context.client, 46);
|
|
6983
7018
|
return (React__namespace.createElement(ApolloContext.Provider, { value: context }, children));
|
|
6984
7019
|
};
|
|
6985
7020
|
|
|
6986
7021
|
function useApolloClient(override) {
|
|
6987
7022
|
var context = React__namespace.useContext(getApolloContext());
|
|
6988
7023
|
var client = override || context.client;
|
|
6989
|
-
invariant(!!client,
|
|
7024
|
+
invariant(!!client, 49);
|
|
6990
7025
|
return client;
|
|
6991
7026
|
}
|
|
6992
7027
|
|
|
@@ -7000,7 +7035,7 @@ var useSyncExternalStore = realHook$1 ||
|
|
|
7000
7035
|
!didWarnUncachedGetSnapshot &&
|
|
7001
7036
|
value !== getSnapshot()) {
|
|
7002
7037
|
didWarnUncachedGetSnapshot = true;
|
|
7003
|
-
globalThis.__DEV__ !== false && invariant.error(
|
|
7038
|
+
globalThis.__DEV__ !== false && invariant.error(58);
|
|
7004
7039
|
}
|
|
7005
7040
|
var _a = React__namespace.useState({
|
|
7006
7041
|
inst: { value: value, getSnapshot: getSnapshot },
|
|
@@ -7065,7 +7100,7 @@ function parser(document) {
|
|
|
7065
7100
|
if (cached)
|
|
7066
7101
|
return cached;
|
|
7067
7102
|
var variables, type, name;
|
|
7068
|
-
invariant(!!document && !!document.kind,
|
|
7103
|
+
invariant(!!document && !!document.kind, 59, document);
|
|
7069
7104
|
var fragments = [];
|
|
7070
7105
|
var queries = [];
|
|
7071
7106
|
var mutations = [];
|
|
@@ -7093,10 +7128,10 @@ function parser(document) {
|
|
|
7093
7128
|
invariant(!fragments.length ||
|
|
7094
7129
|
queries.length ||
|
|
7095
7130
|
mutations.length ||
|
|
7096
|
-
subscriptions.length,
|
|
7131
|
+
subscriptions.length, 60);
|
|
7097
7132
|
invariant(
|
|
7098
7133
|
queries.length + mutations.length + subscriptions.length <= 1,
|
|
7099
|
-
|
|
7134
|
+
61,
|
|
7100
7135
|
document,
|
|
7101
7136
|
queries.length,
|
|
7102
7137
|
subscriptions.length,
|
|
@@ -7110,7 +7145,7 @@ function parser(document) {
|
|
|
7110
7145
|
: mutations.length
|
|
7111
7146
|
? mutations
|
|
7112
7147
|
: subscriptions;
|
|
7113
|
-
invariant(definitions.length === 1,
|
|
7148
|
+
invariant(definitions.length === 1, 62, document, definitions.length);
|
|
7114
7149
|
var definition = definitions[0];
|
|
7115
7150
|
variables = definition.variableDefinitions || [];
|
|
7116
7151
|
if (definition.name && definition.name.kind === "Name") {
|
|
@@ -7129,7 +7164,7 @@ function verifyDocumentType(document, type) {
|
|
|
7129
7164
|
var usedOperationName = operationName(operation.type);
|
|
7130
7165
|
invariant(
|
|
7131
7166
|
operation.type === type,
|
|
7132
|
-
|
|
7167
|
+
63,
|
|
7133
7168
|
requiredOperationName,
|
|
7134
7169
|
requiredOperationName,
|
|
7135
7170
|
usedOperationName
|
|
@@ -7179,7 +7214,7 @@ var InternalState = (function () {
|
|
|
7179
7214
|
}
|
|
7180
7215
|
}
|
|
7181
7216
|
InternalState.prototype.forceUpdateState = function () {
|
|
7182
|
-
globalThis.__DEV__ !== false && invariant.warn(
|
|
7217
|
+
globalThis.__DEV__ !== false && invariant.warn(50);
|
|
7183
7218
|
};
|
|
7184
7219
|
InternalState.prototype.executeQuery = function (options) {
|
|
7185
7220
|
var _this = this;
|
|
@@ -7600,10 +7635,10 @@ function useSubscription(subscription, options) {
|
|
|
7600
7635
|
if (!hasIssuedDeprecationWarningRef.current) {
|
|
7601
7636
|
hasIssuedDeprecationWarningRef.current = true;
|
|
7602
7637
|
if (options === null || options === void 0 ? void 0 : options.onSubscriptionData) {
|
|
7603
|
-
globalThis.__DEV__ !== false && invariant.warn(options.onData ?
|
|
7638
|
+
globalThis.__DEV__ !== false && invariant.warn(options.onData ? 52 : 53);
|
|
7604
7639
|
}
|
|
7605
7640
|
if (options === null || options === void 0 ? void 0 : options.onSubscriptionComplete) {
|
|
7606
|
-
globalThis.__DEV__ !== false && invariant.warn(options.onComplete ?
|
|
7641
|
+
globalThis.__DEV__ !== false && invariant.warn(options.onComplete ? 54 : 55);
|
|
7607
7642
|
}
|
|
7608
7643
|
}
|
|
7609
7644
|
var _b = React__namespace.useState(function () {
|
|
@@ -7820,7 +7855,6 @@ var OBSERVED_CHANGED_OPTIONS = [
|
|
|
7820
7855
|
var InternalQueryReference = (function () {
|
|
7821
7856
|
function InternalQueryReference(observable, options) {
|
|
7822
7857
|
var _this = this;
|
|
7823
|
-
var _a;
|
|
7824
7858
|
this.listeners = new Set();
|
|
7825
7859
|
this.status = "loading";
|
|
7826
7860
|
this.references = 0;
|
|
@@ -7854,7 +7888,13 @@ var InternalQueryReference = (function () {
|
|
|
7854
7888
|
next: this.handleNext,
|
|
7855
7889
|
error: this.handleError,
|
|
7856
7890
|
});
|
|
7857
|
-
|
|
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);
|
|
7858
7898
|
}
|
|
7859
7899
|
Object.defineProperty(InternalQueryReference.prototype, "watchQueryOptions", {
|
|
7860
7900
|
get: function () {
|
|
@@ -8109,11 +8149,11 @@ function validateFetchPolicy(fetchPolicy) {
|
|
|
8109
8149
|
"no-cache",
|
|
8110
8150
|
"cache-and-network",
|
|
8111
8151
|
];
|
|
8112
|
-
invariant(supportedFetchPolicies.includes(fetchPolicy),
|
|
8152
|
+
invariant(supportedFetchPolicies.includes(fetchPolicy), 56, fetchPolicy);
|
|
8113
8153
|
}
|
|
8114
8154
|
function validatePartialDataReturn(fetchPolicy, returnPartialData) {
|
|
8115
8155
|
if (fetchPolicy === "no-cache" && returnPartialData) {
|
|
8116
|
-
globalThis.__DEV__ !== false && invariant.warn(
|
|
8156
|
+
globalThis.__DEV__ !== false && invariant.warn(57);
|
|
8117
8157
|
}
|
|
8118
8158
|
}
|
|
8119
8159
|
function toApolloError(result) {
|
|
@@ -8188,7 +8228,7 @@ function useBackgroundQuery(query, options) {
|
|
|
8188
8228
|
|
|
8189
8229
|
function useReadQuery(queryRef) {
|
|
8190
8230
|
var internalQueryRef = unwrapQueryRef(queryRef);
|
|
8191
|
-
invariant(internalQueryRef.promiseCache,
|
|
8231
|
+
invariant(internalQueryRef.promiseCache, 51);
|
|
8192
8232
|
var promiseCache = internalQueryRef.promiseCache, key = internalQueryRef.key;
|
|
8193
8233
|
if (!promiseCache.has(key)) {
|
|
8194
8234
|
promiseCache.set(key, internalQueryRef.promise);
|