@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/dist/index.cjs.js CHANGED
@@ -24,21 +24,16 @@ var hash__default = /*#__PURE__*/_interopDefaultLegacy(hash);
24
24
 
25
25
  var isSafari = typeof window !== 'undefined' &&
26
26
  /^((?!chrome|android).)*safari/i.test(window.navigator.userAgent);
27
+ var isClient = typeof window !== 'undefined';
27
28
  // TODO: queue all of these in a debounceNextTick
28
29
  function nextTick(fn) {
29
- // React native
30
- if (typeof setImmediate === 'function' && typeof window === 'undefined') {
31
- return setImmediate(fn);
32
- }
33
- // TODO: should this be setImmediate instead? Forgot if that is micro or macro task
34
- // TODO: detect specifically if is server
35
30
  // if (typeof process !== 'undefined' && process.nextTick) {
36
31
  // console.log('process.nextTick?');
37
32
  // process.nextTick(fn);
38
33
  // return;
39
34
  // }
40
35
  // FIXME: fix the real safari issue of this randomly not working
41
- if (isSafari || typeof MutationObserver === 'undefined') {
36
+ if (!isClient || isSafari || typeof MutationObserver === 'undefined') {
42
37
  setTimeout(fn);
43
38
  return;
44
39
  }
@@ -131,7 +126,7 @@ function assertAllowedPropertyName(name) {
131
126
  throw new Error("Property name \"".concat(name, "\" is not allowed"));
132
127
  }
133
128
 
134
- var version = "2.0.6";
129
+ var version = "2.0.8";
135
130
 
136
131
  var Subscription = /** @class */ (function () {
137
132
  function Subscription(listeners, listener) {
@@ -2309,9 +2304,12 @@ var Builder = /** @class */ (function () {
2309
2304
  if (queue[0].format) {
2310
2305
  queryParams.format = queue[0].format;
2311
2306
  }
2307
+ if ('noTraverse' in queue[0]) {
2308
+ queryParams.noTraverse = queue[0].noTraverse;
2309
+ }
2312
2310
  var pageQueryParams = typeof location !== 'undefined'
2313
2311
  ? QueryString.parseDeep(location.search.substr(1))
2314
- : {};
2312
+ : {}; // TODO: WHAT about SSR (this.request) ?
2315
2313
  var userAttributes =
2316
2314
  // FIXME: HACK: only checks first in queue for user attributes overrides, should check all
2317
2315
  // TODO: merge user attributes provided here with defaults and current user attiributes (?)
@@ -2563,6 +2561,10 @@ var Builder = /** @class */ (function () {
2563
2561
  this.apiVersion = options.apiVersion;
2564
2562
  }
2565
2563
  }
2564
+ // Set noTraverse=true if NOT already passed by user, for query performance
2565
+ if (!('noTraverse' in options)) {
2566
+ options.noTraverse = true;
2567
+ }
2566
2568
  return instance
2567
2569
  .getContent(modelName, tslib.__assign(tslib.__assign({ limit: 30 }, options), { key: options.key ||
2568
2570
  // Make the key include all options, so we don't reuse cache for the same content fetched