@apollo/client 3.8.0-alpha.10 → 3.8.0-alpha.11
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 +248 -235
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/cache/cache.cjs +2 -0
- package/cache/cache.cjs.map +1 -1
- package/cache/cache.cjs.native.js +2 -0
- package/cache/core/cache.d.ts +1 -0
- package/cache/core/cache.d.ts.map +1 -1
- package/cache/core/cache.js +1 -0
- package/cache/core/cache.js.map +1 -1
- package/cache/inmemory/inMemoryCache.d.ts +1 -0
- package/cache/inmemory/inMemoryCache.d.ts.map +1 -1
- package/cache/inmemory/inMemoryCache.js +1 -0
- package/cache/inmemory/inMemoryCache.js.map +1 -1
- package/core/ApolloClient.js +6 -6
- package/core/ApolloClient.js.map +1 -1
- package/core/ObservableQuery.d.ts +1 -2
- package/core/ObservableQuery.d.ts.map +1 -1
- package/core/ObservableQuery.js +4 -8
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryInfo.d.ts.map +1 -1
- package/core/QueryInfo.js.map +1 -1
- package/core/QueryManager.d.ts.map +1 -1
- package/core/QueryManager.js +2 -2
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs +13 -17
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +13 -17
- package/core/networkStatus.d.ts +1 -0
- package/core/networkStatus.d.ts.map +1 -1
- package/core/networkStatus.js +3 -0
- package/core/networkStatus.js.map +1 -1
- package/core/types.d.ts +3 -0
- package/core/types.d.ts.map +1 -1
- package/core/types.js.map +1 -1
- package/core/watchQueryOptions.d.ts +0 -1
- package/core/watchQueryOptions.d.ts.map +1 -1
- package/core/watchQueryOptions.js.map +1 -1
- package/invariantErrorCodes.js +35 -30
- package/package.json +2 -2
- package/react/cache/QuerySubscription.d.ts +26 -0
- package/react/cache/QuerySubscription.d.ts.map +1 -0
- package/react/cache/QuerySubscription.js +88 -0
- package/react/cache/QuerySubscription.js.map +1 -0
- package/react/cache/SuspenseCache.d.ts +9 -13
- package/react/cache/SuspenseCache.d.ts.map +1 -1
- package/react/cache/SuspenseCache.js +17 -40
- package/react/cache/SuspenseCache.js.map +1 -1
- package/react/context/ApolloConsumer.js +1 -1
- package/react/context/ApolloProvider.js +1 -1
- package/react/context/context.cjs +2 -2
- package/react/context/context.cjs.map +1 -1
- package/react/context/context.cjs.native.js +2 -2
- 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 +111 -155
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +111 -155
- package/react/hooks/internal/__use.d.ts +2 -0
- package/react/hooks/internal/__use.d.ts.map +1 -0
- package/react/hooks/internal/__use.js +13 -0
- package/react/hooks/internal/__use.js.map +1 -0
- package/react/hooks/internal/index.d.ts +2 -0
- package/react/hooks/internal/index.d.ts.map +1 -1
- package/react/hooks/internal/index.js +2 -0
- package/react/hooks/internal/index.js.map +1 -1
- package/react/hooks/internal/useIsomorphicLayoutEffect.d.ts.map +1 -1
- package/react/hooks/internal/useIsomorphicLayoutEffect.js +2 -2
- package/react/hooks/internal/useIsomorphicLayoutEffect.js.map +1 -1
- package/react/hooks/internal/useStrictModeSafeCleanupEffect.d.ts +2 -0
- package/react/hooks/internal/useStrictModeSafeCleanupEffect.d.ts.map +1 -0
- package/react/hooks/internal/useStrictModeSafeCleanupEffect.js +11 -0
- package/react/hooks/internal/useStrictModeSafeCleanupEffect.js.map +1 -0
- package/react/hooks/useApolloClient.js +1 -1
- package/react/hooks/useSuspenseCache.js +1 -1
- package/react/hooks/useSuspenseQuery.d.ts +7 -2
- package/react/hooks/useSuspenseQuery.d.ts.map +1 -1
- package/react/hooks/useSuspenseQuery.js +66 -153
- package/react/hooks/useSuspenseQuery.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 +112 -38
- package/react/react.cjs.map +1 -1
- package/react/react.cjs.native.js +112 -38
- package/react/types/types.d.ts +0 -2
- 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/testing.cjs +110 -38
- package/testing/testing.cjs.map +1 -1
- package/testing/testing.cjs.native.js +110 -38
- package/utilities/common/mergeOptions.js +1 -1
- package/utilities/common/mergeOptions.js.map +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.js +1 -1
- package/utilities/promises/decoration.d.ts +15 -0
- package/utilities/promises/decoration.d.ts.map +1 -0
- package/utilities/promises/decoration.js +25 -0
- package/utilities/promises/decoration.js.map +1 -0
- package/utilities/utilities.cjs +17 -17
- package/utilities/utilities.cjs.map +1 -1
- package/utilities/utilities.cjs.native.js +17 -17
- package/version.js +1 -1
- package/cache/inmemory/__mocks__/optimism.d.ts +0 -2
- package/cache/inmemory/__mocks__/optimism.d.ts.map +0 -1
- package/cache/inmemory/__mocks__/optimism.js +0 -14
- package/cache/inmemory/__mocks__/optimism.js.map +0 -1
|
@@ -18,7 +18,7 @@ function shouldInclude(_a, variables) {
|
|
|
18
18
|
var evaledValue = false;
|
|
19
19
|
if (ifArgument.value.kind === 'Variable') {
|
|
20
20
|
evaledValue = variables && variables[ifArgument.value.name.value];
|
|
21
|
-
globals.__DEV__ ? globals.invariant(evaledValue !== void 0, "Invalid variable referenced in @".concat(directive.name.value, " directive.")) : globals.invariant(evaledValue !== void 0,
|
|
21
|
+
globals.__DEV__ ? globals.invariant(evaledValue !== void 0, "Invalid variable referenced in @".concat(directive.name.value, " directive.")) : globals.invariant(evaledValue !== void 0, 42);
|
|
22
22
|
}
|
|
23
23
|
else {
|
|
24
24
|
evaledValue = ifArgument.value.value;
|
|
@@ -65,13 +65,13 @@ function getInclusionDirectives(directives) {
|
|
|
65
65
|
return;
|
|
66
66
|
var directiveArguments = directive.arguments;
|
|
67
67
|
var directiveName = directive.name.value;
|
|
68
|
-
globals.__DEV__ ? globals.invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @".concat(directiveName, " directive.")) : globals.invariant(directiveArguments && directiveArguments.length === 1,
|
|
68
|
+
globals.__DEV__ ? globals.invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @".concat(directiveName, " directive.")) : globals.invariant(directiveArguments && directiveArguments.length === 1, 43);
|
|
69
69
|
var ifArgument = directiveArguments[0];
|
|
70
|
-
globals.__DEV__ ? globals.invariant(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @".concat(directiveName, " directive.")) : globals.invariant(ifArgument.name && ifArgument.name.value === 'if',
|
|
70
|
+
globals.__DEV__ ? globals.invariant(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @".concat(directiveName, " directive.")) : globals.invariant(ifArgument.name && ifArgument.name.value === 'if', 44);
|
|
71
71
|
var ifValue = ifArgument.value;
|
|
72
72
|
globals.__DEV__ ? globals.invariant(ifValue &&
|
|
73
73
|
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @".concat(directiveName, " directive must be a variable or a boolean value.")) : globals.invariant(ifValue &&
|
|
74
|
-
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'),
|
|
74
|
+
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 45);
|
|
75
75
|
result.push({ directive: directive, ifArgument: ifArgument });
|
|
76
76
|
});
|
|
77
77
|
}
|
|
@@ -84,14 +84,14 @@ function getFragmentQueryDocument(document, fragmentName) {
|
|
|
84
84
|
document.definitions.forEach(function (definition) {
|
|
85
85
|
if (definition.kind === 'OperationDefinition') {
|
|
86
86
|
throw globals.__DEV__ ? new globals.InvariantError("Found a ".concat(definition.operation, " operation").concat(definition.name ? " named '".concat(definition.name.value, "'") : '', ". ") +
|
|
87
|
-
'No operations are allowed when using a fragment as a query. Only fragments are allowed.') : new globals.InvariantError(
|
|
87
|
+
'No operations are allowed when using a fragment as a query. Only fragments are allowed.') : new globals.InvariantError(46);
|
|
88
88
|
}
|
|
89
89
|
if (definition.kind === 'FragmentDefinition') {
|
|
90
90
|
fragments.push(definition);
|
|
91
91
|
}
|
|
92
92
|
});
|
|
93
93
|
if (typeof actualFragmentName === 'undefined') {
|
|
94
|
-
globals.__DEV__ ? globals.invariant(fragments.length === 1, "Found ".concat(fragments.length, " fragments. `fragmentName` must be provided when there is not exactly 1 fragment.")) : globals.invariant(fragments.length === 1,
|
|
94
|
+
globals.__DEV__ ? globals.invariant(fragments.length === 1, "Found ".concat(fragments.length, " fragments. `fragmentName` must be provided when there is not exactly 1 fragment.")) : globals.invariant(fragments.length === 1, 47);
|
|
95
95
|
actualFragmentName = fragments[0].name.value;
|
|
96
96
|
}
|
|
97
97
|
var query = tslib.__assign(tslib.__assign({}, document), { definitions: tslib.__spreadArray([
|
|
@@ -132,7 +132,7 @@ function getFragmentFromSelection(selection, fragmentMap) {
|
|
|
132
132
|
return fragmentMap(fragmentName);
|
|
133
133
|
}
|
|
134
134
|
var fragment = fragmentMap && fragmentMap[fragmentName];
|
|
135
|
-
globals.__DEV__ ? globals.invariant(fragment, "No fragment named ".concat(fragmentName)) : globals.invariant(fragment,
|
|
135
|
+
globals.__DEV__ ? globals.invariant(fragment, "No fragment named ".concat(fragmentName)) : globals.invariant(fragment, 48);
|
|
136
136
|
return fragment || null;
|
|
137
137
|
}
|
|
138
138
|
default:
|
|
@@ -216,7 +216,7 @@ function valueToObjectRepresentation(argObj, name, value, variables) {
|
|
|
216
216
|
else {
|
|
217
217
|
throw globals.__DEV__ ? new globals.InvariantError("The inline argument \"".concat(name.value, "\" of kind \"").concat(value.kind, "\"") +
|
|
218
218
|
'is not supported. Use variables instead of inline arguments to ' +
|
|
219
|
-
'overcome this limitation.') : new globals.InvariantError(
|
|
219
|
+
'overcome this limitation.') : new globals.InvariantError(57);
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
222
|
function storeKeyNameFromField(field, variables) {
|
|
@@ -350,16 +350,16 @@ function isInlineFragment(selection) {
|
|
|
350
350
|
}
|
|
351
351
|
|
|
352
352
|
function checkDocument(doc) {
|
|
353
|
-
globals.__DEV__ ? globals.invariant(doc && doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql") : globals.invariant(doc && doc.kind === 'Document',
|
|
353
|
+
globals.__DEV__ ? globals.invariant(doc && doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql") : globals.invariant(doc && doc.kind === 'Document', 49);
|
|
354
354
|
var operations = doc.definitions
|
|
355
355
|
.filter(function (d) { return d.kind !== 'FragmentDefinition'; })
|
|
356
356
|
.map(function (definition) {
|
|
357
357
|
if (definition.kind !== 'OperationDefinition') {
|
|
358
|
-
throw globals.__DEV__ ? new globals.InvariantError("Schema type definitions not allowed in queries. Found: \"".concat(definition.kind, "\"")) : new globals.InvariantError(
|
|
358
|
+
throw globals.__DEV__ ? new globals.InvariantError("Schema type definitions not allowed in queries. Found: \"".concat(definition.kind, "\"")) : new globals.InvariantError(50);
|
|
359
359
|
}
|
|
360
360
|
return definition;
|
|
361
361
|
});
|
|
362
|
-
globals.__DEV__ ? globals.invariant(operations.length <= 1, "Ambiguous GraphQL document: contains ".concat(operations.length, " operations")) : globals.invariant(operations.length <= 1,
|
|
362
|
+
globals.__DEV__ ? globals.invariant(operations.length <= 1, "Ambiguous GraphQL document: contains ".concat(operations.length, " operations")) : globals.invariant(operations.length <= 1, 51);
|
|
363
363
|
return doc;
|
|
364
364
|
}
|
|
365
365
|
function getOperationDefinition(doc) {
|
|
@@ -382,14 +382,14 @@ function getFragmentDefinitions(doc) {
|
|
|
382
382
|
}
|
|
383
383
|
function getQueryDefinition(doc) {
|
|
384
384
|
var queryDef = getOperationDefinition(doc);
|
|
385
|
-
globals.__DEV__ ? globals.invariant(queryDef && queryDef.operation === 'query', 'Must contain a query definition.') : globals.invariant(queryDef && queryDef.operation === 'query',
|
|
385
|
+
globals.__DEV__ ? globals.invariant(queryDef && queryDef.operation === 'query', 'Must contain a query definition.') : globals.invariant(queryDef && queryDef.operation === 'query', 52);
|
|
386
386
|
return queryDef;
|
|
387
387
|
}
|
|
388
388
|
function getFragmentDefinition(doc) {
|
|
389
|
-
globals.__DEV__ ? globals.invariant(doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql") : globals.invariant(doc.kind === 'Document',
|
|
390
|
-
globals.__DEV__ ? globals.invariant(doc.definitions.length <= 1, 'Fragment must have exactly one definition.') : globals.invariant(doc.definitions.length <= 1,
|
|
389
|
+
globals.__DEV__ ? globals.invariant(doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql") : globals.invariant(doc.kind === 'Document', 53);
|
|
390
|
+
globals.__DEV__ ? globals.invariant(doc.definitions.length <= 1, 'Fragment must have exactly one definition.') : globals.invariant(doc.definitions.length <= 1, 54);
|
|
391
391
|
var fragmentDef = doc.definitions[0];
|
|
392
|
-
globals.__DEV__ ? globals.invariant(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.') : globals.invariant(fragmentDef.kind === 'FragmentDefinition',
|
|
392
|
+
globals.__DEV__ ? globals.invariant(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.') : globals.invariant(fragmentDef.kind === 'FragmentDefinition', 55);
|
|
393
393
|
return fragmentDef;
|
|
394
394
|
}
|
|
395
395
|
function getMainDefinition(queryDoc) {
|
|
@@ -412,7 +412,7 @@ function getMainDefinition(queryDoc) {
|
|
|
412
412
|
if (fragmentDefinition) {
|
|
413
413
|
return fragmentDefinition;
|
|
414
414
|
}
|
|
415
|
-
throw globals.__DEV__ ? new globals.InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.') : new globals.InvariantError(
|
|
415
|
+
throw globals.__DEV__ ? new globals.InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.') : new globals.InvariantError(56);
|
|
416
416
|
}
|
|
417
417
|
function getDefaultValues(definition) {
|
|
418
418
|
var defaultValues = Object.create(null);
|
|
@@ -1340,7 +1340,7 @@ function stringifyForDisplay(value) {
|
|
|
1340
1340
|
|
|
1341
1341
|
function mergeOptions(defaults, options) {
|
|
1342
1342
|
return compact(defaults, options, options.variables && {
|
|
1343
|
-
variables: tslib.__assign(tslib.__assign({}, (defaults && defaults.variables)), options.variables),
|
|
1343
|
+
variables: compact(tslib.__assign(tslib.__assign({}, (defaults && defaults.variables)), options.variables)),
|
|
1344
1344
|
});
|
|
1345
1345
|
}
|
|
1346
1346
|
|
package/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export var version = '3.8.0-alpha.
|
|
1
|
+
export var version = '3.8.0-alpha.11';
|
|
2
2
|
//# sourceMappingURL=version.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"optimism.d.ts","sourceRoot":"","sources":["../../../../src/cache/inmemory/__mocks__/optimism.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,QAAQ,KAAiC,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var optimism = jest.requireActual('optimism');
|
|
13
|
-
module.exports = __assign(__assign({}, optimism), { wrap: jest.fn(optimism.wrap) });
|
|
14
|
-
//# sourceMappingURL=optimism.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"optimism.js","sourceRoot":"","sources":["../../../../src/cache/inmemory/__mocks__/optimism.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,IAAM,QAAQ,GAAG,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;AAChD,MAAM,CAAC,OAAO,yBACT,QAAQ,KACX,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,GAC7B,CAAC","sourcesContent":["const optimism = jest.requireActual('optimism');\nmodule.exports = {\n ...optimism,\n wrap: jest.fn(optimism.wrap),\n};\n"]}
|