@tanstack/query-devtools 5.14.5 → 5.14.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.
@@ -2032,7 +2032,7 @@ function Dynamic(props) {
2032
2032
  });
2033
2033
  }
2034
2034
 
2035
- // ../../node_modules/.pnpm/superjson@1.12.4/node_modules/superjson/dist/esm/double-indexed-kv.js
2035
+ // ../../node_modules/.pnpm/superjson@1.13.3/node_modules/superjson/dist/esm/double-indexed-kv.js
2036
2036
  var DoubleIndexedKV = (
2037
2037
  /** @class */
2038
2038
  function() {
@@ -2058,7 +2058,7 @@ var DoubleIndexedKV = (
2058
2058
  }()
2059
2059
  );
2060
2060
 
2061
- // ../../node_modules/.pnpm/superjson@1.12.4/node_modules/superjson/dist/esm/registry.js
2061
+ // ../../node_modules/.pnpm/superjson@1.13.3/node_modules/superjson/dist/esm/registry.js
2062
2062
  var Registry = (
2063
2063
  /** @class */
2064
2064
  function() {
@@ -2088,7 +2088,7 @@ var Registry = (
2088
2088
  }()
2089
2089
  );
2090
2090
 
2091
- // ../../node_modules/.pnpm/superjson@1.12.4/node_modules/superjson/dist/esm/class-registry.js
2091
+ // ../../node_modules/.pnpm/superjson@1.13.3/node_modules/superjson/dist/esm/class-registry.js
2092
2092
  var __extends = function() {
2093
2093
  var extendStatics = function(d, b) {
2094
2094
  extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
@@ -2138,7 +2138,7 @@ var ClassRegistry = (
2138
2138
  }(Registry)
2139
2139
  );
2140
2140
 
2141
- // ../../node_modules/.pnpm/superjson@1.12.4/node_modules/superjson/dist/esm/util.js
2141
+ // ../../node_modules/.pnpm/superjson@1.13.3/node_modules/superjson/dist/esm/util.js
2142
2142
  var __read = function(o, n) {
2143
2143
  var m = typeof Symbol === "function" && o[Symbol.iterator];
2144
2144
  if (!m)
@@ -2205,7 +2205,7 @@ function findArr(record, predicate) {
2205
2205
  return void 0;
2206
2206
  }
2207
2207
 
2208
- // ../../node_modules/.pnpm/superjson@1.12.4/node_modules/superjson/dist/esm/custom-transformer-registry.js
2208
+ // ../../node_modules/.pnpm/superjson@1.13.3/node_modules/superjson/dist/esm/custom-transformer-registry.js
2209
2209
  var CustomTransformerRegistry = (
2210
2210
  /** @class */
2211
2211
  function() {
@@ -2227,7 +2227,7 @@ var CustomTransformerRegistry = (
2227
2227
  }()
2228
2228
  );
2229
2229
 
2230
- // ../../node_modules/.pnpm/superjson@1.12.4/node_modules/superjson/dist/esm/is.js
2230
+ // ../../node_modules/.pnpm/superjson@1.13.3/node_modules/superjson/dist/esm/is.js
2231
2231
  var getType = function(payload) {
2232
2232
  return Object.prototype.toString.call(payload).slice(8, -1);
2233
2233
  };
@@ -2298,7 +2298,7 @@ var isURL = function(payload) {
2298
2298
  return payload instanceof URL;
2299
2299
  };
2300
2300
 
2301
- // ../../node_modules/.pnpm/superjson@1.12.4/node_modules/superjson/dist/esm/pathstringifier.js
2301
+ // ../../node_modules/.pnpm/superjson@1.13.3/node_modules/superjson/dist/esm/pathstringifier.js
2302
2302
  var escapeKey = function(key) {
2303
2303
  return key.replace(/\./g, "\\.");
2304
2304
  };
@@ -2329,7 +2329,7 @@ var parsePath = function(string) {
2329
2329
  return result;
2330
2330
  };
2331
2331
 
2332
- // ../../node_modules/.pnpm/superjson@1.12.4/node_modules/superjson/dist/esm/transformer.js
2332
+ // ../../node_modules/.pnpm/superjson@1.13.3/node_modules/superjson/dist/esm/transformer.js
2333
2333
  var __assign = function() {
2334
2334
  __assign = Object.assign || function(t) {
2335
2335
  for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -2603,7 +2603,7 @@ var untransformValue = function(json, type, superJson) {
2603
2603
  }
2604
2604
  };
2605
2605
 
2606
- // ../../node_modules/.pnpm/superjson@1.12.4/node_modules/superjson/dist/esm/accessDeep.js
2606
+ // ../../node_modules/.pnpm/superjson@1.13.3/node_modules/superjson/dist/esm/accessDeep.js
2607
2607
  var getNthKey = function(value, n) {
2608
2608
  var keys = value.keys();
2609
2609
  while (n > 0) {
@@ -2717,7 +2717,7 @@ var setDeep = function(object, path, mapper) {
2717
2717
  return object;
2718
2718
  };
2719
2719
 
2720
- // ../../node_modules/.pnpm/superjson@1.12.4/node_modules/superjson/dist/esm/plainer.js
2720
+ // ../../node_modules/.pnpm/superjson@1.13.3/node_modules/superjson/dist/esm/plainer.js
2721
2721
  var __read3 = function(o, n) {
2722
2722
  var m = typeof Symbol === "function" && o[Symbol.iterator];
2723
2723
  if (!m)
@@ -2808,22 +2808,25 @@ function addIdentity(object, path, identities) {
2808
2808
  identities.set(object, [path]);
2809
2809
  }
2810
2810
  }
2811
- function generateReferentialEqualityAnnotations(identitites) {
2811
+ function generateReferentialEqualityAnnotations(identitites, dedupe) {
2812
2812
  var result = {};
2813
2813
  var rootEqualityPaths = void 0;
2814
2814
  identitites.forEach(function(paths) {
2815
2815
  if (paths.length <= 1) {
2816
2816
  return;
2817
2817
  }
2818
- var _a = __read3(paths.map(function(path) {
2819
- return path.map(String);
2820
- }).sort(function(a, b) {
2821
- return a.length - b.length;
2822
- })), shortestPath = _a[0], identicalPaths = _a.slice(1);
2823
- if (shortestPath.length === 0) {
2818
+ if (!dedupe) {
2819
+ paths = paths.map(function(path) {
2820
+ return path.map(String);
2821
+ }).sort(function(a, b) {
2822
+ return a.length - b.length;
2823
+ });
2824
+ }
2825
+ var _a = __read3(paths), representativePath = _a[0], identicalPaths = _a.slice(1);
2826
+ if (representativePath.length === 0) {
2824
2827
  rootEqualityPaths = identicalPaths.map(stringifyPath);
2825
2828
  } else {
2826
- result[stringifyPath(shortestPath)] = identicalPaths.map(stringifyPath);
2829
+ result[stringifyPath(representativePath)] = identicalPaths.map(stringifyPath);
2827
2830
  }
2828
2831
  });
2829
2832
  if (rootEqualityPaths) {
@@ -2836,7 +2839,7 @@ function generateReferentialEqualityAnnotations(identitites) {
2836
2839
  return isEmptyObject(result) ? void 0 : result;
2837
2840
  }
2838
2841
  }
2839
- var walker = function(object, identities, superJson, path, objectsInThisPath) {
2842
+ var walker = function(object, identities, superJson, dedupe, path, objectsInThisPath, seenObjects) {
2840
2843
  var _a;
2841
2844
  if (path === void 0) {
2842
2845
  path = [];
@@ -2844,21 +2847,31 @@ var walker = function(object, identities, superJson, path, objectsInThisPath) {
2844
2847
  if (objectsInThisPath === void 0) {
2845
2848
  objectsInThisPath = [];
2846
2849
  }
2847
- if (!isPrimitive(object)) {
2850
+ if (seenObjects === void 0) {
2851
+ seenObjects = /* @__PURE__ */ new Map();
2852
+ }
2853
+ var primitive = isPrimitive(object);
2854
+ if (!primitive) {
2848
2855
  addIdentity(object, path, identities);
2856
+ var seen = seenObjects.get(object);
2857
+ if (seen) {
2858
+ return dedupe ? {
2859
+ transformedValue: null
2860
+ } : seen;
2861
+ }
2849
2862
  }
2850
2863
  if (!isDeep(object, superJson)) {
2851
2864
  var transformed_1 = transformValue(object, superJson);
2852
- if (transformed_1) {
2853
- return {
2854
- transformedValue: transformed_1.value,
2855
- annotations: [transformed_1.type]
2856
- };
2857
- } else {
2858
- return {
2859
- transformedValue: object
2860
- };
2865
+ var result_1 = transformed_1 ? {
2866
+ transformedValue: transformed_1.value,
2867
+ annotations: [transformed_1.type]
2868
+ } : {
2869
+ transformedValue: object
2870
+ };
2871
+ if (!primitive) {
2872
+ seenObjects.set(object, result_1);
2861
2873
  }
2874
+ return result_1;
2862
2875
  }
2863
2876
  if (includes(objectsInThisPath, object)) {
2864
2877
  return {
@@ -2867,13 +2880,10 @@ var walker = function(object, identities, superJson, path, objectsInThisPath) {
2867
2880
  }
2868
2881
  var transformationResult = transformValue(object, superJson);
2869
2882
  var transformed = (_a = transformationResult === null || transformationResult === void 0 ? void 0 : transformationResult.value) !== null && _a !== void 0 ? _a : object;
2870
- if (!isPrimitive(object)) {
2871
- objectsInThisPath = __spreadArray2(__spreadArray2([], __read3(objectsInThisPath)), [object]);
2872
- }
2873
2883
  var transformedValue = isArray(transformed) ? [] : {};
2874
2884
  var innerAnnotations = {};
2875
2885
  forEach(transformed, function(value, index) {
2876
- var recursiveResult = walker(value, identities, superJson, __spreadArray2(__spreadArray2([], __read3(path)), [index]), objectsInThisPath);
2886
+ var recursiveResult = walker(value, identities, superJson, dedupe, __spreadArray2(__spreadArray2([], __read3(path)), [index]), __spreadArray2(__spreadArray2([], __read3(objectsInThisPath)), [object]), seenObjects);
2877
2887
  transformedValue[index] = recursiveResult.transformedValue;
2878
2888
  if (isArray(recursiveResult.annotations)) {
2879
2889
  innerAnnotations[index] = recursiveResult.annotations;
@@ -2883,17 +2893,17 @@ var walker = function(object, identities, superJson, path, objectsInThisPath) {
2883
2893
  });
2884
2894
  }
2885
2895
  });
2886
- if (isEmptyObject(innerAnnotations)) {
2887
- return {
2888
- transformedValue,
2889
- annotations: !!transformationResult ? [transformationResult.type] : void 0
2890
- };
2891
- } else {
2892
- return {
2893
- transformedValue,
2894
- annotations: !!transformationResult ? [transformationResult.type, innerAnnotations] : innerAnnotations
2895
- };
2896
+ var result = isEmptyObject(innerAnnotations) ? {
2897
+ transformedValue,
2898
+ annotations: !!transformationResult ? [transformationResult.type] : void 0
2899
+ } : {
2900
+ transformedValue,
2901
+ annotations: !!transformationResult ? [transformationResult.type, innerAnnotations] : innerAnnotations
2902
+ };
2903
+ if (!primitive) {
2904
+ seenObjects.set(object, result);
2896
2905
  }
2906
+ return result;
2897
2907
  };
2898
2908
 
2899
2909
  // ../../node_modules/.pnpm/is-what@4.1.15/node_modules/is-what/dist/index.js
@@ -2954,7 +2964,7 @@ function copy(target, options = {}) {
2954
2964
  }, {});
2955
2965
  }
2956
2966
 
2957
- // ../../node_modules/.pnpm/superjson@1.12.4/node_modules/superjson/dist/esm/index.js
2967
+ // ../../node_modules/.pnpm/superjson@1.13.3/node_modules/superjson/dist/esm/index.js
2958
2968
  var __assign2 = function() {
2959
2969
  __assign2 = Object.assign || function(t) {
2960
2970
  for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -2996,25 +3006,27 @@ var __spreadArray3 = function(to, from) {
2996
3006
  var SuperJSON = (
2997
3007
  /** @class */
2998
3008
  function() {
2999
- function SuperJSON2() {
3009
+ function SuperJSON2(_a) {
3010
+ var _b = _a === void 0 ? {} : _a, _c = _b.dedupe, dedupe = _c === void 0 ? false : _c;
3000
3011
  this.classRegistry = new ClassRegistry();
3001
3012
  this.symbolRegistry = new Registry(function(s) {
3002
- var _a;
3003
- return (_a = s.description) !== null && _a !== void 0 ? _a : "";
3013
+ var _a2;
3014
+ return (_a2 = s.description) !== null && _a2 !== void 0 ? _a2 : "";
3004
3015
  });
3005
3016
  this.customTransformerRegistry = new CustomTransformerRegistry();
3006
3017
  this.allowedErrorProps = [];
3018
+ this.dedupe = dedupe;
3007
3019
  }
3008
3020
  SuperJSON2.prototype.serialize = function(object) {
3009
3021
  var identities = /* @__PURE__ */ new Map();
3010
- var output = walker(object, identities, this);
3022
+ var output = walker(object, identities, this, this.dedupe);
3011
3023
  var res = {
3012
3024
  json: output.transformedValue
3013
3025
  };
3014
3026
  if (output.annotations) {
3015
3027
  res.meta = __assign2(__assign2({}, res.meta), { values: output.annotations });
3016
3028
  }
3017
- var equalityAnnotations = generateReferentialEqualityAnnotations(identities);
3029
+ var equalityAnnotations = generateReferentialEqualityAnnotations(identities, this.dedupe);
3018
3030
  if (equalityAnnotations) {
3019
3031
  res.meta = __assign2(__assign2({}, res.meta), { referentialEqualities: equalityAnnotations });
3020
3032
  }