@builder.io/sdk 2.0.5-0 → 2.0.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.
package/dist/index.esm.js CHANGED
@@ -123,7 +123,7 @@ function assertAllowedPropertyName(name) {
123
123
  throw new Error("Property name \"".concat(name, "\" is not allowed"));
124
124
  }
125
125
 
126
- var version = "2.0.4";
126
+ var version = "2.0.5";
127
127
 
128
128
  var Subscription = /** @class */ (function () {
129
129
  function Subscription(listeners, listener) {
@@ -160,9 +160,18 @@ var Subscription = /** @class */ (function () {
160
160
  // TODO: follow minimal basic spec: https://github.com/tc39/proposal-observable
161
161
  var BehaviorSubject = /** @class */ (function () {
162
162
  function BehaviorSubject(value) {
163
+ var _this = this;
163
164
  this.value = value;
164
165
  this.listeners = [];
165
166
  this.errorListeners = [];
167
+ this.then = function () {
168
+ var _a;
169
+ var args = [];
170
+ for (var _i = 0; _i < arguments.length; _i++) {
171
+ args[_i] = arguments[_i];
172
+ }
173
+ return (_a = _this.toPromise()).then.apply(_a, args);
174
+ };
166
175
  }
167
176
  BehaviorSubject.prototype.next = function (value) {
168
177
  this.value = value;
@@ -2235,7 +2244,7 @@ var Builder = /** @class */ (function () {
2235
2244
  // even though we only use `fetch()` now, we prefer to keep the old behavior and use the `fetch` that comes from
2236
2245
  // the core SDK for consistency
2237
2246
  Builder.prototype.requestUrl = function (url, options) {
2238
- return getFetch()(url, options).then(function (res) { return res.json(); });
2247
+ return getFetch()(url, __assign({ next: __assign({ revalidate: 1 }, options === null || options === void 0 ? void 0 : options.next) }, options)).then(function (res) { return res.json(); });
2239
2248
  };
2240
2249
  Object.defineProperty(Builder.prototype, "host", {
2241
2250
  get: function () {
@@ -2400,7 +2409,7 @@ var Builder = /** @class */ (function () {
2400
2409
  }
2401
2410
  var queryStr = QueryString.stringifyDeep(queryParams);
2402
2411
  var format = queryParams.format;
2403
- var requestOptions = { headers: {} };
2412
+ var requestOptions = { headers: {}, next: { revalidate: 1 } };
2404
2413
  if (this.authToken) {
2405
2414
  requestOptions.headers = __assign(__assign({}, requestOptions.headers), { Authorization: "Bearer ".concat(this.authToken) });
2406
2415
  }