@builder.io/sdk 2.0.7 → 2.1.0

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/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ### 2.1.0
2
+
3
+ - Setting `noTraverse` option's default to `true` when fetching multiple content entries.
4
+
5
+ ### 2.0.8
6
+
7
+ - Fix: remove `setImmediate` usage to fix issue with next.js edge runtime.
8
+
1
9
  ### 2.0.7
2
10
 
3
11
  - Fix: remove dev dependency from `dependencies` (`nx` and `nx-cloud`)
@@ -50,21 +50,16 @@
50
50
 
51
51
  var isSafari = typeof window !== 'undefined' &&
52
52
  /^((?!chrome|android).)*safari/i.test(window.navigator.userAgent);
53
+ var isClient = typeof window !== 'undefined';
53
54
  // TODO: queue all of these in a debounceNextTick
54
55
  function nextTick(fn) {
55
- // React native
56
- if (typeof setImmediate === 'function' && typeof window === 'undefined') {
57
- return setImmediate(fn);
58
- }
59
- // TODO: should this be setImmediate instead? Forgot if that is micro or macro task
60
- // TODO: detect specifically if is server
61
56
  // if (typeof process !== 'undefined' && process.nextTick) {
62
57
  // console.log('process.nextTick?');
63
58
  // process.nextTick(fn);
64
59
  // return;
65
60
  // }
66
61
  // FIXME: fix the real safari issue of this randomly not working
67
- if (isSafari || typeof MutationObserver === 'undefined') {
62
+ if (!isClient || isSafari || typeof MutationObserver === 'undefined') {
68
63
  setTimeout(fn);
69
64
  return;
70
65
  }
@@ -157,7 +152,7 @@
157
152
  throw new Error("Property name \"".concat(name, "\" is not allowed"));
158
153
  }
159
154
 
160
- var version = "2.0.6";
155
+ var version = "2.0.8";
161
156
 
162
157
  var Subscription = /** @class */ (function () {
163
158
  function Subscription(listeners, listener) {
@@ -2403,9 +2398,12 @@
2403
2398
  if (queue[0].format) {
2404
2399
  queryParams.format = queue[0].format;
2405
2400
  }
2401
+ if ('noTraverse' in queue[0]) {
2402
+ queryParams.noTraverse = queue[0].noTraverse;
2403
+ }
2406
2404
  var pageQueryParams = typeof location !== 'undefined'
2407
2405
  ? QueryString.parseDeep(location.search.substr(1))
2408
- : {};
2406
+ : {}; // TODO: WHAT about SSR (this.request) ?
2409
2407
  var userAttributes =
2410
2408
  // FIXME: HACK: only checks first in queue for user attributes overrides, should check all
2411
2409
  // TODO: merge user attributes provided here with defaults and current user attiributes (?)
@@ -2657,6 +2655,10 @@
2657
2655
  this.apiVersion = options.apiVersion;
2658
2656
  }
2659
2657
  }
2658
+ // Set noTraverse=true if NOT already passed by user, for query performance
2659
+ if (!('noTraverse' in options)) {
2660
+ options.noTraverse = true;
2661
+ }
2660
2662
  return instance
2661
2663
  .getContent(modelName, __assign(__assign({ limit: 30 }, options), { key: options.key ||
2662
2664
  // Make the key include all options, so we don't reuse cache for the same content fetched