@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.
Files changed (117) hide show
  1. package/apollo-client.cjs +248 -235
  2. package/apollo-client.cjs.map +1 -1
  3. package/apollo-client.min.cjs +1 -1
  4. package/cache/cache.cjs +2 -0
  5. package/cache/cache.cjs.map +1 -1
  6. package/cache/cache.cjs.native.js +2 -0
  7. package/cache/core/cache.d.ts +1 -0
  8. package/cache/core/cache.d.ts.map +1 -1
  9. package/cache/core/cache.js +1 -0
  10. package/cache/core/cache.js.map +1 -1
  11. package/cache/inmemory/inMemoryCache.d.ts +1 -0
  12. package/cache/inmemory/inMemoryCache.d.ts.map +1 -1
  13. package/cache/inmemory/inMemoryCache.js +1 -0
  14. package/cache/inmemory/inMemoryCache.js.map +1 -1
  15. package/core/ApolloClient.js +6 -6
  16. package/core/ApolloClient.js.map +1 -1
  17. package/core/ObservableQuery.d.ts +1 -2
  18. package/core/ObservableQuery.d.ts.map +1 -1
  19. package/core/ObservableQuery.js +4 -8
  20. package/core/ObservableQuery.js.map +1 -1
  21. package/core/QueryInfo.d.ts.map +1 -1
  22. package/core/QueryInfo.js.map +1 -1
  23. package/core/QueryManager.d.ts.map +1 -1
  24. package/core/QueryManager.js +2 -2
  25. package/core/QueryManager.js.map +1 -1
  26. package/core/core.cjs +13 -17
  27. package/core/core.cjs.map +1 -1
  28. package/core/core.cjs.native.js +13 -17
  29. package/core/networkStatus.d.ts +1 -0
  30. package/core/networkStatus.d.ts.map +1 -1
  31. package/core/networkStatus.js +3 -0
  32. package/core/networkStatus.js.map +1 -1
  33. package/core/types.d.ts +3 -0
  34. package/core/types.d.ts.map +1 -1
  35. package/core/types.js.map +1 -1
  36. package/core/watchQueryOptions.d.ts +0 -1
  37. package/core/watchQueryOptions.d.ts.map +1 -1
  38. package/core/watchQueryOptions.js.map +1 -1
  39. package/invariantErrorCodes.js +35 -30
  40. package/package.json +2 -2
  41. package/react/cache/QuerySubscription.d.ts +26 -0
  42. package/react/cache/QuerySubscription.d.ts.map +1 -0
  43. package/react/cache/QuerySubscription.js +88 -0
  44. package/react/cache/QuerySubscription.js.map +1 -0
  45. package/react/cache/SuspenseCache.d.ts +9 -13
  46. package/react/cache/SuspenseCache.d.ts.map +1 -1
  47. package/react/cache/SuspenseCache.js +17 -40
  48. package/react/cache/SuspenseCache.js.map +1 -1
  49. package/react/context/ApolloConsumer.js +1 -1
  50. package/react/context/ApolloProvider.js +1 -1
  51. package/react/context/context.cjs +2 -2
  52. package/react/context/context.cjs.map +1 -1
  53. package/react/context/context.cjs.native.js +2 -2
  54. package/react/hoc/hoc-utils.js +1 -1
  55. package/react/hoc/hoc.cjs +2 -2
  56. package/react/hoc/hoc.cjs.map +1 -1
  57. package/react/hoc/hoc.cjs.native.js +2 -2
  58. package/react/hoc/withApollo.js +1 -1
  59. package/react/hooks/hooks.cjs +111 -155
  60. package/react/hooks/hooks.cjs.map +1 -1
  61. package/react/hooks/hooks.cjs.native.js +111 -155
  62. package/react/hooks/internal/__use.d.ts +2 -0
  63. package/react/hooks/internal/__use.d.ts.map +1 -0
  64. package/react/hooks/internal/__use.js +13 -0
  65. package/react/hooks/internal/__use.js.map +1 -0
  66. package/react/hooks/internal/index.d.ts +2 -0
  67. package/react/hooks/internal/index.d.ts.map +1 -1
  68. package/react/hooks/internal/index.js +2 -0
  69. package/react/hooks/internal/index.js.map +1 -1
  70. package/react/hooks/internal/useIsomorphicLayoutEffect.d.ts.map +1 -1
  71. package/react/hooks/internal/useIsomorphicLayoutEffect.js +2 -2
  72. package/react/hooks/internal/useIsomorphicLayoutEffect.js.map +1 -1
  73. package/react/hooks/internal/useStrictModeSafeCleanupEffect.d.ts +2 -0
  74. package/react/hooks/internal/useStrictModeSafeCleanupEffect.d.ts.map +1 -0
  75. package/react/hooks/internal/useStrictModeSafeCleanupEffect.js +11 -0
  76. package/react/hooks/internal/useStrictModeSafeCleanupEffect.js.map +1 -0
  77. package/react/hooks/useApolloClient.js +1 -1
  78. package/react/hooks/useSuspenseCache.js +1 -1
  79. package/react/hooks/useSuspenseQuery.d.ts +7 -2
  80. package/react/hooks/useSuspenseQuery.d.ts.map +1 -1
  81. package/react/hooks/useSuspenseQuery.js +66 -153
  82. package/react/hooks/useSuspenseQuery.js.map +1 -1
  83. package/react/parser/index.js +5 -5
  84. package/react/parser/parser.cjs +5 -5
  85. package/react/parser/parser.cjs.map +1 -1
  86. package/react/parser/parser.cjs.native.js +5 -5
  87. package/react/react.cjs +112 -38
  88. package/react/react.cjs.map +1 -1
  89. package/react/react.cjs.native.js +112 -38
  90. package/react/types/types.d.ts +0 -2
  91. package/react/types/types.d.ts.map +1 -1
  92. package/react/types/types.js.map +1 -1
  93. package/testing/core/core.cjs +1 -1
  94. package/testing/core/core.cjs.map +1 -1
  95. package/testing/core/core.cjs.native.js +1 -1
  96. package/testing/core/mocking/mockLink.js +1 -1
  97. package/testing/testing.cjs +110 -38
  98. package/testing/testing.cjs.map +1 -1
  99. package/testing/testing.cjs.native.js +110 -38
  100. package/utilities/common/mergeOptions.js +1 -1
  101. package/utilities/common/mergeOptions.js.map +1 -1
  102. package/utilities/graphql/directives.js +4 -4
  103. package/utilities/graphql/fragments.js +3 -3
  104. package/utilities/graphql/getFromAST.js +8 -8
  105. package/utilities/graphql/storeUtils.js +1 -1
  106. package/utilities/promises/decoration.d.ts +15 -0
  107. package/utilities/promises/decoration.d.ts.map +1 -0
  108. package/utilities/promises/decoration.js +25 -0
  109. package/utilities/promises/decoration.js.map +1 -0
  110. package/utilities/utilities.cjs +17 -17
  111. package/utilities/utilities.cjs.map +1 -1
  112. package/utilities/utilities.cjs.native.js +17 -17
  113. package/version.js +1 -1
  114. package/cache/inmemory/__mocks__/optimism.d.ts +0 -2
  115. package/cache/inmemory/__mocks__/optimism.d.ts.map +0 -1
  116. package/cache/inmemory/__mocks__/optimism.js +0 -14
  117. 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, 41);
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, 42);
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', 43);
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'), 44);
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(45);
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, 46);
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, 47);
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(56);
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', 48);
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(49);
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, 50);
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', 51);
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', 52);
390
- globals.__DEV__ ? globals.invariant(doc.definitions.length <= 1, 'Fragment must have exactly one definition.') : globals.invariant(doc.definitions.length <= 1, 53);
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', 54);
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(55);
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.10';
1
+ export var version = '3.8.0-alpha.11';
2
2
  //# sourceMappingURL=version.js.map
@@ -1,2 +0,0 @@
1
- declare const optimism: any;
2
- //# sourceMappingURL=optimism.d.ts.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"]}