@apollo/client 3.9.0-alpha.0 → 3.9.0-alpha.2

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 (104) hide show
  1. package/apollo-client.cjs +116 -136
  2. package/apollo-client.cjs.map +1 -1
  3. package/apollo-client.min.cjs +1 -1
  4. package/cache/cache.cjs +6 -29
  5. package/cache/cache.cjs.map +1 -1
  6. package/cache/cache.cjs.native.js +6 -29
  7. package/cache/index.d.ts +1 -2
  8. package/cache/index.d.ts.map +1 -1
  9. package/cache/index.js +1 -2
  10. package/cache/index.js.map +1 -1
  11. package/cache/inmemory/inMemoryCache.d.ts.map +1 -1
  12. package/cache/inmemory/inMemoryCache.js +1 -2
  13. package/cache/inmemory/inMemoryCache.js.map +1 -1
  14. package/cache/inmemory/object-canon.d.ts +0 -5
  15. package/cache/inmemory/object-canon.d.ts.map +1 -1
  16. package/cache/inmemory/object-canon.js +0 -22
  17. package/cache/inmemory/object-canon.js.map +1 -1
  18. package/cache/inmemory/policies.d.ts.map +1 -1
  19. package/cache/inmemory/policies.js +0 -2
  20. package/cache/inmemory/policies.js.map +1 -1
  21. package/cache/inmemory/readFromStore.d.ts.map +1 -1
  22. package/cache/inmemory/readFromStore.js +2 -2
  23. package/cache/inmemory/readFromStore.js.map +1 -1
  24. package/cache/inmemory/writeToStore.d.ts.map +1 -1
  25. package/cache/inmemory/writeToStore.js +1 -2
  26. package/cache/inmemory/writeToStore.js.map +1 -1
  27. package/core/ObservableQuery.d.ts.map +1 -1
  28. package/core/ObservableQuery.js +5 -6
  29. package/core/ObservableQuery.js.map +1 -1
  30. package/core/QueryInfo.d.ts +0 -2
  31. package/core/QueryInfo.d.ts.map +1 -1
  32. package/core/QueryInfo.js +0 -2
  33. package/core/QueryInfo.js.map +1 -1
  34. package/core/QueryManager.js +2 -2
  35. package/core/QueryManager.js.map +1 -1
  36. package/core/core.cjs +8 -11
  37. package/core/core.cjs.map +1 -1
  38. package/core/core.cjs.native.js +8 -11
  39. package/dev/dev.cjs +52 -37
  40. package/dev/dev.cjs.map +1 -1
  41. package/dev/dev.cjs.native.js +52 -37
  42. package/dev/loadErrorMessageHandler.js +1 -1
  43. package/dev/loadErrorMessageHandler.js.map +1 -1
  44. package/invariantErrorCodes.js +24 -18
  45. package/package.json +7 -7
  46. package/react/cache/index.d.ts +0 -4
  47. package/react/cache/index.d.ts.map +1 -1
  48. package/react/cache/index.js +0 -14
  49. package/react/cache/index.js.map +1 -1
  50. package/react/index.d.ts +0 -1
  51. package/react/index.d.ts.map +1 -1
  52. package/react/index.js +0 -1
  53. package/react/index.js.map +1 -1
  54. package/react/react.cjs +1 -218
  55. package/react/react.cjs.map +1 -1
  56. package/react/react.cjs.native.js +1 -218
  57. package/react/types/types.d.ts +0 -3
  58. package/react/types/types.d.ts.map +1 -1
  59. package/react/types/types.js.map +1 -1
  60. package/testing/core/core.cjs +9 -1
  61. package/testing/core/core.cjs.map +1 -1
  62. package/testing/core/core.cjs.native.js +9 -1
  63. package/testing/core/mocking/mockLink.d.ts +1 -0
  64. package/testing/core/mocking/mockLink.d.ts.map +1 -1
  65. package/testing/core/mocking/mockLink.js +9 -1
  66. package/testing/core/mocking/mockLink.js.map +1 -1
  67. package/testing/internal/ObservableStream.d.ts +26 -0
  68. package/testing/internal/ObservableStream.d.ts.map +1 -0
  69. package/testing/internal/ObservableStream.js +101 -0
  70. package/testing/internal/ObservableStream.js.map +1 -0
  71. package/testing/internal/index.d.ts +1 -0
  72. package/testing/internal/index.d.ts.map +1 -1
  73. package/testing/internal/index.js +1 -0
  74. package/testing/internal/index.js.map +1 -1
  75. package/utilities/common/canonicalStringify.d.ts +4 -0
  76. package/utilities/common/canonicalStringify.d.ts.map +1 -0
  77. package/utilities/common/canonicalStringify.js +37 -0
  78. package/utilities/common/canonicalStringify.js.map +1 -0
  79. package/utilities/globals/globals.cjs +29 -19
  80. package/utilities/globals/globals.cjs.map +1 -1
  81. package/utilities/globals/globals.cjs.native.js +29 -19
  82. package/utilities/globals/invariantWrappers.d.ts.map +1 -1
  83. package/utilities/globals/invariantWrappers.js +28 -18
  84. package/utilities/globals/invariantWrappers.js.map +1 -1
  85. package/utilities/graphql/DocumentTransform.js +1 -1
  86. package/utilities/graphql/directives.js +4 -4
  87. package/utilities/graphql/fragments.js +3 -3
  88. package/utilities/graphql/getFromAST.js +8 -8
  89. package/utilities/graphql/storeUtils.d.ts +2 -2
  90. package/utilities/graphql/storeUtils.d.ts.map +1 -1
  91. package/utilities/graphql/storeUtils.js +8 -20
  92. package/utilities/graphql/storeUtils.js.map +1 -1
  93. package/utilities/graphql/transform.js +2 -2
  94. package/utilities/index.d.ts +1 -0
  95. package/utilities/index.d.ts.map +1 -1
  96. package/utilities/index.js +1 -0
  97. package/utilities/index.js.map +1 -1
  98. package/utilities/observables/asyncMap.d.ts.map +1 -1
  99. package/utilities/observables/asyncMap.js +17 -34
  100. package/utilities/observables/asyncMap.js.map +1 -1
  101. package/utilities/utilities.cjs +80 -72
  102. package/utilities/utilities.cjs.map +1 -1
  103. package/utilities/utilities.cjs.native.js +80 -72
  104. package/version.js +1 -1
package/cache/cache.cjs CHANGED
@@ -766,28 +766,6 @@ var ObjectCanon = (function () {
766
766
  };
767
767
  return ObjectCanon;
768
768
  }());
769
- var canonicalStringify = Object.assign(function (value) {
770
- if (utilities.isNonNullObject(value)) {
771
- if (stringifyCanon === void 0) {
772
- resetCanonicalStringify();
773
- }
774
- var canonical = stringifyCanon.admit(value);
775
- var json = stringifyCache.get(canonical);
776
- if (json === void 0) {
777
- stringifyCache.set(canonical, (json = JSON.stringify(canonical)));
778
- }
779
- return json;
780
- }
781
- return JSON.stringify(value);
782
- }, {
783
- reset: resetCanonicalStringify,
784
- });
785
- var stringifyCanon;
786
- var stringifyCache;
787
- function resetCanonicalStringify() {
788
- stringifyCanon = new ObjectCanon();
789
- stringifyCache = new (utilities.canUseWeakMap ? WeakMap : Map)();
790
- }
791
769
 
792
770
  function execSelectionSetKeyArgs(options) {
793
771
  return [
@@ -854,7 +832,7 @@ var StoreReader = (function () {
854
832
  selectionSet: utilities.getMainDefinition(query).selectionSet,
855
833
  objectOrReference: rootRef,
856
834
  enclosingRef: rootRef,
857
- context: tslib.__assign({ store: store, query: query, policies: policies, variables: variables, varString: canonicalStringify(variables), canonizeResults: canonizeResults }, extractFragmentContext(query, this.config.fragments)),
835
+ context: tslib.__assign({ store: store, query: query, policies: policies, variables: variables, varString: utilities.canonicalStringify(variables), canonizeResults: canonizeResults }, extractFragmentContext(query, this.config.fragments)),
858
836
  });
859
837
  var missing;
860
838
  if (execResult.missing) {
@@ -1239,7 +1217,6 @@ function normalize(value) {
1239
1217
  return value;
1240
1218
  }
1241
1219
 
1242
- utilities.getStoreKeyName.setStringify(canonicalStringify);
1243
1220
  function argsFromFieldSpecifier(spec) {
1244
1221
  return spec.args !== void 0
1245
1222
  ? spec.args
@@ -1712,7 +1689,7 @@ var StoreWriter = (function () {
1712
1689
  variables = tslib.__assign(tslib.__assign({}, utilities.getDefaultValues(operationDefinition)), variables);
1713
1690
  var context = tslib.__assign(tslib.__assign({ store: store, written: Object.create(null), merge: function (existing, incoming) {
1714
1691
  return merger.merge(existing, incoming);
1715
- }, variables: variables, varString: canonicalStringify(variables) }, extractFragmentContext(query, this.fragments)), { overwrite: !!overwrite, incomingById: new Map(), clientOnly: false, deferred: false, flavors: new Map() });
1692
+ }, variables: variables, varString: utilities.canonicalStringify(variables) }, extractFragmentContext(query, this.fragments)), { overwrite: !!overwrite, incomingById: new Map(), clientOnly: false, deferred: false, flavors: new Map() });
1716
1693
  var ref = this.processSelectionSet({
1717
1694
  result: result || Object.create(null),
1718
1695
  dataId: dataId,
@@ -2131,7 +2108,7 @@ var InMemoryCache = (function (_super) {
2131
2108
  var store = c.optimistic ? _this.optimisticData : _this.data;
2132
2109
  if (supportsResultCaching(store)) {
2133
2110
  var optimistic = c.optimistic, id = c.id, variables = c.variables;
2134
- return store.makeCacheKey(c.query, c.callback, canonicalStringify({ optimistic: optimistic, id: id, variables: variables }));
2111
+ return store.makeCacheKey(c.query, c.callback, utilities.canonicalStringify({ optimistic: optimistic, id: id, variables: variables }));
2135
2112
  }
2136
2113
  },
2137
2114
  });
@@ -2209,7 +2186,7 @@ var InMemoryCache = (function (_super) {
2209
2186
  };
2210
2187
  };
2211
2188
  InMemoryCache.prototype.gc = function (options) {
2212
- canonicalStringify.reset();
2189
+ utilities.canonicalStringify.reset();
2213
2190
  var ids = this.optimisticData.gc();
2214
2191
  if (options && !this.txCount) {
2215
2192
  if (options.resetResultCache) {
@@ -2257,7 +2234,7 @@ var InMemoryCache = (function (_super) {
2257
2234
  InMemoryCache.prototype.reset = function (options) {
2258
2235
  var _this = this;
2259
2236
  this.init();
2260
- canonicalStringify.reset();
2237
+ utilities.canonicalStringify.reset();
2261
2238
  if (options && options.discardWatches) {
2262
2239
  this.watches.forEach(function (watch) { return _this.maybeBroadcastWatch.forget(watch); });
2263
2240
  this.watches.clear();
@@ -2485,6 +2462,7 @@ var FragmentRegistry = (function () {
2485
2462
  return FragmentRegistry;
2486
2463
  }());
2487
2464
 
2465
+ exports.canonicalStringify = utilities.canonicalStringify;
2488
2466
  exports.isReference = utilities.isReference;
2489
2467
  exports.makeReference = utilities.makeReference;
2490
2468
  exports.ApolloCache = ApolloCache;
@@ -2492,7 +2470,6 @@ exports.InMemoryCache = InMemoryCache;
2492
2470
  exports.MissingFieldError = MissingFieldError;
2493
2471
  exports.Policies = Policies;
2494
2472
  exports.cacheSlot = cacheSlot;
2495
- exports.canonicalStringify = canonicalStringify;
2496
2473
  exports.createFragmentRegistry = createFragmentRegistry;
2497
2474
  exports.defaultDataIdFromObject = defaultDataIdFromObject;
2498
2475
  exports.fieldNameFromStoreName = fieldNameFromStoreName;